From 44307ce49aeee89574bc8c85196f806e8b1cd94b Mon Sep 17 00:00:00 2001 From: WMJ Date: Sun, 1 Sep 2024 17:01:45 +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/Common/FontUtility.cs | 1 - .../DocumentOption/DocumentFontListForm.cs | 15 ++++++--------- App/Functions/Editor/BookmarkEditorView.cs | 15 ++++----------- App/Processor/Mupdf/PixmapData.cs | 6 ++---- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/App/Common/FontUtility.cs b/App/Common/FontUtility.cs index 107ba5f..8fdfaf7 100644 --- a/App/Common/FontUtility.cs +++ b/App/Common/FontUtility.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; using System.Text.RegularExpressions; namespace PDFPatcher.Common diff --git a/App/Functions/DocumentOption/DocumentFontListForm.cs b/App/Functions/DocumentOption/DocumentFontListForm.cs index d0e2c54..764d1ba 100644 --- a/App/Functions/DocumentOption/DocumentFontListForm.cs +++ b/App/Functions/DocumentOption/DocumentFontListForm.cs @@ -43,10 +43,8 @@ namespace PDFPatcher.Functions else if (args.ProgressPercentage > 0) { _ProgressBar.SetValue(args.ProgressPercentage); } - else { - if (args.UserState is PageFont pf) { - _FontListBox.AddObject(pf); - } + else if (args.UserState is PageFont pf) { + _FontListBox.AddObject(pf); } }; _Worker.RunWorkerCompleted += (s, args) => { @@ -133,8 +131,7 @@ namespace PDFPatcher.Functions } } - private void SetGoal(int goal) { _ProgressBar.Maximum = goal; } - private void _ListFontsButton_Click(object sender, EventArgs e) { + void _ListFontsButton_Click(object sender, EventArgs e) { _ProgressBar.Value = 0; _ListFontsButton.Enabled = false; _Worker.RunWorkerAsync(); @@ -159,7 +156,7 @@ namespace PDFPatcher.Functions } } - private void _SelectAllButton_Click(object sender, EventArgs e) { + void _SelectAllButton_Click(object sender, EventArgs e) { if (_FontListBox.GetItemCount() == 0) { return; } @@ -172,7 +169,7 @@ namespace PDFPatcher.Functions _FontListBox.Focus(); } - private void _AddSelectedFontsButton_Click(object sender, EventArgs e) { + void _AddSelectedFontsButton_Click(object sender, EventArgs e) { if (SubstitutionsEditor == null) { return; } @@ -185,7 +182,7 @@ namespace PDFPatcher.Functions Close(); } - private void _AppConfigButton_Click(object sender, EventArgs e) { + void _AppConfigButton_Click(object sender, EventArgs e) { this.ShowDialog(); } } diff --git a/App/Functions/Editor/BookmarkEditorView.cs b/App/Functions/Editor/BookmarkEditorView.cs index 4aa45b2..e7768d4 100644 --- a/App/Functions/Editor/BookmarkEditorView.cs +++ b/App/Functions/Editor/BookmarkEditorView.cs @@ -130,8 +130,7 @@ namespace PDFPatcher.Functions if (o == null) { return; } - var f = o.GetFileDropList(); - foreach (var item in f) { + foreach (var item in o.GetFileDropList()) { if (FileHelper.HasExtension(item, Constants.FileExtensions.Xml) || FileHelper.HasExtension(item, Constants.FileExtensions.Pdf)) { args.Handled = true; @@ -150,7 +149,7 @@ namespace PDFPatcher.Functions e.Effect = DragDropEffects.None; return; } - var copy = (Control.ModifierKeys & Keys.Control) != Keys.None || (e.SourceModels[0] as XmlElement).OwnerDocument != ti.OwnerDocument; + var copy = (ModifierKeys & Keys.Control) != Keys.None || (e.SourceModels[0] as XmlElement).OwnerDocument != ti.OwnerDocument; if (copy == false) { if (e.DropTargetItem.Selected) { e.Effect = DragDropEffects.None; @@ -195,8 +194,8 @@ namespace PDFPatcher.Functions Freeze(); var child = ml.X > d.Position.X + d.GetBounds(ItemBoundsPortion.ItemOnly).Width / 2; var append = ml.Y > d.Position.Y + d.Bounds.Height / 2; - var copy = (Control.ModifierKeys & Keys.Control) != Keys.None || (args.SourceModels[0] as BookmarkElement).OwnerDocument != ti.OwnerDocument; - var deepCopy = copy && (OperationAffectsDescendants || (Control.ModifierKeys & Keys.Shift) != Keys.None); + var copy = (ModifierKeys & Keys.Control) != Keys.None || (args.SourceModels[0] as BookmarkElement).OwnerDocument != ti.OwnerDocument; + var deepCopy = copy && (OperationAffectsDescendants || (ModifierKeys & Keys.Shift) != Keys.None); var tii = TopItemIndex; CopyOrMoveElement(se, ti, child, append, copy, deepCopy); //e.RefreshObjects (); @@ -265,12 +264,6 @@ namespace PDFPatcher.Functions pn.Add(e); } } - //else { - // foreach (var item in source) { - // this.Collapse (item); - // } - // this.RemoveObjects (source); - //} if (child) { if (after) { tpr = target.Name == Constants.DocumentBookmark; diff --git a/App/Processor/Mupdf/PixmapData.cs b/App/Processor/Mupdf/PixmapData.cs index a1f9e75..2094723 100644 --- a/App/Processor/Mupdf/PixmapData.cs +++ b/App/Processor/Mupdf/PixmapData.cs @@ -108,8 +108,7 @@ namespace MuPdfSharp if (grayscale) { bmp.Palette.CreateGrayscalePalette(); for (int y = height - 1; y >= 0; y--) { - var pDest = bmp.GetScanlinePointer(y); - var pl = (byte*)pDest.ToPointer(); + var pl = (byte*)bmp.GetScanlinePointer(y).ToPointer(); var sl = ptrSrc; for (int x = 0; x < width; x++) { *pl = invert ? (byte)(*sl ^ 0xFF) : *sl; @@ -121,8 +120,7 @@ namespace MuPdfSharp } else { // DeviceBGR for (int y = height - 1; y >= 0; y--) { - var pDest = bmp.GetScanlinePointer(y); - var pl = (byte*)pDest.ToPointer(); + var pl = (byte*)bmp.GetScanlinePointer(y).ToPointer(); var sl = ptrSrc; if (invert) { for (int x = 0; x < width; x++) {