From bbc8d834df1ddc612fabfa54c387febca98c5550 Mon Sep 17 00:00:00 2001 From: WMJ Date: Tue, 18 Apr 2023 14:16:12 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BC=8B=E4=B9=A6=E7=AD=BE=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E6=94=AF=E6=8C=81=E7=BC=96=E8=BE=91=E5=A4=9A=E8=A1=8C?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E7=9A=84=E4=B9=A6=E7=AD=BE=EF=BC=88fixed=20#?= =?UTF-8?q?158=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Functions/Editor/BookmarkEditorView.cs | 30 +++++----------------- App/Functions/EditorControl.cs | 2 +- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/App/Functions/Editor/BookmarkEditorView.cs b/App/Functions/Editor/BookmarkEditorView.cs index 4027c17..4210014 100644 --- a/App/Functions/Editor/BookmarkEditorView.cs +++ b/App/Functions/Editor/BookmarkEditorView.cs @@ -25,7 +25,6 @@ namespace PDFPatcher.Functions public OLVColumn BookmarkNameColumn => _BookmarkNameColumn; public OLVColumn BookmarkPageColumn => _BookmarkPageColumn; public bool HasMarker => _markers.Count > 0; - public bool IsLabelEditing { get; private set; } readonly Dictionary _markers = new Dictionary(); AutoResizingTextBox _LabelEditBox; @@ -484,31 +483,10 @@ namespace PDFPatcher.Functions protected override void OnBeforeLabelEdit(LabelEditEventArgs e) { base.OnBeforeLabelEdit(e); - IsLabelEditing = true; e.CancelEdit = true; EditSubItem(GetItem(e.Item), 0); } - protected override void OnAfterLabelEdit(LabelEditEventArgs e) { - base.OnAfterLabelEdit(e); - IsLabelEditing = false; - var o = GetModelObject(e.Item) as XmlElement; - if (o == null || String.IsNullOrEmpty(e.Label)) { - e.CancelEdit = true; - return; - } - var p = new ReplaceTitleTextProcessor(e.Label); - Undo?.AddUndo("编辑书签文本", p.Process(o)); - var i = GetItem(e.Item); - if (o.HasChildNodes && FormHelper.IsCtrlKeyDown == false) { - Expand(o); - } - if (i.Index < Items.Count - 1) { - GetItem(i.Index + 1).BeginEdit(); - } - RefreshItem(i); - } - protected override void OnCellEditStarting(CellEditEventArgs e) { base.OnCellEditStarting(e); if (e.Column == _BookmarkNameColumn) { @@ -667,6 +645,7 @@ namespace PDFPatcher.Functions MaximumSize = new Size(_Width, _MaxHeight); Multiline = true; Text = text; + AcceptsReturn = text.IndexOf('\n') >= 0; } void ResizeForText(string value) { @@ -679,7 +658,7 @@ namespace PDFPatcher.Functions } protected override void OnKeyDown(KeyEventArgs e) { - if (e.KeyData == (Keys.Control | Keys.Enter)) { + if (e.KeyData == (Keys.Shift | Keys.Enter)) { AcceptsReturn = true; // hack: The following line can throw ObjectDisposedException //ScrollBars = ScrollBars.Vertical; @@ -689,7 +668,10 @@ namespace PDFPatcher.Functions e.SuppressKeyPress = true; return; } - base.OnKeyUp(e); + //else if (e.KeyData == (Keys.Control | Keys.Enter)) { + // AcceptsReturn = false; + //} + base.OnKeyDown(e); } } } diff --git a/App/Functions/EditorControl.cs b/App/Functions/EditorControl.cs index 4283bdf..3956f2f 100644 --- a/App/Functions/EditorControl.cs +++ b/App/Functions/EditorControl.cs @@ -485,7 +485,7 @@ namespace PDFPatcher.Functions [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { - if (_BookmarkBox.IsCellEditing || _BookmarkBox.IsLabelEditing || _CurrentPageBox.Focused) { + if (_BookmarkBox.IsCellEditing || _CurrentPageBox.Focused) { return base.ProcessCmdKey(ref msg, keyData); } switch (keyData ^ Keys.Control) {