ide: merge keymapping into ide options

git-svn-id: trunk@17174 -
This commit is contained in:
paul 2008-11-01 17:25:12 +00:00
parent c5e876817b
commit 566abcc5b5
9 changed files with 593 additions and 63 deletions

3
.gitattributes vendored
View File

@ -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.lrs svneol=native#text/plain
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.lrs svneol=native#text/pascal
ide/frames/options_files.pas svneol=native#text/pascal

View File

@ -3,9 +3,10 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
Width = 454
ClientHeight = 504
ClientWidth = 454
TabOrder = 0
Visible = False
DesignLeft = 176
DesignTop = 232
DesignLeft = 66
DesignTop = 87
object BlockIndentLabel: TLabel[0]
AnchorSideLeft.Control = BlockIndentComboBox
AnchorSideLeft.Side = asrBottom
@ -89,7 +90,6 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
'4'
'8'
)
MaxLength = -1
OnChange = ComboboxOnChange
OnExit = ComboBoxOnExit
OnKeyDown = ComboboxOnKeyDown
@ -110,7 +110,6 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
'4096'
'512'
)
MaxLength = -1
OnChange = ComboboxOnChange
OnExit = ComboBoxOnExit
OnKeyDown = ComboboxOnKeyDown
@ -132,7 +131,6 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
'4'
'8'
)
MaxLength = -1
OnChange = ComboboxOnChange
OnExit = ComboBoxOnExit
OnKeyDown = ComboboxOnKeyDown

View File

@ -3,53 +3,53 @@
LazarusResources.Add('TEditorGeneralOptionsFrame','FORMDATA',[
'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
+#1#7'Visible'#8#10'DesignLeft'#3#176#0#9'DesignTop'#3#232#0#0#242#2#0#6'TLab'
+'el'#16'BlockIndentLabel'#22'AnchorSideLeft.Control'#7#19'BlockIndentComboBo'
+'x'#19'AnchorSideLeft.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#19
+'BlockIndentComboBox'#21'AnchorSideBottom.Side'#7#9'asrCenter'#4'Left'#2'j'#6
+'Height'#2#14#3'Top'#3#179#1#5'Width'#2'R'#7'Anchors'#11#6'akLeft'#8'akBotto'
+'m'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#16'BlockIndentLabel'#11'Pare'
+'ntColor'#8#0#0#242#2#1#6'TLabel'#14'UndoLimitLabel'#22'AnchorSideLeft.Contr'
+'ol'#7#17'UndoLimitComboBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#24'Ancho'
+'rSideBottom.Control'#7#17'UndoLimitComboBox'#21'AnchorSideBottom.Side'#7#9
+'asrCenter'#4'Left'#2'j'#6'Height'#2#14#3'Top'#3#206#1#5'Width'#2'H'#7'Ancho'
+'rs'#11#6'akLeft'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#14
+'UndoLimitLabel'#11'ParentColor'#8#0#0#242#2#2#6'TLabel'#14'TabWidthsLabel'
+#22'AnchorSideLeft.Control'#7#17'TabWidthsComboBox'#19'AnchorSideLeft.Side'#7
+#9'asrBottom'#24'AnchorSideBottom.Control'#7#17'TabWidthsComboBox'#21'Anchor'
+'SideBottom.Side'#7#9'asrCenter'#4'Left'#2'j'#6'Height'#2#14#3'Top'#3#230#1#5
+'Width'#2'M'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#20'BorderSpacing.Around'#2
+#6#7'Caption'#6#14'TabWidthsLabel'#11'ParentColor'#8#0#0#242#2#3#11'TCheckGr'
+'oup'#21'EditorOptionsGroupBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anc'
+'horSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'#20'An'
+'chorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#19'BlockI'
+'ndentComboBox'#6'Height'#3#170#1#5'Width'#3#198#1#5'Align'#7#5'alTop'#7'Anc'
+'hors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'AutoFill'#9#20'Borde'
+'rSpacing.Bottom'#2#6#7'Caption'#6#21'EditorOptionsGroupBox'#28'ChildSizing.'
+'LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.E'
+'nlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVert'
+'ical'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14
+'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'Chil'
+'dSizing.Layout'#7#29'cclTopToBottomThenLeftToRight'#27'ChildSizing.Controls'
+'PerLine'#2#1#12'ColumnLayout'#7#24'clVerticalThenHorizontal'#7'Columns'#2#2
+#11'OnItemClick'#7#30'EditorOptionsGroupBoxItemClick'#8'TabOrder'#2#0#0#0#242
+#2#4#9'TComboBox'#19'BlockIndentComboBox'#22'AnchorSideLeft.Control'#7#5'Own'
+'er'#24'AnchorSideBottom.Control'#7#17'UndoLimitComboBox'#6'Height'#2#21#3'T'
+'op'#3#176#1#5'Width'#2'd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#20'BorderSp'
+'acing.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'
+#7#14'ComboBoxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#1#0
+#0#242#2#5#9'TComboBox'#17'UndoLimitComboBox'#22'AnchorSideLeft.Control'#7#5
+'Owner'#24'AnchorSideBottom.Control'#7#14'TabWidthsLabel'#6'Height'#2#21#3'T'
+'op'#3#203#1#5'Width'#2'd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#17'BorderSp'
+'acing.Top'#2#6#20'BorderSpacing.Bottom'#2#6#10'ItemHeight'#2#13#13'Items.St'
+'rings'#1#6#5'32767'#6#4'4096'#6#3'512'#0#9'MaxLength'#2#255#8'OnChange'#7#16
+'ComboboxOnChange'#6'OnExit'#7#14'ComboBoxOnExit'#9'OnKeyDown'#7#17'Combobox'
+'OnKeyDown'#8'TabOrder'#2#2#0#0#242#2#6#9'TComboBox'#17'TabWidthsComboBox'#22
+'AnchorSideLeft.Control'#7#5'Owner'#24'AnchorSideBottom.Control'#7#5'Owner'
+#21'AnchorSideBottom.Side'#7#9'asrBottom'#6'Height'#2#21#3'Top'#3#227#1#5'Wi'
+'dth'#2'd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#17'BorderSpacing.Top'#2#6#10
+'ItemHeight'#2#13#13'Items.Strings'#1#6#1'1'#6#1'2'#6#1'4'#6#1'8'#0#9'MaxLen'
+'gth'#2#255#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7#14'ComboBoxOnExit'
+#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#3#0#0#0
+#1#8'TabOrder'#2#0#7'Visible'#8#10'DesignLeft'#2'B'#9'DesignTop'#2'W'#0#242#2
+#0#6'TLabel'#16'BlockIndentLabel'#22'AnchorSideLeft.Control'#7#19'BlockInden'
+'tComboBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#24'AnchorSideBottom.Contr'
+'ol'#7#19'BlockIndentComboBox'#21'AnchorSideBottom.Side'#7#9'asrCenter'#4'Le'
+'ft'#2'j'#6'Height'#2#14#3'Top'#3#179#1#5'Width'#2'R'#7'Anchors'#11#6'akLeft'
+#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#16'BlockIndentLabel'
+#11'ParentColor'#8#0#0#242#2#1#6'TLabel'#14'UndoLimitLabel'#22'AnchorSideLef'
+'t.Control'#7#17'UndoLimitComboBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#24
+'AnchorSideBottom.Control'#7#17'UndoLimitComboBox'#21'AnchorSideBottom.Side'
+#7#9'asrCenter'#4'Left'#2'j'#6'Height'#2#14#3'Top'#3#206#1#5'Width'#2'H'#7'A'
+'nchors'#11#6'akLeft'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6
+#14'UndoLimitLabel'#11'ParentColor'#8#0#0#242#2#2#6'TLabel'#14'TabWidthsLabe'
+'l'#22'AnchorSideLeft.Control'#7#17'TabWidthsComboBox'#19'AnchorSideLeft.Sid'
+'e'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#17'TabWidthsComboBox'#21'A'
+'nchorSideBottom.Side'#7#9'asrCenter'#4'Left'#2'j'#6'Height'#2#14#3'Top'#3
+#230#1#5'Width'#2'M'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#20'BorderSpacing.'
+'Around'#2#6#7'Caption'#6#14'TabWidthsLabel'#11'ParentColor'#8#0#0#242#2#3#11
+'TCheckGroup'#21'EditorOptionsGroupBox'#22'AnchorSideLeft.Control'#7#5'Owner'
+#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'
+#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#19'B'
+'lockIndentComboBox'#6'Height'#3#170#1#5'Width'#3#198#1#5'Align'#7#5'alTop'#7
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'AutoFill'#9#20'Bo'
+'rderSpacing.Bottom'#2#6#7'Caption'#6#21'EditorOptionsGroupBox'#28'ChildSizi'
+'ng.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizin'
+'g.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeV'
+'ertical'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7
+#14'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'C'
+'hildSizing.Layout'#7#29'cclTopToBottomThenLeftToRight'#27'ChildSizing.Contr'
+'olsPerLine'#2#1#12'ColumnLayout'#7#24'clVerticalThenHorizontal'#7'Columns'#2
+#2#11'OnItemClick'#7#30'EditorOptionsGroupBoxItemClick'#8'TabOrder'#2#0#0#0
+#242#2#4#9'TComboBox'#19'BlockIndentComboBox'#22'AnchorSideLeft.Control'#7#5
+'Owner'#24'AnchorSideBottom.Control'#7#17'UndoLimitComboBox'#6'Height'#2#21#3
+'Top'#3#176#1#5'Width'#2'd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#20'BorderS'
+'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#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7#14'ComboBoxOnExi'
+'t'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#1#0#0#242#2#5#9'TComb'
+'oBox'#17'UndoLimitComboBox'#22'AnchorSideLeft.Control'#7#5'Owner'#24'Anchor'
+'SideBottom.Control'#7#14'TabWidthsLabel'#6'Height'#2#21#3'Top'#3#203#1#5'Wi'
+'dth'#2'd'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#17'BorderSpacing.Top'#2#6#20
+'BorderSpacing.Bottom'#2#6#10'ItemHeight'#2#13#13'Items.Strings'#1#6#5'32767'
+#6#4'4096'#6#3'512'#0#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7#14'Comb'
+'oBoxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#2#0#0#242#2#6
+#9'TComboBox'#17'TabWidthsComboBox'#22'AnchorSideLeft.Control'#7#5'Owner'#24
+'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBotto'
+'m'#6'Height'#2#21#3'Top'#3#227#1#5'Width'#2'd'#7'Anchors'#11#6'akLeft'#8'ak'
+'Bottom'#0#17'BorderSpacing.Top'#2#6#10'ItemHeight'#2#13#13'Items.Strings'#1
+#6#1'1'#6#1'2'#6#1'4'#6#1'8'#0#8'OnChange'#7#16'ComboboxOnChange'#6'OnExit'#7
+#14'ComboBoxOnExit'#9'OnKeyDown'#7#17'ComboboxOnKeyDown'#8'TabOrder'#2#3#0#0
+#0
]);

View File

@ -27,8 +27,7 @@ interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Graphics, LCLProc, LCLType,
StdCtrls, SynEdit, Controls, ExtCtrls,
EditorOptions, LazarusIDEStrConsts, IDEProcs, IDEOptionsIntf, SrcEditorIntf,
KeyMapping;
EditorOptions, LazarusIDEStrConsts, IDEProcs, IDEOptionsIntf;
type
TPreviewEditor = TSynEdit;
@ -55,7 +54,6 @@ type
PreviewEdits: array of TPreviewEditor;
PreviewSyn: TSrcIDEHighlighter;
CurLanguageID: Integer;
EditingKeyMap: TKeyCommandRelationList;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -176,7 +174,6 @@ begin
PreviewSyn := GetHighlighter(TPreviewPasSyn, GetCurColorScheme(TPreviewPasSyn.GetLanguageName), True);
CurLanguageID := HighlighterList.FindByClass(TCustomSynClass(PreviewSyn.ClassType));
EditingKeyMap.Assign(KeyMap);
for i := Low(PreviewEdits) to High(PreviewEdits) do
if PreviewEdits[i] <> nil then
@ -185,7 +182,6 @@ begin
if UseSyntaxHighlight then
Highlighter := PreviewSyn;
GetSynEditPreviewSettings(PreviewEdits[i]);
EditingKeyMap.AssignTo(PreviewEdits[i].KeyStrokes, TSourceEditorWindowInterface);
Lines.Text := HighlighterList[CurLanguageID].SampleSource;
CaretXY := HighlighterList[CurLanguageID].CaretXY;
TopLine := 1;
@ -450,14 +446,12 @@ constructor TEditorGeneralOptionsFrame.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
PreviewEdits := nil;
EditingKeyMap := TKeyCommandRelationList.Create;
end;
destructor TEditorGeneralOptionsFrame.Destroy;
begin
ClearHighlighters;
FColorSchemes.Free;
EditingKeyMap.Free;
inherited Destroy;
end;

View 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

View 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
]);

View 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.

View File

@ -41,7 +41,7 @@
<PackageName Value="SynEdit"/>
</Item4>
</RequiredPackages>
<Units Count="13">
<Units Count="14">
<Unit0>
<Filename Value="lazarus.pp"/>
<IsPartOfProject Value="True"/>
@ -143,6 +143,14 @@
<ResourceFilename Value="frames\options_editor_display.lrs"/>
<UnitName Value="options_editor_display"/>
</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>
</ProjectOptions>
<CompilerOptions>

View File

@ -129,7 +129,7 @@ uses
IDEOptionsIntf, IDEOptionsDlg, EditorOptionsDlg {temporary},
options_files, options_desktop, options_window, options_formed, options_oi,
options_backup, options_naming, options_fpdoc,
options_editor_general, options_editor_display;
options_editor_general, options_editor_display, options_editor_keymapping;
type
TIDEProjectItem =