[pdfmod] Fix extracting pages, add F9 sidebar keybinding
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pdfmod] Fix extracting pages, add F9 sidebar keybinding
- Date: Tue, 14 Sep 2010 19:59:44 +0000 (UTC)
commit 4c720333f1299ee5db6d10f78b3a9f20d3da6aee
Author: Gabriel Burt <gabriel burt gmail com>
Date: Tue Sep 14 14:58:50 2010 -0500
Fix extracting pages, add F9 sidebar keybinding
src/PdfMod/Gui/Actions.cs | 25 ++++++++++++++-----------
src/PdfMod/Gui/MetadataEditorBox.cs | 4 ++--
src/PdfMod/Pdf/Document.cs | 3 +++
3 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/src/PdfMod/Gui/Actions.cs b/src/PdfMod/Gui/Actions.cs
index bab8ec8..7496b2b 100644
--- a/src/PdfMod/Gui/Actions.cs
+++ b/src/PdfMod/Gui/Actions.cs
@@ -30,6 +30,7 @@ using Hyena;
using Hyena.Gui;
using PdfSharp.Pdf;
+using PdfSharp.Pdf.IO;
using PdfMod.Pdf;
using PdfMod.Pdf.Actions;
@@ -110,7 +111,7 @@ namespace PdfMod.Gui
new ToggleActionEntry ("Properties", Stock.Properties, null, "<alt>Return", Catalog.GetString ("View and edit the title, keywords, and more for this document"), OnProperties, false),
new ToggleActionEntry ("ZoomFit", Stock.ZoomFit, null, "<control>0", null, OnZoomFit, true),
new ToggleActionEntry ("ViewToolbar", null, Catalog.GetString ("Toolbar"), null, null, OnViewToolbar, Client.Configuration.ShowToolbar),
- new ToggleActionEntry ("ViewBookmarks", null, Catalog.GetString ("Bookmarks"), "<ctrl>B", null, OnViewBookmarks, Client.Configuration.ShowBookmarks),
+ new ToggleActionEntry ("ViewBookmarks", null, Catalog.GetString ("Bookmarks"), "F9", null, OnViewBookmarks, Client.Configuration.ShowBookmarks),
new ToggleActionEntry ("FullScreenView", null, Catalog.GetString ("Fullscreen"), "F11", null, OnFullScreenView, false)
);
@@ -274,7 +275,7 @@ namespace PdfMod.Gui
var export_path_base = Path.Combine (
Path.GetDirectoryName (app.Document.SuggestedSavePath),
Hyena.StringUtil.EscapeFilename (
- app.Document.Title ?? System.IO.Path.GetFileNameWithoutExtension (app.Document.Filename))
+ System.IO.Path.GetFileNameWithoutExtension (app.Document.Filename))
);
var export_path = export_path_base;
@@ -346,21 +347,23 @@ namespace PdfMod.Gui
void OnExtractPages (object o, EventArgs args)
{
- var doc = new PdfDocument ();
- var pages = new List<Page> (app.IconView.SelectedPages);
- foreach (var page in pages) {
- doc.AddPage (page.Pdf);
+ var to_doc = new PdfDocument ();
+ var from_doc = PdfSharp.Pdf.IO.PdfReader.Open (new Uri (app.Document.CurrentStateUri).LocalPath, PdfDocumentOpenMode.Import, null);
+ var pages = app.IconView.SelectedPages.ToList ();
+
+ foreach (var index in pages.Select (p => p.Index)) {
+ to_doc.AddPage (from_doc.Pages[index]);
}
var path = Client.GetTmpFilename ();
- doc.Save (path);
- doc.Dispose ();
+ to_doc.Save (path);
+ to_doc.Dispose ();
app.LoadPath (path, Path.Combine (
Path.GetDirectoryName (app.Document.SuggestedSavePath),
- String.Format ("[{0}] {1}",
- GLib.Markup.EscapeText (Document.GetPageSummary (pages, 10)),
- Path.GetFileName (app.Document.SuggestedSavePath))
+ String.Format ("{0} [{1}].pdf",
+ Path.GetFileNameWithoutExtension (app.Document.SuggestedSavePath),
+ GLib.Markup.EscapeText (Document.GetPageSummary (pages, 10)))
));
}
diff --git a/src/PdfMod/Gui/MetadataEditorBox.cs b/src/PdfMod/Gui/MetadataEditorBox.cs
index 6b00e05..37a2ca3 100644
--- a/src/PdfMod/Gui/MetadataEditorBox.cs
+++ b/src/PdfMod/Gui/MetadataEditorBox.cs
@@ -113,7 +113,7 @@ namespace PdfMod.Gui
var pdf = app.Document.Pdf;
var info = pdf.Info;
- Console.WriteLine ("Author = {0}", info.Author);
+ /*Console.WriteLine ("Author = {0}", info.Author);
Console.WriteLine ("CreationDate = {0}", info.CreationDate);
Console.WriteLine ("Creator = {0}", info.Creator);
Console.WriteLine ("Keywords = {0}", info.Keywords);
@@ -140,7 +140,7 @@ namespace PdfMod.Gui
Console.WriteLine ("FitWindow = {0}", prefs.FitWindow);
Console.WriteLine ("HideMenubar = {0}", prefs.HideMenubar);
Console.WriteLine ("HideToolbar = {0}", prefs.HideToolbar);
- Console.WriteLine ("HideWindowUI = {0}", prefs.HideWindowUI);
+ Console.WriteLine ("HideWindowUI = {0}", prefs.HideWindowUI);*/
title.SetDefault (doc.Title);
author.SetDefault (doc.Author);
diff --git a/src/PdfMod/Pdf/Document.cs b/src/PdfMod/Pdf/Document.cs
index 8401c9f..8082fa6 100644
--- a/src/PdfMod/Pdf/Document.cs
+++ b/src/PdfMod/Pdf/Document.cs
@@ -270,7 +270,10 @@ namespace PdfMod.Pdf
Pdf.Save (uri);
UnsavedChanges = 0;
Log.DebugFormat ("Saved to {0}", uri);
+
+ var uri_obj = new Uri (uri);
Uri = uri;
+ SuggestedSavePath = Path = uri_obj.LocalPath;
if (tmp_uri != null) {
try {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]