liyijie 1 year ago
parent
commit
d6f52e2ef2

+ 18 - 9
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogViewModel.cs

@@ -1089,17 +1089,26 @@ namespace PDF_Master.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
                             PageRangeSelectIndex = 4;
                         }
                     }
-                }
-                else if (parameters.TryGetValue<int>(ParameterNames.PrintCurrentPage, out currentPage))
-                {
-                    PrintSettingsInfo.PageRangeList = PageList;
-                    PrintSettingsInfo.PageRangeList[0]--;
-                    System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+                    if (parameters.TryGetValue<int>(ParameterNames.PrintCurrentPage, out currentPage))
                     {
-                        PageRangeSelectIndex = 1;
-                    }));
+                        PrintSettingsInfo.PageRangeList = PageList;
+                        PrintSettingsInfo.PageRangeList[0]--;
+                        System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+                        {
+                            PageRangeSelectIndex = 4;
+                        }));
+                    }
                 }
-                   
+                //else if (parameters.TryGetValue<int>(ParameterNames.PrintCurrentPage, out currentPage))
+                //{
+                //    PrintSettingsInfo.PageRangeList = PageList;
+                //    PrintSettingsInfo.PageRangeList[0]--;
+                //    System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+                //    {
+                //        PageRangeSelectIndex = 1;
+                //    }));
+                //}
+
                 System.Windows.Size pageSize = PDFViewer.Document.GetPageSize(0);
 
                 if ((pageSize.Height / pageSize.Width > 1.0 && (double)PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Height / PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Width < 1.0)

+ 125 - 56
PDF Office/ViewModels/FillAndSign/PropertyPanel/ShapFillPropertyViewModel.cs

@@ -24,6 +24,8 @@ using PDFSettings;
 using PDF_Master.ViewModels.Tools.AnnotManager;
 using Prism.Common;
 using ComPDFKitViewer.PdfViewer;
+using PDF_Master.CustomControl.CompositeControl;
+using Microsoft.Office.Interop.Word;
 
 namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
 {
@@ -46,6 +48,7 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
             }
         }
 
+
         public string shapeType = "";
         public string ShapeType
         {
@@ -69,28 +72,14 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
         {
         }
 
-        private Brush selectColor = new SolidColorBrush(Colors.GreenYellow);
+        private Brush selectColor = new SolidColorBrush(Color.FromArgb(0xff, 0x26, 0x25, 0x29));
         public Brush SelectColor
         {
             get { return selectColor; }
             set
             {
-                SetProperty(ref selectColor, value);
-                //if (!fillAndSignContentViewModel.isFirst)
-                //{
-                //    fillAndSignContentViewModel.SelectColor = value;
-                //    //if (FillAndSignContentViewModel.IsEdit)
-                //    {
-                //        // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple);
-                //        PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Color, (selectColor as SolidColorBrush).Color);
-                //    }
-                //    //else
-                //    {
-                //        if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
-
-                //    }
-
-                //}
+                SetProperty(ref selectColor, value);
+                UPDataColor();
 
             }
         }
@@ -126,7 +115,9 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
         public bool IsMultiSelected
         {
             get { return _isMultiSelected; }
-            set { SetProperty(ref _isMultiSelected, value);
+            set
+            {
+                SetProperty(ref _isMultiSelected, value);
                 if (value) { ShapeType = "General Properties"; }
             }
         }
@@ -144,25 +135,73 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
             get { return lineWidth; }
             set
             {
-                SetProperty(ref lineWidth, value);
-                UPDataLineWidth();
-         
+                SetProperty(ref lineWidth, value);
+
+
             }
         }
-        public DelegateCommand<object> SelectedThickCommand { get; set; }
-        public DelegateCommand<object> SelectedColorCommand { get; set; }
-
-
-        //public DelegateCommand<object> LineStyleCommand { get; set; }
+
+
+        private Brush _shapeColortColor = new SolidColorBrush(Color.FromArgb(0xff, 0x26, 0x25, 0x29));
+        public Brush ShapeColorColor
+        {
+            get { return _shapeColortColor; }
+            set { SetProperty(ref _shapeColortColor, value); }
 
+        }
+
+        List<ColorItem> shapeColorItems = new List<ColorItem>();
+
+        public List<ColorItem> ShapeColorItems
+        {
+            get { return shapeColorItems; }
+            set
+            {
+                SetProperty(ref shapeColorItems, value);
+
+            }
+        }
+        private void InitShapeColorList()
+        {
+            ShapeColorItems = new List<ColorItem>();
+            ColorItem colorItem = new ColorItem(Color.FromArgb(0xff, 0xfc, 0x1f, 0x1f), 0);
+            ShapeColorItems.Add(colorItem);
+            colorItem = new ColorItem(Color.FromArgb(0xff, 0x26, 0x25, 0x29), 1);
+            ShapeColorItems.Add(colorItem);
+            colorItem = new ColorItem(Color.FromArgb(0xff, 0x29, 0x53, 0x93), 2);
+            ShapeColorItems.Add(colorItem);
+            colorItem = new ColorItem(Color.FromArgb(0xff, 0x1e, 0x89, 0x56), 3);
+            ShapeColorItems.Add(colorItem);
+
+        }
+
+
+        private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType, string savaKey = "")
+        {
+            var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType, savaKey);
+            if (Annot == null)
+            {
+                Annot = new DefaultAnnotProperty();
+                Annot.AnnotToolType = annotArgsType;
+            }
+            return Annot;
+        }
+        public DelegateCommand<object> SelectedThickCommand { get; set; }
+        public DelegateCommand<object> SelectedColorCommand { get; set; }
+
+
+        //public DelegateCommand<object> LineStyleCommand { get; set; }
+        public DelegateCommand<object> SelectedLineWidthValueCommand { get; set; }
         public DelegateCommand<object> SharpsTypeCommand { get; set; }
         public DelegateCommand<object> ThicknessChangedCommand { get; set; }
         public DelegateCommand<object> SelectedOpacityValueCommand { get; set; }
 
         public ShapFillPropertyViewModel()
-        {
+        {
+            InitShapeColorList();
             SelectedThickCommand = new DelegateCommand<object>(SelectedThick_Command);
             SelectedColorCommand = new DelegateCommand<object>(SelectedColor_Command);
+            SelectedLineWidthValueCommand = new DelegateCommand<object>(SelectedLineWitdh_Command);
             //LineStyleCommand = new DelegateCommand<object>(LineStyle_Command);
             SharpsTypeCommand = new DelegateCommand<object>(SharpsType_Command);
             ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged_Command);
@@ -476,7 +515,8 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
                 }
             }
         }
-        private void UPDataLineWidth(){
+        private void UPDataLineWidth()
+        {
 
             if (!fillAndSignContentViewModel.isFirst)
             {
@@ -484,8 +524,8 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
 
                 //if (FillAndSignContentViewModel.IsEdit)
                 {
-
-                    PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple);
+                    if (!fillAndSignContentViewModel.IsClickNull)
+                        PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple);
 
                 }
                 // else
@@ -502,18 +542,24 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
 
             if (!fillAndSignContentViewModel.isFirst)
             {
-                fillAndSignContentViewModel.SelectColor = SelectColor;
-                //if (FillAndSignContentViewModel.IsEdit)
+                var newColor = (ShapeColorColor as SolidColorBrush).Color;
+                var oldColor = (SelectColor as SolidColorBrush).Color;
+                if (newColor.A != oldColor.A || newColor.B != oldColor.B || newColor.R != oldColor.R || newColor.G != oldColor.G)
                 {
-                    // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple);
-                    PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Color, (selectColor as SolidColorBrush).Color);
-                }
-                //else
-                {
-                    if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
+                    ShapeColorColor = SelectColor;
+                    fillAndSignContentViewModel.SelectColor = SelectColor;
+                    //if (FillAndSignContentViewModel.IsEdit)
+                    {
+                        // PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * lineWidthMultiple);
+                        if (!fillAndSignContentViewModel.IsClickNull)
+                            PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Color, (selectColor as SolidColorBrush).Color);
+                    }
+                    //else
+                    {
+                        if (IsFillAndSign) { fillAndSignContentViewModel.SetStamp(); }
 
+                    }
                 }
-
             }
         }
         private void UPDataOpacity()
@@ -524,7 +570,8 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
 
                 //if (FillAndSignContentViewModel.IsEdit)
                 {
-                    PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, fillOpacity);
+                    if (!fillAndSignContentViewModel.IsClickNull)
+                        PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, fillOpacity);
                 }
 
                 //else
@@ -536,7 +583,7 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
             }
         }
 
-            private void SelectedColor_Command(object obj)
+        private void SelectedColor_Command(object obj)
         {
             if (obj != null)
             {
@@ -556,8 +603,18 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
             }
 
         }
-        
-            private void SelectedOpacityValue(object obj)
+
+        private void SelectedLineWitdh_Command(object obj)
+        {
+            if (obj != null)
+            {
+                double colorValue = (double)obj;
+                UPDataLineWidth();
+            }
+
+        }
+
+        private void SelectedOpacityValue(object obj)
         {
             if (obj != null)
             {
@@ -643,7 +700,7 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
 
                 if (IsMultiSelected)
                 {
-
+                    ShapeColorColor = new SolidColorBrush(Colors.Transparent);
                 }
                 else
                 {
@@ -659,22 +716,34 @@ namespace PDF_Master.ViewModels.FillAndSign.PropertyPanel
             {
                 var annot = Annot as FreehandAnnotArgs;
                 if (annot != null)
-                {
-                    //SelectColor = new SolidColorBrush(annot.InkColor);
-                    //FillOpacity = annot.Transparency;
-                    //LineWidth = annot.LineWidth;
-                    foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
+                {
+
+                    try
                     {
-                        if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
+                        foreach (var point in fillAndSignContentViewModel.viewContentViewModel.FillAndSign)
                         {
-                            lineWidthMultiple = 1;
-                            if (point.Shape == "DotShape")
+                            if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
                             {
-                                lineWidthMultiple = 5;
+                                lineWidthMultiple = 1;
+                                if (point.Shape == "DotShape")
+                                {
+                                    lineWidthMultiple = 5;
+                                    LineWidth = annot.LineWidth / 5;
+                                }
+                                else { LineWidth = annot.LineWidth; }
+                                SelectColor = new SolidColorBrush(annot.InkColor);
+
+
+                                FillOpacity = annot.Transparency;
+                                InitShapesType(point.Shape);
+                                Shape = point.Shape;
                             }
-                            InitShapesType(point.Shape);
-                            Shape = point.Shape;
-                        }
+                        }
+                    }
+                    catch
+                    {
+
+
                     }
                 }
 

+ 56 - 47
PDF Office/Views/FillAndSign/PropertyPanel/ShapFillProperty.xaml

@@ -51,9 +51,9 @@
                 CornerRadius="2"
                 Visibility="{Binding IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
                 >
-                
+
                 <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
-                    
+
                     <Path
                         Name="SharpPath"
                         
@@ -74,7 +74,7 @@
                     <RowDefinition Height="auto" />
                     <RowDefinition />
                 </Grid.RowDefinitions>
-                <TextBlock Text="Color" VerticalAlignment="Center"/>
+                <TextBlock Text="Color" VerticalAlignment="Center" Margin="0,0,0,12"/>
                 <CompositeControl:SlidContent x:Name="layerThick"  HorizontalAlignment="Right" 
                                               
                                               >
@@ -84,11 +84,11 @@
                         </i:EventTrigger>
                     </i:Interaction.Triggers>
                 </CompositeControl:SlidContent>
-                <CompositeControl:ColorContent  x:Name="cusColor" Grid.Row="1" />
+                <CompositeControl:ColorContent  x:Name="cusColor" Grid.Row="1"  ItemSource="{Binding ShapeColorItems}" UIColor="{Binding ShapeColorColor,Mode=TwoWay}"/>
 
             </Grid>
 
-            <Grid Margin="0,18,0,0">
+            <Grid Margin="0,18,0,0" Visibility="Collapsed">
                 <Grid.RowDefinitions>
                     <RowDefinition Height="auto" />
                     <RowDefinition />
@@ -110,11 +110,17 @@
                     Minimum="1"
                     Style="{StaticResource RoundThumbSlider}"
                     TickFrequency="1"
-                    Value="{Binding LineWidth}">
+                    Value="{Binding LineWidth}"
+                       >
                         <Slider.Resources>
                             <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
                             <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
                         </Slider.Resources>
+                        <i:Interaction.Triggers>
+                            <i:EventTrigger EventName="ValueChanged">
+                                <i:InvokeCommandAction Command="{Binding SelectedLineWidthValueCommand}" CommandParameter="{Binding ElementName=BorderSlider,Path=Value}"/>
+                            </i:EventTrigger>
+                        </i:Interaction.Triggers>
                     </Slider>
 
                     <Border
@@ -183,26 +189,28 @@
                     </Border>
                 </Grid>
             </Grid>
-
-            <Border
+            <StackPanel Visibility="{Binding IsSelected,Converter={StaticResource InvertBoolToVisibleConvert}}" Margin="0,18,0,0">
+                <TextBlock Text="Fill Type" VerticalAlignment="Center"/>
+                <Border
                 Width="228"
                 Height="32"
-                Margin="0,12,0,0"
+                Margin="0,10,0,0"
                 BorderBrush="#FFE2E3E6"
                 BorderThickness="1" 
-                Visibility="{Binding IsSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
-                > 
-                <Grid Name="ToolGrid" >
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="40.5" />
-                        <ColumnDefinition Width="40.5" />
-                        <ColumnDefinition Width="40.5" />
-                        <ColumnDefinition Width="40.5" />
-                        <ColumnDefinition Width="40.5" />
-                    </Grid.ColumnDefinitions>
+                
+                >
 
+                    <Grid Name="ToolGrid" >
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="40.5" />
+                            <ColumnDefinition Width="40.5" />
+                            <ColumnDefinition Width="40.5" />
+                            <ColumnDefinition Width="40.5" />
+                            <ColumnDefinition Width="40.5" />
+                        </Grid.ColumnDefinitions>
 
-                    <ToggleButton
+
+                        <ToggleButton
                         Name="HookShapeBtn"
                         Width="40.5"
                         Background="Transparent"
@@ -211,7 +219,7 @@
                         Command="{Binding SharpsTypeCommand}"
                         CommandParameter="{Binding ElementName=HookShapeBtn, Path=Tag}"
                         Tag="HookShape">
-                        <Path
+                            <Path
                             Width="15"
                             Height="13"
                             HorizontalAlignment="Center"
@@ -219,14 +227,14 @@
                             StrokeThickness="1.6"
                             StrokeLineJoin="Round"
                            Stroke="#616469">
-                            <Path.Data>M0.599976 7.0286L5.57775 11.8L13.4 1.40002
-                            </Path.Data>
-                        </Path>
-                    </ToggleButton>
+                                <Path.Data>M0.599976 7.0286L5.57775 11.8L13.4 1.40002
+                                </Path.Data>
+                            </Path>
+                        </ToggleButton>
 
 
 
-                    <ToggleButton
+                        <ToggleButton
                         Name="ForkShapeBtn"
                         Grid.Column="1"
                         Width="40.5"
@@ -237,7 +245,7 @@
                         Command="{Binding SharpsTypeCommand}"
                         CommandParameter="{Binding ElementName=ForkShapeBtn, Path=Tag}"
                         Tag="ForkShape">
-                        <Path
+                            <Path
                             Width="16"
                             Height="16"
                             HorizontalAlignment="Center"
@@ -245,16 +253,16 @@
                             StrokeThickness="1.6"
                             StrokeLineJoin="Round"
                            Stroke="#616469">
-                            <Path.Data>
-                                M3.19995 3.20001L12.8 12.8
+                                <Path.Data>
+                                    M3.19995 3.20001L12.8 12.8
                                M12.8 3.20001L3.20005 12.8
-                            </Path.Data>
-                        </Path>
-                    </ToggleButton>
+                                </Path.Data>
+                            </Path>
+                        </ToggleButton>
 
 
 
-                    <ToggleButton
+                        <ToggleButton
                         Name="RectShapeBtn"
                         Grid.Column="2"
                         Width="40.5"
@@ -264,7 +272,7 @@
                         Command="{Binding SharpsTypeCommand}"
                         CommandParameter="{Binding ElementName=RectShapeBtn, Path=Tag}"
                         Tag="RectShape">
-                        <Rectangle
+                            <Rectangle
                             Width="9.6"
                             Height="9.6"
                            StrokeThickness="1.6"
@@ -273,10 +281,10 @@
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center"
                             Stroke="#616469" />
-                    </ToggleButton>
+                        </ToggleButton>
 
 
-                    <ToggleButton
+                        <ToggleButton
                         Name="LineShapeBtn"
                         Grid.Column="3"
                         Width="40.5"
@@ -286,7 +294,7 @@
                         Command="{Binding SharpsTypeCommand}"
                         CommandParameter="{Binding ElementName=LineShapeBtn, Path=Tag}"
                         Tag="LineShape">
-                        <Path
+                            <Path
                             Width="14"
                             Height="2"
                             HorizontalAlignment="Center"
@@ -294,13 +302,13 @@
                             StrokeThickness="1.6"
                             StrokeLineJoin="Round"
                            Stroke="#616469">
-                            <Path.Data>
-                                M13.4 1L0.600024 1
-                            </Path.Data>
-                        </Path>
-                    </ToggleButton>
+                                <Path.Data>
+                                    M13.4 1L0.600024 1
+                                </Path.Data>
+                            </Path>
+                        </ToggleButton>
 
-                    <ToggleButton
+                        <ToggleButton
                         Name="DotShapeBtn"
                         Width="40.5"
                         Grid.Column="4"
@@ -310,15 +318,16 @@
                         Command="{Binding SharpsTypeCommand}"
                         CommandParameter="{Binding ElementName=DotShapeBtn, Path=Tag}"
                         Tag="DotShape">
-                        <Ellipse
+                            <Ellipse
                             Width="4.8"
                             Height="4.8"
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center"
                             Fill="#616469" />
-                    </ToggleButton>
-                </Grid>
-            </Border>
+                        </ToggleButton>
+                    </Grid>
+                </Border>
+            </StackPanel>
         </StackPanel>
     </Grid>
 </UserControl>