IDE: Improve keymapping options frame.

git-svn-id: trunk@35472 -
This commit is contained in:
juha 2012-02-19 09:58:48 +00:00
parent 6e64f6d1fc
commit 5866b2577e
3 changed files with 257 additions and 211 deletions

View File

@ -1,5 +1,7 @@
inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
Left = 0
Height = 510 Height = 510
Top = 0
Width = 461 Width = 461
ClientHeight = 510 ClientHeight = 510
ClientWidth = 461 ClientWidth = 461
@ -7,113 +9,138 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
Visible = False Visible = False
DesignLeft = 303 DesignLeft = 303
DesignTop = 99 DesignTop = 99
object KeyMappingHelpLabel: TLabel[0] object HelpLabel: TLabel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
Left = 0 Left = 0
Height = 18 Height = 15
Top = 0 Top = 0
Width = 140 Width = 56
Caption = 'KeyMappingHelpLabel' Caption = 'HelpLabel'
ParentColor = False ParentColor = False
end end
object KeyMappingFilterEdit: TEdit[1] object TreeView: TTreeView
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = KeyMappingHelpLabel AnchorSideTop.Control = FilterEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 27 Height = 402
Top = 24 Top = 48
Width = 461
Anchors = [akTop, akLeft, akRight]
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
Left = 0
Height = 383
Top = 57
Width = 461 Width = 461
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 6 BorderSpacing.Top = 3
BorderSpacing.Bottom = 6 DefaultItemHeight = 16
DefaultItemHeight = 19 PopupMenu = PopupMenu1
ReadOnly = True ReadOnly = True
RightClickSelect = True
RowSelect = True RowSelect = True
ScrollBars = ssAutoBoth ScrollBars = ssAutoBoth
TabOrder = 1 TabOrder = 0
OnDblClick = KeyMappingTreeViewDblClick OnDblClick = TreeViewDblClick
OnSelectionChanged = KeyMappingTreeViewSelectionChanged OnKeyPress = TreeViewKeyPress
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw] OnSelectionChanged = TreeViewSelectionChanged
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
end end
object KeyMappingFindKeyButton: TButton[3] object FilterEdit: TTreeFilterEdit
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = HelpLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 0
Height = 24
Top = 21
Width = 224
ButtonWidth = 23
NumGlyphs = 0
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
MaxLength = 0
TabOrder = 1
FilteredTreeview = TreeView
ExpandAllInitially = True
end
object ClearButton: TBitBtn
AnchorSideRight.Side = asrBottom
Left = 380
Height = 25
Top = 455
Width = 81
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Bottom = 6
Caption = 'ClearButton'
OnClick = ClearButtonClick
TabOrder = 2
end
object FindKeyButton: TBitBtn
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = KeyMappingChooseSchemeButton
Left = 0 Left = 0
Height = 29 Height = 25
Top = 446 Top = 455
Width = 178 Width = 93
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
Caption = 'KeyMappingFindKeyButton' Caption = 'FindKeyButton'
OnClick = KeyMappingFindKeyButtonClick OnClick = FindKeyButtonClick
TabOrder = 2
end
object KeyMappingChooseSchemeButton: TButton[4]
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 29
Top = 481
Width = 232
Anchors = [akLeft, akBottom]
AutoSize = True
Caption = 'KeyMappingChooseSchemeButton'
OnClick = KeyMappingChooseSchemeButtonClick
TabOrder = 3 TabOrder = 3
end end
object KeyMappingConsistencyCheckButton: TButton[5] object ConsistencyCheckButton: TBitBtn
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 214 Left = 308
Height = 29 Height = 25
Top = 481 Top = 485
Width = 247 Width = 153
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
AutoSize = True AutoSize = True
Caption = 'KeyMappingConsistencyCheckButton' Caption = 'ConsistencyCheckButton'
OnClick = KeyMappingConsistencyCheckButtonClick OnClick = ConsistencyCheckButtonClick
TabOrder = 4 TabOrder = 4
end end
object KeyMappingClearButton: TButton[6] object ChooseSchemeButton: TBitBtn
AnchorSideTop.Control = KeyMappingFindKeyButton AnchorSideLeft.Control = Owner
AnchorSideRight.Control = KeyMappingConsistencyCheckButton AnchorSideBottom.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 297 Left = 0
Height = 29 Height = 25
Top = 446 Top = 485
Width = 164 Width = 138
Anchors = [akTop, akRight] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
Caption = 'KeyMappingClearButton' Caption = 'ChooseSchemeButton'
OnClick = KeyMappingClearButtonClick OnClick = ChooseSchemeButtonClick
TabOrder = 5 TabOrder = 5
end end
object SchemeLabel: TLabel
AnchorSideLeft.Control = ChooseSchemeButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ChooseSchemeButton
AnchorSideTop.Side = asrCenter
Left = 144
Height = 15
Top = 490
Width = 76
BorderSpacing.Around = 6
Caption = 'SchemeLabel'
ParentColor = False
end
object PopupMenu1: TPopupMenu
OnPopup = PopupMenu1Popup
left = 356
top = 16
object EditMenuItem: TMenuItem
Caption = 'Edit Key Mapping'
OnClick = EditMenuItemClick
end
object ClearMenuItem: TMenuItem
Caption = 'Clear Key Mapping'
OnClick = ClearMenuItemClick
end
end
end end

View File

@ -25,10 +25,9 @@ unit editor_keymapping_options;
interface interface
uses uses
Classes, SysUtils, FileUtil, Forms, StdCtrls, ComCtrls, Controls, Classes, SysUtils, FileUtil, TreeFilterEdit, Forms, StdCtrls, ComCtrls,
Dialogs, LCLType, LCLProc, Controls, Dialogs, LCLType, LCLProc, Menus, Buttons, EditorOptions,
EditorOptions, LazarusIDEStrConsts, IDEOptionsIntf, IDEImagesIntf, LazarusIDEStrConsts, IDEOptionsIntf, IDEImagesIntf, editor_general_options,
editor_general_options,
KeymapSchemeDlg, KeyMapping, IDECommands, KeyMapShortCutDlg, SrcEditorIntf; KeymapSchemeDlg, KeyMapping, IDECommands, KeyMapShortCutDlg, SrcEditorIntf;
type type
@ -36,33 +35,40 @@ type
{ TEditorKeymappingOptionsFrame } { TEditorKeymappingOptionsFrame }
TEditorKeymappingOptionsFrame = class(TAbstractIDEOptionsEditor) TEditorKeymappingOptionsFrame = class(TAbstractIDEOptionsEditor)
KeyMappingClearButton: TButton; ChooseSchemeButton: TBitBtn;
KeyMappingChooseSchemeButton: TButton; ClearButton: TBitBtn;
KeyMappingConsistencyCheckButton: TButton; ConsistencyCheckButton: TBitBtn;
KeyMappingFilterEdit: TEdit; FilterEdit: TTreeFilterEdit;
KeyMappingFindKeyButton: TButton; FindKeyButton: TBitBtn;
KeyMappingHelpLabel: TLabel; HelpLabel: TLabel;
KeyMappingTreeView: TTreeView; SchemeLabel: TLabel;
procedure KeyMappingChooseSchemeButtonClick(Sender: TObject); TreeView: TTreeView;
procedure KeyMappingClearButtonClick(Sender: TObject); EditMenuItem: TMenuItem;
procedure KeyMappingConsistencyCheckButtonClick(Sender: TObject); ClearMenuItem: TMenuItem;
procedure KeyMappingFilterEditChange(Sender: TObject); PopupMenu1: TPopupMenu;
procedure KeyMappingFilterEditEnter(Sender: TObject); procedure ClearMenuItemClick(Sender: TObject);
procedure KeyMappingFilterEditExit(Sender: TObject); procedure EditMenuItemClick(Sender: TObject);
procedure KeyMappingFindKeyButtonClick(Sender: TObject); procedure ChooseSchemeButtonClick(Sender: TObject);
procedure KeyMappingTreeViewDblClick(Sender: TObject); procedure ClearButtonClick(Sender: TObject);
procedure KeyMappingTreeViewSelectionChanged(Sender: TObject); procedure ConsistencyCheckButtonClick(Sender: TObject);
procedure FindKeyButtonClick(Sender: TObject);
procedure TreeViewDblClick(Sender: TObject);
procedure TreeViewKeyPress(Sender: TObject; var Key: char);
procedure TreeViewSelectionChanged(Sender: TObject);
procedure PopupMenu1Popup(Sender: TObject);
private private
FDialog: TAbstractOptionsEditorDialog; FDialog: TAbstractOptionsEditorDialog;
KeyMapNameFilter: string;
EditingKeyMap: TKeyCommandRelationList; EditingKeyMap: TKeyCommandRelationList;
KeyMapKeyFilter: TIDEShortCut; KeyMapKeyFilter: TIDEShortCut;
fModified: Boolean;
function GeneralPage: TEditorGeneralOptionsFrame; inline; function GeneralPage: TEditorGeneralOptionsFrame; inline;
procedure FillKeyMappingTreeView; procedure FillKeyMappingTreeView;
procedure EditCommandMapping(ANode: TTreeNode);
procedure ClearCommandMapping(ANode: TTreeNode);
function KeyMappingRelationToString(Index: Integer): String; function KeyMappingRelationToString(Index: Integer): String;
function KeyMappingRelationToString(KeyRelation: TKeyCommandRelation): String; function KeyMappingRelationToString(KeyRelation: TKeyCommandRelation): String;
procedure UpdateKeyFilterButton; procedure UpdateKeyFilterButton;
procedure UpdateSchemeLabel;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -126,21 +132,21 @@ end;
{ TEditorKeymappingOptionsFrame } { TEditorKeymappingOptionsFrame }
procedure TEditorKeymappingOptionsFrame.KeyMappingFilterEditChange(Sender: TObject); constructor TEditorKeymappingOptionsFrame.Create(AOwner: TComponent);
var
Filter: String;
begin begin
if [csLoading, csDestroying] * ComponentState <> [] then inherited Create(AOwner);
Exit; EditingKeyMap := TKeyCommandRelationList.Create;
Filter := KeyMappingFilterEdit.Text; ClearButton.Enabled:=false;
if (Filter = lisCEFilter) or (Filter = KeyMappingFilterEdit.Name) then fModified:=False;
Filter := '';
KeyMapNameFilter := Filter;
FillKeyMappingTreeView;
end; end;
procedure TEditorKeymappingOptionsFrame.KeyMappingChooseSchemeButtonClick( destructor TEditorKeymappingOptionsFrame.Destroy;
Sender: TObject); begin
EditingKeyMap.Free;
inherited Destroy;
end;
procedure TEditorKeymappingOptionsFrame.ChooseSchemeButtonClick(Sender: TObject);
var var
NewScheme: String; NewScheme: String;
begin begin
@ -150,35 +156,16 @@ begin
EditorOpts.KeyMappingScheme := NewScheme; EditorOpts.KeyMappingScheme := NewScheme;
EditingKeyMap.LoadScheme(NewScheme); EditingKeyMap.LoadScheme(NewScheme);
FillKeyMappingTreeView; FillKeyMappingTreeView;
fModified:=False;
UpdateSchemeLabel;
end; end;
procedure TEditorKeymappingOptionsFrame.KeyMappingClearButtonClick( procedure TEditorKeymappingOptionsFrame.ClearButtonClick(Sender: TObject);
Sender: TObject);
var
i: integer;
ARelation: TKeyCommandRelation;
ANode: TTreeNode;
begin begin
ANode := KeyMappingTreeView.Selected; ClearCommandMapping(TreeView.Selected);
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
ARelation.ShortcutA := IDEShortCut(VK_UNKNOWN, []);
ARelation.ShortcutB := IDEShortCut(VK_UNKNOWN, []);
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; end;
procedure TEditorKeymappingOptionsFrame.KeyMappingConsistencyCheckButtonClick( procedure TEditorKeymappingOptionsFrame.ConsistencyCheckButtonClick(
Sender: TObject); Sender: TObject);
var var
Protocol: TStringList; Protocol: TStringList;
@ -210,64 +197,61 @@ begin
end; end;
end; end;
procedure TEditorKeymappingOptionsFrame.KeyMappingFilterEditEnter(Sender: TObject); procedure TEditorKeymappingOptionsFrame.FindKeyButtonClick(Sender: TObject);
begin
if KeyMappingFilterEdit.Text = lisCEFilter then
KeyMappingFilterEdit.Text := '';
end;
procedure TEditorKeymappingOptionsFrame.KeyMappingFilterEditExit(Sender: TObject);
begin
if KeyMappingFilterEdit.Text = '' then
KeyMappingFilterEdit.Text := lisCEFilter;
end;
procedure TEditorKeymappingOptionsFrame.KeyMappingFindKeyButtonClick(Sender: TObject);
var var
KeyFilter: TIDEShortCut; KeyFilter: TIDEShortCut;
begin begin
if ShowKeyMappingGrabForm(KeyFilter) <> mrOK then if ShowKeyMappingGrabForm(KeyFilter) <> mrOK then
Exit; Exit;
//debugln(['TEditorOptionsForm.KeyMappingFindKeyButtonClick ',KeyAndShiftStateToEditorKeyString(KeyFilter)]);
KeyMapKeyFilter := KeyFilter; KeyMapKeyFilter := KeyFilter;
UpdateKeyFilterButton; UpdateKeyFilterButton;
FillKeyMappingTreeView; FillKeyMappingTreeView;
end; end;
procedure TEditorKeymappingOptionsFrame.KeyMappingTreeViewDblClick( procedure TEditorKeymappingOptionsFrame.TreeViewDblClick(Sender: TObject);
Sender: TObject);
var var
P: TPoint; P: TPoint;
i: integer;
ARelation: TKeyCommandRelation;
ANode: TTreeNode; ANode: TTreeNode;
begin begin
P := KeyMappingTreeView.ScreenToClient(Mouse.CursorPos); P := TreeView.ScreenToClient(Mouse.CursorPos);
ANode := KeyMappingTreeView.GetNodeAt(P.X, P.Y); ANode := TreeView.GetNodeAt(P.X, P.Y);
if (ANode <> nil) and (ANode.Data <> nil) and if (ANode<>nil) and (ANode.Data<>nil) and (TObject(ANode.Data) is TKeyCommandRelation) then
(TObject(ANode.Data) is TKeyCommandRelation) then EditCommandMapping(ANode);
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; end;
procedure TEditorKeymappingOptionsFrame.KeyMappingTreeViewSelectionChanged( procedure TEditorKeymappingOptionsFrame.TreeViewKeyPress(Sender: TObject; var Key: char);
Sender: TObject); begin
if Key = char(VK_RETURN) then
EditCommandMapping(TreeView.Selected);
end;
procedure TEditorKeymappingOptionsFrame.TreeViewSelectionChanged(Sender: TObject);
var var
ANode: TTreeNode; ANode: TTreeNode;
begin begin
ANode := KeyMappingTreeView.Selected; ANode := TreeView.Selected;
KeyMappingClearButton.Enabled:=(ANode <> nil) and (ANode.Data <> nil) ClearButton.Enabled:=
and (TObject(ANode.Data) is TKeyCommandRelation); (ANode<>nil) and (ANode.Data<>nil) and (TObject(ANode.Data) is TKeyCommandRelation);
end;
procedure TEditorKeymappingOptionsFrame.PopupMenu1Popup(Sender: TObject);
var
ANode: TTreeNode;
begin
ANode := TreeView.Selected;
EditMenuItem.Enabled:=
(ANode<>nil) and (ANode.Data<>nil) and (TObject(ANode.Data) is TKeyCommandRelation);
ClearMenuItem.Enabled := EditMenuItem.Enabled;
end;
procedure TEditorKeymappingOptionsFrame.EditMenuItemClick(Sender: TObject);
begin
EditCommandMapping(TreeView.Selected);
end;
procedure TEditorKeymappingOptionsFrame.ClearMenuItemClick(Sender: TObject);
begin
ClearCommandMapping(TreeView.Selected);
end; end;
function TEditorKeymappingOptionsFrame.GeneralPage: TEditorGeneralOptionsFrame; inline; function TEditorKeymappingOptionsFrame.GeneralPage: TEditorGeneralOptionsFrame; inline;
@ -283,15 +267,27 @@ end;
procedure TEditorKeymappingOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog); procedure TEditorKeymappingOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin begin
FDialog := ADialog; FDialog := ADialog;
KeyMappingChooseSchemeButton.Caption := lisEdOptsLoadAScheme; HelpLabel.Caption := lisCommandEditHint;
KeyMappingConsistencyCheckButton.Caption := dlgCheckConsistency; ChooseSchemeButton.Caption := lisEdOptsLoadAScheme;
KeyMappingHelpLabel.Caption := lisHintDoubleClickOnTheCommandYouWantToEdit; ConsistencyCheckButton.Caption := dlgCheckConsistency;
KeyMappingFilterEdit.Text := lisCEFilter; FindKeyButton.Caption := lisFindKeyCombination;
KeyMappingFindKeyButton.Caption := lisFindKeyCombination; ClearButton.Caption := lisClearKeyMapping;
KeyMappingTreeView.Images := IDEImages.Images_16; ClearMenuItem.Caption := lisClearKeyMapping;
KeyMappingClearButton.Caption := lisClearKeyMapping; EditMenuItem.Caption := lisEditKeyMapping;
TreeView.Images := IDEImages.Images_16;
imgKeyCategory := IDEImages.LoadImage(16, 'item_keyboard'); imgKeyCategory := IDEImages.LoadImage(16, 'item_keyboard');
imgKeyItem := IDEImages.LoadImage(16, 'item_character'); imgKeyItem := IDEImages.LoadImage(16, 'item_character');
ChooseSchemeButton.LoadGlyphFromLazarusResource('item_keyboard'); // keymapcategory
ConsistencyCheckButton.LoadGlyphFromLazarusResource('menu_tool_check_lfm');
FindKeyButton.LoadGlyphFromLazarusResource('menu_search_find');
ClearButton.LoadGlyphFromLazarusResource('menu_clean');
PopupMenu1.Images := IDEImages.Images_16;
ClearMenuItem.ImageIndex := IDEImages.LoadImage(16, 'menu_clean');
EditMenuItem.ImageIndex := IDEImages.LoadImage(16, 'laz_edit');
FillKeyMappingTreeView;
UpdateSchemeLabel;
end; end;
procedure TEditorKeymappingOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); procedure TEditorKeymappingOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
@ -327,13 +323,9 @@ var
CurKeyRelation: TKeyCommandRelation; CurKeyRelation: TKeyCommandRelation;
ChildNodeIndex: Integer; ChildNodeIndex: Integer;
CategoryNodeIndex: Integer; CategoryNodeIndex: Integer;
HasFilter: Boolean;
ItemCaption: String; ItemCaption: String;
NameFilterUp: String;
begin begin
HasFilter:=(KeyMapNameFilter<>''); with TreeView do
NameFilterUp:=uppercase(KeyMapNameFilter);
with KeyMappingTreeView do
begin begin
BeginUpdate; BeginUpdate;
CategoryNodeIndex:=0; CategoryNodeIndex:=0;
@ -355,9 +347,6 @@ begin
begin begin
CurKeyRelation := TKeyCommandRelation(CurCategory[j]); CurKeyRelation := TKeyCommandRelation(CurCategory[j]);
ItemCaption:=KeyMappingRelationToString(CurKeyRelation); ItemCaption:=KeyMappingRelationToString(CurKeyRelation);
if (NameFilterUp<>'')
and (System.Pos(NameFilterUp,UpperCase(ItemCaption))=0) then
continue;
if (KeyMapKeyFilter.Key1<>VK_UNKNOWN) if (KeyMapKeyFilter.Key1<>VK_UNKNOWN)
and (CompareIDEShortCutKey1s(@KeyMapKeyFilter,@CurKeyRelation.ShortcutA)<>0) and (CompareIDEShortCutKey1s(@KeyMapKeyFilter,@CurKeyRelation.ShortcutA)<>0)
and (CompareIDEShortCutKey1s(@KeyMapKeyFilter,@CurKeyRelation.ShortcutB)<>0) and (CompareIDEShortCutKey1s(@KeyMapKeyFilter,@CurKeyRelation.ShortcutB)<>0)
@ -370,8 +359,7 @@ begin
NewKeyNode.Data := CurKeyRelation; NewKeyNode.Data := CurKeyRelation;
end end
else else
NewKeyNode := Items.AddChildObject(NewCategoryNode, NewKeyNode := Items.AddChildObject(NewCategoryNode,ItemCaption, CurKeyRelation);
ItemCaption, CurKeyRelation);
NewKeyNode.ImageIndex := imgKeyItem; NewKeyNode.ImageIndex := imgKeyItem;
NewKeyNode.SelectedIndex := NewKeyNode.ImageIndex; NewKeyNode.SelectedIndex := NewKeyNode.ImageIndex;
inc(ChildNodeIndex); inc(ChildNodeIndex);
@ -379,11 +367,8 @@ begin
// delete unneeded ones // delete unneeded ones
while NewCategoryNode.Count > ChildNodeIndex do while NewCategoryNode.Count > ChildNodeIndex do
NewCategoryNode[NewCategoryNode.Count - 1].Delete; NewCategoryNode[NewCategoryNode.Count - 1].Delete;
if NewCategoryNode.Count>0 then begin if NewCategoryNode.Count>0 then
if HasFilter then
NewCategoryNode.Expanded:=true;
inc(CategoryNodeIndex); inc(CategoryNodeIndex);
end;
end; end;
while Items.TopLvlCount > CategoryNodeIndex do while Items.TopLvlCount > CategoryNodeIndex do
Items.TopLvlItems[Items.TopLvlCount - 1].Delete; Items.TopLvlItems[Items.TopLvlCount - 1].Delete;
@ -432,23 +417,60 @@ end;
procedure TEditorKeymappingOptionsFrame.UpdateKeyFilterButton; procedure TEditorKeymappingOptionsFrame.UpdateKeyFilterButton;
begin begin
if IDEShortCutEmpty(KeyMapKeyFilter) then if IDEShortCutEmpty(KeyMapKeyFilter) then
KeyMappingFindKeyButton.Caption:=lisFindKeyCombination FindKeyButton.Caption:=lisFindKeyCombination
else else
KeyMappingFindKeyButton.Caption:= FindKeyButton.Caption:=
Format(lisFilter3, [KeyAndShiftStateToEditorKeyString(KeyMapKeyFilter)]); Format(lisFilter3, [KeyAndShiftStateToEditorKeyString(KeyMapKeyFilter)]);
end; end;
constructor TEditorKeymappingOptionsFrame.Create(AOwner: TComponent); procedure TEditorKeymappingOptionsFrame.UpdateSchemeLabel;
var
s: String;
begin begin
inherited Create(AOwner); s:=lisNowLoadedScheme+EditorOpts.KeyMappingScheme;
EditingKeyMap := TKeyCommandRelationList.Create; if fModified then
KeyMappingClearButton.Enabled:=false; s:=s+' (*)';
SchemeLabel.Caption:=s;
end; end;
destructor TEditorKeymappingOptionsFrame.Destroy; procedure TEditorKeymappingOptionsFrame.EditCommandMapping(ANode: TTreeNode);
var
i: integer;
ARelation: TKeyCommandRelation;
begin begin
EditingKeyMap.Free; ARelation := TKeyCommandRelation(ANode.Data);
inherited Destroy; i := EditingKeyMap.IndexOf(ARelation);
if (i >= 0) and (ShowKeyMappingEditForm(i, EditingKeyMap) = mrOk) then
begin
FillKeyMappingTreeView;
fModified:=True;
UpdateSchemeLabel;
with GeneralPage do
for i := Low(PreviewEdits) to High(PreviewEdits) do
if PreviewEdits[i] <> nil then
EditingKeyMap.AssignTo(PreviewEdits[i].KeyStrokes, TSourceEditorWindowInterface);
end;
end;
procedure TEditorKeymappingOptionsFrame.ClearCommandMapping(ANode: TTreeNode);
var
i: integer;
ARelation: TKeyCommandRelation;
begin
ARelation := TKeyCommandRelation(ANode.Data);
i := EditingKeyMap.IndexOf(ARelation);
if (i >= 0) {and (ShowKeyMappingEditForm(i, EditingKeyMap) = mrOk)} then
begin
ARelation.ShortcutA := IDEShortCut(VK_UNKNOWN, []);
ARelation.ShortcutB := IDEShortCut(VK_UNKNOWN, []);
FillKeyMappingTreeView;
fModified:=True;
UpdateSchemeLabel;
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;
initialization initialization

View File

@ -1533,6 +1533,10 @@ resourcestring
dlgKeyMappingScheme = 'Key Mapping Scheme'; dlgKeyMappingScheme = 'Key Mapping Scheme';
dlgCheckConsistency = 'Check consistency'; dlgCheckConsistency = 'Check consistency';
lisEdOptsLoadAScheme = 'Load a scheme'; lisEdOptsLoadAScheme = 'Load a scheme';
lisFindKeyCombination = 'Find key combination';
lisClearKeyMapping = 'Clear Command''s Mapping';
lisEditKeyMapping = 'Edit Command''s Mapping';
lisNowLoadedScheme = 'Now loaded: ';
dlgLang = 'Language'; dlgLang = 'Language';
dlgEditSchemDefaults = 'Scheme globals'; dlgEditSchemDefaults = 'Scheme globals';
lis0No1DrawDividerLinesOnlyForTopLevel2DrawLinesForFi = '0 = no, 1 = draw ' lis0No1DrawDividerLinesOnlyForTopLevel2DrawLinesForFi = '0 = no, 1 = draw '
@ -1731,12 +1735,10 @@ resourcestring
'This option will use a locked (and only a locked) Editor, '+ 'This option will use a locked (and only a locked) Editor, '+
'which does not need to scroll in order to display the target jump point '+ 'which does not need to scroll in order to display the target jump point '+
'(target jump point is already in visible screen area).'; '(target jump point is already in visible screen area).';
dlgEditAccessDescUnLockedInSoftView = dlgEditAccessDescUnLockedInSoftView = 'This option will use a not locked Editor, '+
'This option will use a not locked Editor, '+
'which does not need to scroll in order to display the target jump point '+ 'which does not need to scroll in order to display the target jump point '+
'(target jump point is already in visible screen center area, excluding 2-5 lines at the top/bottom).'; '(target jump point is already in visible screen center area, excluding 2-5 lines at the top/bottom).';
dlgEditAccessDescUnLocked = dlgEditAccessDescUnLocked = 'This option will use any not locked Editor.';
'This option will use any not locked Editor.';
dlgEditAccessDescUnLockedOpenNewInOldWin = dlgEditAccessDescUnLockedOpenNewInOldWin =
'If no unlocked tab is found, then this option will open a new Tab in an existing '+ 'If no unlocked tab is found, then this option will open a new Tab in an existing '+
'(and only in an existing) Window. '+ '(and only in an existing) Window. '+
@ -1762,9 +1764,6 @@ resourcestring
'if no unlocked tab is found. '+ 'if no unlocked tab is found. '+
'This option will always succeed, further options are never tested.'; 'This option will always succeed, further options are never tested.';
lisClearKeyMapping = 'Clear Key Mapping';
// CodeTools dialog // CodeTools dialog
dlgCodeToolsOpts = 'CodeTools Options'; dlgCodeToolsOpts = 'CodeTools Options';
dlgCodeCreation = 'Code Creation'; dlgCodeCreation = 'Code Creation';
@ -4839,7 +4838,6 @@ resourcestring
+'dependency is not allowed.'; +'dependency is not allowed.';
lisTheComponentCanNotBeDeletedBecauseItIsNotOwnedBy = 'The component %s can ' lisTheComponentCanNotBeDeletedBecauseItIsNotOwnedBy = 'The component %s can '
+'not be deleted, because it is not owned by %s.'; +'not be deleted, because it is not owned by %s.';
lisFindKeyCombination = 'Find key combination';
lisFilter3 = 'Filter: %s'; lisFilter3 = 'Filter: %s';
lisInvalidPublishingDirectory = 'Invalid publishing Directory'; lisInvalidPublishingDirectory = 'Invalid publishing Directory';
lisSourceDirectoryAndDestinationDirectoryAreTheSameMa = 'Source directory %' lisSourceDirectoryAndDestinationDirectoryAreTheSameMa = 'Source directory %'
@ -5177,8 +5175,7 @@ resourcestring
//Jump History dialog //Jump History dialog
lisJHJumpHistory = 'Jump History'; lisJHJumpHistory = 'Jump History';
lisHintDoubleClickOnTheCommandYouWantToEdit = 'Hint: double click on the ' lisCommandEditHint = 'Edit command''s mapping with double click, Return key or Popup menu';
+'command you want to edit';
lisTheGNUDebuggerThroughSshAllowsToRemoteDebugViaASsh = lisTheGNUDebuggerThroughSshAllowsToRemoteDebugViaASsh =
'The GNU debugger ' 'The GNU debugger '
+'through ssh allows to remote debug via a ssh connection. See docs/' +'through ssh allows to remote debug via a ssh connection. See docs/'