ide: represent keys better in the keymapping tree, don't show "empty" for commands without keys

git-svn-id: trunk@19816 -
This commit is contained in:
paul 2009-05-06 05:55:37 +00:00
parent 61a7fb8388
commit bb487dbdd2
4 changed files with 58 additions and 71 deletions

View File

@ -4,8 +4,8 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
ClientHeight = 510
ClientWidth = 461
Visible = False
DesignLeft = 554
DesignTop = 241
DesignLeft = 110
DesignTop = 145
object KeyMappingHelpLabel: TLabel[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
@ -13,7 +13,6 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
Height = 14
Top = 0
Width = 105
HelpContext = 0
Caption = 'KeyMappingHelpLabel'
ParentColor = False
end
@ -24,10 +23,9 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 27
Height = 23
Top = 20
Width = 461
HelpContext = 0
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 6
@ -45,14 +43,12 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = KeyMappingFindKeyButton
Left = 0
Height = 399
Top = 53
Height = 403
Top = 49
Width = 461
HelpContext = 0
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
Ctl3D = False
DefaultItemHeight = 15
ReadOnly = True
RowSelect = True
@ -69,7 +65,6 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
Height = 23
Top = 458
Width = 154
HelpContext = 0
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Bottom = 6
@ -84,8 +79,7 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
Left = 0
Height = 23
Top = 487
Width = 189
HelpContext = 0
Width = 191
Anchors = [akLeft, akBottom]
AutoSize = True
Caption = 'KeyMappingChooseSchemeButton'
@ -97,11 +91,10 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 258
Left = 257
Height = 23
Top = 487
Width = 203
HelpContext = 0
Width = 204
Anchors = [akRight, akBottom]
AutoSize = True
Caption = 'KeyMappingConsistencyCheckButton'

View File

@ -3,46 +3,44 @@
LazarusResources.Add('TEditorKeymappingOptionsFrame','FORMDATA',[
'TPF0'#241#29'TEditorKeymappingOptionsFrame'#28'EditorKeymappingOptionsFrame'
+#6'Height'#3#254#1#5'Width'#3#205#1#12'ClientHeight'#3#254#1#11'ClientWidth'
+#3#205#1#7'Visible'#8#10'DesignLeft'#3'*'#2#9'DesignTop'#3#241#0#0#242#2#0#6
+'TLabel'#19'KeyMappingHelpLabel'#22'AnchorSideLeft.Control'#7#5'Owner'#21'An'
+'chorSideTop.Control'#7#5'Owner'#4'Left'#2#0#6'Height'#2#14#3'Top'#2#0#5'Wid'
+'th'#2'i'#11'HelpContext'#2#0#7'Caption'#6#19'KeyMappingHelpLabel'#11'Parent'
+'Color'#8#0#0#242#2#1#5'TEdit'#20'KeyMappingFilterEdit'#22'AnchorSideLeft.Co'
+'ntrol'#7#5'Owner'#21'AnchorSideTop.Control'#7#19'KeyMappingHelpLabel'#18'An'
+'chorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20
+'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#27#3'Top'#2#20
+#5'Width'#3#205#1#11'HelpContext'#2#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akR'
+'ight'#0#8'AutoSize'#9#17'BorderSpacing.Top'#2#6#8'OnChange'#7#26'KeyMapping'
+'FilterEditChange'#7'OnEnter'#7#25'KeyMappingFilterEditEnter'#6'OnExit'#7#24
+'KeyMappingFilterEditExit'#8'TabOrder'#2#0#4'Text'#6#20'KeyMappingFilterEdit'
+#0#0#242#2#2#9'TTreeView'#18'KeyMappingTreeView'#22'AnchorSideLeft.Control'#7
+#5'Owner'#21'AnchorSideTop.Control'#7#20'KeyMappingFilterEdit'#18'AnchorSide'
+'Top.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSi'
+'deRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#23'KeyMappingFi'
+'ndKeyButton'#4'Left'#2#0#6'Height'#3#143#1#3'Top'#2'5'#5'Width'#3#205#1#11
+'HelpContext'#2#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0
+#17'BorderSpacing.Top'#2#6#20'BorderSpacing.Bottom'#2#6#5'Ctl3D'#8#17'Defaul'
+'tItemHeight'#2#15#8'ReadOnly'#9#9'RowSelect'#9#10'ScrollBars'#7#10'ssAutoBo'
+'th'#8'TabOrder'#2#1#9'OnMouseUp'#7#25'KeyMappingTreeViewMouseUp'#7'Options'
+#3#205#1#7'Visible'#8#10'DesignLeft'#2'n'#9'DesignTop'#3#145#0#0#242#2#0#6'T'
+'Label'#19'KeyMappingHelpLabel'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anc'
+'horSideTop.Control'#7#5'Owner'#4'Left'#2#0#6'Height'#2#14#3'Top'#2#0#5'Widt'
+'h'#2'i'#7'Caption'#6#19'KeyMappingHelpLabel'#11'ParentColor'#8#0#0#242#2#1#5
+'TEdit'#20'KeyMappingFilterEdit'#22'AnchorSideLeft.Control'#7#5'Owner'#21'An'
+'chorSideTop.Control'#7#19'KeyMappingHelpLabel'#18'AnchorSideTop.Side'#7#9'a'
+'srBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7
+#9'asrBottom'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#20#5'Width'#3#205#1#7'Anch'
+'ors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#17'BorderSpacing.Top'
+#2#6#8'OnChange'#7#26'KeyMappingFilterEditChange'#7'OnEnter'#7#25'KeyMapping'
+'FilterEditEnter'#6'OnExit'#7#24'KeyMappingFilterEditExit'#8'TabOrder'#2#0#4
+'Text'#6#20'KeyMappingFilterEdit'#0#0#242#2#2#9'TTreeView'#18'KeyMappingTree'
+'View'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#20
+'KeyMappingFilterEdit'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRi'
+'ght.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSi'
+'deBottom.Control'#7#23'KeyMappingFindKeyButton'#4'Left'#2#0#6'Height'#3#147
+#1#3'Top'#2'1'#5'Width'#3#205#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8
+'akBottom'#0#17'BorderSpacing.Top'#2#6#20'BorderSpacing.Bottom'#2#6#17'Defau'
+'ltItemHeight'#2#15#8'ReadOnly'#9#9'RowSelect'#9#10'ScrollBars'#7#10'ssAutoB'
+'oth'#8'TabOrder'#2#1#9'OnMouseUp'#7#25'KeyMappingTreeViewMouseUp'#7'Options'
+#11#17'tvoAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11
+'tvoReadOnly'#12'tvoRowSelect'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoSho'
+'wRoot'#11'tvoToolTips'#0#0#0#242#2#3#7'TButton'#23'KeyMappingFindKeyButton'
+#22'AnchorSideLeft.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBotto'
+'m'#24'AnchorSideBottom.Control'#7#28'KeyMappingChooseSchemeButton'#4'Left'#2
+#0#6'Height'#2#23#3'Top'#3#202#1#5'Width'#3#154#0#11'HelpContext'#2#0#7'Anch'
+'ors'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Bottom'#2#6#7
+'Caption'#6#23'KeyMappingFindKeyButton'#7'OnClick'#7#28'KeyMappingFindKeyBut'
+'tonClick'#8'TabOrder'#2#2#0#0#242#2#4#7'TButton'#28'KeyMappingChooseSchemeB'
+'utton'#22'AnchorSideLeft.Control'#7#5'Owner'#24'AnchorSideBottom.Control'#7
+#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#23
+#3'Top'#3#231#1#5'Width'#3#189#0#11'HelpContext'#2#0#7'Anchors'#11#6'akLeft'
+#8'akBottom'#0#8'AutoSize'#9#7'Caption'#6#28'KeyMappingChooseSchemeButton'#7
+'OnClick'#7'!KeyMappingChooseSchemeButtonClick'#8'TabOrder'#2#3#0#0#242#2#5#7
+'TButton KeyMappingConsistencyCheckButton'#23'AnchorSideRight.Control'#7#5'O'
+'wner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7
+#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#2#1#6'Height'#2
+#23#3'Top'#3#231#1#5'Width'#3#203#0#11'HelpContext'#2#0#7'Anchors'#11#7'akRi'
+'ght'#8'akBottom'#0#8'AutoSize'#9#7'Caption'#6' KeyMappingConsistencyCheckBu'
+'tton'#7'OnClick'#7'%KeyMappingConsistencyCheckButtonClick'#8'TabOrder'#2#4#0
+#0#0
+#0#6'Height'#2#23#3'Top'#3#202#1#5'Width'#3#154#0#7'Anchors'#11#6'akLeft'#8
+'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Bottom'#2#6#7'Caption'#6#23'KeyM'
+'appingFindKeyButton'#7'OnClick'#7#28'KeyMappingFindKeyButtonClick'#8'TabOrd'
+'er'#2#2#0#0#242#2#4#7'TButton'#28'KeyMappingChooseSchemeButton'#22'AnchorSi'
+'deLeft.Control'#7#5'Owner'#24'AnchorSideBottom.Control'#7#5'Owner'#21'Ancho'
+'rSideBottom.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#23#3'Top'#3#231#1#5
+'Width'#3#191#0#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#7'Captio'
+'n'#6#28'KeyMappingChooseSchemeButton'#7'OnClick'#7'!KeyMappingChooseSchemeB'
+'uttonClick'#8'TabOrder'#2#3#0#0#242#2#5#7'TButton KeyMappingConsistencyChec'
+'kButton'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9
+'asrBottom'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'
+#7#9'asrBottom'#4'Left'#3#1#1#6'Height'#2#23#3'Top'#3#231#1#5'Width'#3#204#0
+#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#7'Caption'#6' KeyMappi'
+'ngConsistencyCheckButton'#7'OnClick'#7'%KeyMappingConsistencyCheckButtonCli'
+'ck'#8'TabOrder'#2#4#0#0#0
]);

View File

@ -355,34 +355,30 @@ end;
function TEditorKeymappingOptionsFrame.KeyMappingRelationToString(
KeyRelation: TKeyCommandRelation): String;
var
s: String;
CopiedLength: Integer;
function AddBrakets(S: String): String;
begin
Result := '[' + S + ']';
end;
begin
with KeyRelation do
begin
Result := UTF8Copy(LocalizedName, 1, 40);
CopiedLength := UTF8Length(Result);
if CopiedLength < 40 then
begin
SetLength(s, (40 - CopiedLength));
FillChar(s[1], length(s), ' ');
end
else
s := '';
Result := Result + s;
if Result <> '' then
Result := Result + ' ';
if (ShortcutA.Key1 = VK_UNKNOWN) and (ShortcutB.Key1 = VK_UNKNOWN) then
Result := Result + lisNone2
Result := Result{ + lisNone2 }
else
if (ShortcutA.Key1 = VK_UNKNOWN) then
Result := Result + KeyAndShiftStateToEditorKeyString(ShortcutB)
Result := Result + AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutB))
else
if (ShortcutB.Key1 = VK_UNKNOWN) then
Result := Result + KeyAndShiftStateToEditorKeyString(ShortcutA)
Result := Result + AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutA))
else
Result := Result + KeyAndShiftStateToEditorKeyString(ShortcutA)
Result := Result + AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutA))
+ ' '+lisOr+' ' +
KeyAndShiftStateToEditorKeyString(ShortcutB);
AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutB));
end;
end;

View File

@ -1918,10 +1918,10 @@ begin
end;
end;
function KeyAndShiftStateToEditorKeyString(const Key: TIDEShortCut): String;
function KeyAndShiftStateToEditorKeyString(const Key: TIDEShortCut): String;
begin
Result := KeyAndShiftStateToKeyString(Key.Key1, Key.Shift1);
if (Key.Key2<>VK_UNKNOWN) then
if (Key.Key2 <> VK_UNKNOWN) then
Result := Result + ', ' + KeyAndShiftStateToKeyString(Key.Key2, Key.Shift2);
end;