Преглед на файлове

文本注释-* 逻辑修改

OYXH\oyxh преди 1 година
родител
ревизия
90bebddc7c

+ 3 - 2
PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml

@@ -55,7 +55,7 @@
                         MaxDropDownHeight="200" />
 
                     <TextBox
-                        Name="title"
+                        x:Name="title"
                         Height="20"
                         Margin="10,0,35,0"
                         VerticalAlignment="Center"
@@ -64,7 +64,8 @@
                         FontFamily="Segoe UI"
                         FontSize="14"
                         IsReadOnly="True"
-                        TextAlignment="Left" />
+                        TextAlignment="Left" 
+                        />
                 </Grid>
             </Border>
         </Grid>

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

@@ -642,6 +642,7 @@ namespace PDF_Master.Model.AnnotPanel
             }
 
             CurrrentFontWeightStyle = new ComboDataItem(strValue, strContent);
+            UpdateFontWeight_Style();
         }
 
         public void GetCurrentFontSize(int size)

+ 86 - 28
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreetextAnnotPropertyViewModel.cs

@@ -323,24 +323,43 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     var currentItem = FontVm.PresetFontList.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
                     if (currentItem.mTag != "Custom")
                     {
-                        foreach (var item in Settings.Default.PresetFontList)
+                        foreach (var item in FontVm.PresetFontList)
                         {
                             if (item.mTag == currentItem.mTag)
                             {
                                 if (FontVm.FontWeightItem != item.mFontWeight || FontVm.FontStyleItem != item.mFontStyle)
-                                {
-                                    Title = string.Format($"*{currentItem.mTagContent}");
+                                {
+                                    string txt = string.Format($" * {currentItem.mTagContent}");
+
+                                    if (Title == txt)
+                                    {
+                                        Title = "";
+                                    }
+                                    Title = txt;
                                     break;
                                 }
                                 else
                                 {
                                     if (FontVm.FontWeightItem == item.mFontWeight && FontVm.FontStyleItem == item.mFontStyle && FontVm.CurrentFontSize.Value == item.mFontSize && FontVm.CurrentFontFamily.ValueStr == item.mFontFamily.Source)
                                     {
-                                        Title = currentItem.mTagContent;
+                                        string txt = currentItem.mTagContent;
+
+                                        if (Title == txt)
+                                        {
+                                            Title = "";
+                                        }
+                                        Title = txt;
                                     }
                                 }
                             }
                         }
+                    }
+                    else
+                    {
+                        bool isExist = FontVm.GetCurrentPresetFont(Annot);
+                        if (isExist)
+                        {
+                        }
                     }
                 }
             }
@@ -372,76 +391,112 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 
         //设置字体大小
         private void FontSizeChanged()
-        {
+        {
+            if (FontVm.CurrentFontSize != null)
+            {
+                PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.FontSize, FontVm.CurrentFontSize.Value);
+                //if (BasicVm.IsMultiSelected == false)
+                //    PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
+            }
             if (FontVm.CurrentPresetFont != null)
             {
                 var currentItem = FontVm.PresetFontList.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
                 //var comboDataItem = FontVm.PresetFontItems.FirstOrDefault(temp => temp.ValueStr == FontVm.CurrentPresetFont.ValueStr);
                 if (currentItem.mTag != "Custom")
                 {
-                    foreach (var item in Settings.Default.PresetFontList)
+                    foreach (var item in FontVm.PresetFontList)
                     {
                         if (item.mTag == currentItem.mTag)
                         {
                             if (FontVm.CurrentFontSize.Value != item.mFontSize)
                             {
-                                Title = string.Format($"*{currentItem.mTagContent}");
+                                string txt = string.Format($" * {currentItem.mTagContent}");
+
+                                if (Title == txt)
+                                {
+                                    Title = "";
+                                }
+                                Title = txt;
                                 break;
                             }
                             else
                             {
                                 if (FontVm.FontWeightItem == item.mFontWeight && FontVm.FontStyleItem == item.mFontStyle && FontVm.CurrentFontSize.Value == item.mFontSize && FontVm.CurrentFontFamily.ValueStr == item.mFontFamily.Source)
                                 {
-                                    Title = currentItem.mTagContent;
+                                    string txt = currentItem.mTagContent;
+
+                                    if (Title == txt)
+                                    {
+                                        Title = "";
+                                    }
+                                    Title = txt;
                                 }
                             }
                         }
                     }
-                }
-            }
-
-            if (FontVm.CurrentFontSize != null)
-            {
-                PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.FontSize, FontVm.CurrentFontSize.Value);
-                //if (BasicVm.IsMultiSelected == false)
-                //    PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
+                }
+                else
+                {
+                    bool isExist = FontVm.GetCurrentPresetFont(Annot);
+                    if (isExist)
+                    {
+                    }
+                }
             }
         }
 
         //设置字体样式
         private void FontFamilyChanged()
-        {
+        {
+            if (string.IsNullOrEmpty(FontVm.CurrentFontFamily.ValueStr) == false)
+            {
+                PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.FontFamily, new FontFamily(FontVm.CurrentFontFamily.ValueStr));
+            }
             if (FontVm.CurrentPresetFont != null)
             {
                 var currentItem = FontVm.PresetFontList.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
                 //var comboDataItem = FontVm.PresetFontItems.FirstOrDefault(temp => temp.ValueStr == FontVm.CurrentPresetFont.ValueStr);
                 if (currentItem.mTag != "Custom")
                 {
-                    foreach (var item in Settings.Default.PresetFontList)
+                    foreach (var item in FontVm.PresetFontList)
                     {
                         if (item.mTag == currentItem.mTag)
                         {
                             if (FontVm.CurrentFontFamily.ValueStr != item.mFontFamily.Source)
-                            {
-                                Title = string.Format($"*{currentItem.mTagContent}");
+                            {
+                                string txt = string.Format($" * {currentItem.mTagContent}");
+
+                                if (Title == txt)
+                                {
+                                    Title = "";
+                                }
+                                Title = txt;
                                 break;
                             }
                             else
                             {
                                 if (FontVm.FontWeightItem == item.mFontWeight && FontVm.FontStyleItem == item.mFontStyle && FontVm.CurrentFontSize.Value == item.mFontSize && FontVm.CurrentFontFamily.ValueStr == item.mFontFamily.Source)
                                 {
-                                    Title = currentItem.mTagContent;
+                                    string txt = currentItem.mTagContent;
+
+                                    if (Title == txt)
+                                    {
+                                        Title = "";
+                                    }
+                                    Title = txt;
                                 }
                             }
                         }
                     }
+                }
+                else
+                {
+                    bool isExist = FontVm.GetCurrentPresetFont(Annot);
+                    if (isExist)
+                    {
+                    }
                 }
             }
-
-            if (string.IsNullOrEmpty(FontVm.CurrentFontFamily.ValueStr) == false)
-            {
-                PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.FontFamily, new FontFamily(FontVm.CurrentFontFamily.ValueStr));
-            }
         }
 
         private void SelectedFillColorChange(object obj)
@@ -524,7 +579,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         public List<PresetFontItem> FontStyleList = new List<PresetFontItem>();
 
         /// <summary>
-        /// 重新定义
+        /// 用所选部分重新定义
         /// </summary>
         private void ReDefineFontStyle()
         {
@@ -562,6 +617,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
         }
 
+        /// <summary>
+        /// 恢复默认预设样式
+        /// </summary>
         private void RestoreDefaultStyle()
         {
             var defaultlists = TextFont.GetPresetFontStyle();
@@ -778,7 +836,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             bool isExist = FontVm.GetCurrentPresetFont(Annot);
             if (isExist == false)
             {
-                FontVm.CurrentPresetFont = new ComboDataItem("Custom", "自定义");
+                FontVm.CurrentPresetFont = new ComboDataItem("Custom", "Custom");
                 FontVm.GetCurrentFontSize((int)Annot.FontSize);
 
                 FontVm.GetCurrentFontFamily(Annot.FontFamily.ToString(), Annot.FontFamily.ToString());

+ 1 - 1
PDF Office/Views/BOTA/AnnotationContent.xaml.cs

@@ -77,7 +77,7 @@ namespace PDF_Master.Views.BOTA
                             {
                                 var scroller = GetScrollHost(AnnotationList);
                                 var stackpanel = CommonHelper.FindVisualChild<StackPanel>(scroller);
-                                int count = VisualTreeHelper.GetChildrenCount(stackpanel);
+                                //int count = VisualTreeHelper.GetChildrenCount(stackpanel);
                                 var groupItem = VisualTreeHelper.GetChild(stackpanel, i) as GroupItem;
                                 var g = CommonHelper.FindVisualChild<Expander>(groupItem);
                                 if (g != null)

+ 1 - 1
PDF Office/Views/PropertyPanel/AnnotPanel/FreetextAnnotProperty.xaml

@@ -137,7 +137,7 @@
                     </Grid.ColumnDefinitions>
                     <CompositeControl:CustomComboControl
                         x:Name="ComBoxPresetFont"
-                        Title="{Binding Title}"
+                        Title="{Binding Title,Mode=TwoWay,NotifyOnSourceUpdated=True}"
                         Width="188"
                         Height="32"
                         HorizontalAlignment="Left"