mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 14:19:11 +02:00
ide: merge keymapping into ide options
git-svn-id: trunk@17174 -
This commit is contained in:
parent
c5e876817b
commit
566abcc5b5
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -2438,6 +2438,9 @@ ide/frames/options_editor_display.pas svneol=native#text/pascal
|
|||||||
ide/frames/options_editor_general.lfm svneol=native#text/plain
|
ide/frames/options_editor_general.lfm svneol=native#text/plain
|
||||||
ide/frames/options_editor_general.lrs svneol=native#text/plain
|
ide/frames/options_editor_general.lrs svneol=native#text/plain
|
||||||
ide/frames/options_editor_general.pas svneol=native#text/pascal
|
ide/frames/options_editor_general.pas svneol=native#text/pascal
|
||||||
|
ide/frames/options_editor_keymapping.lfm svneol=native#text/plain
|
||||||
|
ide/frames/options_editor_keymapping.lrs svneol=native#text/pascal
|
||||||
|
ide/frames/options_editor_keymapping.pas svneol=native#text/pascal
|
||||||
ide/frames/options_files.lfm svneol=native#text/plain
|
ide/frames/options_files.lfm svneol=native#text/plain
|
||||||
ide/frames/options_files.lrs svneol=native#text/pascal
|
ide/frames/options_files.lrs svneol=native#text/pascal
|
||||||
ide/frames/options_files.pas svneol=native#text/pascal
|
ide/frames/options_files.pas svneol=native#text/pascal
|
||||||
|
@ -3,9 +3,10 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
|||||||
Width = 454
|
Width = 454
|
||||||
ClientHeight = 504
|
ClientHeight = 504
|
||||||
ClientWidth = 454
|
ClientWidth = 454
|
||||||
|
TabOrder = 0
|
||||||
Visible = False
|
Visible = False
|
||||||
DesignLeft = 176
|
DesignLeft = 66
|
||||||
DesignTop = 232
|
DesignTop = 87
|
||||||
object BlockIndentLabel: TLabel[0]
|
object BlockIndentLabel: TLabel[0]
|
||||||
AnchorSideLeft.Control = BlockIndentComboBox
|
AnchorSideLeft.Control = BlockIndentComboBox
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
@ -89,7 +90,6 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
|||||||
'4'
|
'4'
|
||||||
'8'
|
'8'
|
||||||
)
|
)
|
||||||
MaxLength = -1
|
|
||||||
OnChange = ComboboxOnChange
|
OnChange = ComboboxOnChange
|
||||||
OnExit = ComboBoxOnExit
|
OnExit = ComboBoxOnExit
|
||||||
OnKeyDown = ComboboxOnKeyDown
|
OnKeyDown = ComboboxOnKeyDown
|
||||||
@ -110,7 +110,6 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
|||||||
'4096'
|
'4096'
|
||||||
'512'
|
'512'
|
||||||
)
|
)
|
||||||
MaxLength = -1
|
|
||||||
OnChange = ComboboxOnChange
|
OnChange = ComboboxOnChange
|
||||||
OnExit = ComboBoxOnExit
|
OnExit = ComboBoxOnExit
|
||||||
OnKeyDown = ComboboxOnKeyDown
|
OnKeyDown = ComboboxOnKeyDown
|
||||||
@ -132,7 +131,6 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
|||||||
'4'
|
'4'
|
||||||
'8'
|
'8'
|
||||||
)
|
)
|
||||||
MaxLength = -1
|
|
||||||
OnChange = ComboboxOnChange
|
OnChange = ComboboxOnChange
|
||||||
OnExit = ComboBoxOnExit
|
OnExit = ComboBoxOnExit
|
||||||
OnKeyDown = ComboboxOnKeyDown
|
OnKeyDown = ComboboxOnKeyDown
|
||||||
|
@ -3,53 +3,53 @@
|
|||||||
LazarusResources.Add('TEditorGeneralOptionsFrame','FORMDATA',[
|
LazarusResources.Add('TEditorGeneralOptionsFrame','FORMDATA',[
|
||||||
'TPF0'#241#26'TEditorGeneralOptionsFrame'#25'EditorGeneralOptionsFrame'#6'Hei'
|
'TPF0'#241#26'TEditorGeneralOptionsFrame'#25'EditorGeneralOptionsFrame'#6'Hei'
|
||||||
+'ght'#3#248#1#5'Width'#3#198#1#12'ClientHeight'#3#248#1#11'ClientWidth'#3#198
|
+'ght'#3#248#1#5'Width'#3#198#1#12'ClientHeight'#3#248#1#11'ClientWidth'#3#198
|
||||||
+#1#7'Visible'#8#10'DesignLeft'#3#176#0#9'DesignTop'#3#232#0#0#242#2#0#6'TLab'
|
+#1#8'TabOrder'#2#0#7'Visible'#8#10'DesignLeft'#2'B'#9'DesignTop'#2'W'#0#242#2
|
||||||
+'el'#16'BlockIndentLabel'#22'AnchorSideLeft.Control'#7#19'BlockIndentComboBo'
|
+#0#6'TLabel'#16'BlockIndentLabel'#22'AnchorSideLeft.Control'#7#19'BlockInden'
|
||||||
+'x'#19'AnchorSideLeft.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#19
|
+'tComboBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#24'AnchorSideBottom.Contr'
|
||||||
+'BlockIndentComboBox'#21'AnchorSideBottom.Side'#7#9'asrCenter'#4'Left'#2'j'#6
|
+'ol'#7#19'BlockIndentComboBox'#21'AnchorSideBottom.Side'#7#9'asrCenter'#4'Le'
|
||||||
+'Height'#2#14#3'Top'#3#179#1#5'Width'#2'R'#7'Anchors'#11#6'akLeft'#8'akBotto'
|
+'ft'#2'j'#6'Height'#2#14#3'Top'#3#179#1#5'Width'#2'R'#7'Anchors'#11#6'akLeft'
|
||||||
+'m'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#16'BlockIndentLabel'#11'Pare'
|
+#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#16'BlockIndentLabel'
|
||||||
+'ntColor'#8#0#0#242#2#1#6'TLabel'#14'UndoLimitLabel'#22'AnchorSideLeft.Contr'
|
+#11'ParentColor'#8#0#0#242#2#1#6'TLabel'#14'UndoLimitLabel'#22'AnchorSideLef'
|
||||||
+'ol'#7#17'UndoLimitComboBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#24'Ancho'
|
+'t.Control'#7#17'UndoLimitComboBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#24
|
||||||
+'rSideBottom.Control'#7#17'UndoLimitComboBox'#21'AnchorSideBottom.Side'#7#9
|
+'AnchorSideBottom.Control'#7#17'UndoLimitComboBox'#21'AnchorSideBottom.Side'
|
||||||
+'asrCenter'#4'Left'#2'j'#6'Height'#2#14#3'Top'#3#206#1#5'Width'#2'H'#7'Ancho'
|
+#7#9'asrCenter'#4'Left'#2'j'#6'Height'#2#14#3'Top'#3#206#1#5'Width'#2'H'#7'A'
|
||||||
+'rs'#11#6'akLeft'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#14
|
+'nchors'#11#6'akLeft'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6
|
||||||
+'UndoLimitLabel'#11'ParentColor'#8#0#0#242#2#2#6'TLabel'#14'TabWidthsLabel'
|
+#14'UndoLimitLabel'#11'ParentColor'#8#0#0#242#2#2#6'TLabel'#14'TabWidthsLabe'
|
||||||
+#22'AnchorSideLeft.Control'#7#17'TabWidthsComboBox'#19'AnchorSideLeft.Side'#7
|
+'l'#22'AnchorSideLeft.Control'#7#17'TabWidthsComboBox'#19'AnchorSideLeft.Sid'
|
||||||
+#9'asrBottom'#24'AnchorSideBottom.Control'#7#17'TabWidthsComboBox'#21'Anchor'
|
+'e'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#17'TabWidthsComboBox'#21'A'
|
||||||
+'SideBottom.Side'#7#9'asrCenter'#4'Left'#2'j'#6'Height'#2#14#3'Top'#3#230#1#5
|
+'nchorSideBottom.Side'#7#9'asrCenter'#4'Left'#2'j'#6'Height'#2#14#3'Top'#3
|
||||||
+'Width'#2'M'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#20'BorderSpacing.Around'#2
|
+#230#1#5'Width'#2'M'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#20'BorderSpacing.'
|
||||||
+#6#7'Caption'#6#14'TabWidthsLabel'#11'ParentColor'#8#0#0#242#2#3#11'TCheckGr'
|
+'Around'#2#6#7'Caption'#6#14'TabWidthsLabel'#11'ParentColor'#8#0#0#242#2#3#11
|
||||||
+'oup'#21'EditorOptionsGroupBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anc'
|
+'TCheckGroup'#21'EditorOptionsGroupBox'#22'AnchorSideLeft.Control'#7#5'Owner'
|
||||||
+'horSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'#20'An'
|
+#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'
|
||||||
+'chorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#19'BlockI'
|
+#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#19'B'
|
||||||
+'ndentComboBox'#6'Height'#3#170#1#5'Width'#3#198#1#5'Align'#7#5'alTop'#7'Anc'
|
+'lockIndentComboBox'#6'Height'#3#170#1#5'Width'#3#198#1#5'Align'#7#5'alTop'#7
|
||||||
+'hors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'AutoFill'#9#20'Borde'
|
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'AutoFill'#9#20'Bo'
|
||||||
+'rSpacing.Bottom'#2#6#7'Caption'#6#21'EditorOptionsGroupBox'#28'ChildSizing.'
|
+'rderSpacing.Bottom'#2#6#7'Caption'#6#21'EditorOptionsGroupBox'#28'ChildSizi'
|
||||||
+'LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.E'
|
+'ng.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizin'
|
||||||
+'nlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVert'
|
+'g.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeV'
|
||||||
+'ical'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14
|
+'ertical'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7
|
||||||
+'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'Chil'
|
+#14'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'C'
|
||||||
+'dSizing.Layout'#7#29'cclTopToBottomThenLeftToRight'#27'ChildSizing.Controls'
|
+'hildSizing.Layout'#7#29'cclTopToBottomThenLeftToRight'#27'ChildSizing.Contr'
|
||||||
+'PerLine'#2#1#12'ColumnLayout'#7#24'clVerticalThenHorizontal'#7'Columns'#2#2
|
+'olsPerLine'#2#1#12'ColumnLayout'#7#24'clVerticalThenHorizontal'#7'Columns'#2
|
||||||
+#11'OnItemClick'#7#30'EditorOptionsGroupBoxItemClick'#8'TabOrder'#2#0#0#0#242
|
+#2#11'OnItemClick'#7#30'EditorOptionsGroupBoxItemClick'#8'TabOrder'#2#0#0#0
|
||||||
+#2#4#9'TComboBox'#19'BlockIndentComboBox'#22'AnchorSideLeft.Control'#7#5'Own'
|
+#242#2#4#9'TComboBox'#19'BlockIndentComboBox'#22'AnchorSideLeft.Control'#7#5
|
||||||
+'er'#24'AnchorSideBottom.Control'#7#17'UndoLimitComboBox'#6'Height'#2#21#3'T'
|
+'Owner'#24'AnchorSideBottom.Control'#7#17'UndoLimitComboBox'#6'Height'#2#21#3
|
||||||
+'op'#3#176#1#5'Width'#2'd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#20'BorderSp'
|
+'Top'#3#176#1#5'Width'#2'd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#20'BorderS'
|
||||||
+'acing.Bottom'#2#6#10'ItemHeight'#2#13#13'Items.Strings'#1#6#1'1'#6#1'2'#6#1
|
+'pacing.Bottom'#2#6#10'ItemHeight'#2#13#13'Items.Strings'#1#6#1'1'#6#1'2'#6#1
|
||||||
+'4'#6#1'8'#0#9'MaxLength'#2#255#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'
|
+'4'#6#1'8'#0#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7#14'ComboBoxOnExi'
|
||||||
+#7#14'ComboBoxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#1#0
|
+'t'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#1#0#0#242#2#5#9'TComb'
|
||||||
+#0#242#2#5#9'TComboBox'#17'UndoLimitComboBox'#22'AnchorSideLeft.Control'#7#5
|
+'oBox'#17'UndoLimitComboBox'#22'AnchorSideLeft.Control'#7#5'Owner'#24'Anchor'
|
||||||
+'Owner'#24'AnchorSideBottom.Control'#7#14'TabWidthsLabel'#6'Height'#2#21#3'T'
|
+'SideBottom.Control'#7#14'TabWidthsLabel'#6'Height'#2#21#3'Top'#3#203#1#5'Wi'
|
||||||
+'op'#3#203#1#5'Width'#2'd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#17'BorderSp'
|
+'dth'#2'd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#17'BorderSpacing.Top'#2#6#20
|
||||||
+'acing.Top'#2#6#20'BorderSpacing.Bottom'#2#6#10'ItemHeight'#2#13#13'Items.St'
|
+'BorderSpacing.Bottom'#2#6#10'ItemHeight'#2#13#13'Items.Strings'#1#6#5'32767'
|
||||||
+'rings'#1#6#5'32767'#6#4'4096'#6#3'512'#0#9'MaxLength'#2#255#8'OnChange'#7#16
|
+#6#4'4096'#6#3'512'#0#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7#14'Comb'
|
||||||
+'ComboboxOnChange'#6'OnExit'#7#14'ComboBoxOnExit'#9'OnKeyDown'#7#17'Combobox'
|
+'oBoxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#2#0#0#242#2#6
|
||||||
+'OnKeyDown'#8'TabOrder'#2#2#0#0#242#2#6#9'TComboBox'#17'TabWidthsComboBox'#22
|
+#9'TComboBox'#17'TabWidthsComboBox'#22'AnchorSideLeft.Control'#7#5'Owner'#24
|
||||||
+'AnchorSideLeft.Control'#7#5'Owner'#24'AnchorSideBottom.Control'#7#5'Owner'
|
+'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBotto'
|
||||||
+#21'AnchorSideBottom.Side'#7#9'asrBottom'#6'Height'#2#21#3'Top'#3#227#1#5'Wi'
|
+'m'#6'Height'#2#21#3'Top'#3#227#1#5'Width'#2'd'#7'Anchors'#11#6'akLeft'#8'ak'
|
||||||
+'dth'#2'd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#17'BorderSpacing.Top'#2#6#10
|
+'Bottom'#0#17'BorderSpacing.Top'#2#6#10'ItemHeight'#2#13#13'Items.Strings'#1
|
||||||
+'ItemHeight'#2#13#13'Items.Strings'#1#6#1'1'#6#1'2'#6#1'4'#6#1'8'#0#9'MaxLen'
|
+#6#1'1'#6#1'2'#6#1'4'#6#1'8'#0#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7
|
||||||
+'gth'#2#255#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7#14'ComboBoxOnExit'
|
+#14'ComboBoxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#3#0#0
|
||||||
+#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#3#0#0#0
|
+#0
|
||||||
]);
|
]);
|
||||||
|
@ -27,8 +27,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, LResources, Forms, Graphics, LCLProc, LCLType,
|
Classes, SysUtils, FileUtil, LResources, Forms, Graphics, LCLProc, LCLType,
|
||||||
StdCtrls, SynEdit, Controls, ExtCtrls,
|
StdCtrls, SynEdit, Controls, ExtCtrls,
|
||||||
EditorOptions, LazarusIDEStrConsts, IDEProcs, IDEOptionsIntf, SrcEditorIntf,
|
EditorOptions, LazarusIDEStrConsts, IDEProcs, IDEOptionsIntf;
|
||||||
KeyMapping;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TPreviewEditor = TSynEdit;
|
TPreviewEditor = TSynEdit;
|
||||||
@ -55,7 +54,6 @@ type
|
|||||||
PreviewEdits: array of TPreviewEditor;
|
PreviewEdits: array of TPreviewEditor;
|
||||||
PreviewSyn: TSrcIDEHighlighter;
|
PreviewSyn: TSrcIDEHighlighter;
|
||||||
CurLanguageID: Integer;
|
CurLanguageID: Integer;
|
||||||
EditingKeyMap: TKeyCommandRelationList;
|
|
||||||
|
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -176,7 +174,6 @@ begin
|
|||||||
|
|
||||||
PreviewSyn := GetHighlighter(TPreviewPasSyn, GetCurColorScheme(TPreviewPasSyn.GetLanguageName), True);
|
PreviewSyn := GetHighlighter(TPreviewPasSyn, GetCurColorScheme(TPreviewPasSyn.GetLanguageName), True);
|
||||||
CurLanguageID := HighlighterList.FindByClass(TCustomSynClass(PreviewSyn.ClassType));
|
CurLanguageID := HighlighterList.FindByClass(TCustomSynClass(PreviewSyn.ClassType));
|
||||||
EditingKeyMap.Assign(KeyMap);
|
|
||||||
|
|
||||||
for i := Low(PreviewEdits) to High(PreviewEdits) do
|
for i := Low(PreviewEdits) to High(PreviewEdits) do
|
||||||
if PreviewEdits[i] <> nil then
|
if PreviewEdits[i] <> nil then
|
||||||
@ -185,7 +182,6 @@ begin
|
|||||||
if UseSyntaxHighlight then
|
if UseSyntaxHighlight then
|
||||||
Highlighter := PreviewSyn;
|
Highlighter := PreviewSyn;
|
||||||
GetSynEditPreviewSettings(PreviewEdits[i]);
|
GetSynEditPreviewSettings(PreviewEdits[i]);
|
||||||
EditingKeyMap.AssignTo(PreviewEdits[i].KeyStrokes, TSourceEditorWindowInterface);
|
|
||||||
Lines.Text := HighlighterList[CurLanguageID].SampleSource;
|
Lines.Text := HighlighterList[CurLanguageID].SampleSource;
|
||||||
CaretXY := HighlighterList[CurLanguageID].CaretXY;
|
CaretXY := HighlighterList[CurLanguageID].CaretXY;
|
||||||
TopLine := 1;
|
TopLine := 1;
|
||||||
@ -450,14 +446,12 @@ constructor TEditorGeneralOptionsFrame.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
PreviewEdits := nil;
|
PreviewEdits := nil;
|
||||||
EditingKeyMap := TKeyCommandRelationList.Create;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TEditorGeneralOptionsFrame.Destroy;
|
destructor TEditorGeneralOptionsFrame.Destroy;
|
||||||
begin
|
begin
|
||||||
ClearHighlighters;
|
ClearHighlighters;
|
||||||
FColorSchemes.Free;
|
FColorSchemes.Free;
|
||||||
EditingKeyMap.Free;
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
98
ide/frames/options_editor_keymapping.lfm
Normal file
98
ide/frames/options_editor_keymapping.lfm
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
|
||||||
|
Height = 510
|
||||||
|
Width = 461
|
||||||
|
ClientHeight = 510
|
||||||
|
ClientWidth = 461
|
||||||
|
TabOrder = 0
|
||||||
|
Visible = False
|
||||||
|
DesignLeft = 154
|
||||||
|
DesignTop = 203
|
||||||
|
object KeyMappingHelpLabel: TLabel[0]
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = Owner
|
||||||
|
Height = 14
|
||||||
|
Width = 105
|
||||||
|
Caption = 'KeyMappingHelpLabel'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object KeyMappingFilterEdit: TEdit[1]
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = KeyMappingHelpLabel
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Height = 27
|
||||||
|
Top = 20
|
||||||
|
Width = 461
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Top = 6
|
||||||
|
OnChange = KeyMappingFilterEditChange
|
||||||
|
OnEnter = KeyMappingFilterEditEnter
|
||||||
|
OnExit = KeyMappingFilterEditExit
|
||||||
|
TabOrder = 0
|
||||||
|
Text = 'KeyMappingFilterEdit'
|
||||||
|
end
|
||||||
|
object KeyMappingTreeView: TTreeView[2]
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = KeyMappingFilterEdit
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = KeyMappingFindKeyButton
|
||||||
|
Height = 399
|
||||||
|
Top = 53
|
||||||
|
Width = 461
|
||||||
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
BorderSpacing.Top = 6
|
||||||
|
BorderSpacing.Bottom = 6
|
||||||
|
DefaultItemHeight = 15
|
||||||
|
ReadOnly = True
|
||||||
|
RowSelect = True
|
||||||
|
TabOrder = 1
|
||||||
|
OnMouseUp = KeyMappingTreeViewMouseUp
|
||||||
|
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoShowSeparators, tvoToolTips]
|
||||||
|
end
|
||||||
|
object KeyMappingFindKeyButton: TButton[3]
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = KeyMappingChooseSchemeButton
|
||||||
|
Height = 23
|
||||||
|
Top = 458
|
||||||
|
Width = 154
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Bottom = 6
|
||||||
|
Caption = 'KeyMappingFindKeyButton'
|
||||||
|
OnClick = KeyMappingFindKeyButtonClick
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object KeyMappingChooseSchemeButton: TButton[4]
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideBottom.Control = Owner
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
|
Height = 23
|
||||||
|
Top = 487
|
||||||
|
Width = 189
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
AutoSize = True
|
||||||
|
Caption = 'KeyMappingChooseSchemeButton'
|
||||||
|
OnClick = KeyMappingChooseSchemeButtonClick
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
|
object KeyMappingConsistencyCheckButton: TButton[5]
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = Owner
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
|
Left = 258
|
||||||
|
Height = 23
|
||||||
|
Top = 487
|
||||||
|
Width = 203
|
||||||
|
Anchors = [akRight, akBottom]
|
||||||
|
AutoSize = True
|
||||||
|
Caption = 'KeyMappingConsistencyCheckButton'
|
||||||
|
OnClick = KeyMappingConsistencyCheckButtonClick
|
||||||
|
TabOrder = 4
|
||||||
|
end
|
||||||
|
end
|
45
ide/frames/options_editor_keymapping.lrs
Normal file
45
ide/frames/options_editor_keymapping.lrs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{ This is an automatically generated lazarus resource file }
|
||||||
|
|
||||||
|
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#8'TabOrder'#2#0#7'Visible'#8#10'DesignLeft'#3#154#0#9'DesignTop'#3
|
||||||
|
+#203#0#0#242#2#0#6'TLabel'#19'KeyMappingHelpLabel'#22'AnchorSideLeft.Control'
|
||||||
|
+#7#5'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#6'Height'#2#14#5'Width'#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'AnchorSid'
|
||||||
|
+'eTop.Control'#7#19'KeyMappingHelpLabel'#18'AnchorSideTop.Side'#7#9'asrBotto'
|
||||||
|
+'m'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrB'
|
||||||
|
+'ottom'#6'Height'#2#27#3'Top'#2#20#5'Width'#3#205#1#7'Anchors'#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'KeyMappingFilterEditEnter'#6
|
||||||
|
+'OnExit'#7#24'KeyMappingFilterEditExit'#8'TabOrder'#2#0#4'Text'#6#20'KeyMapp'
|
||||||
|
+'ingFilterEdit'#0#0#242#2#2#9'TTreeView'#18'KeyMappingTreeView'#22'AnchorSid'
|
||||||
|
+'eLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#20'KeyMappingFilterEd'
|
||||||
|
+'it'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#5'O'
|
||||||
|
+'wner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7
|
||||||
|
+#23'KeyMappingFindKeyButton'#6'Height'#3#143#1#3'Top'#2'5'#5'Width'#3#205#1#7
|
||||||
|
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#17'BorderSpacing.To'
|
||||||
|
+'p'#2#6#20'BorderSpacing.Bottom'#2#6#17'DefaultItemHeight'#2#15#8'ReadOnly'#9
|
||||||
|
+#9'RowSelect'#9#8'TabOrder'#2#1#9'OnMouseUp'#7#25'KeyMappingTreeViewMouseUp'
|
||||||
|
+#7'Options'#11#17'tvoAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapse'
|
||||||
|
+'dNodes'#11'tvoReadOnly'#12'tvoRowSelect'#14'tvoShowButtons'#12'tvoShowLines'
|
||||||
|
+#11'tvoShowRoot'#17'tvoShowSeparators'#11'tvoToolTips'#0#0#0#242#2#3#7'TButt'
|
||||||
|
+'on'#23'KeyMappingFindKeyButton'#22'AnchorSideLeft.Control'#7#5'Owner'#20'An'
|
||||||
|
+'chorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#28'KeyMap'
|
||||||
|
+'pingChooseSchemeButton'#6'Height'#2#23#3'Top'#3#202#1#5'Width'#3#154#0#7'An'
|
||||||
|
+'chors'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Bottom'#2#6
|
||||||
|
+#7'Caption'#6#23'KeyMappingFindKeyButton'#7'OnClick'#7#28'KeyMappingFindKeyB'
|
||||||
|
+'uttonClick'#8'TabOrder'#2#2#0#0#242#2#4#7'TButton'#28'KeyMappingChooseSchem'
|
||||||
|
+'eButton'#22'AnchorSideLeft.Control'#7#5'Owner'#24'AnchorSideBottom.Control'
|
||||||
|
+#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#6'Height'#2#23#3'Top'#3
|
||||||
|
+#231#1#5'Width'#3#189#0#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#7
|
||||||
|
+'Caption'#6#28'KeyMappingChooseSchemeButton'#7'OnClick'#7'!KeyMappingChooseS'
|
||||||
|
+'chemeButtonClick'#8'TabOrder'#2#3#0#0#242#2#5#7'TButton KeyMappingConsisten'
|
||||||
|
+'cyCheckButton'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Si'
|
||||||
|
+'de'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBot'
|
||||||
|
+'tom.Side'#7#9'asrBottom'#4'Left'#3#2#1#6'Height'#2#23#3'Top'#3#231#1#5'Widt'
|
||||||
|
+'h'#3#203#0#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#7'Caption'#6
|
||||||
|
+' KeyMappingConsistencyCheckButton'#7'OnClick'#7'%KeyMappingConsistencyCheck'
|
||||||
|
+'ButtonClick'#8'TabOrder'#2#4#0#0#0
|
||||||
|
]);
|
384
ide/frames/options_editor_keymapping.pas
Normal file
384
ide/frames/options_editor_keymapping.pas
Normal file
@ -0,0 +1,384 @@
|
|||||||
|
unit options_editor_keymapping;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, FileUtil, LResources, Forms, StdCtrls, ComCtrls, Controls,
|
||||||
|
Dialogs, LCLType, LCLProc,
|
||||||
|
EditorOptions, LazarusIDEStrConsts, IDEOptionsIntf, IDEImagesIntf, options_editor_general,
|
||||||
|
KeymapSchemeDlg, KeyMapping, IDECommands, KeyMapShortCutDlg, SrcEditorIntf;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TEditorKeymappingOptionsFrame }
|
||||||
|
|
||||||
|
TEditorKeymappingOptionsFrame = class(TAbstractIDEOptionsEditor)
|
||||||
|
KeyMappingChooseSchemeButton: TButton;
|
||||||
|
KeyMappingConsistencyCheckButton: TButton;
|
||||||
|
KeyMappingFilterEdit: TEdit;
|
||||||
|
KeyMappingFindKeyButton: TButton;
|
||||||
|
KeyMappingHelpLabel: TLabel;
|
||||||
|
KeyMappingTreeView: TTreeView;
|
||||||
|
procedure KeyMappingChooseSchemeButtonClick(Sender: TObject);
|
||||||
|
procedure KeyMappingConsistencyCheckButtonClick(Sender: TObject);
|
||||||
|
procedure KeyMappingFilterEditChange(Sender: TObject);
|
||||||
|
procedure KeyMappingFilterEditEnter(Sender: TObject);
|
||||||
|
procedure KeyMappingFilterEditExit(Sender: TObject);
|
||||||
|
procedure KeyMappingFindKeyButtonClick(Sender: TObject);
|
||||||
|
procedure KeyMappingTreeViewMouseUp(Sender: TObject; Button: TMouseButton;
|
||||||
|
Shift: TShiftState; X, Y: Integer);
|
||||||
|
private
|
||||||
|
FDialog: TAbstractOptionsEditorDialog;
|
||||||
|
KeyMapNameFilter: string;
|
||||||
|
EditingKeyMap: TKeyCommandRelationList;
|
||||||
|
KeyMapKeyFilter: TIDEShortCut;
|
||||||
|
|
||||||
|
function GeneralPage: TEditorGeneralOptionsFrame; inline;
|
||||||
|
procedure FillKeyMappingTreeView;
|
||||||
|
function KeyMappingRelationToString(Index: Integer): String;
|
||||||
|
function KeyMappingRelationToString(KeyRelation: TKeyCommandRelation): String;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
|
||||||
|
function GetTitle: String; override;
|
||||||
|
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||||
|
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||||
|
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||||
|
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
imgKeyCategory, imgKeyItem: Integer;
|
||||||
|
|
||||||
|
type
|
||||||
|
TKeyMapErrorsForm = class(TForm)
|
||||||
|
ListBox: TListBox;
|
||||||
|
BackButton: TButton;
|
||||||
|
procedure BackButtonClick(Sender: TObject);
|
||||||
|
public
|
||||||
|
constructor Create(AnOwner: TComponent); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TKeyMapErrorsForm.Create(AnOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AnOwner);
|
||||||
|
if LazarusResources.Find(ClassName) = Nil then
|
||||||
|
begin
|
||||||
|
SetBounds((Screen.Width - 410) div 2, (Screen.Height - 260) div 2, 400, 250);
|
||||||
|
Caption := dlgKeyMappingErrors;
|
||||||
|
|
||||||
|
ListBox := TListBox.Create(Self);
|
||||||
|
with ListBox do
|
||||||
|
begin
|
||||||
|
Name := 'ListBox';
|
||||||
|
Align:=alTop;
|
||||||
|
Parent := Self;
|
||||||
|
end;
|
||||||
|
|
||||||
|
BackButton := TButton.Create(Self);
|
||||||
|
with BackButton do
|
||||||
|
begin
|
||||||
|
Name := 'BackButton';
|
||||||
|
AutoSize:=true;
|
||||||
|
Anchors:=[akBottom];
|
||||||
|
Parent := Self;
|
||||||
|
AnchorParallel(akBottom,6,Self);
|
||||||
|
Caption := dlgEdBack;
|
||||||
|
OnClick := @BackButtonClick;
|
||||||
|
end;
|
||||||
|
ListBox.AnchorToNeighbour(akBottom,6,BackButton);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TKeyMapErrorsForm.BackButtonClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ModalResult := mrOk;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TEditorKeymappingOptionsFrame }
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.KeyMappingFilterEditChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
Filter: String;
|
||||||
|
begin
|
||||||
|
if [csLoading, csDestroying] * ComponentState <> [] then
|
||||||
|
Exit;
|
||||||
|
Filter := KeyMappingFilterEdit.Text;
|
||||||
|
if (Filter = lisFilter2) or (Filter = KeyMappingFilterEdit.Name) then
|
||||||
|
Filter := '';
|
||||||
|
KeyMapNameFilter := Filter;
|
||||||
|
FillKeyMappingTreeView;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.KeyMappingChooseSchemeButtonClick(
|
||||||
|
Sender: TObject);
|
||||||
|
var
|
||||||
|
NewScheme: String;
|
||||||
|
begin
|
||||||
|
NewScheme := EditorOpts.KeyMappingScheme;
|
||||||
|
if ShowChooseKeySchemeDialog(NewScheme) <> mrOk then
|
||||||
|
Exit;
|
||||||
|
EditorOpts.KeyMappingScheme := NewScheme;
|
||||||
|
EditingKeyMap.LoadScheme(NewScheme);
|
||||||
|
FillKeyMappingTreeView;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.KeyMappingConsistencyCheckButtonClick(
|
||||||
|
Sender: TObject);
|
||||||
|
var
|
||||||
|
Protocol: TStringList;
|
||||||
|
ErrorCount, Index1, Index2: Integer;
|
||||||
|
ACaption, AText: String;
|
||||||
|
KeyMapErrorsForm: TKeyMapErrorsForm;
|
||||||
|
begin
|
||||||
|
Protocol := TStringList.Create;
|
||||||
|
try
|
||||||
|
ErrorCount := FindKeymapConflicts(EditingKeyMap, Protocol, Index1, Index2);
|
||||||
|
if ErrorCount > 0 then
|
||||||
|
begin
|
||||||
|
KeyMapErrorsForm := TKeyMapErrorsForm.Create(nil);
|
||||||
|
try
|
||||||
|
KeyMapErrorsForm.ListBox.Items.Assign(Protocol);
|
||||||
|
KeyMapErrorsForm.ShowModal;
|
||||||
|
finally
|
||||||
|
KeyMapErrorsForm.Free;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
ACaption := dlgReport;
|
||||||
|
AText := dlgEdNoErr;
|
||||||
|
MessageDlg(ACaption, AText, mtInformation, [mbOk], 0);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
Protocol.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.KeyMappingFilterEditEnter(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if KeyMappingFilterEdit.Text = lisFilter2 then
|
||||||
|
KeyMappingFilterEdit.Text := '';
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.KeyMappingFilterEditExit(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if KeyMappingFilterEdit.Text = '' then
|
||||||
|
KeyMappingFilterEdit.Text := lisFilter2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.KeyMappingFindKeyButtonClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
KeyFilter: TIDEShortCut;
|
||||||
|
begin
|
||||||
|
if ShowKeyMappingGrabForm(KeyFilter) <> mrOK then
|
||||||
|
Exit;
|
||||||
|
//debugln(['TEditorOptionsForm.KeyMappingFindKeyButtonClick ',KeyAndShiftStateToEditorKeyString(KeyFilter)]);
|
||||||
|
KeyMapKeyFilter := KeyFilter;
|
||||||
|
FillKeyMappingTreeView;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.KeyMappingTreeViewMouseUp(
|
||||||
|
Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
ARelation: TKeyCommandRelation;
|
||||||
|
ANode: TTreeNode;
|
||||||
|
begin
|
||||||
|
ANode := KeyMappingTreeView.GetNodeAt(X, Y);
|
||||||
|
if (ANode <> nil) and (ANode.Data <> nil) and
|
||||||
|
(TObject(ANode.Data) is TKeyCommandRelation) then
|
||||||
|
begin
|
||||||
|
ARelation := TKeyCommandRelation(ANode.Data);
|
||||||
|
i := EditingKeyMap.IndexOf(ARelation);
|
||||||
|
if (i >= 0) and (ShowKeyMappingEditForm(i, EditingKeyMap) = mrOk) then
|
||||||
|
begin
|
||||||
|
FillKeyMappingTreeView;
|
||||||
|
with GeneralPage do
|
||||||
|
for i := Low(PreviewEdits) to High(PreviewEdits) do
|
||||||
|
if PreviewEdits[i] <> nil then
|
||||||
|
EditingKeyMap.AssignTo(PreviewEdits[i].KeyStrokes, TSourceEditorWindowInterface);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TEditorKeymappingOptionsFrame.GeneralPage: TEditorGeneralOptionsFrame; inline;
|
||||||
|
begin
|
||||||
|
Result := TEditorGeneralOptionsFrame(FDialog.FindEditor(TEditorGeneralOptionsFrame));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TEditorKeymappingOptionsFrame.GetTitle: String;
|
||||||
|
begin
|
||||||
|
Result := dlgKeyMapping;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||||
|
begin
|
||||||
|
FDialog := ADialog;
|
||||||
|
KeyMappingChooseSchemeButton.Caption := lisEdOptsChooseScheme;
|
||||||
|
KeyMappingConsistencyCheckButton.Caption := dlgCheckConsistency;
|
||||||
|
KeyMappingHelpLabel.Caption := dlgEdHintCommand;
|
||||||
|
KeyMappingFilterEdit.Text := lisFilter2;
|
||||||
|
KeyMappingFindKeyButton.Caption := lisFindKeyCombination;
|
||||||
|
KeyMappingTreeView.Images := IDEImages.Images_16;
|
||||||
|
imgKeyCategory := IDEImages.LoadImage(16, 'item_keyboard');
|
||||||
|
imgKeyItem := IDEImages.LoadImage(16, 'item_character');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
with AOptions as TEditorOptions do
|
||||||
|
EditingKeyMap.Assign(KeyMap);
|
||||||
|
FillKeyMappingTreeView;
|
||||||
|
|
||||||
|
with GeneralPage do
|
||||||
|
for i := Low(PreviewEdits) to High(PreviewEdits) do
|
||||||
|
if PreviewEdits[i] <> nil then
|
||||||
|
EditingKeyMap.AssignTo(PreviewEdits[i].KeyStrokes, TSourceEditorWindowInterface);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||||
|
begin
|
||||||
|
with AOptions as TEditorOptions do
|
||||||
|
KeyMap.Assign(EditingKeyMap);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TEditorKeymappingOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
||||||
|
begin
|
||||||
|
Result := TEditorOptions;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TEditorKeymappingOptionsFrame.FillKeyMappingTreeView;
|
||||||
|
var
|
||||||
|
i, j: Integer;
|
||||||
|
NewCategoryNode, NewKeyNode: TTreeNode;
|
||||||
|
CurCategory: TIDECommandCategory;
|
||||||
|
CurKeyRelation: TKeyCommandRelation;
|
||||||
|
ChildNodeIndex: Integer;
|
||||||
|
CategoryNodeIndex: Integer;
|
||||||
|
HasFilter: Boolean;
|
||||||
|
ItemCaption: String;
|
||||||
|
NameFilterUp: String;
|
||||||
|
begin
|
||||||
|
HasFilter:=(KeyMapNameFilter<>'');
|
||||||
|
NameFilterUp:=uppercase(KeyMapNameFilter);
|
||||||
|
with KeyMappingTreeView do
|
||||||
|
begin
|
||||||
|
BeginUpdate;
|
||||||
|
CategoryNodeIndex:=0;
|
||||||
|
for i := 0 to EditingKeyMap.CategoryCount - 1 do
|
||||||
|
begin
|
||||||
|
CurCategory := EditingKeyMap.Categories[i];
|
||||||
|
if Items.TopLvlCount > CategoryNodeIndex then
|
||||||
|
begin
|
||||||
|
NewCategoryNode := Items.TopLvlItems[CategoryNodeIndex];
|
||||||
|
NewCategoryNode.Text := CurCategory.Description;
|
||||||
|
NewCategoryNode.Data := CurCategory;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
NewCategoryNode := Items.AddObject(Nil, CurCategory.Description, CurCategory);
|
||||||
|
NewCategoryNode.ImageIndex := imgKeyCategory;
|
||||||
|
NewCategoryNode.SelectedIndex := NewCategoryNode.ImageIndex;
|
||||||
|
ChildNodeIndex:=0;
|
||||||
|
for j := 0 to CurCategory.Count - 1 do
|
||||||
|
begin
|
||||||
|
CurKeyRelation := TKeyCommandRelation(CurCategory[j]);
|
||||||
|
ItemCaption:=KeyMappingRelationToString(CurKeyRelation);
|
||||||
|
if (NameFilterUp<>'')
|
||||||
|
and (System.Pos(NameFilterUp,UpperCase(ItemCaption))=0) then
|
||||||
|
continue;
|
||||||
|
if (KeyMapKeyFilter.Key1<>VK_UNKNOWN)
|
||||||
|
and (CompareIDEShortCutKey1s(@KeyMapKeyFilter,@CurKeyRelation.ShortcutA)<>0)
|
||||||
|
and (CompareIDEShortCutKey1s(@KeyMapKeyFilter,@CurKeyRelation.ShortcutB)<>0)
|
||||||
|
then
|
||||||
|
continue;
|
||||||
|
if NewCategoryNode.Count > ChildNodeIndex then
|
||||||
|
begin
|
||||||
|
NewKeyNode := NewCategoryNode.Items[ChildNodeIndex];
|
||||||
|
NewKeyNode.Text := ItemCaption;
|
||||||
|
NewKeyNode.Data := CurKeyRelation;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
NewKeyNode := Items.AddChildObject(NewCategoryNode,
|
||||||
|
ItemCaption, CurKeyRelation);
|
||||||
|
NewKeyNode.ImageIndex := imgKeyItem;
|
||||||
|
NewKeyNode.SelectedIndex := NewKeyNode.ImageIndex;
|
||||||
|
inc(ChildNodeIndex);
|
||||||
|
end;
|
||||||
|
// delete unneeded ones
|
||||||
|
while NewCategoryNode.Count > ChildNodeIndex do
|
||||||
|
NewCategoryNode[NewCategoryNode.Count - 1].Delete;
|
||||||
|
if NewCategoryNode.Count>0 then begin
|
||||||
|
if HasFilter then
|
||||||
|
NewCategoryNode.Expanded:=true;
|
||||||
|
inc(CategoryNodeIndex);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
while Items.TopLvlCount > CategoryNodeIndex do
|
||||||
|
Items.TopLvlItems[Items.TopLvlCount - 1].Delete;
|
||||||
|
EndUpdate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TEditorKeymappingOptionsFrame.KeyMappingRelationToString(Index: Integer): String;
|
||||||
|
begin
|
||||||
|
Result := KeyMappingRelationToString(EditingKeyMap.Relations[Index]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TEditorKeymappingOptionsFrame.KeyMappingRelationToString(
|
||||||
|
KeyRelation: TKeyCommandRelation): String;
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
|
CopiedLength: Integer;
|
||||||
|
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 (ShortcutA.Key1 = VK_UNKNOWN) and (ShortcutB.Key1 = VK_UNKNOWN) then
|
||||||
|
Result := Result + lisNone2
|
||||||
|
else
|
||||||
|
if (ShortcutA.Key1 = VK_UNKNOWN) then
|
||||||
|
Result := Result + KeyAndShiftStateToEditorKeyString(ShortcutB)
|
||||||
|
else
|
||||||
|
if (ShortcutB.Key1 = VK_UNKNOWN) then
|
||||||
|
Result := Result + KeyAndShiftStateToEditorKeyString(ShortcutA)
|
||||||
|
else
|
||||||
|
Result := Result + KeyAndShiftStateToEditorKeyString(ShortcutA)
|
||||||
|
+ ' '+lisOr+' ' +
|
||||||
|
KeyAndShiftStateToEditorKeyString(ShortcutB);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TEditorKeymappingOptionsFrame.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
EditingKeyMap := TKeyCommandRelationList.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TEditorKeymappingOptionsFrame.Destroy;
|
||||||
|
begin
|
||||||
|
EditingKeyMap.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
{$I options_editor_keymapping.lrs}
|
||||||
|
RegisterIDEOptionsEditor(GroupEditor, TEditorKeymappingOptionsFrame, EdtOptionsKeys);
|
||||||
|
end.
|
||||||
|
|
@ -41,7 +41,7 @@
|
|||||||
<PackageName Value="SynEdit"/>
|
<PackageName Value="SynEdit"/>
|
||||||
</Item4>
|
</Item4>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="13">
|
<Units Count="14">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="lazarus.pp"/>
|
<Filename Value="lazarus.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -143,6 +143,14 @@
|
|||||||
<ResourceFilename Value="frames\options_editor_display.lrs"/>
|
<ResourceFilename Value="frames\options_editor_display.lrs"/>
|
||||||
<UnitName Value="options_editor_display"/>
|
<UnitName Value="options_editor_display"/>
|
||||||
</Unit12>
|
</Unit12>
|
||||||
|
<Unit13>
|
||||||
|
<Filename Value="frames\options_editor_keymapping.pas"/>
|
||||||
|
<ComponentName Value="EditorKeymappingOptionsFrame"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Frame"/>
|
||||||
|
<ResourceFilename Value="frames\options_editor_keymapping.lrs"/>
|
||||||
|
<UnitName Value="options_editor_keymapping"/>
|
||||||
|
</Unit13>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -129,7 +129,7 @@ uses
|
|||||||
IDEOptionsIntf, IDEOptionsDlg, EditorOptionsDlg {temporary},
|
IDEOptionsIntf, IDEOptionsDlg, EditorOptionsDlg {temporary},
|
||||||
options_files, options_desktop, options_window, options_formed, options_oi,
|
options_files, options_desktop, options_window, options_formed, options_oi,
|
||||||
options_backup, options_naming, options_fpdoc,
|
options_backup, options_naming, options_fpdoc,
|
||||||
options_editor_general, options_editor_display;
|
options_editor_general, options_editor_display, options_editor_keymapping;
|
||||||
|
|
||||||
type
|
type
|
||||||
TIDEProjectItem =
|
TIDEProjectItem =
|
||||||
|
Loading…
Reference in New Issue
Block a user