mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-06 04:40:35 +01:00
IDE: Improve keymapping options
git-svn-id: trunk@36330 -
This commit is contained in:
parent
8e71fa7c1a
commit
8ee1b50961
@ -9,16 +9,6 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
|
||||
Visible = False
|
||||
DesignLeft = 303
|
||||
DesignTop = 99
|
||||
object HelpLabel: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 0
|
||||
Width = 56
|
||||
Caption = 'HelpLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object TreeView: TTreeView
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = FilterEdit
|
||||
@ -26,18 +16,18 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 402
|
||||
Top = 48
|
||||
Height = 420
|
||||
Top = 30
|
||||
Width = 461
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Top = 3
|
||||
DefaultItemHeight = 16
|
||||
DefaultItemHeight = 18
|
||||
PopupMenu = PopupMenu1
|
||||
ReadOnly = True
|
||||
RightClickSelect = True
|
||||
RowSelect = True
|
||||
ScrollBars = ssAutoBoth
|
||||
TabOrder = 0
|
||||
TabOrder = 1
|
||||
OnDblClick = TreeViewDblClick
|
||||
OnKeyPress = TreeViewKeyPress
|
||||
OnSelectionChanged = TreeViewSelectionChanged
|
||||
@ -45,34 +35,33 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
|
||||
end
|
||||
object FilterEdit: TTreeFilterEdit
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = HelpLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 24
|
||||
Top = 21
|
||||
Width = 224
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 232
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 0
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
MaxLength = 0
|
||||
TabOrder = 1
|
||||
TabOrder = 0
|
||||
FilteredTreeview = TreeView
|
||||
ExpandAllInitially = True
|
||||
end
|
||||
object ClearButton: TBitBtn
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 380
|
||||
Left = 381
|
||||
Height = 25
|
||||
Top = 455
|
||||
Width = 81
|
||||
Width = 80
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'ClearButton'
|
||||
OnClick = ClearButtonClick
|
||||
TabOrder = 2
|
||||
TabOrder = 3
|
||||
end
|
||||
object FindKeyButton: TBitBtn
|
||||
AnchorSideLeft.Control = Owner
|
||||
@ -80,28 +69,28 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
|
||||
Left = 0
|
||||
Height = 25
|
||||
Top = 455
|
||||
Width = 93
|
||||
Width = 94
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'FindKeyButton'
|
||||
OnClick = FindKeyButtonClick
|
||||
TabOrder = 3
|
||||
TabOrder = 2
|
||||
end
|
||||
object ConsistencyCheckButton: TBitBtn
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 308
|
||||
Left = 306
|
||||
Height = 25
|
||||
Top = 485
|
||||
Width = 153
|
||||
Width = 155
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
Caption = 'ConsistencyCheckButton'
|
||||
OnClick = ConsistencyCheckButtonClick
|
||||
TabOrder = 4
|
||||
TabOrder = 5
|
||||
end
|
||||
object ChooseSchemeButton: TBitBtn
|
||||
AnchorSideLeft.Control = Owner
|
||||
@ -115,7 +104,7 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
|
||||
AutoSize = True
|
||||
Caption = 'ChooseSchemeButton'
|
||||
OnClick = ChooseSchemeButtonClick
|
||||
TabOrder = 5
|
||||
TabOrder = 4
|
||||
end
|
||||
object SchemeLabel: TLabel
|
||||
AnchorSideLeft.Control = ChooseSchemeButton
|
||||
@ -123,13 +112,42 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
|
||||
AnchorSideTop.Control = ChooseSchemeButton
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 144
|
||||
Height = 15
|
||||
Top = 490
|
||||
Height = 16
|
||||
Top = 489
|
||||
Width = 76
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'SchemeLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object EditButton: TBitBtn
|
||||
AnchorSideTop.Control = ClearButton
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = ClearButton
|
||||
Left = 301
|
||||
Height = 25
|
||||
Top = 455
|
||||
Width = 74
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'EditButton'
|
||||
OnClick = EditButtonClick
|
||||
TabOrder = 6
|
||||
end
|
||||
object CommandLabel: TLabel
|
||||
AnchorSideTop.Control = EditButton
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = EditButton
|
||||
Left = 207
|
||||
Height = 16
|
||||
Top = 459
|
||||
Width = 88
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'CommandLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object PopupMenu1: TPopupMenu
|
||||
OnPopup = PopupMenu1Popup
|
||||
left = 356
|
||||
|
||||
@ -26,7 +26,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, TreeFilterEdit, Forms, StdCtrls, ComCtrls,
|
||||
Controls, Dialogs, LCLType, LCLProc, Menus, Buttons, EditorOptions,
|
||||
Controls, Dialogs, LCLType, LCLProc, Menus, Buttons, Clipbrd, EditorOptions,
|
||||
LazarusIDEStrConsts, IDEOptionsIntf, IDEImagesIntf, editor_general_options,
|
||||
KeymapSchemeDlg, KeyMapping, IDECommands, KeyMapShortCutDlg, SrcEditorIntf;
|
||||
|
||||
@ -37,16 +37,18 @@ type
|
||||
TEditorKeymappingOptionsFrame = class(TAbstractIDEOptionsEditor)
|
||||
ChooseSchemeButton: TBitBtn;
|
||||
ClearButton: TBitBtn;
|
||||
EditButton: TBitBtn;
|
||||
ConsistencyCheckButton: TBitBtn;
|
||||
FilterEdit: TTreeFilterEdit;
|
||||
FindKeyButton: TBitBtn;
|
||||
HelpLabel: TLabel;
|
||||
CommandLabel: TLabel;
|
||||
SchemeLabel: TLabel;
|
||||
TreeView: TTreeView;
|
||||
EditMenuItem: TMenuItem;
|
||||
ClearMenuItem: TMenuItem;
|
||||
PopupMenu1: TPopupMenu;
|
||||
procedure ClearMenuItemClick(Sender: TObject);
|
||||
procedure EditButtonClick(Sender: TObject);
|
||||
procedure EditMenuItemClick(Sender: TObject);
|
||||
procedure ChooseSchemeButtonClick(Sender: TObject);
|
||||
procedure ClearButtonClick(Sender: TObject);
|
||||
@ -88,10 +90,16 @@ var
|
||||
imgKeyCategory, imgKeyItem: Integer;
|
||||
|
||||
type
|
||||
|
||||
{ TKeyMapErrorsForm }
|
||||
|
||||
TKeyMapErrorsForm = class(TForm)
|
||||
ListBox: TListBox;
|
||||
BackButton: TButton;
|
||||
ErrorsPopupMenu: TPopupMenu;
|
||||
CopyMenuItem: TMenuItem;
|
||||
procedure BackButtonClick(Sender: TObject);
|
||||
procedure CopyMenuItemClick(Sender: TObject);
|
||||
public
|
||||
constructor Create(AnOwner: TComponent); override;
|
||||
end;
|
||||
@ -106,7 +114,7 @@ begin
|
||||
with ListBox do
|
||||
begin
|
||||
Name := 'ListBox';
|
||||
Align:=alTop;
|
||||
Align := alTop;
|
||||
Parent := Self;
|
||||
end;
|
||||
|
||||
@ -114,15 +122,25 @@ begin
|
||||
with BackButton do
|
||||
begin
|
||||
Name := 'BackButton';
|
||||
AutoSize:=true;
|
||||
Anchors:=[akLeft,akBottom];
|
||||
AutoSize := true;
|
||||
Anchors := [akLeft,akBottom];
|
||||
Parent := Self;
|
||||
AnchorParallel(akBottom,6,Self);
|
||||
AnchorParallel(akLeft,6,Self);
|
||||
Caption := dlgEdBack;
|
||||
OnClick := @BackButtonClick;
|
||||
end;
|
||||
|
||||
ErrorsPopupMenu := TPopupMenu.Create(Self);
|
||||
ErrorsPopupMenu.Name := 'ErrorsPopupMenu';
|
||||
CopyMenuItem := TMenuItem.Create(Self);
|
||||
CopyMenuItem.Caption := lisCopyAllItemsToClipboard;
|
||||
CopyMenuItem.OnClick := @CopyMenuItemClick;
|
||||
CopyMenuItem.ImageIndex := IDEImages.LoadImage(16, 'laz_copy');
|
||||
ErrorsPopupMenu.Items.Add(CopyMenuItem);
|
||||
|
||||
ListBox.AnchorToNeighbour(akBottom,6,BackButton);
|
||||
ListBox.PopupMenu := ErrorsPopupMenu;
|
||||
end;
|
||||
|
||||
procedure TKeyMapErrorsForm.BackButtonClick(Sender: TObject);
|
||||
@ -130,12 +148,18 @@ begin
|
||||
ModalResult := mrOk;
|
||||
end;
|
||||
|
||||
procedure TKeyMapErrorsForm.CopyMenuItemClick(Sender: TObject);
|
||||
begin
|
||||
Clipboard.AsText := ListBox.Items.Text;
|
||||
end;
|
||||
|
||||
{ TEditorKeymappingOptionsFrame }
|
||||
|
||||
constructor TEditorKeymappingOptionsFrame.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
EditingKeyMap := TKeyCommandRelationList.Create;
|
||||
EditButton.Enabled:=false;
|
||||
ClearButton.Enabled:=false;
|
||||
fModified:=False;
|
||||
end;
|
||||
@ -160,13 +184,17 @@ begin
|
||||
UpdateSchemeLabel;
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.EditButtonClick(Sender: TObject);
|
||||
begin
|
||||
EditCommandMapping(TreeView.Selected);
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.ClearButtonClick(Sender: TObject);
|
||||
begin
|
||||
ClearCommandMapping(TreeView.Selected);
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.ConsistencyCheckButtonClick(
|
||||
Sender: TObject);
|
||||
procedure TEditorKeymappingOptionsFrame.ConsistencyCheckButtonClick(Sender: TObject);
|
||||
var
|
||||
Protocol: TStringList;
|
||||
ErrorCount, Index1, Index2: Integer;
|
||||
@ -230,8 +258,9 @@ var
|
||||
ANode: TTreeNode;
|
||||
begin
|
||||
ANode := TreeView.Selected;
|
||||
ClearButton.Enabled:=
|
||||
EditButton.Enabled:=
|
||||
(ANode<>nil) and (ANode.Data<>nil) and (TObject(ANode.Data) is TKeyCommandRelation);
|
||||
ClearButton.Enabled:=EditButton.Enabled;
|
||||
end;
|
||||
|
||||
procedure TEditorKeymappingOptionsFrame.PopupMenu1Popup(Sender: TObject);
|
||||
@ -267,13 +296,14 @@ end;
|
||||
procedure TEditorKeymappingOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
begin
|
||||
FDialog := ADialog;
|
||||
HelpLabel.Caption := lisCommandEditHint;
|
||||
ChooseSchemeButton.Caption := lisEdOptsLoadAScheme;
|
||||
ConsistencyCheckButton.Caption := dlgCheckConsistency;
|
||||
FindKeyButton.Caption := lisFindKeyCombination;
|
||||
ClearButton.Caption := lisClearKeyMapping;
|
||||
ClearMenuItem.Caption := lisClearKeyMapping;
|
||||
EditMenuItem.Caption := lisEditKeyMapping;
|
||||
CommandLabel.Caption := lisSelectedCommandsMapping;
|
||||
EditButton.Caption := lisEdit;
|
||||
ClearButton.Caption := lisClear;
|
||||
EditMenuItem.Caption := lisEdit;
|
||||
ClearMenuItem.Caption := lisClear;
|
||||
|
||||
TreeView.Images := IDEImages.Images_16;
|
||||
imgKeyCategory := IDEImages.LoadImage(16, 'item_keyboard');
|
||||
@ -281,10 +311,11 @@ begin
|
||||
ChooseSchemeButton.LoadGlyphFromLazarusResource('item_keyboard'); // keymapcategory
|
||||
ConsistencyCheckButton.LoadGlyphFromLazarusResource('menu_tool_check_lfm');
|
||||
FindKeyButton.LoadGlyphFromLazarusResource('menu_search_find');
|
||||
EditButton.LoadGlyphFromLazarusResource('laz_edit');
|
||||
ClearButton.LoadGlyphFromLazarusResource('menu_clean');
|
||||
PopupMenu1.Images := IDEImages.Images_16;
|
||||
ClearMenuItem.ImageIndex := IDEImages.LoadImage(16, 'menu_clean');
|
||||
EditMenuItem.ImageIndex := IDEImages.LoadImage(16, 'laz_edit');
|
||||
ClearMenuItem.ImageIndex := IDEImages.LoadImage(16, 'menu_clean');
|
||||
|
||||
FillKeyMappingTreeView;
|
||||
UpdateSchemeLabel;
|
||||
|
||||
@ -1534,8 +1534,7 @@ resourcestring
|
||||
dlgCheckConsistency = 'Check consistency';
|
||||
lisEdOptsLoadAScheme = 'Load a scheme';
|
||||
lisFindKeyCombination = 'Find key combination';
|
||||
lisClearKeyMapping = 'Clear Command''s Mapping';
|
||||
lisEditKeyMapping = 'Edit Command''s Mapping';
|
||||
lisSelectedCommandsMapping = 'Selected Command''s Mapping';
|
||||
lisNowLoadedScheme = 'Now loaded: ';
|
||||
dlgLang = 'Language';
|
||||
dlgEditSchemDefaults = 'Scheme globals';
|
||||
@ -5161,7 +5160,6 @@ resourcestring
|
||||
|
||||
//Jump History dialog
|
||||
lisJHJumpHistory = 'Jump History';
|
||||
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