From 36bc4cca4d57c75bb4509860e09a05bce94cafda Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 4 Apr 2012 17:41:24 +0000 Subject: [PATCH] Improve Options/Keymap filter git-svn-id: trunk@36562 - --- ide/frames/editor_keymapping_options.lfm | 59 +++++++++++++++--------- ide/frames/editor_keymapping_options.pas | 17 ++++++- 2 files changed, 54 insertions(+), 22 deletions(-) diff --git a/ide/frames/editor_keymapping_options.lfm b/ide/frames/editor_keymapping_options.lfm index c0be20cc2e..5402bd0f22 100644 --- a/ide/frames/editor_keymapping_options.lfm +++ b/ide/frames/editor_keymapping_options.lfm @@ -16,8 +16,8 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 420 - Top = 30 + Height = 418 + Top = 32 Width = 461 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Top = 3 @@ -38,7 +38,7 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom Left = 0 - Height = 21 + Height = 23 Top = 6 Width = 232 ButtonWidth = 23 @@ -52,10 +52,10 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame end object ClearButton: TBitBtn AnchorSideRight.Side = asrBottom - Left = 381 + Left = 372 Height = 25 Top = 455 - Width = 80 + Width = 89 Anchors = [akRight, akBottom] AutoSize = True BorderSpacing.Bottom = 6 @@ -64,15 +64,18 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame TabOrder = 3 end object FindKeyButton: TBitBtn - AnchorSideLeft.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 0 + AnchorSideLeft.Control = FilterEdit + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = FilterEdit + AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = ResetKeyFilterBtn + Left = 320 Height = 25 - Top = 455 - Width = 94 - Anchors = [akLeft, akBottom] + Top = 5 + Width = 104 + Anchors = [akTop, akRight] AutoSize = True - BorderSpacing.Bottom = 6 + BorderSpacing.Around = 2 Caption = 'FindKeyButton' OnClick = FindKeyButtonClick TabOrder = 2 @@ -82,10 +85,10 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom - Left = 306 + Left = 302 Height = 25 Top = 485 - Width = 155 + Width = 159 Anchors = [akRight, akBottom] AutoSize = True Caption = 'ConsistencyCheckButton' @@ -99,7 +102,7 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame Left = 0 Height = 25 Top = 485 - Width = 138 + Width = 144 Anchors = [akLeft, akBottom] AutoSize = True Caption = 'ChooseSchemeButton' @@ -111,10 +114,10 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = ChooseSchemeButton AnchorSideTop.Side = asrCenter - Left = 144 + Left = 150 Height = 16 Top = 489 - Width = 76 + Width = 71 BorderSpacing.Around = 6 Caption = 'SchemeLabel' ParentColor = False @@ -123,10 +126,10 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame AnchorSideTop.Control = ClearButton AnchorSideTop.Side = asrCenter AnchorSideRight.Control = ClearButton - Left = 301 + Left = 284 Height = 25 Top = 455 - Width = 74 + Width = 82 Anchors = [akTop, akRight] AutoSize = True BorderSpacing.Right = 6 @@ -139,15 +142,29 @@ object EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame AnchorSideTop.Control = EditButton AnchorSideTop.Side = asrCenter AnchorSideRight.Control = EditButton - Left = 207 + Left = 192 Height = 16 Top = 459 - Width = 88 + Width = 86 Anchors = [akTop, akRight] BorderSpacing.Right = 6 Caption = 'CommandLabel' ParentColor = False end + object ResetKeyFilterBtn: TSpeedButton + AnchorSideTop.Control = FindKeyButton + AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 426 + Height = 22 + Top = 6 + Width = 29 + Anchors = [akTop, akRight] + BorderSpacing.Right = 6 + NumGlyphs = 0 + OnClick = ResetKeyFilterBtnClick + end object PopupMenu1: TPopupMenu OnPopup = PopupMenu1Popup left = 356 diff --git a/ide/frames/editor_keymapping_options.pas b/ide/frames/editor_keymapping_options.pas index 5cfc538f79..39ba84440b 100644 --- a/ide/frames/editor_keymapping_options.pas +++ b/ide/frames/editor_keymapping_options.pas @@ -28,7 +28,8 @@ uses Classes, SysUtils, FileUtil, TreeFilterEdit, Forms, StdCtrls, ComCtrls, Controls, Dialogs, LCLType, LCLProc, Menus, Buttons, Clipbrd, EditorOptions, LazarusIDEStrConsts, IDEOptionsIntf, IDEImagesIntf, editor_general_options, - KeymapSchemeDlg, KeyMapping, IDECommands, KeyMapShortCutDlg, SrcEditorIntf; + KeymapSchemeDlg, KeyMapping, IDECommands, KeyMapShortCutDlg, SrcEditorIntf, + EditBtn; type @@ -43,6 +44,7 @@ type FindKeyButton: TBitBtn; CommandLabel: TLabel; SchemeLabel: TLabel; + ResetKeyFilterBtn: TSpeedButton; TreeView: TTreeView; EditMenuItem: TMenuItem; ClearMenuItem: TMenuItem; @@ -54,6 +56,7 @@ type procedure ClearButtonClick(Sender: TObject); procedure ConsistencyCheckButtonClick(Sender: TObject); procedure FindKeyButtonClick(Sender: TObject); + procedure ResetKeyFilterBtnClick(Sender: TObject); procedure TreeViewDblClick(Sender: TObject); procedure TreeViewKeyPress(Sender: TObject; var Key: char); procedure TreeViewSelectionChanged(Sender: TObject); @@ -236,6 +239,14 @@ begin FillKeyMappingTreeView; end; +procedure TEditorKeymappingOptionsFrame.ResetKeyFilterBtnClick(Sender: TObject); +begin + KeyMapKeyFilter.Key1 := VK_UNKNOWN; + KeyMapKeyFilter.Key2 := VK_UNKNOWN; + UpdateKeyFilterButton; + FillKeyMappingTreeView; +end; + procedure TEditorKeymappingOptionsFrame.TreeViewDblClick(Sender: TObject); var P: TPoint; @@ -317,6 +328,9 @@ begin EditMenuItem.ImageIndex := IDEImages.LoadImage(16, 'laz_edit'); ClearMenuItem.ImageIndex := IDEImages.LoadImage(16, 'menu_clean'); + ResetKeyFilterBtn.LoadGlyphFromLazarusResource(ResBtnListFilter); + ResetKeyFilterBtn.Enabled := not IDEShortCutEmpty(KeyMapKeyFilter); + FillKeyMappingTreeView; UpdateSchemeLabel; end; @@ -452,6 +466,7 @@ begin else FindKeyButton.Caption:= Format(lisFilter3, [KeyAndShiftStateToEditorKeyString(KeyMapKeyFilter)]); + ResetKeyFilterBtn.Enabled := not IDEShortCutEmpty(KeyMapKeyFilter); end; procedure TEditorKeymappingOptionsFrame.UpdateSchemeLabel;