Browse Source

便签-图标 更新

OYXH\oyxh 1 năm trước cách đây
mục cha
commit
7763df30d3

+ 15 - 6
PDF Office/ViewModels/PropertyPanel/AnnotPanel/StickyNotePropertyViewModel.cs

@@ -25,9 +25,19 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
     public class StickyNotePropertyViewModel : BindableBase, INavigationAware
     {
         //外部UI引用
-        public string strOtherTag { get; private set; }
-
-        public bool IsFirst=true;
+        //public string strOtherTag { get; private set; }
+        private string _strOtherTag;
+
+        public string strOtherTag
+        {
+            get { return _strOtherTag; }
+            set
+            {
+                SetProperty(ref _strOtherTag, value);
+            }
+        }
+
+        public bool IsFirst = true;
 
         private double _transpent;
 
@@ -53,7 +63,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             set { SetProperty(ref _sharpColor, value); SharpCurrentColor = _sharpColor; }
         }
 
-        private Brush _sharpCurrentColor= App.Current.FindResource("color.sys.layout.divider.note") as Brush;
+        private Brush _sharpCurrentColor = App.Current.FindResource("color.sys.layout.divider.note") as Brush;
 
         public Brush SharpCurrentColor
         {
@@ -214,8 +224,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         {
             navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
             if (PropertyPanel != null)
-            {
-                
+            {
                 AnnotEvent = PropertyPanel.AnnotEvent;
                 Annot = PropertyPanel.annot;
                 IsMultiSelected = PropertyPanel.IsMultiSelected;

+ 8 - 6
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -262,8 +262,7 @@ namespace PDF_Master.ViewModels.Tools
                 }
             }
             else
-            {
-                
+            {
                 UncheckAnnot();
             }
 
@@ -462,6 +461,9 @@ namespace PDF_Master.ViewModels.Tools
                 if (str == AddAnnotType.AnnotSticky.ToString())
                 {
                     annotHandler = GetStickyNote();
+                    GetCurrentAnnot = annotHandler as StickyAnnotArgs;
+                    customStickyPopup.GetCurrentAnnot = GetCurrentAnnot;
+                    customStickyPopup.GetPDFViewer = PDFViewer;
                 }
                 if (str == AddAnnotType.AnnotSquare.ToString())
                 {
@@ -1256,7 +1258,7 @@ namespace PDF_Master.ViewModels.Tools
                         Settings.Default.AppProperties.Annotate.NoteAnnoteColor = color;
                         var StickyDefalut = GetAnnotDefault(AnnotArgsType.AnnotSticky);
                         StickyDefalut.ForgoundColor = color;
-
+                        StickyDefalut.NoteIcon = stickyAnnotArgs.IconName;
                         SettingHelper.SetAnnotDefaultProperty(StickyDefalut);
 
                         if (StrAnnotToolChecked == "StickyNote")
@@ -1266,6 +1268,7 @@ namespace PDF_Master.ViewModels.Tools
                                 Color = stickyAnnotArgs.Color,
                                 IconName = stickyAnnotArgs.IconName,
                                 Transparency = stickyAnnotArgs.Transparency,
+                                Author = Settings.Default.AppProperties.Description.Author
                             };
 
                             PDFViewer.SetToolParam(annotArgs);
@@ -2140,7 +2143,7 @@ namespace PDF_Master.ViewModels.Tools
                 }
 
                 AnnotHandlerEventArgs annotArgs = null;
-                if(StrAnnotToolChecked== tuple.Item2)
+                if (StrAnnotToolChecked == tuple.Item2)
                 {
                     StrAnnotToolChecked = "";
                     UncheckAnnot();
@@ -2161,8 +2164,7 @@ namespace PDF_Master.ViewModels.Tools
                         //2023/4/6 设置Stamp刚进入时点击view出现空的选中方框
                         PDFViewer.SetMouseMode(MouseModes.None);
                     }
-                }
-                
+                }
             }
         }
 

+ 9 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/StickyNotePopup.xaml.cs

@@ -457,6 +457,10 @@ namespace PDF_Master.Views.PropertyPanel.AnnotPanel
                 {
                     GetPDFViewer.ToolManager.DisableStickyCreate = false;
                 }
+            }
+            else
+            {
+                CloseText_MouseUp(this, null);
             }
         }
 
@@ -481,6 +485,11 @@ namespace PDF_Master.Views.PropertyPanel.AnnotPanel
             {
                 BtnDelete_Click(null, null);
             }
+            if(e.Key==Key.Enter)
+            {
+                CloseText_MouseUp(this, null);
+                GetPDFViewer.PreviewMouseLeftButtonDown -= GetPDFViewer_LeftButtonDown;
+            }
         }
     }
 }

+ 16 - 7
PDF Office/Views/PropertyPanel/AnnotPanel/StickyNoteProperty.xaml

@@ -10,6 +10,7 @@
     xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
     xmlns:local="clr-namespace:PDF_Master.Views.PropertyPanel.AnnotPanel"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:tools="clr-namespace:PDF_Master.Views.Tools"
     d:DataContext="{d:DesignInstance Type=AnnotPanel:StickyNotePropertyViewModel}"
     d:DesignHeight="450"
     d:DesignWidth="260"
@@ -26,6 +27,7 @@
             <Convert:AnnotArgsTypeConverter x:Key="AnnotArgsTypeConverter" />
             <dataConvert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert" />
             <dataConvert:ColorBrushConvert x:Key="ColorBrushToColorConvert"></dataConvert:ColorBrushConvert>
+            <tools:AnnotToolIsCheckedConvert x:Key="AnnotToolIsCheckedConvert" />
         </ResourceDictionary>
     </UserControl.Resources>
     <Grid VerticalAlignment="Stretch">
@@ -115,7 +117,8 @@
                     Foreground="#616469"
                     GroupName="StrickyNote"
                     Style="{StaticResource GreyBgRadioBtnStyle}"
-                    Tag="Comment">
+                    Tag="Comment"
+                    IsChecked="{Binding strOtherTag, Converter={StaticResource AnnotToolIsCheckedConvert}, ConverterParameter=Comment}">
                     <RadioButton.Content>
                         <Path
                             VerticalAlignment="Center"
@@ -142,7 +145,8 @@
                     Foreground="#616469"
                     GroupName="StrickyNote"
                     Style="{StaticResource GreyBgRadioBtnStyle}"
-                    Tag="Note">
+                    Tag="Note"
+                    IsChecked="{Binding strOtherTag, Converter={StaticResource AnnotToolIsCheckedConvert}, ConverterParameter=Note}">
                     <RadioButton.Content>
                         <Path
                             VerticalAlignment="Center"
@@ -169,7 +173,8 @@
                     Foreground="#616469"
                     GroupName="StrickyNote"
                     Style="{StaticResource GreyBgRadioBtnStyle}"
-                    Tag="Key">
+                    Tag="Key"
+                    IsChecked="{Binding strOtherTag, Converter={StaticResource AnnotToolIsCheckedConvert}, ConverterParameter=Key}">
                     <RadioButton.Content>
                         <Path
                             VerticalAlignment="Center"
@@ -196,7 +201,8 @@
                     Foreground="#616469"
                     GroupName="StrickyNote"
                     Style="{StaticResource GreyBgRadioBtnStyle}"
-                    Tag="Help">
+                    Tag="Help"
+                    IsChecked="{Binding strOtherTag, Converter={StaticResource AnnotToolIsCheckedConvert}, ConverterParameter=Help}">
                     <RadioButton.Content>
                         <Path
                             VerticalAlignment="Center"
@@ -224,7 +230,8 @@
                     Foreground="#616469"
                     GroupName="StrickyNote"
                     Style="{StaticResource GreyBgRadioBtnStyle}"
-                    Tag="Insert">
+                    Tag="Insert"
+                    IsChecked="{Binding strOtherTag, Converter={StaticResource AnnotToolIsCheckedConvert}, ConverterParameter=Insert}">
                     <RadioButton.Content>
                         <Path
                             VerticalAlignment="Center"
@@ -251,7 +258,8 @@
                     Foreground="#616469"
                     GroupName="StrickyNote"
                     Style="{StaticResource GreyBgRadioBtnStyle}"
-                    Tag="Paragraph">
+                    Tag="Paragraph"
+                    IsChecked="{Binding strOtherTag, Converter={StaticResource AnnotToolIsCheckedConvert}, ConverterParameter=Paragraph}">
                     <RadioButton.Content>
                         <Path
                             VerticalAlignment="Center"
@@ -278,7 +286,8 @@
                     Foreground="#616469"
                     GroupName="StrickyNote"
                     Style="{StaticResource GreyBgRadioBtnStyle}"
-                    Tag="NewParagraph">
+                    Tag="NewParagraph"
+                    IsChecked="{Binding strOtherTag, Converter={StaticResource AnnotToolIsCheckedConvert}, ConverterParameter=NewParagraph}">
                     <RadioButton.Content>
                         <Path
                             VerticalAlignment="Center"

+ 1 - 0
PDFSettings/DefaultAnnotProperty.cs

@@ -27,6 +27,7 @@ namespace PDFSettings
         public string FontFamily = string.Empty;
         public string NoteText = string.Empty;
         public string SaveKey;
+        public string NoteIcon;
         public C_LINE_TYPE HeadLineType;
         public C_LINE_TYPE TailLineType;
         public List<double> DashArray;