Explorar o código

Merge branch 'dev' of http://git.kdan.cc:8865/Windows/PDFOffice_Windows_exe into dev

OYXH\oyxh %!s(int64=2) %!d(string=hai) anos
pai
achega
390d232630

+ 22 - 13
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -177,19 +177,28 @@ namespace PDF_Office.ViewModels.Tools
                                 PDFViewer.SetToolParam(annot);
                                 break;
                         }
-
-                        //TODO: 设计已重新调整为:修改注释后,会作用到之后添加的注释中。因此先把此逻辑“创建注释后,会自动回到默认值”注释掉
-                        //if (ToolExpandDict.ContainsValue(e.AnnotItemsList[0].EventType))
-                        //{
-                        //    foreach (var item in ToolExpandDict)
-                        //    {
-                        //        if (item.Value == e.AnnotItemsList[0].EventType)
-                        //        {
-                        //            FindAnnotTypeKey(item.Key, ref annot);
-                        //            break;
-                        //        }
-                        //    }
-                        //}
+                        //TODO: 设计已重新调整为(仅限高亮注释):修改注释后,会作用到之后添加的注释中。因此先把此逻辑“创建注释后,会自动回到默认值”注释掉
+                        if (annot.EventType != AnnotArgsType.AnnotStrikeout &&
+                            annot.EventType != AnnotArgsType.AnnotUnderline &&
+                            annot.EventType != AnnotArgsType.AnnotHighlight &&
+                            annot.EventType != AnnotArgsType.AnnotSquiggly
+                            )
+                        {
+                            if (ToolExpandDict.ContainsValue(e.AnnotItemsList[0].EventType))
+                            {
+                                foreach (var item in ToolExpandDict)
+                                {
+                                    if (item.Value == e.AnnotItemsList[0].EventType)
+                                    {
+                                        annot = null;//新建注释时,回到默认值
+                                        FindAnnotTypeKey(item.Key, ref annot);
+                                        break;
+                                    }
+                                }
+                            }
+                        }
+                        else
+                        PDFViewer.SetToolParam(annot);
                         //设计重新调整,阅读页空白处,右键菜单,添加链接,和pro mac一样的效果,不显示属性栏
                         if (isRightMenuAddAnnot)
                         {

+ 7 - 16
PDF Office/Views/Dialog/DynamicPropertyDialog.xaml

@@ -9,37 +9,28 @@
     xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
-    Width="500"
-    Height="300"
+    Width="432"
+    Height="162"
     prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
     d:DataContext="{d:DesignInstance Type={x:Type annotpanel:DynamicPropertyDialogViewModel}}"
     mc:Ignorable="d">
     <cus:DialogContent Header="动态图章">
         <cus:DialogContent.BottmBar>
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="50*" />
-                    <ColumnDefinition Width="50*" />
-                </Grid.ColumnDefinitions>
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                 <Button
-                    Grid.Column="0"
-                    Width="150"
+                    Width="80"
                     Height="32"
-                    Margin="25,0,0,0"
-                    HorizontalAlignment="Left"
                     Style="{StaticResource Btn.cta}"
                     Command="{Binding ApplyCommnad}"
                     Content="确定" />
                 <Button
-                    Grid.Column="1"
-                    Width="150"
+                    Width="80"
                     Height="32"
-                    Margin="0,0,25,0"
-                    HorizontalAlignment="Right"
+                    Margin="16,0"
                     Style="{StaticResource btn.sec}"
                     Command="{Binding CancelCommand}"
                     Content="取消" />
-            </Grid>
+            </StackPanel>
         </cus:DialogContent.BottmBar>
         <StackPanel
             Grid.Row="1"

+ 149 - 31
PDF Office/Views/PropertyPanel/AnnotPanel/StampAnnotProperty.xaml

@@ -25,6 +25,12 @@
             <Setter Property="BorderThickness" Value="0" />
             <Setter Property="Template" Value="{StaticResource Segmented}" />
         </Style>
+        <SolidColorBrush x:Key="Item.MouseOver.Background" Color="#1F26A0DA"/>
+        <SolidColorBrush x:Key="Item.MouseOver.Border" Color="#a826A0Da"/>
+        <SolidColorBrush x:Key="Item.SelectedInactive.Background" Color="#3DDADADA"/>
+        <SolidColorBrush x:Key="Item.SelectedInactive.Border" Color="#FFDADADA"/>
+        <SolidColorBrush x:Key="Item.SelectedActive.Background" Color="#3D26A0DA"/>
+        <SolidColorBrush x:Key="Item.SelectedActive.Border" Color="#FF26A0DA"/>
     </UserControl.Resources>
     <Grid>
         <Grid.RowDefinitions>
@@ -57,32 +63,70 @@
                         HorizontalContentAlignment="Center"
                         FontSize="12"
                         IsSelected="True">
-                <ListBox ItemsSource="{Binding StandardStampList}" SelectionMode="Single"  Height="auto" VerticalAlignment="Top"  BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
-                    <ListBox.ItemTemplate>
-                        <DataTemplate >
-                            <Grid >
-                                <Grid.ContextMenu>
-                                    <ContextMenu>
-                                        <MenuItem Header="导出图章">
-                                            <MenuItem x:Name="SavePNG" Header="PNG" Tag="PNG" Click="Save_Click"/>
-                                            <MenuItem x:Name="SavePDF" Header="PDF" Tag="PDF" Click="Save_Click"/>
-                                        </MenuItem>
-                                    </ContextMenu>
-                                </Grid.ContextMenu>
-                                <Image Source="{Binding SourcePath}" Stretch="Uniform" Height="48"/>
-                            </Grid>
-                        </DataTemplate>
-                    </ListBox.ItemTemplate>
-                    <ListBox.ItemContainerStyle>
-                        <Style TargetType="ListBoxItem">
-                            <Setter Property="Height" Value="64"/>
-                            <!--<Setter Property="Padding" Value="12 5 12 5"/>-->
-                            <Setter Property="HorizontalContentAlignment" Value="Center"/>
-                            <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown"/>
-                        </Style>
-                    </ListBox.ItemContainerStyle>
-                </ListBox>
-
+                <Grid>
+                    <ListBox  ItemsSource="{Binding StandardStampList}" SelectionMode="Single"  Height="auto" VerticalAlignment="Top"  BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
+                        <ListBox.ItemTemplate>
+                            <DataTemplate >
+                                <Grid >
+                                    <Grid.ContextMenu>
+                                        <ContextMenu>
+                                            <MenuItem Header="导出图章">
+                                                <MenuItem x:Name="SavePNG" Header="PNG" Tag="PNG" Click="Save_Click"/>
+                                                <MenuItem x:Name="SavePDF" Header="PDF" Tag="PDF" Click="Save_Click"/>
+                                            </MenuItem>
+                                        </ContextMenu>
+                                    </Grid.ContextMenu>
+                                    <Image Source="{Binding SourcePath}" Stretch="Uniform" Height="40"/>
+                                </Grid>
+                            </DataTemplate>
+                        </ListBox.ItemTemplate>
+                        <ListBox.ItemContainerStyle>
+                            <Style TargetType="ListBoxItem">
+                                <Setter Property="Height" Value="65"/>
+                                <Setter Property="Padding" Value="8"/>
+                                <Setter Property="HorizontalContentAlignment" Value="Center"/>
+                                <Setter Property="Template">
+                                    <Setter.Value>
+                                        <ControlTemplate TargetType="{x:Type ListBoxItem}">
+                                            <Border x:Name="Bd" CornerRadius="8" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
+                                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                                            </Border>
+                                            <ControlTemplate.Triggers>
+                                                <MultiTrigger>
+                                                    <MultiTrigger.Conditions>
+                                                        <Condition Property="IsMouseOver" Value="True"/>
+                                                    </MultiTrigger.Conditions>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
+                                                </MultiTrigger>
+                                                <MultiTrigger>
+                                                    <MultiTrigger.Conditions>
+                                                        <Condition Property="Selector.IsSelectionActive" Value="False"/>
+                                                        <Condition Property="IsSelected" Value="True"/>
+                                                    </MultiTrigger.Conditions>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}"/>
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}"/>
+                                                </MultiTrigger>
+                                                <MultiTrigger>
+                                                    <MultiTrigger.Conditions>
+                                                        <Condition Property="Selector.IsSelectionActive" Value="True"/>
+                                                        <Condition Property="IsSelected" Value="True"/>
+                                                    </MultiTrigger.Conditions>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}"/>
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}"/>
+                                                </MultiTrigger>
+                                                <Trigger Property="IsEnabled" Value="False">
+                                                    <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
+                                                </Trigger>
+                                            </ControlTemplate.Triggers>
+                                        </ControlTemplate>
+                                    </Setter.Value>
+                                </Setter>
+                                <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown"/>
+                            </Style>
+                        </ListBox.ItemContainerStyle>
+                    </ListBox>
+                </Grid>
             </TabItem>
             <TabItem  x:Name="TabDydamic"
                         Header="Dynamic"
@@ -100,9 +144,46 @@
                     </ListBox.ItemTemplate>
                     <ListBox.ItemContainerStyle>
                         <Style TargetType="ListBoxItem">
-                            <Setter Property="Height" Value="64"/>
-                            <Setter Property="Padding" Value="12 5 12 5"/>
+                            <Setter Property="Height" Value="65"/>
+                            <Setter Property="Padding" Value="8"/>
                             <Setter Property="HorizontalContentAlignment" Value="Center"/>
+                            <Setter Property="Template">
+                                <Setter.Value>
+                                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
+                                        <Border x:Name="Bd" CornerRadius="8" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
+                                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                                        </Border>
+                                        <ControlTemplate.Triggers>
+                                            <MultiTrigger>
+                                                <MultiTrigger.Conditions>
+                                                    <Condition Property="IsMouseOver" Value="True"/>
+                                                </MultiTrigger.Conditions>
+                                                <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
+                                                <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
+                                            </MultiTrigger>
+                                            <MultiTrigger>
+                                                <MultiTrigger.Conditions>
+                                                    <Condition Property="Selector.IsSelectionActive" Value="False"/>
+                                                    <Condition Property="IsSelected" Value="True"/>
+                                                </MultiTrigger.Conditions>
+                                                <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}"/>
+                                                <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}"/>
+                                            </MultiTrigger>
+                                            <MultiTrigger>
+                                                <MultiTrigger.Conditions>
+                                                    <Condition Property="Selector.IsSelectionActive" Value="True"/>
+                                                    <Condition Property="IsSelected" Value="True"/>
+                                                </MultiTrigger.Conditions>
+                                                <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}"/>
+                                                <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}"/>
+                                            </MultiTrigger>
+                                            <Trigger Property="IsEnabled" Value="False">
+                                                <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
+                                            </Trigger>
+                                        </ControlTemplate.Triggers>
+                                    </ControlTemplate>
+                                </Setter.Value>
+                            </Setter>
                             <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown"/>
                         </Style>
                     </ListBox.ItemContainerStyle>
@@ -149,7 +230,7 @@
                                     </Grid.ContextMenu>
                                     <StackPanel Orientation="Horizontal">
                                         <Image Source="{Binding SourcePath}"/>
-                                        <Button x:Name="DeleteIcon" Width="20" Height="20" Click="Delete_Click" Visibility="Collapsed"/>
+                                        <Button HorizontalAlignment="Right" VerticalAlignment="Top" x:Name="DeleteIcon" Width="20" Height="20" Click="Delete_Click" Visibility="Hidden"/>
                                     </StackPanel>
                                 </Grid>
                                 <HierarchicalDataTemplate.Triggers>
@@ -163,8 +244,45 @@
 
                         <ListBox.ItemContainerStyle>
                             <Style TargetType="ListBoxItem">
-                                <Setter Property="Height" Value="64"/>
-                                <!--<Setter Property="Padding" Value="12 5 12 5"/>-->
+                                <Setter Property="Height" Value="65"/>
+                                <Setter Property="Padding" Value="8"/>
+                                <Setter Property="Template">
+                                    <Setter.Value>
+                                        <ControlTemplate TargetType="{x:Type ListBoxItem}">
+                                            <Border x:Name="Bd" CornerRadius="8" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
+                                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                                            </Border>
+                                            <ControlTemplate.Triggers>
+                                                <MultiTrigger>
+                                                    <MultiTrigger.Conditions>
+                                                        <Condition Property="IsMouseOver" Value="True"/>
+                                                    </MultiTrigger.Conditions>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
+                                                </MultiTrigger>
+                                                <MultiTrigger>
+                                                    <MultiTrigger.Conditions>
+                                                        <Condition Property="Selector.IsSelectionActive" Value="False"/>
+                                                        <Condition Property="IsSelected" Value="True"/>
+                                                    </MultiTrigger.Conditions>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}"/>
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}"/>
+                                                </MultiTrigger>
+                                                <MultiTrigger>
+                                                    <MultiTrigger.Conditions>
+                                                        <Condition Property="Selector.IsSelectionActive" Value="True"/>
+                                                        <Condition Property="IsSelected" Value="True"/>
+                                                    </MultiTrigger.Conditions>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}"/>
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}"/>
+                                                </MultiTrigger>
+                                                <Trigger Property="IsEnabled" Value="False">
+                                                    <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
+                                                </Trigger>
+                                            </ControlTemplate.Triggers>
+                                        </ControlTemplate>
+                                    </Setter.Value>
+                                </Setter>
                                 <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                 <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown"/>
                             </Style>

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

@@ -34,7 +34,7 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             ListBox listBox = CommonHelper.FindVisualParent<ListBox>(sender as ListBoxItem);
             if (listBox != null)
             {
-                if (listBox.Tag.ToString() == "Dynamic")
+                if (listBox.Tag!=null&&listBox.Tag.ToString() == "Dynamic")
                 {
                     (DataContext as StampAnnotPropertyViewModel).SetDynamicStamp((sender as ListBoxItem).DataContext as Stamp);
                     return;