From 40c1f4c03c16911e2d705c62c1370f55163a598c Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 21 Apr 2020 18:12:27 +0200 Subject: [PATCH] #444: show initial captions and hints of TAction's on shortcut page in preferences dialog --- source/main.pas | 8 ++++++++ source/options.pas | 7 +++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/source/main.pas b/source/main.pas index 050f9c64..7a912e25 100644 --- a/source/main.pas +++ b/source/main.pas @@ -1118,6 +1118,8 @@ type FLastPortableSettingsSave: Cardinal; FLastAppSettingsWrites: Integer; FFormatSettings: TFormatSettings; + FActionList1DefaultCaptions: TStringList; + FActionList1DefaultHints: TStringList; // Host subtabs backend structures FHostListResults: TDBQueryList; @@ -1242,6 +1244,8 @@ type procedure ApplyVTFilter(FromTimer: Boolean); procedure ApplyFontToGrids; procedure PrepareImageList; + property ActionList1DefaultCaptions: TStringList read FActionList1DefaultCaptions; + property ActionList1DefaultHints: TStringList read FActionList1DefaultHints; end; @@ -1948,9 +1952,13 @@ begin RestoreListSetup(ListTables); // Shortcuts + FActionList1DefaultCaptions := TStringList.Create; + FActionList1DefaultHints := TStringList.Create; for i:=0 to ActionList1.ActionCount-1 do begin Action := TAction(ActionList1.Actions[i]); Action.ShortCut := AppSettings.ReadInt(asActionShortcut1, Action.Name, Action.ShortCut); + FActionList1DefaultCaptions.Insert(i, Action.Caption); + FActionList1DefaultHints.Insert(i, Action.Hint); end; // Size of completion proposal window diff --git a/source/options.pas b/source/options.pas index d5fc92cb..5ebcc408 100644 --- a/source/options.pas +++ b/source/options.pas @@ -1098,8 +1098,8 @@ begin lblShortcutHint.Caption := TreeShortcutItems.Text[Node, 0]; if Assigned(Data.Action) then begin lblShortcut2.Enabled := False; - if Data.Action.Hint <> '' then - lblShortcutHint.Caption := Data.Action.Hint; + if MainForm.ActionList1DefaultHints[Data.Action.Index] <> '' then + lblShortcutHint.Caption := MainForm.ActionList1DefaultHints[Data.Action.Index]; end; Shortcut1.HotKey := Data.ShortCut1; Shortcut2.HotKey := Data.ShortCut2; @@ -1155,8 +1155,7 @@ begin end; CellText := _(CellText); end else if Assigned(Data.Action) then begin - CellText := Data.Action.Caption; - CellText := StripHotkey(CellText); + CellText := MainForm.ActionList1DefaultCaptions[Data.Action.Index]; end; end; end;