Просмотр исходного кода

综合-编辑 屏蔽Marlett字体、添加图像 修复单击添加bug;ocr 优化UI,暂时将IsContainOCRBgImage = false,为true,会有重叠效果

OYXH\oyxh 1 год назад
Родитель
Сommit
0c6c6853bb

+ 3 - 3
PDF Office/Helper/EditHelper.cs

@@ -148,9 +148,7 @@ namespace PDF_Master.Helper
 
         public static List<string> GetFontFamily()
         {
-            var sortedStrings = FontFamily.OrderBy(item => IsChinese(item)).ThenBy(item => item).ToList();
-
-            return sortedStrings.ToList();
+            return  FontFamily.OrderBy(item => IsChinese(item)).ThenBy(item => item).ToList();
         }
 
         private static bool IsChinese(string str)
@@ -158,7 +156,9 @@ namespace PDF_Master.Helper
             foreach (char c in str)
             {
                 if (c >= 0x4E00 && c <= 0x9FFF)
+                {
                     return true;
+                }
             }
             return false;
         }

+ 6 - 1
PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs

@@ -21,7 +21,12 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
     {
         public COCRLanguage OCRLanguage = COCRLanguage.COCRLanguageEnglish;
         public bool IsAllowOCR = false;
-        public bool IsContainOCRBgImage = true;
+
+        /// <summary>
+        /// 开启ocr时是否选择包含ocr底图
+        /// 如果包含 ,PDF转HTML的时候,ocr,会重叠
+        /// </summary>
+        public bool IsContainOCRBgImage = false;
         public bool IsContainAnnotations = true;
         public bool IsContainImages = true;
         public ContentOptions ContentOpts = ContentOptions.AllContent;

+ 4 - 0
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -361,6 +361,10 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
                 {
                     content = "Informal Roman";
                 }
+                if (itemFam.Equals("Marlett"))
+                {
+                    continue;
+                }
                 item = new ComboDataItem(DeleteCharacters(itemFam), content);
                 FontFamilyItems.Add(item);
             }

+ 4 - 0
PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs

@@ -444,6 +444,10 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
                     PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                     PDFViewer.ReloadDocument();
+                    //未设置,将无法触发Active事件
+                    PDFViewer.ToolManager.EnableClickCreate = true;
+                    PDFViewer.ToolManager.ClickCreateWidth = 60;
+                    PDFViewer.ToolManager.ClickCreateHeight = 30;
                     AddToPropertyPanel("PropertyPanelContentEdit", null);
                     ShowPropertyPanel(true);
                 }

+ 116 - 63
PDF Office/Views/Dialog/ConverterDialogs/OCRDownloadProgress.xaml

@@ -1,5 +1,6 @@
-<UserControl x:Class="PDF_Master.Views.Dialog.ConverterDialogs.OCRDownloadProgress"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+<UserControl
+    x:Class="PDF_Master.Views.Dialog.ConverterDialogs.OCRDownloadProgress"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:cus="clr-namespace:PDF_Master.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -7,97 +8,149 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:pageeditdialogs="clr-namespace:PDF_Master.ViewModels.Dialog.PageEditDialogs"
     xmlns:prism="http://prismlibrary.com/"
-        Background="Transparent" Width="374"
-                Height="120" d:DesignHeight="120"
+    Width="374"
+    Height="120"
+    d:DesignHeight="120"
     d:DesignWidth="374"
     prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
-             Loaded="UserControl_Loaded"
     prism:ViewModelLocator.AutoWireViewModel="True"
+    Background="Transparent"
+    Loaded="UserControl_Loaded"
     mc:Ignorable="d">
     <Grid>
         <Border
-              Name="ProgressVisible"  Panel.ZIndex="1" Background="Transparent" Visibility="Visible">
-            <Border 
+            Name="ProgressVisible"
+            Panel.ZIndex="1"
+            Background="Transparent"
+            Visibility="Visible">
+            <Border
                 Width="374"
                 Height="120"
                 Background="#FFFFFF"
                 BorderBrush="Gray"
                 BorderThickness="1"
-                CornerRadius="4"
-                >
+                CornerRadius="4">
                 <Grid>
-                    <Grid Margin="16,18,16,0" 
-                Height="54" Background="Transparent" VerticalAlignment="Top">
+                    <Grid
+                        Height="54"
+                        Margin="16,18,16,0"
+                        VerticalAlignment="Top"
+                        Background="Transparent">
                         <StackPanel Orientation="Horizontal">
-                            <TextBlock Name="ProgressBarName" Foreground="#000000" Text="{Binding T_ProgressBarName}" />
                             <TextBlock
-                            Margin="16,0,0,0"
-                            Text="("
-                            Foreground="#000000"
-                            Visibility="Visible" />
+                                Name="ProgressBarName"
+                                Foreground="#000000"
+                                Text="{Binding T_ProgressBarName}" />
+                            <TextBlock
+                                Margin="16,0,0,0"
+                                Foreground="#000000"
+                                Text="("
+                                Visibility="Visible" />
                             <TextBlock
-                            Name="ProgressBarCurrentSize"
-                            Foreground="#000000"
-                            Visibility="Visible" Text="{Binding ProgressBarCurrentSizeValue}" />
+                                Name="ProgressBarCurrentSize"
+                                Foreground="#000000"
+                                Text="{Binding ProgressBarCurrentSizeValue}"
+                                Visibility="Visible" />
                             <TextBlock
-                            Text="/"
-                            Foreground="#000000"
-                            Visibility="Visible" />
+                                Foreground="#000000"
+                                Text="/"
+                                Visibility="Visible" />
                             <TextBlock
-                            Name="ProgressBarSize"
-                            Foreground="#000000"
-                            Visibility="Visible" Text="{Binding ProgressBarFileSize}"/>
+                                Name="ProgressBarSize"
+                                Foreground="#000000"
+                                Text="{Binding ProgressBarFileSize}"
+                                Visibility="Visible" />
                             <TextBlock
-                            Text=")"
-                            Foreground="#000000"
-                            Visibility="Visible" />
+                                Foreground="#000000"
+                                Text=")"
+                                Visibility="Visible" />
                         </StackPanel>
                         <Button
-                        Width="12"
-                        Height="12"
-                        Padding="0,0,1,1"
-                        Margin="0,0,0,0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Top"
-                        BorderThickness="0"
-                        Background="Transparent"
-                        Command="{Binding CancelCommand}"
-                        Visibility="Collapsed">
+                            Width="12"
+                            Height="12"
+                            Margin="0,0,0,0"
+                            Padding="0,0,1,1"
+                            HorizontalAlignment="Right"
+                            VerticalAlignment="Top"
+                            Background="Transparent"
+                            BorderThickness="0"
+                            Command="{Binding CancelCommand}"
+                            Visibility="Collapsed">
                             <Path Data="M6.00006 7.06072L9.46973 10.5304L10.5304 9.46973L7.06072 6.00006L10.5304 2.53039L9.46973 1.46973L6.00006 4.9394L2.53039 1.46973L1.46973 2.53039L4.9394 6.00006L1.46973 9.46973L2.53039 10.5304L6.00006 7.06072Z" Fill="#CED0D4" />
                         </Button>
-                        <StackPanel Orientation="Horizontal" 
-                        Margin="0,0,0,0"
-                        VerticalAlignment="Bottom" Background="Transparent">
+                        <StackPanel
+                            Margin="0,0,0,0"
+                            VerticalAlignment="Bottom"
+                            Background="Transparent"
+                            Orientation="Horizontal">
                             <ProgressBar
-                        Margin="0,0,18,0"
-                        Name="ProgressBar"
-                        Height="5"
-                        Width="280"
-                        BorderThickness="0"
-                        Foreground="Green"
-                        Maximum="100"
-                        Value="{Binding ProgressBarCurrentValue}" />
+                                Name="ProgressBar"
+                                Width="280"
+                                Height="5"
+                                Margin="0,0,18,0"
+                                BorderThickness="0"
+                                Foreground="Green"
+                                Maximum="100"
+                                Value="{Binding ProgressBarCurrentValue}" />
                             <TextBlock
-                            FontSize="12"
-                            Foreground="#666666"
-                            Text="{Binding ElementName=ProgressBar,Path=Value, StringFormat={}{0}%}"
-                             />
+                                FontSize="12"
+                                Foreground="#666666"
+                                Text="{Binding ElementName=ProgressBar, Path=Value, StringFormat={}{0}%}" />
                         </StackPanel>
-
                     </Grid>
-                    <StackPanel Name="errorStackPanel" Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="{Binding ErrorStackPanelVisible}"  Margin="16,18">
-                        <Grid Width="14" Height="14" Margin="4,0,8,0" VerticalAlignment="Center">
-                            <Ellipse Width="12" Height="12" Fill="#F3465B"></Ellipse>
-                            <Path  Data="M7.25 4V9H8.75V4H7.25ZM7.25 10.5V12H8.75L8.75 10.5H7.25Z" Fill="white" Margin="-1,-1,1,1" />
+                    <StackPanel
+                        Name="errorStackPanel"
+                        Margin="16,18"
+                        VerticalAlignment="Bottom"
+                        Orientation="Horizontal"
+                        Visibility="{Binding ErrorStackPanelVisible}">
+                        <Grid
+                            Width="14"
+                            Height="14"
+                            Margin="4,0,8,0"
+                            VerticalAlignment="Center">
+                            <Ellipse
+                                Width="12"
+                                Height="12"
+                                Fill="#F3465B" />
+                            <Path
+                                Margin="-1,-1,1,1"
+                                Data="M7.25 4V9H8.75V4H7.25ZM7.25 10.5V12H8.75L8.75 10.5H7.25Z"
+                                Fill="white" />
                         </Grid>
-                        <TextBlock Name="ErrorTextBlock" Text="{Binding T_ErrorTextBlock}" Foreground="#F3465B"  FontSize="11" VerticalAlignment="Center"></TextBlock>
+                        <TextBlock
+                            Name="ErrorTextBlock"
+                            VerticalAlignment="Center"
+                            FontSize="11"
+                            Foreground="#F3465B"
+                            Text="{Binding T_ErrorTextBlock}" />
                     </StackPanel>
-                    <StackPanel  Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="Visible" HorizontalAlignment="Right" Margin="16,13">
-                        <Button Name="tryAgainBtn" Width="60" Height="24" Margin="0,0,8,0" Content="{Binding T_TryAgainBtn}"  Style="{StaticResource Btn.cta}"  Command="{Binding TryAgainCommnad}"   Visibility="{Binding TryAgainBtnVisible}"></Button>
-                        <Button Name="CancelBtn" Width="60" Height="24" Content="{Binding T_CancelBtn}" Style="{StaticResource btn.sec}"  Command="{Binding CancelCommand}"  BorderThickness="1" ></Button>
+                    <StackPanel
+                        Margin="16,13"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Bottom"
+                        Orientation="Horizontal"
+                        Visibility="Visible">
+                        <Button
+                            Name="tryAgainBtn"
+                            Width="80"
+                            Height="30"
+                            Margin="0,0,8,0"
+                            Command="{Binding TryAgainCommnad}"
+                            Content="{Binding T_TryAgainBtn}"
+                            Style="{StaticResource Btn.cta}"
+                            Visibility="{Binding TryAgainBtnVisible}" />
+                        <Button
+                            Name="CancelBtn"
+                            Width="60"
+                            Height="24"
+                            BorderThickness="1"
+                            Command="{Binding CancelCommand}"
+                            Content="{Binding T_CancelBtn}"
+                            Style="{StaticResource btn.sec}" />
                     </StackPanel>
                 </Grid>
             </Border>
         </Border>
     </Grid>
-</UserControl>
+</UserControl>