Sfoglia il codice sorgente

编辑-缺省图补充,文字编辑字体动态

lvle 1 anno fa
parent
commit
d1a60d68e0

+ 9 - 3
PDF Office/App.xaml.cs

@@ -134,9 +134,14 @@ namespace PDF_Master
         /// </summary>
         public static bool IsFirstOpen = true;
 
-       /// <summary>
-       /// 激活窗体的原因
-       /// </summary>
+        /// <summary>
+        /// 是否获取了SDK支持的系统样式
+        /// </summary>
+        public static bool IsGetTextFamily = false;
+
+        /// <summary>
+        /// 激活窗体的原因
+        /// </summary>
         public static string  WebOpencase = "";
 
         public static bool IsBookMode = false;
@@ -548,6 +553,7 @@ namespace PDF_Master
             containerRegistry.RegisterForNavigation<ChatGPTAIErrorCorrectionContent>();
             containerRegistry.RegisterForNavigation<BOTAContent>();
             containerRegistry.RegisterForNavigation<PropertyPanelContent>();
+            containerRegistry.RegisterForNavigation<PropertyPanelContentEdit>();
             containerRegistry.RegisterForNavigation<PageEditContent>();
             containerRegistry.RegisterForNavigation<BottomToolContent>();
             containerRegistry.RegisterForNavigation<ToolsBarContent>();

+ 2 - 2
PDF Office/Model/AnnotPanel/FontBoard.cs

@@ -40,7 +40,7 @@ namespace PDF_Master.Model.AnnotPanel
 
         public List<PresetFontItem> PresetFontList = new List<PresetFontItem>();
 
-        public List<string> FontFamily { get; protected set; } = new List<string>
+        public List<string> FontFamily { get;  set; } = new List<string>
 {
     "Adobe Devanagari",
     "Arial",
@@ -187,7 +187,7 @@ namespace PDF_Master.Model.AnnotPanel
         }
 
         //字体
-        private void InitBase_FontFamilys()
+        public void InitBase_FontFamilys()
         {
             FontFamilyItems = TextFont.GetFamilyEdit();
         }

+ 9 - 0
PDF Office/PDF Master.csproj

@@ -638,6 +638,7 @@
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\ImageTextEditPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\PDFEditVM.cs" />
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\TextEditPropertyViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\PropertyPanelContentEditViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\Scan\ScanPropertyPanelViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\ViewModular\ReadViewContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\RecentFiles\RecentFilesContentViewModel.cs" />
@@ -1261,6 +1262,9 @@
     <Compile Include="Views\PropertyPanel\PropertyPanelContent.xaml.cs">
       <DependentUpon>PropertyPanelContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\PropertyPanel\PropertyPanelContentEdit.xaml.cs">
+      <DependentUpon>PropertyPanelContentEdit.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\PropertyPanel\Scan\ScanPropertyPanel.xaml.cs">
       <DependentUpon>ScanPropertyPanel.xaml</DependentUpon>
     </Compile>
@@ -2161,6 +2165,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\PropertyPanel\PropertyPanelContentEdit.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\PropertyPanel\Scan\ScanPropertyPanel.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -2406,6 +2414,7 @@
     <Resource Include="Resources\Service\IAPTop.png" />
     <Resource Include="Resources\HomeIcon\noScanner.png" />
     <Resource Include="Resources\PropertyPanel\no link.png" />
+    <Resource Include="Resources\PropertyPanel\addimage.png" />
     <Content Include="Resources\Service\Login.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>

BIN
PDF Office/Resources/PropertyPanel/addimage.png


+ 70 - 0
PDF Office/ViewModels/PropertyPanel/PropertyPanelContentEditViewModel.cs

@@ -0,0 +1,70 @@
+using PDF_Master.DataConvert;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Master.ViewModels.PropertyPanel
+{
+    public class PropertyPanelContentEditViewModel : BindableBase, INavigationAware
+    {
+        private string _annotPanelType = "HighLight";
+        public string AnnotPanelType
+        {
+            get { return _annotPanelType; }
+            set
+            {
+                SetProperty(ref _annotPanelType, value);
+
+            }
+        }
+
+        private PanelType _propertyPanelType;
+        public PanelType PropertyPanelType
+        {
+            get { return _propertyPanelType; }
+            set
+            {
+                SetProperty(ref _propertyPanelType, value);
+
+            }
+        }
+
+        private IRegionManager regions { get; set; }
+        private string propertyPanelRegionNmae;
+        public string PropertyPanelRegionNmae
+        {
+            get { return propertyPanelRegionNmae; }
+            set
+            {
+                SetProperty(ref propertyPanelRegionNmae, value);
+            }
+        }
+
+        public PropertyPanelContentEditViewModel(IRegionManager regionManager)
+        {
+            regions = regionManager;
+
+            PropertyPanelRegionNmae = Guid.NewGuid().ToString();
+
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+
+        }
+    }
+}

+ 16 - 8
PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs

@@ -27,6 +27,7 @@ using Prism.Events;
 using System.Windows.Media.Imaging;
 using PDFReader_WPF.Helper;
 using PDF_Master.Properties;
+using PDF_Master.Model.AnnotPanel;
 
 namespace PDF_Master.ViewModels.Tools
 {
@@ -128,7 +129,7 @@ namespace PDF_Master.ViewModels.Tools
             btnToProperty.Add("Text", "TextEditProperty");
             btnToProperty.Add("Image", "ImageEditProperty");
             btnToProperty.Add("TextAndImage", "ImageTextEditProperty");
-            btnToProperty.Add("PropertyPanelContent", "PropertyPanelContent");
+            btnToProperty.Add("PropertyPanelContentEdit", "PropertyPanelContentEdit");
         }
 
         #endregion
@@ -344,7 +345,7 @@ namespace PDF_Master.ViewModels.Tools
                         else if (PDFViewer.ToolManager != null)
                         {
                             PDFViewer.ClearSelectPDFEdit();
-                            AddToPropertyPanel("PropertyPanelContent", null);
+                            AddToPropertyPanel("PropertyPanelContentEdit", null);
                             PDFViewer.ReloadDocument();
 
                         }
@@ -428,7 +429,7 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
                     PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                     PDFViewer.ReloadDocument();
-                    AddToPropertyPanel("PropertyPanelContent", null);
+                    AddToPropertyPanel("PropertyPanelContentEdit", null);
                     ShowPropertyPanel(true);
                     
                 }
@@ -619,7 +620,7 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                     PDFViewer.ReloadDocument();
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.None);
-                    AddToPropertyPanel("PropertyPanelContent", null);
+                    AddToPropertyPanel("PropertyPanelContentEdit", null);
                     ShowPropertyPanel(false);
                 }
                 else
@@ -671,6 +672,7 @@ namespace PDF_Master.ViewModels.Tools
         //左键激活逻辑
         private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
         {
+            PDFViewer.ToolManager.IgnoreMoveDistance =5;
             //判断是否已退出登录,限制编辑操作
             if (!App.IsLogin)
             {
@@ -697,8 +699,14 @@ namespace PDF_Master.ViewModels.Tools
                     if (item.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
                     {
                         isText = true;
+                        if(!App.IsGetTextFamily)
+                        {
+                            FontBoard fontBoard = new FontBoard();
+                            fontBoard.FontFamily = e[0].SystemFontNameList;
+                            fontBoard.InitBase_FontFamilys();
+                            App.IsGetTextFamily = true;
+                        }
                     }
-
                 }
 
 
@@ -730,7 +738,7 @@ namespace PDF_Master.ViewModels.Tools
             else
             {
 
-                AddToPropertyPanel("PropertyPanelContent", null);
+                AddToPropertyPanel("PropertyPanelContentEdit", null);
             }
 
             events.GetEvent<PageEditNotifyEvent>().Publish(new PageEditNotifyEventArgs(unicode));
@@ -810,8 +818,8 @@ namespace PDF_Master.ViewModels.Tools
         {
             //图片创建
             if (e.NotifyType == CustomNotifyType.PDFEditImageCreate)
-                {
-                    OpenFileDialog openFileDialog = new OpenFileDialog();
+            {
+                OpenFileDialog openFileDialog = new OpenFileDialog();
                     openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
                     if (openFileDialog.ShowDialog() == true)
                     {                 

+ 1 - 1
PDF Office/Views/Dialog/ServiceDialog/UserOutCodeRegion.xaml

@@ -201,7 +201,7 @@
                     </Grid>
 
                 </WrapPanel>
-                <WrapPanel Margin="0,10,0,0" HorizontalAlignment="Center">
+                <WrapPanel Margin="0,12,0,0" HorizontalAlignment="Center">
                     <TextBlock
                         Width="190"
                         Height="20"

+ 45 - 0
PDF Office/Views/PropertyPanel/PropertyPanelContentEdit.xaml

@@ -0,0 +1,45 @@
+<UserControl
+    x:Class="PDF_Master.Views.PropertyPanel.PropertyPanelContentEdit"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:Convert="clr-namespace:PDF_Master.DataConvert"
+    xmlns:PropertyPanel="clr-namespace:PDF_Master.ViewModels.PropertyPanel"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:PDF_Master.Views.PropertyPanel"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    d:DataContext="{d:DesignInstance Type=PropertyPanel:PropertyPanelContentEditViewModel}"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    Background="{StaticResource color.sys.layout.mg}"
+    mc:Ignorable="d">
+    <Grid VerticalAlignment="Stretch">
+
+        <Grid>
+            <StackPanel x:Name="NoStampStackPanel" VerticalAlignment="Center">
+                <Image
+                    Width="128"
+                    Height="128"
+                    Source="pack://application:,,,/PDF Master;component/Resources/PropertyPanel/addimage.png" />
+                <TextBlock
+                    HorizontalAlignment="Center"
+                    FontFamily="Segoe UI"
+                    FontSize="12"
+                    FontWeight="SemiBold"
+                    Foreground="#616469"
+                    Text="Add Image" />
+                <TextBlock
+                    Width="168"
+                    Margin="0,2,0,0"
+                    HorizontalAlignment="Center"
+                    FontFamily="Segoe UI"
+                    FontSize="12"
+                    Foreground="#94989C"
+                    Text="Select an area on the page to insert the image."
+                    TextAlignment="Center"
+                    TextWrapping="Wrap" />
+            </StackPanel>
+        </Grid>
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/PropertyPanel/PropertyPanelContentEdit.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Master.Views.PropertyPanel
+{
+    /// <summary>
+    /// PropertyPanelContentEdit.xaml 的交互逻辑
+    /// </summary>
+    public partial class PropertyPanelContentEdit : UserControl
+    {
+        public PropertyPanelContentEdit()
+        {
+            InitializeComponent();
+        }
+    }
+}