From b8217429cc55b1fba4a101abb8d71e2c8859f883 Mon Sep 17 00:00:00 2001 From: WMJ Date: Tue, 19 Jul 2022 10:08:25 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BC=81=E9=87=8D=E6=9E=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Configuration.Designer.cs | 68 +++++++++++++++++----------------- App/Functions/EditorControl.cs | 48 +++++++++++------------- App/PDFPatcher.csproj | 3 ++ 3 files changed, 58 insertions(+), 61 deletions(-) diff --git a/App/Configuration.Designer.cs b/App/Configuration.Designer.cs index 702bf83..dbbda48 100644 --- a/App/Configuration.Designer.cs +++ b/App/Configuration.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,13 +13,13 @@ namespace PDFPatcher { /// - /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Configuration { @@ -33,7 +33,7 @@ namespace PDFPatcher { } /// - /// 返回此类使用的缓存的 ResourceManager 实例。 + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ namespace PDFPatcher { } /// - /// 重写当前线程的 CurrentUICulture 属性 - /// 重写当前线程的 CurrentUICulture 属性。 + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ namespace PDFPatcher { } /// - /// 查找类似 书签文本 的本地化字符串。 + /// Looks up a localized string similar to 书签文本. /// internal static string BookmarkText { get { @@ -70,7 +70,7 @@ namespace PDFPatcher { } /// - /// 查找类似 自定义工具栏按钮 的本地化字符串。 + /// Looks up a localized string similar to 自定义工具栏按钮. /// internal static string CustomToolbarButtons { get { @@ -79,7 +79,7 @@ namespace PDFPatcher { } /// - /// 查找类似 文档属性 的本地化字符串。 + /// Looks up a localized string similar to 文档属性. /// internal static string DocInfo { get { @@ -88,7 +88,7 @@ namespace PDFPatcher { } /// - /// 查找类似 正文文本 的本地化字符串。 + /// Looks up a localized string similar to 正文文本. /// internal static string DocText { get { @@ -97,7 +97,7 @@ namespace PDFPatcher { } /// - /// 查找类似 编码方式 的本地化字符串。 + /// Looks up a localized string similar to 编码方式. /// internal static string Encodings { get { @@ -106,7 +106,7 @@ namespace PDFPatcher { } /// - /// 查找类似 导出图片目录 的本地化字符串。 + /// Looks up a localized string similar to 导出图片目录. /// internal static string Folders { get { @@ -115,7 +115,7 @@ namespace PDFPatcher { } /// - /// 查找类似 信息文件 的本地化字符串。 + /// Looks up a localized string similar to 信息文件. /// internal static string InfoFiles { get { @@ -124,7 +124,7 @@ namespace PDFPatcher { } /// - /// 查找类似 减少占用内存 的本地化字符串。 + /// Looks up a localized string similar to 减少占用内存. /// internal static string OptimalMemoryUsage { get { @@ -133,7 +133,7 @@ namespace PDFPatcher { } /// - /// 查找类似 优化处理效率 的本地化字符串。 + /// Looks up a localized string similar to 优化处理效率. /// internal static string OptimalSpeed { get { @@ -142,7 +142,7 @@ namespace PDFPatcher { } /// - /// 查找类似 处理选项 的本地化字符串。 + /// Looks up a localized string similar to 处理选项. /// internal static string Options { get { @@ -151,7 +151,7 @@ namespace PDFPatcher { } /// - /// 查找类似 路径 的本地化字符串。 + /// Looks up a localized string similar to 路径. /// internal static string Path { get { @@ -160,7 +160,7 @@ namespace PDFPatcher { } /// - /// 查找类似 PDF读取方式 的本地化字符串。 + /// Looks up a localized string similar to PDF读取方式. /// internal static string PdfLoadMode { get { @@ -169,7 +169,7 @@ namespace PDFPatcher { } /// - /// 查找类似 PDF阅读器路径 的本地化字符串。 + /// Looks up a localized string similar to PDF阅读器路径. /// internal static string PdfReaderPath { get { @@ -178,7 +178,7 @@ namespace PDFPatcher { } /// - /// 查找类似 历史文件 的本地化字符串。 + /// Looks up a localized string similar to 历史文件. /// internal static string RecentFiles { get { @@ -187,7 +187,7 @@ namespace PDFPatcher { } /// - /// 查找类似 替换文本 的本地化字符串。 + /// Looks up a localized string similar to 替换文本. /// internal static string ReplaceItems { get { @@ -196,7 +196,7 @@ namespace PDFPatcher { } /// - /// 查找类似 配置文件 的本地化字符串。 + /// Looks up a localized string similar to 配置文件. /// internal static string Root { get { @@ -205,7 +205,7 @@ namespace PDFPatcher { } /// - /// 查找类似 保存程序配置 的本地化字符串。 + /// Looks up a localized string similar to 保存程序配置. /// internal static string SaveAppSettings { get { @@ -214,7 +214,7 @@ namespace PDFPatcher { } /// - /// 查找类似 查找文本 的本地化字符串。 + /// Looks up a localized string similar to 查找文本. /// internal static string SearchItems { get { @@ -223,7 +223,7 @@ namespace PDFPatcher { } /// - /// 查找类似 输入文件 的本地化字符串。 + /// Looks up a localized string similar to 输入文件. /// internal static string SourceFiles { get { @@ -232,7 +232,7 @@ namespace PDFPatcher { } /// - /// 查找类似 目标文件 的本地化字符串。 + /// Looks up a localized string similar to 目标文件. /// internal static string TargetFiles { get { @@ -241,7 +241,7 @@ namespace PDFPatcher { } /// - /// 查找类似 版本 的本地化字符串。 + /// Looks up a localized string similar to 版本. /// internal static string Version { get { diff --git a/App/Functions/EditorControl.cs b/App/Functions/EditorControl.cs index 7590e0b..f208e43 100644 --- a/App/Functions/EditorControl.cs +++ b/App/Functions/EditorControl.cs @@ -18,7 +18,7 @@ namespace PDFPatcher.Functions static readonly CommandRegistry __Commands = InitCommands(); - private static CommandRegistry InitCommands() { + static CommandRegistry InitCommands() { var d = new CommandRegistry(); d.Register(new Editor.LoadDocumentCommand(true, false), Commands.Open); d.Register(new Editor.LoadDocumentCommand(true, true), Commands.ImportBookmark); @@ -114,7 +114,7 @@ namespace PDFPatcher.Functions di.Insert(0, new ToolStripMenuItem { Name = Constants.Coordinates.Unchanged, Text = Constants.Coordinates.Unchanged }); _ChangeZoomRate.DropDownItemClicked += _MainToolbar_ItemClicked; _ChangeCase.DropDownItemClicked += (object s, ToolStripItemClickedEventArgs args) => { - FormHelper.HidePopupMenu(args.ClickedItem); + args.ClickedItem.HidePopupMenu(); _EditMenu.Hide(); var i = Array.IndexOf(SetCaseProcessor.CaseNames, args.ClickedItem.Text); if (i != -1) { @@ -127,7 +127,7 @@ namespace PDFPatcher.Functions _SetOpenStatus.DropDownItemClicked += _MainToolbar_ItemClicked; AppContext.MainForm.SetTooltip(_IncludeDecendantBox, "选中此选项后,加粗、斜体等其它修改书签的操作将应用到选中书签的子书签"); - _IncludeDecendantBox.CheckedChanged += (s, args) => { _BookmarkBox.OperationAffectsDescendants = _IncludeDecendantBox.Checked; }; + _IncludeDecendantBox.CheckedChanged += (s, args) => _BookmarkBox.OperationAffectsDescendants = _IncludeDecendantBox.Checked; _UndoButton.DropDownOpening += (object s, EventArgs args) => { var i = _UndoMenu.Items; @@ -191,7 +191,7 @@ namespace PDFPatcher.Functions break; case Keys.Home: _ViewerBox.CurrentPageNumber = 1; - return; + return; case Keys.End: _ViewerBox.CurrentPageNumber = -1; return; @@ -202,12 +202,8 @@ namespace PDFPatcher.Functions _ViewerBox.CurrentPageNumber = p + d; } }; - _ViewerButton.DropDownOpening += (s, args) => { - SetupMenu(_ViewerButton.DropDownItems); - }; - _OcrMenu.DropDownItemClicked += (s, args) => { - _ViewerBox.OcrLanguage = (int)(args.ClickedItem.Tag ?? 0); - }; + _ViewerButton.DropDownOpening += (s, args) => SetupMenu(_ViewerButton.DropDownItems); + _OcrMenu.DropDownItemClicked += (s, args) => _ViewerBox.OcrLanguage = (int)(args.ClickedItem.Tag ?? 0); _OcrMenu.DropDownOpening += (s, args) => { var m = _OcrMenu.DropDownItems; if (m.Count == 1) { @@ -223,9 +219,7 @@ namespace PDFPatcher.Functions } }; _ZoomBox.Text = Constants.DestinationAttributes.ViewType.FitH; - _ZoomBox.TextChanged += (s, args) => { - _ViewerBox.LiteralZoom = _ZoomBox.Text; - }; + _ZoomBox.TextChanged += (s, args) => _ViewerBox.LiteralZoom = _ZoomBox.Text; _ViewerBox.Enabled = false; _ViewerBox.DocumentLoaded += (s, args) => _CurrentPageBox.ToolTipText = "文档共" + _ViewerBox.Document.PageCount + "页\nHome:转到第一页\nEnd:转到最后一页"; _ViewerBox.ZoomChanged += (s, args) => _ZoomBox.ToolTipText = "当前显示比例:" + (_ViewerBox.ZoomFactor * 100).ToInt32() + "%"; @@ -255,10 +249,10 @@ namespace PDFPatcher.Functions _ViewerBox.MouseClick += _ViewBox_MouseClick; _ViewerToolbar.Enabled = false; - Disposed += (s, args) => { _controller.Destroy(); }; + Disposed += (s, args) => _controller.Destroy(); } - private void ScrollToSelectedBookmarkLocation() { + void ScrollToSelectedBookmarkLocation() { BookmarkElement el; var i = _BookmarkBox.GetFirstSelectedIndex(); //_MainToolbar.ToggleEnabled (i != -1, _editButtonNames); @@ -290,7 +284,7 @@ namespace PDFPatcher.Functions _searchForm?.Close(); } - private void _ViewBox_MouseClick(object sender, MouseEventArgs args) { + void _ViewBox_MouseClick(object sender, MouseEventArgs args) { if (_ViewerBox.FirstPage == 0) { return; } @@ -311,12 +305,12 @@ namespace PDFPatcher.Functions //_controller.ShowInsertBookmarkDialog (l, p, t); } - private void _MainToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - FormHelper.HidePopupMenu(e.ClickedItem); + void _MainToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { + e.ClickedItem.HidePopupMenu(); ExecuteCommand(e.ClickedItem.Name); } - private void ButtonClicked(object sender, EventArgs e) { + void ButtonClicked(object sender, EventArgs e) { if (sender == _UndoButton) { _controller.Undo(1); } @@ -468,12 +462,12 @@ namespace PDFPatcher.Functions _ViewerBox.Reopen(); } - private void _BookmarkColorButton_SelectedColorChanged(object sender, EventArgs e) { + void _BookmarkColorButton_SelectedColorChanged(object sender, EventArgs e) { var c = _BookmarkColorButton.Color; _controller.ProcessBookmarks(new SetTextColorProcessor(c)); } - private void _OpenButton_DropDownOpening(object sender, EventArgs e) { + void _OpenButton_DropDownOpening(object sender, EventArgs e) { var m = (sender as ToolStripDropDownItem); var l = m.DropDown.Items; l.ClearDropDownItems(); @@ -484,8 +478,8 @@ namespace PDFPatcher.Functions l.AddInfoFiles(); } - private void _OpenButton_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { - FormHelper.HidePopupMenu(e.ClickedItem); + void _OpenButton_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { + e.ClickedItem.HidePopupMenu(); ExecuteCommand(Commands.OpenFile, e.ClickedItem.ToolTipText); } @@ -553,12 +547,12 @@ namespace PDFPatcher.Functions return base.ProcessCmdKey(ref msg, keyData); } - private void _BookmarkBox_DragEnter(object sender, DragEventArgs e) { - FormHelper.FeedbackDragFileOver(e, Constants.FileExtensions.PdfAndAllBookmarkExtension); + void _BookmarkBox_DragEnter(object sender, DragEventArgs e) { + e.FeedbackDragFileOver(Constants.FileExtensions.PdfAndAllBookmarkExtension); } - private void _BookmarkBox_DragDrop(object sender, DragEventArgs e) { - if (FormHelper.DropFileOver(this, e, Constants.FileExtensions.PdfAndAllBookmarkExtension)) { + void _BookmarkBox_DragDrop(object sender, DragEventArgs e) { + if (this.DropFileOver(e, Constants.FileExtensions.PdfAndAllBookmarkExtension)) { _controller.LoadDocument(Text, false); } } diff --git a/App/PDFPatcher.csproj b/App/PDFPatcher.csproj index ab4d6f1..00485a7 100644 --- a/App/PDFPatcher.csproj +++ b/App/PDFPatcher.csproj @@ -20,6 +20,7 @@ OnOutputUpdated + true @@ -31,6 +32,7 @@ prompt false latest + false ..\bin\Release\ @@ -42,6 +44,7 @@ false prompt latest + false Common\app.manifest