-
Notifications
You must be signed in to change notification settings - Fork 6
extract PDF bookmark with priority #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,8 @@ | |
| using Patagames.Pdf.Net; | ||
| using SuperMemoAssistant.Extensions; | ||
| using SuperMemoAssistant.Plugins.PDF.Models; | ||
| using System.Threading.Tasks; | ||
| using Forge.Forms; | ||
| using SuperMemoAssistant.Services.IO.HotKeys; | ||
| using SuperMemoAssistant.Sys.IO.Devices; | ||
| using SuperMemoAssistant.Sys.Threading; | ||
|
|
@@ -342,6 +344,28 @@ private void TvBookmark_MenuItem_PDFExtract(object sender, | |
| IPDFViewer.ExtractBookmark(bookmark); | ||
| } | ||
|
|
||
| private async void TvBookmark_MenuItem_PDFExtractWithPriority(object sender, | ||
| RoutedEventArgs e) | ||
| { | ||
|
|
||
| var result = await Forge.Forms.Show.Window() | ||
| .For(new Prompt<double> { Title = "Bookmark Priority?", Value = -1 }); | ||
|
|
||
| if (!result.Model.Confirmed) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| PdfBookmark bookmark = (PdfBookmark)tvBookmarks.SelectedItem; | ||
| if (bookmark == null) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| IPDFViewer.ExtractBookmark(bookmark, result.Model.Value); | ||
|
||
| } | ||
|
|
||
|
|
||
| private void TvBookmarks_PreviewKeyDown(object sender, | ||
| KeyEventArgs e) | ||
| { | ||
|
|
@@ -364,6 +388,14 @@ private void TvBookmarks_PreviewKeyDown(object sender, | |
|
|
||
| e.Handled = true; | ||
| } | ||
|
|
||
| else if (kbMod == (KeyModifiers.Ctrl | KeyModifiers.Shift) | ||
| && e.Key == Key.X) | ||
| { | ||
| TvBookmark_MenuItem_PDFExtractWithPriority(sender, | ||
| null); | ||
| e.Handled = true; | ||
| } | ||
| } | ||
|
|
||
| private void BtnExpandAll_Click(object sender, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -225,7 +225,7 @@ protected ContentBase CreateImageContent(Image image, string title) | |
|
|
||
| // PDF Extracts | ||
|
|
||
| protected bool CreatePDFExtract() | ||
| protected bool CreatePDFExtract(double priority = -1) | ||
|
||
| { | ||
| bool ret = false; | ||
|
|
||
|
|
@@ -263,7 +263,8 @@ protected bool CreatePDFExtract() | |
| } | ||
|
|
||
| protected bool CreatePDFExtract(SelectInfo selInfo, | ||
| string title = null) | ||
| string title = null, | ||
| double priority = -1) | ||
| { | ||
| Save(false); | ||
|
|
||
|
|
@@ -282,7 +283,8 @@ protected bool CreatePDFExtract(SelectInfo selInfo, | |
| PDFElement.PageMargin, | ||
| PDFElement.Zoom, | ||
| false, | ||
| title) == PDFElement.CreationResult.Ok; | ||
| title, | ||
| priority) == PDFElement.CreationResult.Ok; | ||
|
|
||
| if (ret) | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Can you also add a
LogTo.Error(...)message since this should never happen ? That way a bug report will be sent if it does happenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sorted.