Browse Source

compdfkit(windows) - 代码注释调整

liuaoran 1 year ago
parent
commit
3f5dc9b80b

File diff suppressed because it is too large
+ 0 - 268
compdfkit_demo_windows/compdfkit/UpgradeLog.htm


File diff suppressed because it is too large
+ 0 - 268
compdfkit_demo_windows/compdfkit/UpgradeLog2.htm


File diff suppressed because it is too large
+ 0 - 268
compdfkit_demo_windows/compdfkit/UpgradeLog3.htm


File diff suppressed because it is too large
+ 0 - 268
compdfkit_demo_windows/compdfkit/UpgradeLog4.htm


File diff suppressed because it is too large
+ 0 - 268
compdfkit_demo_windows/compdfkit/UpgradeLog5.htm


File diff suppressed because it is too large
+ 0 - 268
compdfkit_demo_windows/compdfkit/UpgradeLog6.htm


File diff suppressed because it is too large
+ 0 - 268
compdfkit_demo_windows/compdfkit/UpgradeLog7.htm


File diff suppressed because it is too large
+ 0 - 268
compdfkit_demo_windows/compdfkit/UpgradeLog8.htm


+ 3 - 0
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/Convert/TextLengthToVisibilityConverter.cs

@@ -9,6 +9,7 @@ using System.Windows.Data;
 
 namespace compdfkit_tools.Common
 {
+    [ValueConversion(typeof(string), typeof(Visibility))]
     public class TextLengthToVisibilityConverter: IValueConverter
     {
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
@@ -37,6 +38,8 @@ namespace compdfkit_tools.Common
         }
     }
 
+
+    [ValueConversion(typeof(string), typeof(Visibility))]
     internal class InvertTextLengthToVisibilityConverter : IValueConverter
     {
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

+ 81 - 53
compdfkit_demo_windows/compdfkit/compdfkit/MainPage.xaml.cs

@@ -31,9 +31,6 @@ using Path = System.IO.Path;
 
 namespace compdfkit
 {
-    /// <summary>
-    /// MainPage.xaml 的交互逻辑
-    /// </summary>
     public partial class MainPage : UserControl, INotifyPropertyChanged
     {
         private bool isFirstLoad = true;
@@ -112,13 +109,21 @@ namespace compdfkit
 
         private void LoadDocument()
         {
+            //Load the Document
             pdfViewControl.PDFView?.Load();
+
+            //Highlight the link annotation
             pdfViewControl.PDFView?.SetShowLink(true);
+
+            //Add PDFViewControl to PDFGrid
             PDFGrid.Child = pdfViewControl;
 
+            // Register the InfoChanged event handler,
+            // which is used to notify the CPDFScalingControl of real-time changes in the displayed number when the page size changes.
             pdfViewControl.PDFView.InfoChanged -= PdfViewer_InfoChanged;
             pdfViewControl.PDFView.InfoChanged += PdfViewer_InfoChanged;
 
+            //
             pdfViewControl.PDFView.PDFEditCommandHandler -= PDFView_PDFEditCommandHandler;
             pdfViewControl.PDFView.PDFEditCommandHandler += PDFView_PDFEditCommandHandler;
 
@@ -205,6 +210,7 @@ namespace compdfkit
                 CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)((double)e.Value * 100)));
             }
         }
+
         private void PDFView_PDFEditCommandHandler(object sender, PDFEditCommand e)
         {
             if (e == null)
@@ -488,7 +494,7 @@ namespace compdfkit
 
         #region ContextMenu
         /// <summary>
-        /// 文字编辑右键菜单
+        /// TextEdit right-click menu.
         /// </summary>
         private void PDFEditTextContextMenu(object sender, PDFEditCommand editCommand)
         {
@@ -499,20 +505,6 @@ namespace compdfkit
                 editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
                 editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
                 editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
-                //MenuItem propertyMenu = new MenuItem();
-                //propertyMenu.Header = "Property";
-                //propertyMenu.Click += (o, p) =>
-                //{
-
-                //    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditText)
-                //    {
-                //        PDFTextEditControl textEditControl = new PDFTextEditControl();
-                //        textEditControl.SetPDFTextEditData(lastPDFEditEvent);
-                //        PropertyContainer.Child = textEditControl;
-                //        PropertyContainer.Visibility = Visibility.Visible;
-                //    }
-                //};
-                //editCommand.PopupMenu.Items.Add(propertyMenu);
             }
             else
             {
@@ -525,7 +517,7 @@ namespace compdfkit
         }
 
         /// <summary>
-        /// 图片编辑右键菜单
+        /// ImageEdit right-click menu.
         /// </summary>
         private void PDFEditImageContextMenu(object sender, PDFEditCommand editCommand)
         {
@@ -668,7 +660,7 @@ namespace compdfkit
         }
 
         /// <summary>
-        /// 图片编辑透明度二级菜单
+        /// ImageEdit transparency submenu.
         /// </summary>
         private void AppendOpacityMenu(MenuItem parentMenu)
         {
@@ -768,6 +760,9 @@ namespace compdfkit
 
         #region UI Action
 
+        /// <summary>
+        /// Save the file to another PDF file.
+        /// </summary>
         public void SaveAsFile()
         {
             {
@@ -794,6 +789,9 @@ namespace compdfkit
             }
         }
 
+        /// <summary>
+        /// Save the file in the current path.
+        /// </summary>
         public void SaveFile()
         {
             if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
@@ -1017,8 +1015,6 @@ namespace compdfkit
         /// <summary>
         /// Text and Image Selected Event
         /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
         private void PDFView_PDFEditActiveHandler(object sender, ComPDFKitViewer.PDFEditEvent e)
         {
             lastPDFEditEvent = e;
@@ -1070,16 +1066,19 @@ namespace compdfkit
             }
 
             var item = (sender as ComboBox).SelectedItem as ComboBoxItem;
+            //Behavior when exit mode
             switch (currentMode)
             {
                 case "Viewer":
                     break;
-
-                //Behavior when exit Edit mode
-                // Clear the ToolBar
-                // Collapse the ToolBar
-                // Clear And Collapse the property panel.
-                // Change the mousemode
+                /*
+                 * Behavior when exit Edit mode
+                 * Clear and collapse the ToolBar
+                 * Clear And collapse the property panel.
+                 * Change the mousemode to PanTool
+                 * Unsubscribe the event handles
+                 * Clear the undo history
+                 */
                 case "Annotations":
                     AnnotationBarControl.Visibility = Visibility.Collapsed;
                     AnnotationBarControl.ClearAllToolState();
@@ -1091,21 +1090,26 @@ namespace compdfkit
                     pdfViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
                     pdfViewControl.PDFView?.UndoManager.ClearHistory();
                     break;
-
-                // Behavior when exit Edit mode:
-                // Collapsed the ToolBar
-                // Set the mode to allow editing None
-                // Set the mouse mode to PanTool
-                // Reload Document
-                // Unsubscribe click event.
-                // Clear And Collapse the property panel.
+                /*
+                 * Behavior when exit edit mode:
+                 * Collapsed the ToolBar
+                 * Highlight the link annotation
+                 * Set the mode to not allow edit
+                 * Set the mouse mode to PanTool
+                 * Reload Document
+                 * Unsubscribe click event.
+                 * Clear And collapse the property panel.
+                 * Clear and collapse the ToolBar
+                 * Clear undo history
+                 * CPDFDisplaySettingsControl
+                 * Enable the configuration of the split view.
+                 */
                 case "Content Editor":
                     PDFEditTool.Visibility = Visibility.Collapsed;
                     pdfViewControl.PDFView?.SetShowLink(true);
                     pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.None);
                     pdfViewControl.PDFView?.SetMouseMode(MouseModes.PanTool);
                     pdfViewControl.PDFView?.ReloadDocument();
-
                     pdfViewControl.PDFView.PDFEditActiveHandler -= PDFView_PDFEditActiveHandler;
                     ExpandRightPropertyPanel(null, Visibility.Collapsed);
                     ClearPDFEditState();
@@ -1113,20 +1117,32 @@ namespace compdfkit
                     if (displayPanel != null)
                     {
                         displayPanel.SetSplitContainerVisibility(Visibility.Visible);
-
                     }
                     break;
-
+                /*
+                 * Behavior when exit form mode:
+                 * Clear and collapsed the ToolBar
+                 * Clear And Collapse the property panel. 
+                 * Unsubscribe event.
+                 * Clear undo history
+                 */
                 case "Forms":
-                    FormBarControl.ClearAllToolState();
                     ExpandRightPropertyPanel(null, Visibility.Collapsed);
+                    FormBarControl.ClearAllToolState();
                     FormBarControl.Visibility = Visibility.Collapsed;
                     pdfViewControl.PDFView?.SetMouseMode(MouseModes.PanTool);
                     pdfViewControl.PDFView.AnnotActiveHandler -= PDFView_FormActiveHandler;
                     pdfViewControl.PDFView.AnnotEditHandler -= PDFView_FormEditHandler;
                     pdfViewControl.PDFView?.UndoManager.ClearHistory();
                     break;
-
+                /*
+                 * Unsubscribe event.
+                 * Show Undo Redo Button
+                 * Collapse PageEditBarControl
+                 * Replace PDFGrid.Child to pdfViewControl.
+                 * Reload Document
+                 * Enable Button
+                 */
                 case "Docs Editor":
                     pageEditControl.ExitPageEdit -= PageEditControl_ExitPageEdit;
                     pageEditControl.PageMoved -= PageEditControl_PageMoved;
@@ -1145,17 +1161,23 @@ namespace compdfkit
                     break;
             }
 
-            // Behavior when switching to Viewer mode:
-            // Hide the ToolBar
+            /* 
+             * Behavior when switching to Viewer mode:
+             * Hide the ToolBar
+             * Set mousemode to Viewer
+             */
             if ((string)item.Content == "Viewer")
             {
                 ToolBarContainer.Visibility = Visibility.Collapsed;
                 pdfViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
             }
 
-            // Behavior when switching to Annotation mode:
-            // Show the ToolBar
-            // Show the AnnotationBar
+            /* 
+             * Behavior when switching to Annotation mode:
+             * Show the ToolBar
+             * Show the AnnotationBar
+             */
+
             else if ((string)item.Content == "Annotations")
             {
                 ToolBarContainer.Visibility = Visibility.Visible;
@@ -1166,12 +1188,15 @@ namespace compdfkit
                 pdfViewControl.PDFView.AnnotActiveHandler += PDFView_AnnotActiveHandler;
             }
 
-            // Behavior when switching to Edit mode:
-            // Show the ToolBar
-            // Show the EditBar
-            // Set the mode to allow editing of both text and images
-            // Set the mouse mode to PDFEdit
-            // Reload Document
+            /*
+             * Behavior when switching to Edit mode:
+             * Show the ToolBar
+             * Show the EditBar
+             * Set the mode to allow editing of both text and images
+             * Set the mouse mode to PDFEdit
+             * Reload Document
+             * Set the 
+            */
             else if ((string)item.Content == "Content Editor")
             {
                 ToolBarContainer.Visibility = Visibility.Visible;
@@ -1187,10 +1212,13 @@ namespace compdfkit
                 if (displayPanel != null)
                 {
                     displayPanel.SetSplitContainerVisibility(Visibility.Collapsed);
-
                 }
             }
 
+            /*
+             *
+             *
+             */
             else if ((string)item.Content == "Forms")
             {
                 ToolBarContainer.Visibility = Visibility.Visible;

+ 1 - 1
compdfkit_demo_windows/compdfkit/compdfkit/MainWindow.xaml

@@ -67,7 +67,7 @@
                                 Background="{TemplateBinding Panel.Background}"
                                 Name="border"
                                 SnapsToDevicePixels="True">
-                <Path Name="content" VerticalAlignment="Center" HorizontalAlignment="Center" Fill="#666666">
+                <Path Name="content" VerticalAlignment="Center" HorizontalAlignment="Center" Fill="#FFFFFF">
                     <Path.RenderTransform>
                         <TransformGroup>
                             <TranslateTransform X="-2" Y="-2"/>

+ 0 - 3
compdfkit_demo_windows/compdfkit/compdfkit/MainWindow.xaml.cs

@@ -223,9 +223,6 @@ namespace compdfkit
                 }
             }
 
-            /// <summary>
-            /// 文件更改显示*
-            /// </summary>
             private Visibility _fileChanged = Visibility.Hidden;
             public Visibility FileChanged
             {