From be602b04caa7dc77bc45c997ae4f81894de7ff84 Mon Sep 17 00:00:00 2001 From: WMJ Date: Wed, 16 Nov 2022 14:51:00 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BC=8D=E4=BF=AE=E5=A4=8D=E9=A1=B5=E7=A0=81?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Constants.cs | 18 +++++++++++------- App/Functions/Editor/InsertPageLabelForm.cs | 3 --- App/Processor/Mupdf/PageLabelCollection.cs | 2 +- App/Processor/Mupdf/Structures.cs | 11 ++++++----- 更新历史.txt | 1 + 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/App/Constants.cs b/App/Constants.cs index 563a0b2..c6be5d1 100644 --- a/App/Constants.cs +++ b/App/Constants.cs @@ -233,13 +233,17 @@ namespace PDFPatcher internal const string PageLabels = "页码样式"; internal static class PageLabelStyles { - internal static readonly string[] Names = { "数字", "大写罗马数字", "小写罗马数字", "大写英文字母", "小写英文字母" }; - internal static readonly char[] PdfValues = { 'D', 'R', 'r', 'A', 'a' }; - internal static readonly char[] SimpleInfoIdentifiers = { '0', 'I', 'i', 'A', 'a' }; - internal static readonly int[] Values = { PdfPageLabels.DECIMAL_ARABIC_NUMERALS, - PdfPageLabels.UPPERCASE_ROMAN_NUMERALS, PdfPageLabels.LOWERCASE_ROMAN_NUMERALS, - PdfPageLabels.UPPERCASE_LETTERS, PdfPageLabels.LOWERCASE_LETTERS - }; + internal static readonly string[] Names = { "数字", "大写罗马数字", "小写罗马数字", "大写英文字母", "小写英文字母", "无" }; + internal static readonly char[] PdfValues = { 'D', 'R', 'r', 'A', 'a', '-' }; + internal static readonly char[] SimpleInfoIdentifiers = { '0', 'I', 'i', 'A', 'a', '-' }; + internal static readonly int[] Values = { + PdfPageLabels.DECIMAL_ARABIC_NUMERALS, + PdfPageLabels.UPPERCASE_ROMAN_NUMERALS, + PdfPageLabels.LOWERCASE_ROMAN_NUMERALS, + PdfPageLabels.UPPERCASE_LETTERS, + PdfPageLabels.LOWERCASE_LETTERS, + PdfPageLabels.EMPTY, + }; } internal static class PageLabelsAttributes { diff --git a/App/Functions/Editor/InsertPageLabelForm.cs b/App/Functions/Editor/InsertPageLabelForm.cs index 6e1b565..4e367cf 100644 --- a/App/Functions/Editor/InsertPageLabelForm.cs +++ b/App/Functions/Editor/InsertPageLabelForm.cs @@ -15,9 +15,6 @@ namespace PDFPatcher.Functions public InsertPageLabelForm() { InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - void OnLoad() { _NumericStyleBox.AddRange(Constants.PageLabelStyles.Names).Select(0); _RemoveLabelButton.Enabled = false; } diff --git a/App/Processor/Mupdf/PageLabelCollection.cs b/App/Processor/Mupdf/PageLabelCollection.cs index 78d6e79..24b523a 100644 --- a/App/Processor/Mupdf/PageLabelCollection.cs +++ b/App/Processor/Mupdf/PageLabelCollection.cs @@ -20,7 +20,7 @@ namespace MuPdfSharp var sp = d["St"].IntegerValue; var p = d["P"].StringValue; var s = d["S"].NameValue; - pl.Add(new PageLabel(n, sp, p, s.Length == 0 ? PageLabelStyle.Digit : (PageLabelStyle)(byte)s[0])); + pl.Add(new PageLabel(n, sp, p, s.Length == 0 ? PageLabelStyle.Default : (PageLabelStyle)(byte)s[0])); } pl.Sort(); } diff --git a/App/Processor/Mupdf/Structures.cs b/App/Processor/Mupdf/Structures.cs index 90ad62a..b71145e 100644 --- a/App/Processor/Mupdf/Structures.cs +++ b/App/Processor/Mupdf/Structures.cs @@ -87,16 +87,17 @@ namespace MuPdfSharp var n = pageNumber - FromPageNumber + (StartAt < 1 ? 0 : StartAt - 1); switch (NumericStyle) { case PageLabelStyle.Default: + return Prefix; case PageLabelStyle.Digit: return String.Concat(Prefix, n.ToText()); case PageLabelStyle.UpperRoman: - return String.Concat(Prefix, ValueHelper.ToRoman(n)); + return String.Concat(Prefix, n.ToRoman()); case PageLabelStyle.LowerRoman: - return String.Concat(Prefix, ValueHelper.ToRoman(n)).ToLowerInvariant(); + return String.Concat(Prefix, n.ToRoman()).ToLowerInvariant(); case PageLabelStyle.UpperAlphabetic: - return String.Concat(Prefix, ValueHelper.ToAlphabet(n, true)); + return String.Concat(Prefix, n.ToAlphabet(true)); case PageLabelStyle.LowerAlphabetic: - return String.Concat(Prefix, ValueHelper.ToAlphabet(n, false)); + return String.Concat(Prefix, n.ToAlphabet(false)); default: goto case PageLabelStyle.Digit; } @@ -105,7 +106,7 @@ namespace MuPdfSharp public enum PageLabelStyle : byte { - Default = 0, + Default = (byte)'-', Digit = (byte)'d', UpperRoman = (byte)'R', LowerRoman = (byte)'r', diff --git a/更新历史.txt b/更新历史.txt index 8fd09f2..7aff74e 100644 --- a/更新历史.txt +++ b/更新历史.txt @@ -53,6 +53,7 @@ 尝试复制识别失败页面文本时会导致程序崩溃。 生成书签功能“添加字体筛选条件”对话框在信息文件没有包含字体信息时会导致程序崩溃。 当主程序界面窗口显示不完整时切换功能页面时界面会冻结。 + 编辑器不支持空白页码标签。 0.6.2.0 2021年11月9日 新增功能: