|
@@ -217,7 +217,7 @@ namespace Annotations
|
|
|
PropertyContainer.Visibility = visible;
|
|
|
if (visible == Visibility.Collapsed || visible == Visibility.Hidden)
|
|
|
{
|
|
|
- AnnotationBarBtn.IsChecked = false;
|
|
|
+ RightPanelButton.IsChecked = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -290,8 +290,7 @@ namespace Annotations
|
|
|
pdfViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
|
|
|
pdfViewControl.PDFView.SetToolParam(highLightArgs);
|
|
|
pdfViewControl.PDFView.SetMouseMode(oldMode);
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
e.PopupMenu.Items.Add(highLightMenu);
|
|
@@ -597,36 +596,39 @@ namespace Annotations
|
|
|
return standardZoom / 100;
|
|
|
}
|
|
|
|
|
|
- private void ToolExpand_Click(object sender, RoutedEventArgs e)
|
|
|
+ private void ControlLeftPanel()
|
|
|
{
|
|
|
- ToggleButton expandBtn = sender as ToggleButton;
|
|
|
- if (expandBtn != null)
|
|
|
+ if (LeftToolPanelButton != null)
|
|
|
{
|
|
|
- bool isExpand = expandBtn.IsChecked == true;
|
|
|
+ bool isExpand = LeftToolPanelButton.IsChecked == true;
|
|
|
ExpandLeftPanel(isExpand);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void LeftToolPanelButton_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ ControlLeftPanel();
|
|
|
+ }
|
|
|
+
|
|
|
private void ExpandSearchBtn_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
ExpandLeftPanel(true);
|
|
|
BotaSideTool.SelectBotaTool(BOTATools.Search);
|
|
|
}
|
|
|
|
|
|
- private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
|
|
|
+ private void ShowViewSettings()
|
|
|
{
|
|
|
- ToggleButton toggleButton = sender as ToggleButton;
|
|
|
- if (toggleButton != null)
|
|
|
+ if (ViewSettingBtn != null)
|
|
|
{
|
|
|
- if (toggleButton.IsChecked == true)
|
|
|
+ if (ViewSettingBtn.IsChecked == true)
|
|
|
{
|
|
|
CPDFDisplaySettingsControl displayPanel = new CPDFDisplaySettingsControl();
|
|
|
displayPanel.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
PropertyContainer.Child = displayPanel;
|
|
|
PropertyContainer.Visibility = Visibility.Visible;
|
|
|
- if ((bool)AnnotationBarBtn.IsChecked)
|
|
|
+ if ((bool)RightPanelButton.IsChecked)
|
|
|
{
|
|
|
- AnnotationBarBtn.IsChecked = false;
|
|
|
+ RightPanelButton.IsChecked = false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -637,6 +639,11 @@ namespace Annotations
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ ShowViewSettings();
|
|
|
+ }
|
|
|
+
|
|
|
private void PageInfoBtn_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
PasswordUI.Visibility = Visibility.Collapsed;
|
|
@@ -650,7 +657,7 @@ namespace Annotations
|
|
|
PopupBorder.Visibility = Visibility.Collapsed;
|
|
|
}
|
|
|
|
|
|
- private void OpenFile_Click(object sender, RoutedEventArgs e)
|
|
|
+ private void OpenFile()
|
|
|
{
|
|
|
string filePath = CommonHelper.GetFilePathOrEmpty();
|
|
|
if (!string.IsNullOrEmpty(filePath) && pdfViewControl != null)
|
|
@@ -687,18 +694,22 @@ namespace Annotations
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void OpenFile_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ OpenFile();
|
|
|
+ }
|
|
|
+
|
|
|
private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
SaveFile();
|
|
|
pdfViewControl.PDFView.UndoManager.CanSave = false;
|
|
|
}
|
|
|
|
|
|
- private void AnnotationBarControl_Click(object sender, RoutedEventArgs e)
|
|
|
- {
|
|
|
- ToggleButton toggleButton = sender as ToggleButton;
|
|
|
- if (toggleButton != null)
|
|
|
+ private void ControlRightPanel()
|
|
|
+ {
|
|
|
+ if (RightPanelButton != null)
|
|
|
{
|
|
|
- if (toggleButton.IsChecked == true)
|
|
|
+ if (RightPanelButton.IsChecked == true)
|
|
|
{
|
|
|
if (pdfAnnotationControl != null)
|
|
|
{
|
|
@@ -716,6 +727,11 @@ namespace Annotations
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void RightPanelButton_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ ControlRightPanel();
|
|
|
+ }
|
|
|
+
|
|
|
private void EditLink_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
PropertyContainer.Visibility = Visibility.Visible;
|
|
@@ -758,7 +774,7 @@ namespace Annotations
|
|
|
{
|
|
|
pdfAnnotationControl.AnnotationCancel();
|
|
|
ExpandRightPropertyPanel(null, Visibility.Collapsed);
|
|
|
- AnnotationBarBtn.IsChecked = false;
|
|
|
+ RightPanelButton.IsChecked = false;
|
|
|
ViewSettingBtn.IsChecked = false;
|
|
|
}
|
|
|
|
|
@@ -768,7 +784,7 @@ namespace Annotations
|
|
|
if (e != CPDFAnnotationType.Audio && e != CPDFAnnotationType.Image)
|
|
|
{
|
|
|
ExpandRightPropertyPanel(pdfAnnotationControl, Visibility.Visible);
|
|
|
- AnnotationBarBtn.IsChecked = true;
|
|
|
+ RightPanelButton.IsChecked = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -784,8 +800,7 @@ namespace Annotations
|
|
|
}
|
|
|
|
|
|
private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
|
|
|
- {
|
|
|
-
|
|
|
+ {
|
|
|
if (e.Key == "Zoom")
|
|
|
{
|
|
|
CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)((double)e.Value * 100)));
|
|
@@ -794,6 +809,31 @@ namespace Annotations
|
|
|
#endregion
|
|
|
|
|
|
#region Save file
|
|
|
+ /// <summary>
|
|
|
+ /// Save the file to another PDF file.
|
|
|
+ /// </summary>
|
|
|
+ public void SaveAsFile()
|
|
|
+ {
|
|
|
+ {
|
|
|
+ if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
|
|
|
+ {
|
|
|
+ CPDFDocument pdfDoc = pdfViewControl.PDFView.Document;
|
|
|
+ SaveFileDialog saveDialog = new SaveFileDialog();
|
|
|
+ saveDialog.Filter = "(*.pdf)|*.pdf";
|
|
|
+ saveDialog.DefaultExt = ".pdf";
|
|
|
+ saveDialog.OverwritePrompt = true;
|
|
|
+
|
|
|
+ if (saveDialog.ShowDialog() == true)
|
|
|
+ {
|
|
|
+ pdfDoc.WriteToFilePath(saveDialog.FileName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Save the file in the current path.
|
|
|
+ /// </summary>
|
|
|
private void SaveFile()
|
|
|
{
|
|
|
if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
|
|
@@ -836,7 +876,7 @@ namespace Annotations
|
|
|
ToolBarContainer.Visibility = Visibility.Collapsed;
|
|
|
ExpandRightPropertyPanel(null, Visibility.Collapsed);
|
|
|
pdfAnnotationControl.AnnotationCancel();
|
|
|
- AnnotationBarBtn.IsChecked = false;
|
|
|
+ RightPanelButton.IsChecked = false;
|
|
|
if (pdfViewControl != null && pdfViewControl.PDFView != null)
|
|
|
{
|
|
|
pdfViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
|
|
@@ -877,5 +917,154 @@ namespace Annotations
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
+
|
|
|
+ #region Shortcut
|
|
|
+ private void CommandBinding_Executed_Open(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ OpenFile();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Save(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (CanSave)
|
|
|
+ {
|
|
|
+ SaveFile();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_SaveAs(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ SaveAsFile();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Undo(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (pdfViewControl != null && pdfViewControl.PDFView != null && CanUndo)
|
|
|
+ {
|
|
|
+ pdfViewControl.PDFView.UndoManager?.Undo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Redo(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (pdfViewControl != null && pdfViewControl.PDFView != null && CanRedo)
|
|
|
+ {
|
|
|
+ pdfViewControl.PDFView.UndoManager?.Redo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_ControlLeftPanel(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ LeftToolPanelButton.IsChecked = !LeftToolPanelButton.IsChecked;
|
|
|
+ ControlLeftPanel();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_ControlRightPanel(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ RightPanelButton.IsChecked = !RightPanelButton.IsChecked;
|
|
|
+ ControlRightPanel();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Highlight(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (ModeComboBox.SelectedIndex == 1)
|
|
|
+ {
|
|
|
+ AnnotationBarControl.SetAnnotationType(CPDFAnnotationType.Highlight);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Underline(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (ModeComboBox.SelectedIndex == 1)
|
|
|
+ {
|
|
|
+ AnnotationBarControl.SetAnnotationType(CPDFAnnotationType.Underline);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Strikeout(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (ModeComboBox.SelectedIndex == 1)
|
|
|
+ {
|
|
|
+ AnnotationBarControl.SetAnnotationType(CPDFAnnotationType.Strikeout);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Squiggly(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (ModeComboBox.SelectedIndex == 1)
|
|
|
+ {
|
|
|
+ AnnotationBarControl.SetAnnotationType(CPDFAnnotationType.Squiggly);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Bookmark(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ ExpandLeftPanel(true);
|
|
|
+ LeftToolPanelButton.IsChecked = true;
|
|
|
+ BotaSideTool.SelectBotaTool(BOTATools.Bookmark);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Outline(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ ExpandLeftPanel(true);
|
|
|
+ LeftToolPanelButton.IsChecked = true;
|
|
|
+ BotaSideTool.SelectBotaTool(BOTATools.Outline);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Thumbnail(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ ExpandLeftPanel(true);
|
|
|
+ LeftToolPanelButton.IsChecked = true;
|
|
|
+ BotaSideTool.SelectBotaTool(BOTATools.Thumbnail);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Annotation(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ ExpandLeftPanel(true);
|
|
|
+ LeftToolPanelButton.IsChecked = true;
|
|
|
+ BotaSideTool.SelectBotaTool(BOTATools.Annotation);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_Search(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ ExpandLeftPanel(true);
|
|
|
+ LeftToolPanelButton.IsChecked = true;
|
|
|
+ BotaSideTool.SelectBotaTool(BOTATools.Search);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_ScaleAdd(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
|
|
|
+ pdfViewControl.PDFView?.Zoom(newZoom);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_ScaleSubtract(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
|
|
|
+ pdfViewControl.PDFView?.Zoom(newZoom);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_DisplaySettings(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ ViewSettingBtn.IsChecked = !ViewSettingBtn.IsChecked;
|
|
|
+ ShowViewSettings();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CommandBinding_Executed_DocumentInfo(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (PopupBorder.Visibility != Visibility.Visible)
|
|
|
+ {
|
|
|
+ PasswordUI.Visibility = Visibility.Collapsed;
|
|
|
+ FileInfoUI.Visibility = Visibility.Visible;
|
|
|
+ FileInfoControl.InitWithPDFViewer(pdfViewControl.PDFView);
|
|
|
+ PopupBorder.Visibility = Visibility.Visible;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ FileInfoUI.Visibility = Visibility.Collapsed;
|
|
|
+ PopupBorder.Visibility = Visibility.Collapsed;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|