mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 02:29:26 +02:00
IDE: Improve keymapping options frame.
git-svn-id: trunk@35472 -
This commit is contained in:
parent
6e64f6d1fc
commit
5866b2577e
@ -1,5 +1,7 @@
|
||||
inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
|
||||
object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
|
||||
Left = 0
|
||||
Height = 510
|
||||
Top = 0
|
||||
Width = 461
|
||||
ClientHeight = 510
|
||||
ClientWidth = 461
|
||||
@ -7,113 +9,138 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
|
||||
Visible = False
|
||||
DesignLeft = 303
|
||||
DesignTop = 99
|
||||
object KeyMappingHelpLabel: TLabel[0]
|
||||
object HelpLabel: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 0
|
||||
Height = 18
|
||||
Height = 15
|
||||
Top = 0
|
||||
Width = 140
|
||||
Caption = 'KeyMappingHelpLabel'
|
||||
Width = 56
|
||||
Caption = 'HelpLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object KeyMappingFilterEdit: TEdit[1]
|
||||
object TreeView: TTreeView
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = KeyMappingHelpLabel
|
||||
AnchorSideTop.Control = FilterEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 27
|
||||
Top = 24
|
||||
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
|
||||
Height = 402
|
||||
Top = 48
|
||||
Width = 461
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
DefaultItemHeight = 19
|
||||
BorderSpacing.Top = 3
|
||||
DefaultItemHeight = 16
|
||||
PopupMenu = PopupMenu1
|
||||
ReadOnly = True
|
||||
RightClickSelect = True
|
||||
RowSelect = True
|
||||
ScrollBars = ssAutoBoth
|
||||
TabOrder = 1
|
||||
OnDblClick = KeyMappingTreeViewDblClick
|
||||
OnSelectionChanged = KeyMappingTreeViewSelectionChanged
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
||||
TabOrder = 0
|
||||
OnDblClick = TreeViewDblClick
|
||||
OnKeyPress = TreeViewKeyPress
|
||||
OnSelectionChanged = TreeViewSelectionChanged
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
||||
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
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = KeyMappingChooseSchemeButton
|
||||
Left = 0
|
||||
Height = 29
|
||||
Top = 446
|
||||
Width = 178
|
||||
Height = 25
|
||||
Top = 455
|
||||
Width = 93
|
||||
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
|
||||
Left = 0
|
||||
Height = 29
|
||||
Top = 481
|
||||
Width = 232
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
Caption = 'KeyMappingChooseSchemeButton'
|
||||
OnClick = KeyMappingChooseSchemeButtonClick
|
||||
Caption = 'FindKeyButton'
|
||||
OnClick = FindKeyButtonClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object KeyMappingConsistencyCheckButton: TButton[5]
|
||||
object ConsistencyCheckButton: TBitBtn
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 214
|
||||
Height = 29
|
||||
Top = 481
|
||||
Width = 247
|
||||
Left = 308
|
||||
Height = 25
|
||||
Top = 485
|
||||
Width = 153
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
Caption = 'KeyMappingConsistencyCheckButton'
|
||||
OnClick = KeyMappingConsistencyCheckButtonClick
|
||||
Caption = 'ConsistencyCheckButton'
|
||||
OnClick = ConsistencyCheckButtonClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object KeyMappingClearButton: TButton[6]
|
||||
AnchorSideTop.Control = KeyMappingFindKeyButton
|
||||
AnchorSideRight.Control = KeyMappingConsistencyCheckButton
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 297
|
||||
Height = 29
|
||||
Top = 446
|
||||
Width = 164
|
||||
Anchors = [akTop, akRight]
|
||||
object ChooseSchemeButton: TBitBtn
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 25
|
||||
Top = 485
|
||||
Width = 138
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
Caption = 'KeyMappingClearButton'
|
||||
OnClick = KeyMappingClearButtonClick
|
||||
Caption = 'ChooseSchemeButton'
|
||||
OnClick = ChooseSchemeButtonClick
|
||||
TabOrder = 5
|
||||
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
|
||||
|
@ -25,10 +25,9 @@ unit editor_keymapping_options;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, StdCtrls, ComCtrls, Controls,
|
||||
Dialogs, LCLType, LCLProc,
|
||||
EditorOptions, LazarusIDEStrConsts, IDEOptionsIntf, IDEImagesIntf,
|
||||
editor_general_options,
|
||||
Classes, SysUtils, FileUtil, TreeFilterEdit, Forms, StdCtrls, ComCtrls,
|
||||
Controls, Dialogs, LCLType, LCLProc, Menus, Buttons, EditorOptions,
|
||||
LazarusIDEStrConsts, IDEOptionsIntf, IDEImagesIntf, editor_general_options,
|
||||
KeymapSchemeDlg, KeyMapping, IDECommands, KeyMapShortCutDlg, SrcEditorIntf;
|
||||
|
||||
type
|
||||
@ -36,33 +35,40 @@ type
|
||||
{ TEditorKeymappingOptionsFrame }
|
||||
|
||||
TEditorKeymappingOptionsFrame = class(TAbstractIDEOptionsEditor)
|
||||
KeyMappingClearButton: TButton;
|
||||
KeyMappingChooseSchemeButton: TButton;
|
||||
KeyMappingConsistencyCheckButton: TButton;
|
||||
KeyMappingFilterEdit: TEdit;
|
||||
KeyMappingFindKeyButton: TButton;
|
||||
KeyMappingHelpLabel: TLabel;
|
||||
KeyMappingTreeView: TTreeView;
|
||||
procedure KeyMappingChooseSchemeButtonClick(Sender: TObject);
|
||||
procedure KeyMappingClearButtonClick(Sender: TObject);
|
||||
procedure KeyMappingConsistencyCheckButtonClick(Sender: TObject);
|
||||
procedure KeyMappingFilterEditChange(Sender: TObject);
|
||||
procedure KeyMappingFilterEditEnter(Sender: TObject);
|
||||
procedure KeyMappingFilterEditExit(Sender: TObject);
|
||||
procedure KeyMappingFindKeyButtonClick(Sender: TObject);
|
||||
procedure KeyMappingTreeViewDblClick(Sender: TObject);
|
||||
procedure KeyMappingTreeViewSelectionChanged(Sender: TObject);
|
||||
ChooseSchemeButton: TBitBtn;
|
||||
ClearButton: TBitBtn;
|
||||
ConsistencyCheckButton: TBitBtn;
|
||||
FilterEdit: TTreeFilterEdit;
|
||||
FindKeyButton: TBitBtn;
|
||||
HelpLabel: TLabel;
|
||||
SchemeLabel: TLabel;
|
||||
TreeView: TTreeView;
|
||||
EditMenuItem: TMenuItem;
|
||||
ClearMenuItem: TMenuItem;
|
||||
PopupMenu1: TPopupMenu;
|
||||
procedure ClearMenuItemClick(Sender: TObject);
|
||||
procedure EditMenuItemClick(Sender: TObject);
|
||||
procedure ChooseSchemeButtonClick(Sender: TObject);
|
||||
procedure ClearButtonClick(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
|
||||
FDialog: TAbstractOptionsEditorDialog;
|
||||
KeyMapNameFilter: string;
|
||||
EditingKeyMap: TKeyCommandRelationList;
|
||||
KeyMapKeyFilter: TIDEShortCut;
|
||||
|
||||
fModified: Boolean;
|
||||
function GeneralPage: TEditorGeneralOptionsFrame; inline;
|
||||
procedure FillKeyMappingTreeView;
|
||||
procedure EditCommandMapping(ANode: TTreeNode);
|
||||
procedure ClearCommandMapping(ANode: TTreeNode);
|
||||
function KeyMappingRelationToString(Index: Integer): String;
|
||||
function KeyMappingRelationToString(KeyRelation: TKeyCommandRelation): String;
|
||||
procedure UpdateKeyFilterButton;
|
||||
procedure UpdateSchemeLabel;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -126,21 +132,21 @@ end;
|
||||
|
||||
{ TEditorKeymappingOptionsFrame }
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.KeyMappingFilterEditChange(Sender: TObject);
|
||||
var
|
||||
Filter: String;
|
||||
constructor TEditorKeymappingOptionsFrame.Create(AOwner: TComponent);
|
||||
begin
|
||||
if [csLoading, csDestroying] * ComponentState <> [] then
|
||||
Exit;
|
||||
Filter := KeyMappingFilterEdit.Text;
|
||||
if (Filter = lisCEFilter) or (Filter = KeyMappingFilterEdit.Name) then
|
||||
Filter := '';
|
||||
KeyMapNameFilter := Filter;
|
||||
FillKeyMappingTreeView;
|
||||
inherited Create(AOwner);
|
||||
EditingKeyMap := TKeyCommandRelationList.Create;
|
||||
ClearButton.Enabled:=false;
|
||||
fModified:=False;
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.KeyMappingChooseSchemeButtonClick(
|
||||
Sender: TObject);
|
||||
destructor TEditorKeymappingOptionsFrame.Destroy;
|
||||
begin
|
||||
EditingKeyMap.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.ChooseSchemeButtonClick(Sender: TObject);
|
||||
var
|
||||
NewScheme: String;
|
||||
begin
|
||||
@ -150,35 +156,16 @@ begin
|
||||
EditorOpts.KeyMappingScheme := NewScheme;
|
||||
EditingKeyMap.LoadScheme(NewScheme);
|
||||
FillKeyMappingTreeView;
|
||||
fModified:=False;
|
||||
UpdateSchemeLabel;
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.KeyMappingClearButtonClick(
|
||||
Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
ARelation: TKeyCommandRelation;
|
||||
ANode: TTreeNode;
|
||||
procedure TEditorKeymappingOptionsFrame.ClearButtonClick(Sender: TObject);
|
||||
begin
|
||||
ANode := KeyMappingTreeView.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;
|
||||
ClearCommandMapping(TreeView.Selected);
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.KeyMappingConsistencyCheckButtonClick(
|
||||
procedure TEditorKeymappingOptionsFrame.ConsistencyCheckButtonClick(
|
||||
Sender: TObject);
|
||||
var
|
||||
Protocol: TStringList;
|
||||
@ -210,64 +197,61 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.KeyMappingFilterEditEnter(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);
|
||||
procedure TEditorKeymappingOptionsFrame.FindKeyButtonClick(Sender: TObject);
|
||||
var
|
||||
KeyFilter: TIDEShortCut;
|
||||
begin
|
||||
if ShowKeyMappingGrabForm(KeyFilter) <> mrOK then
|
||||
Exit;
|
||||
//debugln(['TEditorOptionsForm.KeyMappingFindKeyButtonClick ',KeyAndShiftStateToEditorKeyString(KeyFilter)]);
|
||||
KeyMapKeyFilter := KeyFilter;
|
||||
UpdateKeyFilterButton;
|
||||
FillKeyMappingTreeView;
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.KeyMappingTreeViewDblClick(
|
||||
Sender: TObject);
|
||||
procedure TEditorKeymappingOptionsFrame.TreeViewDblClick(Sender: TObject);
|
||||
var
|
||||
P: TPoint;
|
||||
i: integer;
|
||||
ARelation: TKeyCommandRelation;
|
||||
ANode: TTreeNode;
|
||||
begin
|
||||
P := KeyMappingTreeView.ScreenToClient(Mouse.CursorPos);
|
||||
ANode := KeyMappingTreeView.GetNodeAt(P.X, P.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;
|
||||
P := TreeView.ScreenToClient(Mouse.CursorPos);
|
||||
ANode := TreeView.GetNodeAt(P.X, P.Y);
|
||||
if (ANode<>nil) and (ANode.Data<>nil) and (TObject(ANode.Data) is TKeyCommandRelation) then
|
||||
EditCommandMapping(ANode);
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.KeyMappingTreeViewSelectionChanged(
|
||||
Sender: TObject);
|
||||
procedure TEditorKeymappingOptionsFrame.TreeViewKeyPress(Sender: TObject; var Key: char);
|
||||
begin
|
||||
if Key = char(VK_RETURN) then
|
||||
EditCommandMapping(TreeView.Selected);
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.TreeViewSelectionChanged(Sender: TObject);
|
||||
var
|
||||
ANode: TTreeNode;
|
||||
begin
|
||||
ANode := KeyMappingTreeView.Selected;
|
||||
KeyMappingClearButton.Enabled:=(ANode <> nil) and (ANode.Data <> nil)
|
||||
and (TObject(ANode.Data) is TKeyCommandRelation);
|
||||
ANode := TreeView.Selected;
|
||||
ClearButton.Enabled:=
|
||||
(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;
|
||||
|
||||
function TEditorKeymappingOptionsFrame.GeneralPage: TEditorGeneralOptionsFrame; inline;
|
||||
@ -283,15 +267,27 @@ end;
|
||||
procedure TEditorKeymappingOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
begin
|
||||
FDialog := ADialog;
|
||||
KeyMappingChooseSchemeButton.Caption := lisEdOptsLoadAScheme;
|
||||
KeyMappingConsistencyCheckButton.Caption := dlgCheckConsistency;
|
||||
KeyMappingHelpLabel.Caption := lisHintDoubleClickOnTheCommandYouWantToEdit;
|
||||
KeyMappingFilterEdit.Text := lisCEFilter;
|
||||
KeyMappingFindKeyButton.Caption := lisFindKeyCombination;
|
||||
KeyMappingTreeView.Images := IDEImages.Images_16;
|
||||
KeyMappingClearButton.Caption := lisClearKeyMapping;
|
||||
HelpLabel.Caption := lisCommandEditHint;
|
||||
ChooseSchemeButton.Caption := lisEdOptsLoadAScheme;
|
||||
ConsistencyCheckButton.Caption := dlgCheckConsistency;
|
||||
FindKeyButton.Caption := lisFindKeyCombination;
|
||||
ClearButton.Caption := lisClearKeyMapping;
|
||||
ClearMenuItem.Caption := lisClearKeyMapping;
|
||||
EditMenuItem.Caption := lisEditKeyMapping;
|
||||
|
||||
TreeView.Images := IDEImages.Images_16;
|
||||
imgKeyCategory := IDEImages.LoadImage(16, 'item_keyboard');
|
||||
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;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
@ -327,13 +323,9 @@ var
|
||||
CurKeyRelation: TKeyCommandRelation;
|
||||
ChildNodeIndex: Integer;
|
||||
CategoryNodeIndex: Integer;
|
||||
HasFilter: Boolean;
|
||||
ItemCaption: String;
|
||||
NameFilterUp: String;
|
||||
begin
|
||||
HasFilter:=(KeyMapNameFilter<>'');
|
||||
NameFilterUp:=uppercase(KeyMapNameFilter);
|
||||
with KeyMappingTreeView do
|
||||
with TreeView do
|
||||
begin
|
||||
BeginUpdate;
|
||||
CategoryNodeIndex:=0;
|
||||
@ -355,9 +347,6 @@ begin
|
||||
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)
|
||||
@ -370,8 +359,7 @@ begin
|
||||
NewKeyNode.Data := CurKeyRelation;
|
||||
end
|
||||
else
|
||||
NewKeyNode := Items.AddChildObject(NewCategoryNode,
|
||||
ItemCaption, CurKeyRelation);
|
||||
NewKeyNode := Items.AddChildObject(NewCategoryNode,ItemCaption, CurKeyRelation);
|
||||
NewKeyNode.ImageIndex := imgKeyItem;
|
||||
NewKeyNode.SelectedIndex := NewKeyNode.ImageIndex;
|
||||
inc(ChildNodeIndex);
|
||||
@ -379,11 +367,8 @@ begin
|
||||
// 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;
|
||||
if NewCategoryNode.Count>0 then
|
||||
inc(CategoryNodeIndex);
|
||||
end;
|
||||
end;
|
||||
while Items.TopLvlCount > CategoryNodeIndex do
|
||||
Items.TopLvlItems[Items.TopLvlCount - 1].Delete;
|
||||
@ -432,23 +417,60 @@ end;
|
||||
procedure TEditorKeymappingOptionsFrame.UpdateKeyFilterButton;
|
||||
begin
|
||||
if IDEShortCutEmpty(KeyMapKeyFilter) then
|
||||
KeyMappingFindKeyButton.Caption:=lisFindKeyCombination
|
||||
FindKeyButton.Caption:=lisFindKeyCombination
|
||||
else
|
||||
KeyMappingFindKeyButton.Caption:=
|
||||
FindKeyButton.Caption:=
|
||||
Format(lisFilter3, [KeyAndShiftStateToEditorKeyString(KeyMapKeyFilter)]);
|
||||
end;
|
||||
|
||||
constructor TEditorKeymappingOptionsFrame.Create(AOwner: TComponent);
|
||||
procedure TEditorKeymappingOptionsFrame.UpdateSchemeLabel;
|
||||
var
|
||||
s: String;
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
EditingKeyMap := TKeyCommandRelationList.Create;
|
||||
KeyMappingClearButton.Enabled:=false;
|
||||
s:=lisNowLoadedScheme+EditorOpts.KeyMappingScheme;
|
||||
if fModified then
|
||||
s:=s+' (*)';
|
||||
SchemeLabel.Caption:=s;
|
||||
end;
|
||||
|
||||
destructor TEditorKeymappingOptionsFrame.Destroy;
|
||||
procedure TEditorKeymappingOptionsFrame.EditCommandMapping(ANode: TTreeNode);
|
||||
var
|
||||
i: integer;
|
||||
ARelation: TKeyCommandRelation;
|
||||
begin
|
||||
EditingKeyMap.Free;
|
||||
inherited Destroy;
|
||||
ARelation := TKeyCommandRelation(ANode.Data);
|
||||
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;
|
||||
|
||||
initialization
|
||||
|
@ -1533,6 +1533,10 @@ resourcestring
|
||||
dlgKeyMappingScheme = 'Key Mapping Scheme';
|
||||
dlgCheckConsistency = 'Check consistency';
|
||||
lisEdOptsLoadAScheme = 'Load a scheme';
|
||||
lisFindKeyCombination = 'Find key combination';
|
||||
lisClearKeyMapping = 'Clear Command''s Mapping';
|
||||
lisEditKeyMapping = 'Edit Command''s Mapping';
|
||||
lisNowLoadedScheme = 'Now loaded: ';
|
||||
dlgLang = 'Language';
|
||||
dlgEditSchemDefaults = 'Scheme globals';
|
||||
lis0No1DrawDividerLinesOnlyForTopLevel2DrawLinesForFi = '0 = no, 1 = draw '
|
||||
@ -1731,12 +1735,10 @@ resourcestring
|
||||
'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 '+
|
||||
'(target jump point is already in visible screen area).';
|
||||
dlgEditAccessDescUnLockedInSoftView =
|
||||
'This option will use a not locked Editor, '+
|
||||
dlgEditAccessDescUnLockedInSoftView = 'This option will use a not locked Editor, '+
|
||||
'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).';
|
||||
dlgEditAccessDescUnLocked =
|
||||
'This option will use any not locked Editor.';
|
||||
dlgEditAccessDescUnLocked = 'This option will use any not locked Editor.';
|
||||
dlgEditAccessDescUnLockedOpenNewInOldWin =
|
||||
'If no unlocked tab is found, then this option will open a new Tab in an existing '+
|
||||
'(and only in an existing) Window. '+
|
||||
@ -1762,9 +1764,6 @@ resourcestring
|
||||
'if no unlocked tab is found. '+
|
||||
'This option will always succeed, further options are never tested.';
|
||||
|
||||
|
||||
lisClearKeyMapping = 'Clear Key Mapping';
|
||||
|
||||
// CodeTools dialog
|
||||
dlgCodeToolsOpts = 'CodeTools Options';
|
||||
dlgCodeCreation = 'Code Creation';
|
||||
@ -4839,7 +4838,6 @@ resourcestring
|
||||
+'dependency is not allowed.';
|
||||
lisTheComponentCanNotBeDeletedBecauseItIsNotOwnedBy = 'The component %s can '
|
||||
+'not be deleted, because it is not owned by %s.';
|
||||
lisFindKeyCombination = 'Find key combination';
|
||||
lisFilter3 = 'Filter: %s';
|
||||
lisInvalidPublishingDirectory = 'Invalid publishing Directory';
|
||||
lisSourceDirectoryAndDestinationDirectoryAreTheSameMa = 'Source directory %'
|
||||
@ -5177,8 +5175,7 @@ resourcestring
|
||||
|
||||
//Jump History dialog
|
||||
lisJHJumpHistory = 'Jump History';
|
||||
lisHintDoubleClickOnTheCommandYouWantToEdit = 'Hint: double click on the '
|
||||
+'command you want to edit';
|
||||
lisCommandEditHint = 'Edit command''s mapping with double click, Return key or Popup menu';
|
||||
lisTheGNUDebuggerThroughSshAllowsToRemoteDebugViaASsh =
|
||||
'The GNU debugger '
|
||||
+'through ssh allows to remote debug via a ssh connection. See docs/'
|
||||
|
Loading…
Reference in New Issue
Block a user