Sfoglia il codice sorgente

注释 - 优化右键菜单颜色,选择文本预设样式崩溃,存储线条虚实线

chenrongqian@kdanmobile.com 2 anni fa
parent
commit
d5df4b0326

+ 3 - 0
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -33,6 +33,7 @@ namespace PDF_Office.Model.PropertyPanel.AnnotPanel
                     newItem.mFontStyle = cacheItem.mFontStyle;
                     newItem.mFontWeight = cacheItem.mFontWeight;
                     newItem.mFontSize = cacheItem.mFontSize;
+                    newItem.mFontFamily = cacheItem.mFontFamily;
                     Settings.Default.PresetFontList.Add(newItem);
                 }
 
@@ -48,6 +49,7 @@ namespace PDF_Office.Model.PropertyPanel.AnnotPanel
                     newItem.mFontStyle = item.mFontStyle;
                     newItem.mFontWeight = item.mFontWeight;
                     newItem.mFontSize = item.mFontSize;
+                    newItem.mFontFamily = item.mFontFamily;
                     cacheTempList.Add(newItem);
                 }
             }
@@ -115,6 +117,7 @@ namespace PDF_Office.Model.PropertyPanel.AnnotPanel
                 {
                     if (item.mTag == itemDefault.mTag)
                     {
+                        item.mTagContent = itemDefault.mTagContent;
                         item.mFontFamily = itemDefault.mFontFamily;
                         item.mFontWeight = itemDefault.mFontWeight;
                         item.mFontStyle = itemDefault.mFontStyle;

+ 4 - 1
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreetextAnnotPropertyViewModel.cs

@@ -221,7 +221,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                 if (item != null)
                 {
                     FontVm.GetCurrentFontSize(item.mFontSize);
-                    FontVm.GetCurrentFontFamily(item.mFontFamily.ToString(), item.mFontFamily.ToString());
+
+                    if (item.mFontFamily != null)
+                        FontVm.GetCurrentFontFamily(item.mFontFamily.ToString(), item.mFontFamily.ToString());
+
                     FontVm.GetFontWeights_Style(item.mFontStyle, item.mFontWeight);
 
                     Dictionary<AnnotAttrib, object> AnnotAttribDir = new Dictionary<AnnotAttrib, object>();

+ 16 - 0
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -486,6 +486,10 @@ namespace PDF_Office.ViewModels.Tools
                     {
                         collect.Add(item);
                     }
+
+                    if (freehandArgs.LineDash == null)
+                        freehandArgs.LineDash = new DashStyle();
+
                     freehandArgs.LineDash.Dashes = collect;
                 }
 
@@ -681,6 +685,10 @@ namespace PDF_Office.ViewModels.Tools
                     {
                         collect.Add(item);
                     }
+
+                    if (squareArgs.LineDash == null)
+                        squareArgs.LineDash = new DashStyle();
+
                     squareArgs.LineDash.Dashes = collect;
                 }
 
@@ -749,6 +757,10 @@ namespace PDF_Office.ViewModels.Tools
                     {
                         collect.Add(item);
                     }
+
+                    if (circleAnnotArgs.LineDash == null)
+                        circleAnnotArgs.LineDash = new DashStyle();
+
                     circleAnnotArgs.LineDash.Dashes = collect;
                 }
                 
@@ -827,6 +839,10 @@ namespace PDF_Office.ViewModels.Tools
                     {
                         collect.Add(item);
                     }
+
+                    if (lineArgs.LineDash == null)
+                        lineArgs.LineDash = new DashStyle();
+
                     lineArgs.LineDash.Dashes = collect;
                 }
 

+ 6 - 4
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Layout.cs

@@ -408,11 +408,12 @@ namespace PDF_Office.ViewModels.Tools
             menuItem.Name = "hightColor";
             menuItem.Height = 20 + 15;
             menuItem.Header = colorContent;
+
             var hightColorStyle = App.Current.FindResource("UIElementMenuItem") as Style;
             if (hightColorStyle != null)
                 menuItem.Style = hightColorStyle;
 
-            pop.AddItem(menuItem);
+            colorContent.DataContext = pop.AddItem(menuItem);
 
             pop.AddItem(GetSeparator());
 
@@ -490,10 +491,10 @@ namespace PDF_Office.ViewModels.Tools
             }
             else
             {
-                var annot = (sender as FrameworkElement).DataContext as AnnotHandlerEventArgs;
-                if (annot != null)
+                var cusMenuItem = (sender as FrameworkElement).DataContext as CusMenuItem;
+                if (cusMenuItem != null && cusMenuItem.Parameter != null)
                 {
-                    var test = annot as TextHighlightAnnotArgs;
+                    var test = cusMenuItem.Parameter as TextHighlightAnnotArgs;
                     if (test != null)
                     {
                         var anvent = AnnotAttribEvent.GetAnnotAttribEvent(test, test.GetAnnotAttrib());
@@ -501,6 +502,7 @@ namespace PDF_Office.ViewModels.Tools
                         anvent.UpdateAnnot();
                     }
                 }
+
             }
         }