Browse Source

compdfkit(windows) - 删除无用控件

liuaoran 1 year ago
parent
commit
4ade55d62c

+ 0 - 14
Demo/Examples/Compdfkit_Tools/Compdfkit_Tools.csproj

@@ -302,9 +302,6 @@
     <Compile Include="PDFView\PDFInfo\CPDFSecurityInfoControl.xaml.cs">
     <Compile Include="PDFView\PDFInfo\CPDFSecurityInfoControl.xaml.cs">
       <DependentUpon>CPDFSecurityInfoControl.xaml</DependentUpon>
       <DependentUpon>CPDFSecurityInfoControl.xaml</DependentUpon>
     </Compile>
     </Compile>
-    <Compile Include="PDFView\PDFPageTurning\PDFPageTurningControl\CPDFPageTurningControl.xaml.cs">
-      <DependentUpon>CPDFPageTurningControl.xaml</DependentUpon>
-    </Compile>
     <Compile Include="PDFView\PDFScaling\PDFScalingControl\CPDFScalingControl.xaml.cs">
     <Compile Include="PDFView\PDFScaling\PDFScalingControl\CPDFScalingControl.xaml.cs">
       <DependentUpon>CPDFScalingControl.xaml</DependentUpon>
       <DependentUpon>CPDFScalingControl.xaml</DependentUpon>
     </Compile>
     </Compile>
@@ -330,9 +327,6 @@
     <Compile Include="PDFView\PDFDisplaySettings\PDFDisplaySettingsUI\CPDFDrawModeUI.xaml.cs">
     <Compile Include="PDFView\PDFDisplaySettings\PDFDisplaySettingsUI\CPDFDrawModeUI.xaml.cs">
       <DependentUpon>CPDFDrawModeUI.xaml</DependentUpon>
       <DependentUpon>CPDFDrawModeUI.xaml</DependentUpon>
     </Compile>
     </Compile>
-    <Compile Include="PDFView\PDFPageTurning\PDFPageTurningUI\CPDFPageTurningUI.xaml.cs">
-      <DependentUpon>CPDFPageTurningUI.xaml</DependentUpon>
-    </Compile>
     <Compile Include="PDFView\PDFScaling\PDFScalingUI\CPDFScalingUI.xaml.cs">
     <Compile Include="PDFView\PDFScaling\PDFScalingUI\CPDFScalingUI.xaml.cs">
       <DependentUpon>CPDFScalingUI.xaml</DependentUpon>
       <DependentUpon>CPDFScalingUI.xaml</DependentUpon>
     </Compile>
     </Compile>
@@ -738,14 +732,6 @@
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
     </Page>
     </Page>
-    <Page Include="PDFView\PDFPageTurning\PDFPageTurningControl\CPDFPageTurningControl.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
-    <Page Include="PDFView\PDFPageTurning\PDFPageTurningUI\CPDFPageTurningUI.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
     <Page Include="PDFView\PDFScaling\PDFScalingControl\CPDFScalingControl.xaml">
     <Page Include="PDFView\PDFScaling\PDFScalingControl\CPDFScalingControl.xaml">
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>

+ 0 - 13
Demo/Examples/Compdfkit_Tools/PDFView/PDFPageTurning/PDFPageTurningControl/CPDFPageTurningControl.xaml

@@ -1,13 +0,0 @@
-<UserControl x:Class="Compdfkit_Tools.PDFControl.CPDFPageTurningControl"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:pdftoolsui="clr-namespace:Compdfkit_Tools.PDFControlUI"
-             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControl"
-             mc:Ignorable="d" 
-             d:DesignHeight="30" d:DesignWidth="120">
-    <Grid Height="30" Width="120" >
-        <pdftoolsui:CPDFPageTurningUI x:Name="CPDFPageTurningUI"></pdftoolsui:CPDFPageTurningUI>
-    </Grid>
-</UserControl>

+ 0 - 120
Demo/Examples/Compdfkit_Tools/PDFView/PDFPageTurning/PDFPageTurningControl/CPDFPageTurningControl.xaml.cs

@@ -1,120 +0,0 @@
-using Compdfkit_Tools.PDFControlUI;
-using ComPDFKitViewer.PdfViewer;
-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 Compdfkit_Tools.PDFControl
-{
-    /// <summary>
-    /// PDFPageTurningControl.xaml 的交互逻辑
-    /// </summary>
-    public partial class CPDFPageTurningControl : UserControl
-    {
-        public CPDFViewer pdfViewer;
-
-        public CPDFPageTurningControl()
-        {
-            InitializeComponent();
-            CPDFPageTurningUI.Loaded += PDFPageTurningUI_Loaded;
-        }
-
-        public void InitWithPDFViewer(CPDFViewer pdfViewer)
-        {
-            this.pdfViewer = pdfViewer;
-            pdfViewer.InfoChanged += PdfViewer_InfoChanged;
-        }
-
-        /// <summary>
-        /// 翻页传递到自定义控件中,修改页码
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
-        {
-            if (e.Key == "PageNum")
-            {
-                CPDFPageTurningUI.PageIndex = pdfViewer.CurrentIndex + 1;
-            }
-        }
-
-        private void PDFPageTurningUI_Loaded(object sender, RoutedEventArgs e)
-        {
-            CPDFPageTurningUI.EnsureKey = Key.Enter;
-            CPDFPageTurningUI.GoToSpecificPageEvent += PDFPageTurningUI_GoToSpecificPageEvent;
-            CPDFPageTurningUI.GoToNextPageEvent += PDFPageTurningUI_GoToNextPageEvent;
-            CPDFPageTurningUI.GoToPreviousPageEvent += PDFPageTurningUI_GoToPreviousPageEvent;
-        }
-
-        /// <summary>
-        /// 需要注意:
-        /// 在GoToPage之后不可以马上获取页码,此时页码正在延迟渲染
-        /// 页码变换的引起UI变化的函数应该写在PdfViewer_InfoChanged中
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void PDFPageTurningUI_GoToPreviousPageEvent(object sender, EventArgs e)
-        {
-            if (pdfViewer == null || pdfViewer.Document == null)
-            {
-                return;
-            }
-            if (pdfViewer.CurrentIndex <= 0)
-            {
-                return;
-            }
-            if (pdfViewer.ModeView == ComPDFKitViewer.ViewMode.Single || pdfViewer.ModeView == ComPDFKitViewer.ViewMode.SingleContinuous)
-            {
-                pdfViewer.GoToPage(pdfViewer.CurrentIndex - 1);
-            }
-            else
-            {
-                pdfViewer.GoToPage(pdfViewer.CurrentIndex - 2);
-            }
-        }
-
-        private void PDFPageTurningUI_GoToNextPageEvent(object sender, EventArgs e)
-        {
-            if (pdfViewer == null || pdfViewer.Document == null)
-            {
-                return;
-            }
-            if (pdfViewer.CurrentIndex >= pdfViewer.Document.PageCount)
-            {
-                return;
-            }
-
-            if (pdfViewer.ModeView == ComPDFKitViewer.ViewMode.Single || pdfViewer.ModeView == ComPDFKitViewer.ViewMode.SingleContinuous)
-            {
-                pdfViewer.GoToPage(pdfViewer.CurrentIndex + 1);
-            }
-            else
-            {
-                pdfViewer.GoToPage(pdfViewer.CurrentIndex + 2);
-            }
-        }
-
-        private void PDFPageTurningUI_GoToSpecificPageEvent(object sender, int e)
-        {
-            if (pdfViewer == null || pdfViewer.Document == null)
-            {
-                return;
-            }
-            if (e >= 1 && e <= pdfViewer.Document.PageCount)
-            {
-                pdfViewer.GoToPage(e - 1);
-            }
-        }
-    }
-}

+ 0 - 25
Demo/Examples/Compdfkit_Tools/PDFView/PDFPageTurning/PDFPageTurningUI/CPDFPageTurningUI.xaml

@@ -1,25 +0,0 @@
-<UserControl x:Class="Compdfkit_Tools.PDFControlUI.CPDFPageTurningUI"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="clr-namespace:Compdfkit_Tools.PDFControlUI"
-             mc:Ignorable="d" 
-             d:DesignHeight="30" d:DesignWidth="120">
-    <Grid Height="30" Width="120" >
-        <Grid.ColumnDefinitions>
-            <ColumnDefinition Width="11*"/>
-            <ColumnDefinition/>
-        </Grid.ColumnDefinitions>
-        <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2">
-            <Button x:Name="GoToPreviousPageButton" Click="GoToPreviousPageButton_Click" Height="30" Width="30" Margin="0,0,5,0">
-                <TextBlock Text="-"></TextBlock>
-            </Button>
-            <TextBox x:Name="PageIndexTexBox" Height="30" Width="50" Text="{Binding PageIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" KeyDown="PageIndexTexBox_KeyDown">
-            </TextBox>
-            <Button x:Name="GoToNextPageButton" Click="GoToNextPageButton_Click" Height="30" Width="30" Margin="5,0,0,0">
-                <TextBlock Text="+"></TextBlock>
-            </Button>
-        </StackPanel>
-    </Grid>
-</UserControl>

+ 0 - 107
Demo/Examples/Compdfkit_Tools/PDFView/PDFPageTurning/PDFPageTurningUI/CPDFPageTurningUI.xaml.cs

@@ -1,107 +0,0 @@
-using ComPDFKit.NativeMethod;
-using ComPDFKitViewer.PdfViewer;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-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 Compdfkit_Tools.PDFControlUI
-{
-    /// <summary>
-    /// pdfpageturning.xaml 的交互逻辑
-    /// </summary>
-    public partial class CPDFPageTurningUI : UserControl, INotifyPropertyChanged
-    {
-        public Key EnsureKey { get; set; }
-
-        /// <summary>
-        /// 跳转指定页事件
-        /// </summary>
-        public event EventHandler<int> GoToSpecificPageEvent;
-
-        /// <summary>
-        /// 跳转下一页事件
-        /// </summary>
-        public event EventHandler GoToNextPageEvent;
-
-        /// <summary>
-        /// 跳转上一页事件
-        /// </summary>
-        public event EventHandler GoToPreviousPageEvent;
-
-        /// <summary>
-        /// 跳转首页
-        /// </summary>
-        public event EventHandler GoToFirstPageEvent;
-
-        /// <summary>
-        /// 跳转末页
-        /// </summary>
-        public event EventHandler GotoLastPageEvent;
-
-        /// <summary>
-        /// 当前页码
-        /// </summary>
-        private int _pageIndex = 1;
-        public int PageIndex
-        {
-            get { return _pageIndex; }
-            set
-            {
-                if (_pageIndex != value)
-                {
-                    _pageIndex = value;
-                    OnPropertyChanged(nameof(PageIndex));
-                }
-            }
-        }
-
-
-        public CPDFPageTurningUI()
-        {
-            InitializeComponent();
-            DataContext = this;
-        }
-
-
-        /// <summary>
-        /// 回车跳转指定页
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void PageIndexTexBox_KeyDown(object sender, KeyEventArgs e)
-        {
-            if (e.Key == EnsureKey)
-            { 
-                GoToSpecificPageEvent?.Invoke(sender, PageIndex);
-            }
-        }
-
-        private void GoToPreviousPageButton_Click(object sender, RoutedEventArgs e)
-        {
-            GoToPreviousPageEvent?.Invoke(sender, e);
-        }
-
-        private void GoToNextPageButton_Click(object sender, RoutedEventArgs e)
-        {
-            GoToNextPageEvent?.Invoke(sender, e);
-        }
-
-        public event PropertyChangedEventHandler PropertyChanged;
-        protected void OnPropertyChanged(string propertyName)
-        {
-            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
-        }
-    }
-}

+ 6 - 2
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -272,8 +272,12 @@ namespace PDFViewer
                             e.Handle = true;
                             e.Handle = true;
                             e.PopupMenu = new ContextMenu();
                             e.PopupMenu = new ContextMenu();
 
 
-                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
-                            e.PopupMenu.Items.Add(new Separator());
+                            if (currentMode == "Annotations")
+                            {
+                                e.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                                e.PopupMenu.Items.Add(new Separator()); 
+                            }
+
 
 
                             MenuItem fitWidthMenu = new MenuItem();
                             MenuItem fitWidthMenu = new MenuItem();
                             fitWidthMenu.Header = "Automatically Resize";
                             fitWidthMenu.Header = "Automatically Resize";

+ 0 - 7
Demo/Examples/Viewer/Viewer.csproj

@@ -73,15 +73,8 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
       <SubType>Code</SubType>
     </Compile>
     </Compile>
-    <Page Include="PDFDisplaySettings\PDFDisplaySettings.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
-    <Compile Include="PDFDisplaySettings\PDFDisplaySettings.xaml.cs">
-      <DependentUpon>PDFDisplaySettings.xaml</DependentUpon>
-    </Compile>
     <Compile Include="Properties\AssemblyInfo.cs">
     <Compile Include="Properties\AssemblyInfo.cs">
       <SubType>Code</SubType>
       <SubType>Code</SubType>
     </Compile>
     </Compile>

+ 0 - 16
Demo/Examples/Viewer/pdfdisplaysettings/PDFDisplaySettings.xaml

@@ -1,16 +0,0 @@
-<UserControl x:Class="Viewer.PDFDisplaySettings.PDFDisplaySettings"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             xmlns:local="clr-namespace:Viewer.PDFDisplaySettings"
-             xmlns:tools="clr-namespace:Compdfkit_Tools;assembly=com.compdfkit.tools"
-             mc:Ignorable="d"
-             d:DesignHeight="245" d:DesignWidth="210">
-    <Grid>
-        <Grid.RowDefinitions>
-            <RowDefinition Height="100"></RowDefinition>
-            <RowDefinition></RowDefinition>
-        </Grid.RowDefinitions>
-    </Grid>
-</UserControl>

+ 0 - 71
Demo/Examples/Viewer/pdfdisplaysettings/PDFDisplaySettings.xaml.cs

@@ -1,71 +0,0 @@
-using ComPDFKitViewer.PdfViewer;
-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 Viewer.PDFDisplaySettings
-{
-    /// <summary>
-    /// displaysettings.xaml 的交互逻辑
-    /// </summary>
-    public partial class PDFDisplaySettings : UserControl
-    {
-        public CPDFViewer PDFViewer;
-        public PDFDisplaySettings()
-        {
-            //InitializeComponent();
-            //BrowseModeControl.Loaded += BrowseModeControl_Loaded;
-            //ColorModeControl.Loaded += ColorModeControl_Loaded;
-        }
-
-        private void BrowseModeControl_Loaded(object sender, RoutedEventArgs e)
-        {
-           // BrowseModeControl.SetBrowsingModeEvent += BrowseModeControl_SetBrowsingMode;
-        }
-
-        private void BrowseModeControl_SetBrowsingMode(object sender, string e)
-        {
-            switch (e)
-            {
-                case "SinglePageModeRadioButton":
-                    PDFViewer.ChangeViewMode(ComPDFKitViewer.ViewMode.Single);
-                    break;
-                case "SinglePageContinuousModeRadioButton":
-                    PDFViewer.ChangeViewMode(ComPDFKitViewer.ViewMode.SingleContinuous);
-                    break;
-                case "DoublePageModeRadioButton":
-                    PDFViewer.ChangeViewMode(ComPDFKitViewer.ViewMode.Double);
-                    break;
-                case "DoublePageContinuousModeRadioButton":
-                    PDFViewer.ChangeViewMode(ComPDFKitViewer.ViewMode.DoubleContinuous);
-                    break;
-                case "BookModeRadioButton":
-                    PDFViewer.ChangeViewMode(ComPDFKitViewer.ViewMode.Book);
-                    break;
-                case "BookContinuousModeRadioButton":
-                    PDFViewer.ChangeViewMode(ComPDFKitViewer.ViewMode.BookContinuous);
-                    break;
-            }
-        }
-
-        private void ScrollModeControl_Loaded(object sender, RoutedEventArgs e)
-        {
-        }
-
-        private void ColorModeControl_Loaded(object sender, RoutedEventArgs e)
-        {
-        }
-
-    }
-}