Przeglądaj źródła

默认颜色-修复,偏好设置改-下划线高亮删除线待修复

liyijie 1 rok temu
rodzic
commit
1dcd04a652

+ 1 - 1
PDF Office/App.xaml.cs

@@ -304,7 +304,7 @@ namespace PDF_Master
             InitSettings();
 
 #if DEBUG
-            IsLogin = false;
+            IsLogin = true;
 #endif
 
             CachePath = CacheFilePath.Instance;

+ 1 - 1
PDF Office/CustomControl/ColorDropBox.xaml.cs

@@ -196,7 +196,7 @@ namespace PDF_Master.CustomControl
 
         private void ColorPop_ColorSelected(object sender, Color e)
         {
-            if (SelectedColor != e)
+            //if (SelectedColor != e)
             {
               //  NormalColorRectControl.Visibility = Visibility.Collapsed;
                // TransparentRectControl.Visibility = Visibility.Collapsed;

+ 19 - 7
PDF Office/CustomControl/CompositeControl/ColorContent.xaml

@@ -118,20 +118,32 @@
             BorderBrush="#E2E3E6"
             BorderThickness="1"
             CornerRadius="4">
-            <StackPanel Orientation="Horizontal">
-
-                <Ellipse
+            
+                <StackPanel Orientation="Horizontal">
+                <Grid     Margin="4,0">
+                    <Ellipse
+                    x:Name="defaultColor"
+                   
+            Panel.ZIndex="2"
+                    Width="20"
+                    Height="20"
+                    Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorContent}, Path=DefaultColorVisibility, Mode=TwoWay}"
+                     Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorContent}, Path=DefaultColor, Mode=TwoWay}"
+                    />
+                    <Ellipse
                     x:Name="ElcustomColor"
                     Width="20"
                     Height="20"
-                    Margin="4,0"
-                    Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorContent}, Path=SelectedColor, Mode=TwoWay, Converter={StaticResource colorBrushConvert}}"
-                    PreviewMouseLeftButtonDown="ElcustomColor_PreviewMouseLeftButtonDown" />
+                
+                     Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorContent}, Path=SelectedColor, Mode=OneTime, Converter={StaticResource colorBrushConvert}}"
+                    />
+                </Grid>
                 <cus:ColorDropBox
                     x:Name="ColorDropPicker"
                     Margin="4,0"
                     SelectedColorChanged="ColorDropPicker_SelectedColorChanged" />
-            </StackPanel>
+                </StackPanel>
+         
         </Border>
         <cus:ColorDropBox
             x:Name="PnlColor"

+ 32 - 2
PDF Office/CustomControl/CompositeControl/ColorContent.xaml.cs

@@ -81,6 +81,7 @@ namespace PDF_Master.CustomControl.CompositeControl
         private ObservableCollection<ColorItem> colors = new ObservableCollection<ColorItem>();
         public event EventHandler<Color> SelectedColorHandler;
         public event RoutedEventHandler SelectedColorInvoke;
+        public event RoutedEventHandler DefaultColorInvoke;
         private ColorItem ChangedColorItem;
 
         public ColorSelectorType ColorType
@@ -115,6 +116,24 @@ namespace PDF_Master.CustomControl.CompositeControl
         public static readonly DependencyProperty ceshiColorProperty =
             DependencyProperty.Register("UIColor", typeof(Brush), typeof(ColorContent), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(0x6C,0x33,0xF8,0xCC)), SelectedColorPropertyChanged));
 
+        public Brush DefaultColor
+        {
+            get { return (Brush)GetValue(DefaultColorProperty); }
+            set { SetValue(DefaultColorProperty, value); }
+        }
+
+        public static readonly DependencyProperty DefaultColorProperty =
+            DependencyProperty.Register("DefaultColor", typeof(Brush), typeof(ColorContent), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xFF, 0xFF))));
+
+        public Visibility DefaultColorVisibility
+        {
+            get { return (Visibility)GetValue(DefaultColorVisibilityProperty); }
+            set { SetValue(DefaultColorVisibilityProperty, value); }
+        }
+
+        public static readonly DependencyProperty DefaultColorVisibilityProperty =
+            DependencyProperty.Register("DefaultColorVisibility", typeof(Visibility), typeof(ColorContent), new PropertyMetadata(Visibility.Collapsed));
+
         public List<ColorItem> ItemSource
         {
             get { return (List<ColorItem>)GetValue(ItemSourceProperty); }
@@ -161,18 +180,24 @@ namespace PDF_Master.CustomControl.CompositeControl
 
                 foreach(var item in control.colors)
                 {
+                    if (co == null) { break; }
                     var colorItem = (item.Color as SolidColorBrush).Color;
                     if (colorItem.A == co.Color.A && colorItem.G == co.Color.G && colorItem.B == co.Color.B && colorItem.R == co.Color.R)
                     {
                         control.ListColor.SelectedItem = item;
                         control.SelectedColor = colorItem;
-                        //control.ElcustomColor.Fill = new SolidColorBrush(Colors.Transparent);
+                        if (control.ElcustomColor.Fill == null) { control.ElcustomColor.Fill = co; }
+                        {
+                          
+                           
+                        }
+                        
                         isFoundListItem = true;
                         break;
                     }
                 }
 
-                if(isFoundListItem == false)
+                if (isFoundListItem == false)
                 {
                     control.ElcustomColor.Fill = co;
                     control.ListColor.SelectedItem = null;
@@ -192,11 +217,15 @@ namespace PDF_Master.CustomControl.CompositeControl
 
         private void ColorDropPicker_SelectedColorChanged(object sender, Color? e)
         {
+            if (ElcustomColor.Fill == null) {
+                ElcustomColor.Fill= new SolidColorBrush(Colors.Transparent);
+            }
             IsExistForContainer((ElcustomColor.Fill as SolidColorBrush).Color);
             SelectedColorHandler?.Invoke(this, e.Value);
             ElcustomColor.Fill = new SolidColorBrush(e.Value);
             SelectedColor = e.Value;
             SelectedColorInvoke?.Invoke(e.Value, null);
+            DefaultColorInvoke?.Invoke(e.Value, null);
         }
 
         private void ListColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -213,6 +242,7 @@ namespace PDF_Master.CustomControl.CompositeControl
                 SelectedColor = selectCo;
                 SelectedColorHandler?.Invoke(this, selectCo);
                 SelectedColorInvoke?.Invoke(selectCo, null);
+                
             }
         }
 

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

@@ -142,7 +142,7 @@ namespace PDF_Master.Model.AnnotPanel
         }
 
         //当前边框颜色
-        private Brush _currentFontColor = new SolidColorBrush(Colors.Transparent);
+        private Brush _currentFontColor ;
 
         public Brush CurrentFontColor
         {

+ 12 - 0
PDF Office/Themes/Alias_Light.xaml

@@ -55,6 +55,18 @@
     <SolidColorBrush x:Key="color.sys.layout.anti">#ffffff</SolidColorBrush>
     <SolidColorBrush x:Key="color.sys.layout.accent">#1770F4</SolidColorBrush>
     <SolidColorBrush x:Key="color.sys.layout.brand">#273C62</SolidColorBrush>
+
+    <SolidColorBrush x:Key="color.sys.layout.divider.highlight">#7A44FF</SolidColorBrush>
+    <SolidColorBrush x:Key="color.sys.layout.divider.strikethough">#252629</SolidColorBrush>
+    <SolidColorBrush x:Key="color.sys.layout.divider.underline">#252629</SolidColorBrush>
+    <SolidColorBrush x:Key="color.sys.layout.divider.pen">#252629</SolidColorBrush>
+    <SolidColorBrush x:Key="color.sys.layout.divider.text-date-fill">#BDDFFD</SolidColorBrush>
+    <SolidColorBrush x:Key="color.sys.layout.divider.note">#9462FF</SolidColorBrush>
+    <SolidColorBrush x:Key="color.sys.layout.divider.shapes-border">#252629</SolidColorBrush>
+    <SolidColorBrush x:Key="color.sys.layout.divider.shapes-fill">#BDDFFD</SolidColorBrush>
+    <SolidColorBrush x:Key="color.sys.layout.divider.signature">#273C62</SolidColorBrush>
+    <SolidColorBrush x:Key="color.sys.layout.divider.background">#BDDFFD</SolidColorBrush>
+    <SolidColorBrush x:Key="color.sys.layout.divider.fill-sign">#FFFFFF</SolidColorBrush>
     <SolidColorBrush
         x:Key="color.sys.layout.divider"
         Opacity=" 0.1"

+ 83 - 15
PDF Office/ViewModels/PropertyPanel/AnnotPanel/TextAnnotPropertyViewModel.cs

@@ -13,6 +13,8 @@ using Prism.Regions;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Diagnostics.Eventing.Reader;
 using System.Globalization;
 using System.Windows;
 using System.Windows.Data;
@@ -63,10 +65,20 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             throw new NotImplementedException();
         }
     }
-    public class TextAnnotPropertyViewModel:BindableBase, INavigationAware
+    public class TextAnnotPropertyViewModel : BindableBase, INavigationAware
     {
 
         #region 属性
+
+        //当前边框颜色
+        private Brush _textDefaultColor;
+
+        public Brush TextDefaultColor
+        {
+            get { return _textDefaultColor; }
+            set => SetProperty(ref _textDefaultColor, value);
+        }
+
         private AnnotCommon _basicVm = new AnnotCommon();
         public AnnotCommon BasicVm
         {
@@ -83,6 +95,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 
         public List<ColorItem> HighlightItems { get; set; }
         public List<ColorItem> UnderLineItems { get; set; }
+        public List<ColorItem> StrikeoutItems { get; set; }
 
         #endregion 属性
 
@@ -91,10 +104,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         private AnnotTransfer PropertyPanel;
         public DelegateCommand<object> SelectedColorChangedCommand { get; set; }
         public DelegateCommand<object> SelectedOpacityChangedCommand { get; set; }
-
+        public DelegateCommand<object> DefaultColorChangedCommand { get; set; }
         public TextAnnotPropertyViewModel()
         {
             SelectedColorChangedCommand = new DelegateCommand<object>(SelectedColorChanged);
+            DefaultColorChangedCommand = new DelegateCommand<object>(DefaultColorChanged);
             SelectedOpacityChangedCommand = new DelegateCommand<object>(SelectedOpacityChanged);
             InitHighlightItems();
             InitUnderLinetItems();
@@ -108,7 +122,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 
         private void InitUnderLinetItems()
         {
-            UnderLineItems = AnnotColorList.GetColorList(ColorSelectorType.Border); 
+            UnderLineItems = AnnotColorList.GetColorList(ColorSelectorType.Border);
+            StrikeoutItems = AnnotColorList.GetColorList(ColorSelectorType.Border);
         }
 
 
@@ -146,11 +161,55 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 
                 }
             }
+        }
+
+        private Brush HighlightDefaultColor = App.Current.FindResource("color.sys.layout.divider.highlight") as Brush;
+        private Brush UnderlineDefaultColor = App.Current.FindResource("color.sys.layout.divider.strikethough") as Brush;
+        private Brush StrikeoutDefaultColor = App.Current.FindResource("color.sys.layout.divider.underline") as Brush;
+        private AnnotArgsType annotArgsType = AnnotArgsType.AnnotHighlight;
+        public void DefaultColorChanged(object color)
+        {
+            if (color != null)
+            {
+                var colorValue = (Color)color;
+                if (colorValue != null)
+                {
+                    TextDefaultColor= new SolidColorBrush(colorValue);
+                    switch (annotArgsType)
+                    {
+                        case AnnotArgsType.AnnotHighlight:
+
+                            {
+                                HighlightDefaultColor = new SolidColorBrush(colorValue);
+
+                            }
+                            break;
+
+                        case AnnotArgsType.AnnotUnderline:
+                            {
+                                UnderlineDefaultColor = new SolidColorBrush(colorValue);
+                            }
+                            break;
+
+                        case AnnotArgsType.AnnotStrikeout:
+                            {
+                                StrikeoutDefaultColor = new SolidColorBrush(colorValue);
+                            }
+                            break;
+
+                        case AnnotArgsType.AnnotSquiggly:
+                            {
+
+                            }
+                            break;
+
+                    }
+                }
+            }
         }
-
         private void SetAnnotType()
         {
-            if(BasicVm.IsMultiSelected)
+            if (BasicVm.IsMultiSelected)
             {
                 BasicVm.AnnotTypeTitle = "General Properties";
                 return;
@@ -187,7 +246,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         {
 
             navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
-            if(PropertyPanel != null)
+            if (PropertyPanel != null)
             {
                 AllVariable();
                 SetAnnotType();
@@ -205,8 +264,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     else
                     {
                         BasicVm.FontColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
-                    }
-                    
+                    }
+
                 }
                 else
                 {
@@ -219,15 +278,20 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 
         private void SelectedColorItems()
         {
-            if(BasicVm.AnnotType == AnnotArgsType.AnnotHighlight)
+            if (BasicVm.AnnotType == AnnotArgsType.AnnotHighlight)
             {
                 BasicVm.ColorItems = HighlightItems;
                 ColorType = ColorSelectorType.Highlight;
-            }
-            else
+            }
+            else if (BasicVm.AnnotType == AnnotArgsType.AnnotUnderline)
             {
                 BasicVm.ColorItems = UnderLineItems;
                 ColorType = ColorSelectorType.Border;
+            }
+         else
+            {
+                BasicVm.ColorItems = StrikeoutItems;
+                ColorType = ColorSelectorType.Border;
             }
         }
 
@@ -243,12 +307,14 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         private void GetAnnotProperty()
         {
             if (Annot != null)
-            {
+            {
+                annotArgsType = Annot.EventType;
                 switch (Annot.EventType)
                 {
-                    case AnnotArgsType.AnnotHighlight:
-                      if (Annot is TextHighlightAnnotArgs)
-                        {
+                    case AnnotArgsType.AnnotHighlight:
+                        if (Annot is TextHighlightAnnotArgs)
+                        {
+                            TextDefaultColor = HighlightDefaultColor;
                             var Hightlight = Annot as TextHighlightAnnotArgs;
                             BasicVm.FillOpacity = Hightlight.Transparency;
                             BasicVm.FontColor = new SolidColorBrush(Hightlight.Color);
@@ -257,6 +323,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 
                     case AnnotArgsType.AnnotUnderline:
                         {
+                            TextDefaultColor = UnderlineDefaultColor;
                             var Underline = Annot as TextUnderlineAnnotArgs;
                             BasicVm.FillOpacity = Underline.Transparency;
                             BasicVm.FontColor = new SolidColorBrush(Underline.Color);
@@ -265,6 +332,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 
                     case AnnotArgsType.AnnotStrikeout:
                         {
+                            TextDefaultColor = StrikeoutDefaultColor;
                             var Strikeout = Annot as TextStrikeoutAnnotArgs;
                             BasicVm.FillOpacity = Strikeout.Transparency;
                             BasicVm.FontColor = new SolidColorBrush(Strikeout.Color);

+ 7 - 4
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -527,9 +527,12 @@ namespace PDF_Master.ViewModels.Tools
                         SettingHelper.SetAnnotDefaultProperty(defaultAnnot);
                         Settings.Default.Save();
                     }
-
+                    underlineArgs.Color = defaultAnnot.ForgoundColor;
                     UnderLineOpacity = underlineArgs.Transparency = defaultAnnot.Opacity;
                 }
+                else
+                {
+                }
 
                 selectedArgs = new List<AnnotHandlerEventArgs>();
                 selectedArgs.Add(underlineArgs);
@@ -615,7 +618,7 @@ namespace PDF_Master.ViewModels.Tools
                         SettingHelper.SetAnnotDefaultProperty(defaultAnnot);
                         Settings.Default.Save();
                     }
-
+                    strikeoutArgs.Color =defaultAnnot.ForgoundColor;
                     strikeoutArgs.Transparency = defaultAnnot.Opacity;
                 }
 
@@ -672,7 +675,7 @@ namespace PDF_Master.ViewModels.Tools
 
                     freehandArgs.Transparency = defaultAnnot.Opacity;
                     freehandArgs.LineWidth = defaultAnnot.Thickness;
-
+                    freehandArgs.InkColor = defaultAnnot.ForgoundColor;
                     if (defaultAnnot.DashArray == null || defaultAnnot.DashArray.Count == 0)
                     {
                         freehandArgs.LineDash = DashStyles.Solid;
@@ -769,7 +772,7 @@ namespace PDF_Master.ViewModels.Tools
                     freetextArgs.FontWeight = defaultAnnot.FontWeight;
                     freetextArgs.FontStyle = defaultAnnot.FontStyle;
                     freetextArgs.LineWidth = defaultAnnot.Thickness;
-
+                    freetextArgs.BgColor= defaultAnnot.BackgroundColor;
                     int align = (int)Settings.Default.AppProperties.Annotate.TextAlign;
 
                     if (align == 0)

+ 5 - 2
PDF Office/Views/PropertyPanel/AnnotPanel/TextAnnotProperty.xaml

@@ -126,14 +126,16 @@
                     FontSize="12"
                     Foreground="{StaticResource color.sys.text.neutral.lv2}"
                     Text="Color" />
-
+                
                 <CompositeControl:ColorContent
                     x:Name="cusColor"
                     Grid.Row="1"
                     Margin="0,8,0,0"
                     ColorType="{Binding ColorType}"
                     ItemSource="{Binding BasicVm.ColorItems}"
-                    UIColor="{Binding BasicVm.CurrentFontColor, Mode=OneWay}">
+                    UIColor="{Binding BasicVm.CurrentFontColor, Mode=OneWay}" DefaultColor="{Binding TextDefaultColor,Mode=TwoWay}" 
+                    DefaultColorVisibility="Visible"
+                    DefaultColorInvoke="cusColor_DefaultColorInvoke">
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="SelectedColorInvoke">
                             <i:InvokeCommandAction Command="{Binding SelectedColorChangedCommand}" CommandParameter="{Binding ElementName=cusColor, Path=SelectedColor}" />
@@ -142,5 +144,6 @@
                 </CompositeControl:ColorContent>
             </Grid>
         </StackPanel>
+       
     </Grid>
 </UserControl>

+ 6 - 1
PDF Office/Views/PropertyPanel/AnnotPanel/TextAnnotProperty.xaml.cs

@@ -29,7 +29,12 @@ namespace PDF_Master.Views.PropertyPanel.AnnotPanel
         public TextAnnotProperty()
         {
             InitializeComponent();
-        }
+        }
+
+        private void cusColor_DefaultColorInvoke(object sender, RoutedEventArgs e)
+        {
+            ViewModel.DefaultColorChangedCommand?.Execute(sender);
+        }
     }
    
 }