Browse Source

注释-文本注释、esc取消 联动问题

OYXH\oyxh 1 year ago
parent
commit
908ff960d4

+ 1 - 1
PDF Office/Model/AnnotPanel/FontBoard.cs

@@ -670,7 +670,7 @@ namespace PDF_Master.Model.AnnotPanel
             //List<PresetFontItem> presetFontItems = TextFont.GetCachePresetFontList();
             foreach (var item in PresetFontList)
             {
-                if (annot.FontSize == item.mFontSize && annot.FontWeight == item.mFontWeight
+                if (annot.FontSize == item.mFontSize && annot.FontWeight == item.mFontWeight && annot.FontStyle == item.mFontStyle
                     && (annot.FontFamily.Source == item.mFontFamily.Source || annot.FontFamily.Source == "Arial" && item.mFontFamily.Source == "Helvetica")
                     )
                 {

+ 45 - 24
PDF Office/ViewModels/PropertyPanel/AnnotPanel/StampAnnotPropertyViewModel.cs

@@ -8,6 +8,7 @@ using PDF_Master.Helper;
 using PDF_Master.Model;
 using PDF_Master.Model.AnnotPanel;
 using PDF_Master.Properties;
+using PDF_Master.ViewModels.Tools.AnnotManager;
 using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
@@ -31,7 +32,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
     {
         #region 标准图章相关默认配置(如果需要修改,要留意按顺序一一对应的,如果要支持多语,Path则需要替换成SDK获取图片的方法,并修改对应参数与实现代码)
 
-        List<string> Path = new List<string>
+        private List<string> Path = new List<string>
         {
             "pack://application:,,,/PDF Master;component/Resources/StampIcons/Approved.png",
             "pack://application:,,,/PDF Master;component/Resources/StampIcons/NotApproved.png",
@@ -55,38 +56,43 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             "pack://application:,,,/PDF Master;component/Resources/StampIcons/PrivateMark2.png",
             "pack://application:,,,/PDF Master;component/Resources/StampIcons/PrivateMark3.png",
         };
-        List<string> StampText = new List<string>
+
+        private List<string> StampText = new List<string>
         {
             "Approved","NotApproved","Completed","Final","Draft","Confidential","ForPublicRelease","NotForPublicRelease",
             "ForComment","Void","PreliminaryResults","InformationOnly","Accepted","Rejected","Witness","InitialHere","SignHere",
             "revised","PrivateMark#1","PrivateMark#2","PrivateMark#3"
         };
-        List<int> MaxWidth = new List<int>
+
+        private List<int> MaxWidth = new List<int>
         {
             218,292,234,130,150,280,386,461,282,121,405,366,30,30,133,133,133,173,30,30,30
         };
-        List<int> MaxHeight = new List<int>
+
+        private List<int> MaxHeight = new List<int>
         {
            66,66,66,66,66,66,66,66,66,66,66,66,30,30,39,39,39,66,30,30,30
         };
 
-        #endregion
+        #endregion 标准图章相关默认配置(如果需要修改,要留意按顺序一一对应的,如果要支持多语,Path则需要替换成SDK获取图片的方法,并修改对应参数与实现代码)
 
         #region 动态图章相关配置(需要支持多语则修改DynamicStampText的内容)
 
-        List<string> DynamicStampText = new List<string>
+        private List<string> DynamicStampText = new List<string>
         {
             "REVISED","REVIEWED","Completed","RECEIVED","APPROVED","CONFIDENTIAL"
         };
-        List<C_TEXTSTAMP_COLOR> DynamicColor = new List<C_TEXTSTAMP_COLOR>
+
+        private List<C_TEXTSTAMP_COLOR> DynamicColor = new List<C_TEXTSTAMP_COLOR>
         {
           C_TEXTSTAMP_COLOR.TEXTSTAMP_RED,  C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN,
           C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN,C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN,
           C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN,C_TEXTSTAMP_COLOR.TEXTSTAMP_RED,
         };
 
-        #endregion
+        #endregion 动态图章相关配置(需要支持多语则修改DynamicStampText的内容)
 
+        private AnnotTransfer PropertyPanel;
         private string author = "12312";
 
         public string Author
@@ -139,9 +145,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
-
-
         private bool unStandard;
+
         /// <summary>
         /// 判断当前是否为非标准图章,控制UI展示
         /// </summary>
@@ -153,6 +158,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 SetProperty(ref unStandard, value);
             }
         }
+
         /// <summary>
         /// 日期格式
         /// </summary>
@@ -227,6 +233,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 StandardStampList.Add(standardStamp);
             }
         }
+
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;
@@ -244,20 +251,28 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             {
                 return;
             }
+            navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
             navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
         }
 
         public void Close()
         {
-            //PDFViewer.SetMouseMode(MouseModes.PanTool);
-            PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
-            var annotArgs = new SelectToolArgs();
-            PDFViewer.SetToolParam(annotArgs);
-            //PDFViewer.SetMouseMode(MouseModes.PanTool);
-
-            PDFViewer.DisableClearSelectAnnot(false);
-            PDFViewer.ClearSelectAnnots();
-            viewContentViewModel.IsPropertyOpen = false;
+            if (PropertyPanel != null)
+            {
+                if (PropertyPanel.AnnotSelect == "Signature")
+                {
+                    //PDFViewer.SetMouseMode(MouseModes.PanTool);
+                    PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                    var annotArgs = new SelectToolArgs();
+                    PDFViewer.SetToolParam(annotArgs);
+                    //PDFViewer.SetMouseMode(MouseModes.PanTool);
+
+                    PDFViewer.DisableClearSelectAnnot(false);
+                    PDFViewer.ClearSelectAnnots();
+                    viewContentViewModel.IsPropertyOpen = false;
+                }
+            }
+            
         }
 
         public void SetDynamicStamp(Stamp stamp)
@@ -279,7 +294,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             Args.Opacity = stamp.Opacity;
             if (stamp.Type == StampType.IMAGE_STAMP)
             {
-
                 Args.ImageWidth = stamp.MaxWidth;
                 Args.ImageHeight = stamp.MaxHeight;
             }
@@ -317,7 +331,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         /// </summary>
         public void UpDataDynamicStampList()
         {
-
             string time = System.DateTime.Now.ToString(dateType);
             for (int i = 0; i < DynamicStampText.Count; i++)
             {
@@ -340,7 +353,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     {
                         standardStamp.StampTextDate = Author;
                     }
-
                 }
                 else
                 {
@@ -370,14 +382,18 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 {
                     case C_TEXTSTAMP_COLOR.TEXTSTAMP_WHITE:
                         break;
+
                     case C_TEXTSTAMP_COLOR.TEXTSTAMP_RED:
                         standardStamp.TextColor = TextStampColor.TEXTSTAMP_RED;
                         break;
+
                     case C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN:
                         standardStamp.TextColor = TextStampColor.TEXTSTAMP_GREEN;
                         break;
+
                     case C_TEXTSTAMP_COLOR.TEXTSTAMP_BLUE:
                         break;
+
                     default:
                         break;
                 }
@@ -426,12 +442,14 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     newDoc.InsertPage(0, frame.PixelWidth, frame.PixelHeight, imageData, CPDFDocumentImageMode.CPDFDocumentImageModeScaleToFill);
                     newDoc.WriteToFilePath(path);
                     break;
+
                 case "PNG":
                     using (FileStream stream = new FileStream(path, FileMode.Create))
                     {
                         encoder.Save(stream);
                     }
                     break;
+
                 default:
                     break;
             }
@@ -459,6 +477,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             stamps.Clear();
             Settings.Default.Save();
         }
+
         private void ShowDialog()
         {
             switch (TabControlSelectedIndex)
@@ -466,14 +485,16 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 case 1:
                     ShowDynamicPropertyDialog();
                     break;
+
                 case 2:
                     ShowCustomCreateDialog(null);
                     break;
+
                 default:
                     break;
             }
-
         }
+
         private void ShowDynamicPropertyDialog()
         {
             bool result = true;
@@ -649,4 +670,4 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             CusListboxIndex = CustomStampList.Count - 1;
         }
     }
-}
+}

+ 2 - 2
PDF Office/Views/PropertyPanel/AnnotPanel/SignatureAnnotProperty.xaml.cs

@@ -27,8 +27,8 @@ namespace PDF_Master.Views.PropertyPanel.AnnotPanel
         public SignatureAnnotProperty()
         {
             InitializeComponent();
-            KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
-            KeyEventsHelper.KeyDown += ShortCut_KeyDown;
+            //KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
+            //KeyEventsHelper.KeyDown += ShortCut_KeyDown;
         }
 
         private void ShortCut_KeyDown(object sender, KeyEventArgs e)

+ 2 - 2
PDF Office/Views/PropertyPanel/AnnotPanel/StampAnnotProperty.xaml.cs

@@ -27,8 +27,8 @@ namespace PDF_Master.Views.PropertyPanel.AnnotPanel
         public StampAnnotProperty()
         {
             InitializeComponent();
-            KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
-            KeyEventsHelper.KeyDown += ShortCut_KeyDown;
+            //KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
+            //KeyEventsHelper.KeyDown += ShortCut_KeyDown;
         }
 
         private void ShortCut_KeyDown(object sender, KeyEventArgs e)