Skip to content

Commit

Permalink
#444: show initial captions and hints of TAction's on shortcut page i…
Browse files Browse the repository at this point in the history
…n preferences dialog
  • Loading branch information
ansgarbecker committed Apr 21, 2020
1 parent 114b92d commit 40c1f4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 8 additions & 0 deletions source/main.pas
Expand Up @@ -1118,6 +1118,8 @@ TMainForm = class(TExtForm)
FLastPortableSettingsSave: Cardinal;
FLastAppSettingsWrites: Integer;
FFormatSettings: TFormatSettings;
FActionList1DefaultCaptions: TStringList;
FActionList1DefaultHints: TStringList;

// Host subtabs backend structures
FHostListResults: TDBQueryList;
Expand Down Expand Up @@ -1242,6 +1244,8 @@ TMainForm = class(TExtForm)
procedure ApplyVTFilter(FromTimer: Boolean);
procedure ApplyFontToGrids;
procedure PrepareImageList;
property ActionList1DefaultCaptions: TStringList read FActionList1DefaultCaptions;
property ActionList1DefaultHints: TStringList read FActionList1DefaultHints;
end;


Expand Down Expand Up @@ -1948,9 +1952,13 @@ procedure TMainForm.FormCreate(Sender: TObject);
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
Expand Down
7 changes: 3 additions & 4 deletions source/options.pas
Expand Up @@ -1098,8 +1098,8 @@ procedure Toptionsform.TreeShortcutItemsFocusChanged(Sender: TBaseVirtualTree; N
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;
Expand Down Expand Up @@ -1155,8 +1155,7 @@ procedure Toptionsform.TreeShortcutItemsGetText(Sender: TBaseVirtualTree; Node:
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;
Expand Down

0 comments on commit 40c1f4c

Please sign in to comment.