Browse Source

compdfkit(win) - viewer form 快捷键

liuaoran 1 year ago
parent
commit
61c6623238

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFTitleBarControl.xaml

@@ -22,7 +22,7 @@
                   HorizontalAlignment="Left">
                     
                     <MenuItem Header="File" Style="{StaticResource Dropdown_MenuItem}">
-                        <MenuItem Header="Open File(Ctrl+0)" Name="OpenFileItem" Style="{StaticResource Sub_MenuItem}" Click="OpenFileItem_Click"></MenuItem>
+                        <MenuItem Header="Open File(Ctrl+O)" Name="OpenFileItem" Style="{StaticResource Sub_MenuItem}" Click="OpenFileItem_Click"></MenuItem>
                         <MenuItem Header="Save File(Ctrl+S)" Style="{StaticResource Sub_MenuItem}"  Click="SaveFileItem_Click" IsEnabled="{Binding CanSave, RelativeSource={RelativeSource AncestorType=UserControl}}"></MenuItem>
                         <MenuItem Header="Save As(Ctrl+Shift+S)" Style="{StaticResource Sub_MenuItem}"  Click="SaveAsItem_Click"></MenuItem>
                     </MenuItem>

+ 53 - 3
Demo/Examples/Forms/MainWindow.xaml

@@ -14,8 +14,58 @@
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
+            <RoutedUICommand x:Key="Open" Text="Open"/>
+            <RoutedUICommand x:Key="Save" Text="Right rotate"/>
+            <RoutedUICommand x:Key="SaveAs" Text="Delete"/>
+            <RoutedUICommand x:Key="Undo" Text="Undo"/>
+            <RoutedUICommand x:Key="Redo" Text="Redo"/>
+            <RoutedUICommand x:Key="ControlLeftPanel" Text="Control left panel"/>
+            <RoutedUICommand x:Key="ControlRightPanel" Text="Control right panel"/>
+            <RoutedUICommand x:Key="GoToBookmark" Text="Go to bookmark"></RoutedUICommand>
+            <RoutedUICommand x:Key="GoToOutline" Text="Go to outline"></RoutedUICommand>
+            <RoutedUICommand x:Key="GoToThumbnail" Text="Go to thumbnail"></RoutedUICommand>
+            <RoutedUICommand x:Key="GoToSearch" Text="Go to search"></RoutedUICommand>
+            <RoutedUICommand x:Key="ScaleAdd" Text="Scale add"></RoutedUICommand>
+            <RoutedUICommand x:Key="ScaleSubtract" Text="Scale reduce"></RoutedUICommand>
+            <RoutedUICommand x:Key="DisplaySettings" Text="Display settings"></RoutedUICommand>
+            <RoutedUICommand x:Key="DocumentInfo" Text="Document infomation"></RoutedUICommand>
         </ResourceDictionary>
     </Window.Resources>
+    <Window.CommandBindings>
+        <CommandBinding Command="{StaticResource Open}" Executed="CommandBinding_Executed_Open"/>
+        <CommandBinding Command="{StaticResource Save}" Executed="CommandBinding_Executed_Save"/>
+        <CommandBinding Command="{StaticResource SaveAs}" Executed="CommandBinding_Executed_SaveAs"/>
+        <CommandBinding Command="{StaticResource Undo}" Executed="CommandBinding_Executed_Undo"/>
+        <CommandBinding Command="{StaticResource Redo}" Executed="CommandBinding_Executed_Redo"/>
+        <CommandBinding Command="{StaticResource ControlLeftPanel}" Executed="CommandBinding_Executed_ControlLeftPanel"></CommandBinding>
+        <CommandBinding Command="{StaticResource ControlRightPanel}" Executed="CommandBinding_Executed_ControlRightPanel"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToBookmark}" Executed="CommandBinding_Executed_Bookmark"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToOutline}" Executed="CommandBinding_Executed_Outline"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToThumbnail}" Executed="CommandBinding_Executed_Thumbnail"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToSearch}" Executed="CommandBinding_Executed_Search"></CommandBinding>
+        <CommandBinding Command="{StaticResource ScaleAdd}" Executed="CommandBinding_Executed_ScaleAdd"></CommandBinding>
+        <CommandBinding Command="{StaticResource ScaleSubtract}" Executed="CommandBinding_Executed_ScaleSubtract"></CommandBinding>
+        <CommandBinding Command="{StaticResource DisplaySettings}" Executed="CommandBinding_Executed_DisplaySettings"></CommandBinding>
+        <CommandBinding Command="{StaticResource DocumentInfo}" Executed="CommandBinding_Executed_DocumentInfo"></CommandBinding>
+    </Window.CommandBindings>
+
+    <Window.InputBindings>
+        <KeyBinding Key="O" Modifiers="Control" Command="{StaticResource Open}"/>
+        <KeyBinding Key="S" Modifiers="Control" Command="{StaticResource Save}"/>
+        <KeyBinding Key="S" Modifiers="Control+Shift" Command="{StaticResource SaveAs}"/>
+        <KeyBinding Key="Z" Modifiers="Control" Command="{StaticResource Undo}"/>
+        <KeyBinding Key="Y" Modifiers="Control" Command="{StaticResource Redo}"/>
+        <KeyBinding Key="F4" Command="{StaticResource ControlLeftPanel}"/>
+        <KeyBinding Key="F4" Modifiers="Control" Command="{StaticResource ControlRightPanel}"/>
+        <KeyBinding Key="B" Modifiers="Control" Command="{StaticResource GoToBookmark}"></KeyBinding>
+        <KeyBinding Key="O" Modifiers="Control+Shift" Command="{StaticResource GoToOutline}"></KeyBinding>
+        <KeyBinding Key="T" Modifiers="Control" Command="{StaticResource GoToThumbnail}"></KeyBinding>
+        <KeyBinding Key="F" Modifiers="Control" Command="{StaticResource GoToSearch}"></KeyBinding>
+        <KeyBinding Key="Add" Modifiers="Control" Command="{StaticResource ScaleAdd}"></KeyBinding>
+        <KeyBinding Key="Subtract" Modifiers="Control" Command="{StaticResource ScaleSubtract}"></KeyBinding>
+        <KeyBinding Key="D" Modifiers="Control" Command="{StaticResource DisplaySettings}"></KeyBinding>
+        <KeyBinding Key="I" Modifiers="Control" Command="{StaticResource DocumentInfo}"></KeyBinding>
+    </Window.InputBindings>
     <Grid>
         <Grid>
             <Grid.RowDefinitions>
@@ -89,8 +139,8 @@
                             <ToolTip Content="Save"></ToolTip>
                         </Button.ToolTip>
                     </Button>
- 
-                    <ToggleButton Name="ToolExpandBtn" Margin="13,0,0,0" BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="ToolExpand_Click">
+
+                    <ToggleButton Name="LeftToolPanelButton" Margin="13,0,0,0" BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="LeftToolPanelButton_Click">
                         <ToggleButton.Content>
                             <Path Fill="#43474D" Width="30" Height="30">
                                 <Path.Data>
@@ -166,7 +216,7 @@
                         </ToggleButton.Content>
                     </ToggleButton>
 
-                    <ToggleButton  x:Name="FormBarBtn" BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="FormBarBtn_Click">
+                    <ToggleButton  x:Name="RightPanelButton" BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="RightPanelButton_Click">
                         <ToggleButton.Content>
                             <Path Fill="#43474D" Width="30" Height="30">
                                 <Path.Data>

+ 203 - 34
Demo/Examples/Forms/MainWindow.xaml.cs

@@ -19,6 +19,7 @@ using ComPDFKit.PDFPage;
 using ComPDFKitViewer.PdfViewer;
 using System.ComponentModel;
 using System.Runtime.CompilerServices;
+using Compdfkit_Tools.Edit;
 
 namespace Forms
 {
@@ -28,7 +29,7 @@ namespace Forms
         private PDFViewControl passwordViewer;
         private PDFViewControl pdfViewControl;
         private CPDFSearchControl searchControl = null;
-        private FromPropertyControl fromPropertyControl;
+        private FromPropertyControl formPropertyControl;
 
         bool LoadPDFFormTool = false;
 
@@ -72,7 +73,7 @@ namespace Forms
 
         public event PropertyChangedEventHandler PropertyChanged;
         #endregion
-         
+
         public MainWindow()
         {
             InitializeComponent();
@@ -84,7 +85,7 @@ namespace Forms
         private void MainWindow_Loaded(object sender, RoutedEventArgs e)
         {
             BotaSideTool.AddBOTAContent(BOTATools.Thumbnail | BOTATools.Outline | BOTATools.Bookmark | BOTATools.Search);
-            fromPropertyControl = new FromPropertyControl();
+            formPropertyControl = new FromPropertyControl();
             LoadDefaultDocument();
         }
 
@@ -140,18 +141,21 @@ namespace Forms
             pdfViewControl.PDFView.InitDocument(defaultFilePath);
             LoadDocument();
         }
-         
+
         public void InitialPDFViewControl(PDFViewControl newPDFViewer)
         {
-            PDFFormTool.InitWithPDFViewer(newPDFViewer.PDFView, fromPropertyControl);
-            fromPropertyControl.SetPDFViewer(newPDFViewer.PDFView);
+            PDFFormTool.InitWithPDFViewer(newPDFViewer.PDFView, formPropertyControl);
+            formPropertyControl.SetPDFViewer(newPDFViewer.PDFView);
             PDFFormTool.ClearAllToolState();
             newPDFViewer.PDFView.AnnotEditHandler += PDFView_AnnotEditHandler;
             newPDFViewer.PDFView.AnnotActiveHandler += PDFView_AnnotActiveHandler;
             newPDFViewer.CustomSignHandle = true;
             newPDFViewer.PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
         }
-         
+
+        /// <summary>
+        /// Save the file in the current path.
+        /// </summary>
         private void SaveFile()
         {
             if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
@@ -175,6 +179,27 @@ namespace Forms
             }
         }
 
+        /// <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);
+                    }
+                }
+            }
+        }
         #endregion
 
         #region Property changed 
@@ -392,6 +417,27 @@ namespace Forms
 
         #region Expand and collapse panel 
 
+        private void ControlRightPanel()
+        {
+            if (RightPanelButton != null)
+            {
+                if (RightPanelButton.IsChecked == true)
+                {
+
+                    ExpandRightPropertyPanel(formPropertyControl, Visibility.Visible);
+
+                    if ((bool)ViewSettingBtn.IsChecked)
+                    {
+                        ViewSettingBtn.IsChecked = false;
+                    }
+                }
+                else
+                {
+                    ExpandRightPropertyPanel(null, Visibility.Collapsed);
+                }
+            }
+        }
+
         private void ExpandLeftPanel(bool isExpand)
         {
             BotaSideTool.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
@@ -462,37 +508,40 @@ namespace Forms
             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);
-            ToolExpandBtn.IsChecked = true;
+            LeftToolPanelButton.IsChecked = 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)FormBarBtn.IsChecked)
+                    if ((bool)RightPanelButton.IsChecked)
                     {
-                        FormBarBtn.IsChecked = false;
+                        RightPanelButton.IsChecked = false;
                     }
                 }
                 else
@@ -503,7 +552,12 @@ namespace Forms
             }
         }
 
-        private void FormBarBtn_Click(object sender, RoutedEventArgs e)
+        private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
+        {
+            ShowViewSettings();
+        }
+
+        private void RightPanelButton_Click(object sender, RoutedEventArgs e)
         {
             ToggleButton toggleButton = sender as ToggleButton;
             if (toggleButton != null)
@@ -511,7 +565,7 @@ namespace Forms
                 if (toggleButton.IsChecked == true)
                 {
 
-                    ExpandRightPropertyPanel(fromPropertyControl, Visibility.Visible);
+                    ExpandRightPropertyPanel(formPropertyControl, Visibility.Visible);
                     if ((bool)ViewSettingBtn.IsChecked)
                     {
                         ViewSettingBtn.IsChecked = false;
@@ -547,7 +601,7 @@ namespace Forms
             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)
@@ -584,6 +638,11 @@ namespace Forms
             }
         }
 
+        private void OpenFile_Click(object sender, RoutedEventArgs e)
+        {
+            OpenFile();
+        }
+
         private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
         {
             SaveFile();
@@ -665,10 +724,10 @@ namespace Forms
                     pdfViewControl.PDFView?.ReloadDocument();
                     if (PropertyContainer != null)
                     {
-                        fromPropertyControl.CleanProperty();
+                        formPropertyControl.CleanProperty();
                         PropertyContainer.Child = null;
                         ViewSettingBtn.IsChecked = false;
-                        FormBarBtn.IsChecked = false;
+                        RightPanelButton.IsChecked = false;
                     }
                     return;
                 }
@@ -683,10 +742,10 @@ namespace Forms
                     pdfViewControl.PDFView?.ReloadDocument();
                     if (PropertyContainer != null)
                     {
-                        fromPropertyControl.CleanProperty();
+                        formPropertyControl.CleanProperty();
                         PropertyContainer.Child = null;
                         ViewSettingBtn.IsChecked = false;
-                        FormBarBtn.IsChecked = false;
+                        RightPanelButton.IsChecked = false;
                     }
                 }
             }
@@ -699,13 +758,13 @@ namespace Forms
         {
             if (e is WidgetSignArgs)
             {
-                FormBarBtn.IsChecked = true;
-                ExpandRightPropertyPanel(fromPropertyControl, Visibility.Visible);
-                fromPropertyControl.SetPropertyForType(e, null);
+                RightPanelButton.IsChecked = true;
+                ExpandRightPropertyPanel(formPropertyControl, Visibility.Visible);
+                formPropertyControl.SetPropertyForType(e, null);
             }
             else
             {
-                FormBarBtn.IsChecked = false;
+                RightPanelButton.IsChecked = false;
                 ExpandRightPropertyPanel(null, Visibility.Collapsed);
             }
         }
@@ -714,7 +773,7 @@ namespace Forms
         {
             if (e == null || e.IsAnnotCreateReset)
             {
-                fromPropertyControl.SetPropertyForType(null, null);
+                formPropertyControl.SetPropertyForType(null, null);
             }
             else
             {
@@ -727,17 +786,17 @@ namespace Forms
                             case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_PUSHBUTTON:
                             case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_COMBOBOX:
                             case ComPDFKit.PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_LISTBOX:
-                                ExpandRightPropertyPanel(fromPropertyControl, Visibility.Visible);
+                                ExpandRightPropertyPanel(formPropertyControl, Visibility.Visible);
                                 if ((bool)ViewSettingBtn.IsChecked)
                                 {
                                     ViewSettingBtn.IsChecked = false;
                                 }
-                                FormBarBtn.IsChecked = true;
+                                RightPanelButton.IsChecked = true;
                                 break;
                             default:
                                 break;
                         }
-                        fromPropertyControl.SetPropertyForType(formArgs, e);
+                        formPropertyControl.SetPropertyForType(formArgs, e);
                         break;
                 }
             }
@@ -794,7 +853,7 @@ namespace Forms
                 }
                 else if (editEvent.EditAction == ActionType.Del)
                 {
-                    fromPropertyControl.CleanProperty();
+                    formPropertyControl.CleanProperty();
                 }
             }
         }
@@ -821,5 +880,115 @@ namespace Forms
             }
         }
         #endregion
+
+        #region
+        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_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_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
     }
 }

+ 0 - 1
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -1116,7 +1116,6 @@ namespace PDFViewer
                     ExpandRightPropertyPanel(null, Visibility.Collapsed);
                 }
             }
-
         }
 
         private void LeftToolPanelButton_Click(object sender, RoutedEventArgs e)

+ 39 - 3
Demo/Examples/Viewer/MainWindow.xaml

@@ -18,19 +18,55 @@
             <RoutedUICommand x:Key="Open" Text="Open"/>
             <RoutedUICommand x:Key="Save" Text="Right rotate"/>
             <RoutedUICommand x:Key="SaveAs" Text="Delete"/>
+            <RoutedUICommand x:Key="Undo" Text="Undo"/>
+            <RoutedUICommand x:Key="Redo" Text="Redo"/>
+            <RoutedUICommand x:Key="ControlLeftPanel" Text="Control left panel"/>
+            <RoutedUICommand x:Key="ControlRightPanel" Text="Control right panel"/>
+            <RoutedUICommand x:Key="GoToBookmark" Text="Go to bookmark"></RoutedUICommand>
+            <RoutedUICommand x:Key="GoToOutline" Text="Go to outline"></RoutedUICommand>
+            <RoutedUICommand x:Key="GoToThumbnail" Text="Go to thumbnail"></RoutedUICommand>
+            <RoutedUICommand x:Key="GoToAnnotationList" Text="Go to annotation list"></RoutedUICommand>
+            <RoutedUICommand x:Key="GoToSearch" Text="Go to search"></RoutedUICommand>
+            <RoutedUICommand x:Key="ScaleAdd" Text="Scale add"></RoutedUICommand>
+            <RoutedUICommand x:Key="ScaleSubtract" Text="Scale reduce"></RoutedUICommand>
+            <RoutedUICommand x:Key="DisplaySettings" Text="Display settings"></RoutedUICommand>
+            <RoutedUICommand x:Key="DocumentInfo" Text="Document infomation"></RoutedUICommand>
         </ResourceDictionary> 
     </Window.Resources>
 
+
     <Window.CommandBindings>
         <CommandBinding Command="{StaticResource Open}" Executed="CommandBinding_Executed_Open"/>
         <CommandBinding Command="{StaticResource Save}" Executed="CommandBinding_Executed_Save"/>
         <CommandBinding Command="{StaticResource SaveAs}" Executed="CommandBinding_Executed_SaveAs"/>
+        <CommandBinding Command="{StaticResource ControlLeftPanel}" Executed="CommandBinding_Executed_ControlLeftPanel"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToBookmark}" Executed="CommandBinding_Executed_Bookmark"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToOutline}" Executed="CommandBinding_Executed_Outline"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToThumbnail}" Executed="CommandBinding_Executed_Thumbnail"></CommandBinding>
+        <CommandBinding Command="{StaticResource GoToSearch}" Executed="CommandBinding_Executed_Search"></CommandBinding>
+        <CommandBinding Command="{StaticResource ScaleAdd}" Executed="CommandBinding_Executed_ScaleAdd"></CommandBinding>
+        <CommandBinding Command="{StaticResource ScaleSubtract}" Executed="CommandBinding_Executed_ScaleSubtract"></CommandBinding>
+        <CommandBinding Command="{StaticResource DisplaySettings}" Executed="CommandBinding_Executed_DisplaySettings"></CommandBinding>
+        <CommandBinding Command="{StaticResource DocumentInfo}" Executed="CommandBinding_Executed_DocumentInfo"></CommandBinding>
     </Window.CommandBindings>
-    
+
     <Window.InputBindings>
         <KeyBinding Key="O" Modifiers="Control" Command="{StaticResource Open}"/>
         <KeyBinding Key="S" Modifiers="Control" Command="{StaticResource Save}"/>
         <KeyBinding Key="S" Modifiers="Control+Shift" Command="{StaticResource SaveAs}"/>
+        <KeyBinding Key="Z" Modifiers="Control" Command="{StaticResource Undo}"/>
+        <KeyBinding Key="Y" Modifiers="Control" Command="{StaticResource Redo}"/>
+        <KeyBinding Key="F4" Command="{StaticResource ControlLeftPanel}"/>
+        <KeyBinding Key="F4" Modifiers="Control" Command="{StaticResource ControlRightPanel}"/>
+        <KeyBinding Key="B" Modifiers="Control" Command="{StaticResource GoToBookmark}"></KeyBinding>
+        <KeyBinding Key="O" Modifiers="Control+Shift" Command="{StaticResource GoToOutline}"></KeyBinding>
+        <KeyBinding Key="T" Modifiers="Control" Command="{StaticResource GoToThumbnail}"></KeyBinding>
+        <KeyBinding Key="A" Modifiers="Control" Command="{StaticResource GoToAnnotationList}"></KeyBinding>
+        <KeyBinding Key="F" Modifiers="Control" Command="{StaticResource GoToSearch}"></KeyBinding>
+        <KeyBinding Key="Add" Modifiers="Control" Command="{StaticResource ScaleAdd}"></KeyBinding>
+        <KeyBinding Key="Subtract" Modifiers="Control" Command="{StaticResource ScaleSubtract}"></KeyBinding>
+        <KeyBinding Key="D" Modifiers="Control" Command="{StaticResource DisplaySettings}"></KeyBinding>
+        <KeyBinding Key="I" Modifiers="Control" Command="{StaticResource DocumentInfo}"></KeyBinding>
     </Window.InputBindings>
     
     <Grid>
@@ -92,8 +128,8 @@
                         <Button.ToolTip>
                             <ToolTip Content="Save"></ToolTip>
                         </Button.ToolTip>
-                    </Button> 
-                    <ToggleButton Name="ToolExpandBtn" Margin="13,0,0,0" BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="ToolExpand_Click">
+                    </Button>
+                    <ToggleButton Name="LeftToolPanelButton" Margin="13,0,0,0" BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="LeftToolPanelButton_Click">
                         <ToggleButton.Content>
                             <Path Fill="#43474D" Width="30" Height="30">
                                 <Path.Data>

+ 96 - 12
Demo/Examples/Viewer/MainWindow.xaml.cs

@@ -1,6 +1,6 @@
 using ComPDFKit.PDFDocument;
 using Compdfkit_Tools.Helper;
-using Compdfkit_Tools.PDFControl; 
+using Compdfkit_Tools.PDFControl;
 using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
@@ -10,9 +10,9 @@ using System.Collections.Generic;
 using System.ComponentModel;
 using System.Diagnostics;
 using System.Drawing;
-using System.IO; 
+using System.IO;
 using System.Runtime.CompilerServices;
-using System.Windows; 
+using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Controls.Primitives;
 using System.Windows.Input;
@@ -27,9 +27,12 @@ namespace Viewer
         #region Property
         private PDFViewControl passwordViewer;
         private PDFViewControl pdfViewControl;
+        CPDFDisplaySettingsControl displayPanel = new CPDFDisplaySettingsControl();
+
         private int[] zoomLevelList = { 10, 25, 50, 100, 150, 200, 300, 400, 500, 1000 };
 
         public event PropertyChangedEventHandler PropertyChanged;
+        private KeyEventHandler KeyDownHandler;
 
         public bool CanSave
         {
@@ -89,6 +92,7 @@ namespace Viewer
             PropertyContainer.Child = null;
             PropertyContainer.Visibility = Visibility.Collapsed;
         }
+
         private void LoadDefaultDocument()
         {
             string defaultFilePath = "PDF32000_2008.pdf";
@@ -135,6 +139,15 @@ namespace Viewer
 
         #region Expand or Hide Panel 
 
+        private void ControlLeftPanel()
+        {
+            if (LeftToolPanelButton != null)
+            {
+                bool isExpand = LeftToolPanelButton.IsChecked == true;
+                ExpandLeftPanel(isExpand);
+            }
+        }
+
         private void ExpandLeftPanel(bool isExpand)
         {
             BotaSideTool.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
@@ -157,7 +170,7 @@ namespace Viewer
             BotaSideTool.SelectBotaTool(BOTATools.Search);
         }
 
-        private void ToolExpand_Click(object sender, RoutedEventArgs e)
+        private void LeftToolPanelButton_Click(object sender, RoutedEventArgs e)
         {
             ToggleButton expandBtn = sender as ToggleButton;
             if (expandBtn != null)
@@ -199,17 +212,15 @@ namespace Viewer
             return standardZoom / 100;
         }
 
-        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;
+                    PropertyContainer.Visibility = Visibility.Visible; 
                 }
                 else
                 {
@@ -219,6 +230,11 @@ namespace Viewer
             }
         }
 
+        private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
+        {
+            ShowViewSettings();
+        }
+
         private void ZoomInBtn_Click(object sender, RoutedEventArgs e)
         {
             if (pdfViewControl != null)
@@ -457,7 +473,7 @@ namespace Viewer
                         resetForms.Click += (o, p) =>
                         {
                             if (pdfViewControl != null)
-                            { 
+                            {
                                 //pdfViewControl.PDFView?.ResetForm();
                             }
                         };
@@ -624,6 +640,7 @@ namespace Viewer
         #endregion
 
         #region Shortcut  
+
         private void CommandBinding_Executed_Open(object sender, ExecutedRoutedEventArgs e)
         {
             OpenFile();
@@ -641,6 +658,73 @@ namespace Viewer
         {
             SaveAsFile();
         }
-        #endregion 
+
+        private void CommandBinding_Executed_ControlLeftPanel(object sender, ExecutedRoutedEventArgs e)
+        {
+            LeftToolPanelButton.IsChecked = !LeftToolPanelButton.IsChecked;
+            ControlLeftPanel();
+        }
+
+        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_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
     }
 }