IDE: Remember the state of filter buttons in ProcedureList. Trigger filtering when they are clicked.

git-svn-id: trunk@58902 -
This commit is contained in:
juha 2018-09-07 11:03:31 +00:00
parent c51224fbad
commit 9c7329fca7
3 changed files with 79 additions and 84 deletions

View File

@ -512,10 +512,11 @@ type
// project inspector
FProjInspSortAlphabetically: boolean;
FProjInspShowDirHierarchy: boolean;
// package editor
FPackageEditorSortAlphabetically: boolean;
FPackageEditorShowDirHierarchy: boolean;
// procedure list
FProcedureListFilterStart: boolean;
// hints
FAskSaveSessionOnly: boolean;
@ -775,6 +776,9 @@ type
write FPackageEditorSortAlphabetically;
property PackageEditorShowDirHierarchy: boolean read FPackageEditorShowDirHierarchy
write FPackageEditorShowDirHierarchy;
// procedure list
property ProcedureListFilterStart: boolean read FProcedureListFilterStart
write FProcedureListFilterStart;
// hints
property CheckDiskChangesWithLoading: boolean read FCheckDiskChangesWithLoading
write FCheckDiskChangesWithLoading;
@ -1653,14 +1657,14 @@ begin
// object inspector
FObjectInspectorOptions:=TOIOptions.Create;
// project inspector
FProjInspSortAlphabetically:=false;
FProjInspShowDirHierarchy:=false;
// package editor
FPackageEditorSortAlphabetically:=false;
FPackageEditorShowDirHierarchy:=false;
// procedure list
FProcedureListFilterStart:=false;
// hints
FCheckDiskChangesWithLoading:=false;
@ -2105,6 +2109,9 @@ begin
FPackageEditorSortAlphabetically:=FXMLCfg.GetValue(Path+'PackageEditorSortAlphabetically/Value',false);
FPackageEditorShowDirHierarchy:=FXMLCfg.GetValue(Path+'PackageEditorShowDirHierarchy/Value',false);
// procedure list
FProcedureListFilterStart:=FXMLCfg.GetValue(Path+'ProcedureListFilterStart/Value',false);
// hints
FCheckDiskChangesWithLoading:=FXMLCfg.GetValue(Path+'CheckDiskChangesWithLoading/Value',false);
FDiskChangesAutoCheckModified:=FXMLCfg.GetValue(Path+'DiskChangesAutoCheckModified/Value',false);
@ -2457,6 +2464,9 @@ begin
FXMLCfg.SetDeleteValue(Path+'PackageEditorSortAlphabetically/Value',FPackageEditorSortAlphabetically,false);
FXMLCfg.SetDeleteValue(Path+'PackageEditorShowDirHierarchy/Value',FPackageEditorShowDirHierarchy,false);
// procedure list
FXMLCfg.SetDeleteValue(Path+'ProcedureListFilterStart/Value',FProcedureListFilterStart,false);
// hints
FXMLCfg.SetDeleteValue(Path+'CheckDiskChangesWithLoading/Value',FCheckDiskChangesWithLoading,false);
FXMLCfg.SetDeleteValue(Path+'DiskChangesAutoCheckModified/Value',FDiskChangesAutoCheckModified,false);

View File

@ -13,11 +13,11 @@ object ProcedureListForm: TProcedureListForm
OnResize = FormResize
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.7'
LCLVersion = '1.9.0.0'
object StatusBar: TStatusBar
Left = 0
Height = 23
Top = 665
Height = 21
Top = 667
Width = 952
Panels = <
item
@ -50,7 +50,6 @@ object ProcedureListForm: TProcedureListForm
Left = 131
Height = 22
Top = 0
Width = 5
Caption = 'ToolButton2'
Style = tbsDivider
end
@ -68,7 +67,6 @@ object ProcedureListForm: TProcedureListForm
Left = 103
Height = 22
Top = 0
Width = 5
Caption = 'ToolButton4'
Style = tbsDivider
end
@ -80,6 +78,7 @@ object ProcedureListForm: TProcedureListForm
Down = True
Grouped = True
ImageIndex = 8
OnClick = SomethingChange
ParentShowHint = False
ShowHint = True
Style = tbsCheck
@ -91,6 +90,7 @@ object ProcedureListForm: TProcedureListForm
Caption = 'tbFilterStart'
Grouped = True
ImageIndex = 7
OnClick = SomethingChange
ParentShowHint = False
ShowHint = True
Style = tbsCheck
@ -99,7 +99,6 @@ object ProcedureListForm: TProcedureListForm
Left = 52
Height = 22
Top = 0
Width = 5
Caption = 'ToolButton7'
Style = tbsDivider
Visible = False
@ -118,7 +117,6 @@ object ProcedureListForm: TProcedureListForm
Left = 24
Height = 22
Top = 0
Width = 5
Caption = 'ToolButton9'
Style = tbsDivider
end
@ -135,13 +133,13 @@ object ProcedureListForm: TProcedureListForm
end
object pnlHeader: TPanel
Left = 0
Height = 44
Height = 47
Top = 26
Width = 952
Align = alTop
AutoSize = True
BevelOuter = bvNone
ClientHeight = 44
ClientHeight = 47
ClientWidth = 952
ParentColor = False
TabOrder = 1
@ -149,9 +147,9 @@ object ProcedureListForm: TProcedureListForm
AnchorSideTop.Control = pnlHeader
AnchorSideTop.Side = asrCenter
Left = 6
Height = 18
Top = 13
Width = 42
Height = 19
Top = 14
Width = 43
BorderSpacing.Around = 6
Caption = '&Search'
ParentColor = False
@ -162,8 +160,8 @@ object ProcedureListForm: TProcedureListForm
AnchorSideTop.Control = pnlHeader
AnchorSideTop.Side = asrCenter
Left = 610
Height = 18
Top = 13
Height = 19
Top = 14
Width = 46
BorderSpacing.Left = 12
BorderSpacing.Around = 6
@ -177,15 +175,15 @@ object ProcedureListForm: TProcedureListForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = cbObjects
AnchorSideBottom.Side = asrBottom
Left = 54
Height = 32
Left = 55
Height = 35
Top = 6
Width = 538
Width = 537
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
OnChange = edMethodsChange
OnChange = SomethingChange
OnKeyDown = edMethodsKeyDown
OnKeyPress = edMethodsKeyPress
TabOrder = 0
@ -197,13 +195,13 @@ object ProcedureListForm: TProcedureListForm
AnchorSideRight.Control = pnlHeader
AnchorSideRight.Side = asrBottom
Left = 662
Height = 32
Height = 35
Top = 6
Width = 284
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
ItemHeight = 18
OnChange = cbObjectsChange
ItemHeight = 0
OnChange = SomethingChange
Sorted = True
Style = csDropDownList
TabOrder = 1
@ -211,8 +209,8 @@ object ProcedureListForm: TProcedureListForm
end
object SG: TStringGrid
Left = 0
Height = 607
Top = 58
Height = 594
Top = 73
Width = 952
Align = alClient
ColCount = 4

View File

@ -47,7 +47,7 @@ uses
// IDEIntf
LazIDEIntf, IDEImagesIntf, SrcEditorIntf, IDEWindowIntf,
// IDE
LazarusIDEStrConsts;
EnvironmentOpts, LazarusIDEStrConsts;
type
@ -81,8 +81,6 @@ type
ToolButton7: TToolButton;
tbChangeFont: TToolButton;
ToolButton9: TToolButton;
procedure cbObjectsChange(Sender: TObject);
procedure edMethodsChange(Sender: TObject);
procedure edMethodsKeyDown(Sender: TObject; var Key: Word;
{%H-}Shift: TShiftState);
procedure edMethodsKeyPress(Sender: TObject; var Key: char);
@ -96,6 +94,7 @@ type
{%H-}aState: TGridDrawState);
procedure SGSelectCell(Sender: TObject; {%H-}aCol, aRow: Integer;
var {%H-}CanSelect: Boolean);
procedure SomethingChange(Sender: TObject);
procedure tbAboutClick(Sender: TObject);
procedure tbCopyClick(Sender: TObject);
private
@ -238,12 +237,38 @@ end;
{ TProcedureListForm }
procedure TProcedureListForm.FormCreate(Sender: TObject);
begin
if SourceEditorManagerIntf.ActiveEditor = nil then
begin
//SetupGUI makes the dialog look as it should, and is clears the listview
//thus preventing a crash when clicking on the LV
SetupGUI;
Exit; //==>
end;
FMainFilename := SourceEditorManagerIntf.ActiveEditor.Filename;
Caption := Caption + ExtractFileName(FMainFilename);
SetupGUI;
PopulateObjectsCombo;
PopulateGrid;
StatusBar.Panels[0].Text := self.MainFilename;
tbFilterStart.Down := EnvironmentOptions.ProcedureListFilterStart;
IDEDialogLayoutList.ApplyLayout(Self, 950, 680);
end;
procedure TProcedureListForm.FormDestroy(Sender: TObject);
begin
EnvironmentOptions.ProcedureListFilterStart := tbFilterStart.Down;
ClearGrid;
IDEDialogLayoutList.SaveLayout(self);
end;
procedure TProcedureListForm.FormResize(Sender: TObject);
begin
StatusBar.Panels[0].Width := self.ClientWidth - 105;
end;
procedure TProcedureListForm.FormShow(Sender: TObject);
begin
edMethods.SetFocus;
@ -296,19 +321,6 @@ begin
end;
end;
procedure TProcedureListForm.tbAboutClick(Sender: TObject);
begin
ShowMessage(cAbout);
end;
procedure TProcedureListForm.tbCopyClick(Sender: TObject);
begin
if SG.Row > 0 then
Clipboard.AsText := SG.Cells[SG_COLIDX_PROCEDURE,SG.Row];
end;
procedure TProcedureListForm.SetupGUI;
begin
self.KeyPreview := True;
@ -632,34 +644,6 @@ begin
end;
end;
procedure TProcedureListForm.FormCreate(Sender: TObject);
begin
if SourceEditorManagerIntf.ActiveEditor = nil then
begin
//SetupGUI makes the dialog look as it should, and is clears the listview
//thus preventing a crash when clicking on the LV
SetupGUI;
Exit; //==>
end;
FMainFilename := SourceEditorManagerIntf.ActiveEditor.Filename;
Caption := Caption + ExtractFileName(FMainFilename);
SetupGUI;
PopulateObjectsCombo;
PopulateGrid;
StatusBar.Panels[0].Text := self.MainFilename;
IDEDialogLayoutList.ApplyLayout(Self, 950, 680);
end;
procedure TProcedureListForm.FormDestroy(Sender: TObject);
begin
ClearGrid;
IDEDialogLayoutList.SaveLayout(self);
end;
procedure TProcedureListForm.edMethodsKeyPress(Sender: TObject; var Key: char);
begin
case Key of
@ -676,19 +660,6 @@ begin
end;
end;
procedure TProcedureListForm.edMethodsChange(Sender: TObject);
begin
PopulateGrid;
end;
procedure TProcedureListForm.cbObjectsChange(Sender: TObject);
begin
PopulateGrid;
end;
procedure TProcedureListForm.edMethodsKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
@ -718,4 +689,20 @@ begin
end;
procedure TProcedureListForm.SomethingChange(Sender: TObject);
begin
PopulateGrid;
end;
procedure TProcedureListForm.tbAboutClick(Sender: TObject);
begin
ShowMessage(cAbout);
end;
procedure TProcedureListForm.tbCopyClick(Sender: TObject);
begin
if SG.Row > 0 then
Clipboard.AsText := SG.Cells[SG_COLIDX_PROCEDURE,SG.Row];
end;
end.