mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 13:59:22 +02:00
IDE: Refactoring the KeyValuesToCaptionStr function of the IdeCommands unit
This commit is contained in:
parent
b33ae45ea6
commit
9de423baed
@ -966,31 +966,27 @@ begin
|
||||
end;
|
||||
|
||||
function KeyValuesToCaptionStr(const ShortcutA, ShortcutB: TIDEShortCut; Brackets: Char): String;
|
||||
function AddBrakets(S: String): String;
|
||||
//
|
||||
function GetShortCut(aShortCut: TIDEShortCut): String;
|
||||
begin
|
||||
Result := KeyAndShiftStateToEditorKeyString(aShortCut);
|
||||
if Brackets = '[' then
|
||||
Result := '[' + S + ']'
|
||||
Result := '[' + Result + ']'
|
||||
else if Brackets = '(' then
|
||||
Result := '(' + S + ')'
|
||||
Result := '(' + Result + ')'
|
||||
else if Brackets > #0 then
|
||||
Result := Brackets + S + Brackets
|
||||
else
|
||||
Result := S;
|
||||
Result := Brackets + Result + Brackets;
|
||||
end;
|
||||
//
|
||||
begin
|
||||
Result := '';
|
||||
if (ShortcutA.Key1 = VK_UNKNOWN) and (ShortcutB.Key1 = VK_UNKNOWN) then
|
||||
Result := Result{ + lisNone2 }
|
||||
Result := ''
|
||||
else if ShortcutA.Key1 = VK_UNKNOWN then
|
||||
Result := GetShortCut(ShortcutB)
|
||||
else if ShortcutB.Key1 = VK_UNKNOWN then
|
||||
Result := GetShortCut(ShortcutA)
|
||||
else
|
||||
if (ShortcutA.Key1 = VK_UNKNOWN) then
|
||||
Result := Result + AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutB))
|
||||
else
|
||||
if (ShortcutB.Key1 = VK_UNKNOWN) then
|
||||
Result := Result + AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutA))
|
||||
else
|
||||
Result := Result + AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutA))
|
||||
+ ' / ' +
|
||||
AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutB));
|
||||
Result := GetShortCut(ShortcutA) + ' / ' + GetShortCut(ShortcutB);
|
||||
end;
|
||||
|
||||
type
|
||||
|
Loading…
Reference in New Issue
Block a user