Added: initial filter configuration dialog
This commit is contained in:
parent
450baa3705
commit
8faa61f358
Binary file not shown.
@ -52,6 +52,8 @@ contains
|
|||||||
CmpSwDialog in '..\..\Source\CmpSwDialog.pas' {frmCmpSwDialog},
|
CmpSwDialog in '..\..\Source\CmpSwDialog.pas' {frmCmpSwDialog},
|
||||||
CmpSwFilters in '..\..\Source\CmpSwFilters.pas',
|
CmpSwFilters in '..\..\Source\CmpSwFilters.pas',
|
||||||
BaseSwSettings in '..\..\Source\BaseSwSettings.pas',
|
BaseSwSettings in '..\..\Source\BaseSwSettings.pas',
|
||||||
CmpSwSettings in '..\..\Source\CmpSwSettings.pas';
|
CmpSwSettings in '..\..\Source\CmpSwSettings.pas',
|
||||||
|
CmpSwConfiguration in '..\..\Source\CmpSwConfiguration.pas' {frmCmpSwConfiguration},
|
||||||
|
CmpSwFilterConfiguration in '..\..\Source\CmpSwFilterConfiguration.pas' {frmCmpSwFilterConfiguration};
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
235
Source/CmpSwConfiguration.dfm
Normal file
235
Source/CmpSwConfiguration.dfm
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
object frmCmpSwConfiguration: TfrmCmpSwConfiguration
|
||||||
|
Left = 279
|
||||||
|
Top = 170
|
||||||
|
BorderIcons = [biSystemMenu]
|
||||||
|
BorderStyle = bsDialog
|
||||||
|
Caption = 'ComponentSwitcher Configuration'
|
||||||
|
ClientHeight = 423
|
||||||
|
ClientWidth = 328
|
||||||
|
Color = clBtnFace
|
||||||
|
Font.Charset = DEFAULT_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -11
|
||||||
|
Font.Name = 'Tahoma'
|
||||||
|
Font.Style = []
|
||||||
|
OldCreateOrder = False
|
||||||
|
Position = poScreenCenter
|
||||||
|
DesignSize = (
|
||||||
|
328
|
||||||
|
423)
|
||||||
|
PixelsPerInch = 96
|
||||||
|
TextHeight = 13
|
||||||
|
object pcConfiguration: TPageControl
|
||||||
|
Left = 4
|
||||||
|
Top = 4
|
||||||
|
Width = 320
|
||||||
|
Height = 382
|
||||||
|
ActivePage = tsGeneral
|
||||||
|
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||||
|
TabOrder = 0
|
||||||
|
object tsGeneral: TTabSheet
|
||||||
|
Caption = 'Filters'
|
||||||
|
DesignSize = (
|
||||||
|
312
|
||||||
|
354)
|
||||||
|
object btnDefault: TButton
|
||||||
|
Left = 4
|
||||||
|
Top = 323
|
||||||
|
Width = 109
|
||||||
|
Height = 25
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
Caption = 'Reset to &default'
|
||||||
|
TabOrder = 0
|
||||||
|
OnClick = btnDefaultClick
|
||||||
|
end
|
||||||
|
object chkAllowEmptyResults: TCheckBox
|
||||||
|
Left = 4
|
||||||
|
Top = 292
|
||||||
|
Width = 273
|
||||||
|
Height = 17
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
Caption = 'Allow e&mpty results'
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object lbFilters: TListBox
|
||||||
|
Left = 4
|
||||||
|
Top = 4
|
||||||
|
Width = 301
|
||||||
|
Height = 233
|
||||||
|
Style = lbVirtual
|
||||||
|
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||||
|
ItemHeight = 16
|
||||||
|
TabOrder = 2
|
||||||
|
OnClick = lbFiltersClick
|
||||||
|
OnData = lbFiltersData
|
||||||
|
OnDataObject = lbFiltersDataObject
|
||||||
|
end
|
||||||
|
object btnAdd: TButton
|
||||||
|
Left = 4
|
||||||
|
Top = 243
|
||||||
|
Width = 97
|
||||||
|
Height = 25
|
||||||
|
Action = actAdd
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
|
object btnEdit: TButton
|
||||||
|
Left = 108
|
||||||
|
Top = 243
|
||||||
|
Width = 97
|
||||||
|
Height = 25
|
||||||
|
Action = actEdit
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
TabOrder = 4
|
||||||
|
end
|
||||||
|
object btnRemove: TButton
|
||||||
|
Left = 212
|
||||||
|
Top = 243
|
||||||
|
Width = 93
|
||||||
|
Height = 25
|
||||||
|
Action = actRemove
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
TabOrder = 5
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object tsAbout: TTabSheet
|
||||||
|
Caption = 'About...'
|
||||||
|
ImageIndex = 1
|
||||||
|
DesignSize = (
|
||||||
|
312
|
||||||
|
354)
|
||||||
|
object imgAbout: TImage
|
||||||
|
Left = 8
|
||||||
|
Top = 8
|
||||||
|
Width = 32
|
||||||
|
Height = 32
|
||||||
|
Picture.Data = {
|
||||||
|
055449636F6E0000010001002020100001000400E80200001600000028000000
|
||||||
|
2000000040000000010004000000000000020000000000000000000000000000
|
||||||
|
0000000000000000000080000080000000808000800000008000800080800000
|
||||||
|
80808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000
|
||||||
|
FFFFFF0000000000000000000000000000000000000000000000000000000000
|
||||||
|
00000000000000F7777777777777777777777700000000F8F8F8F8F8F8F8F8F8
|
||||||
|
F8F8F700000000FF8F8F8F8F8F8F8F8F8F8F8700000000F8F8F8F8F8F8F8F8F8
|
||||||
|
F8F8F700000000FF8F8F8F8F8F8F8F8F8F8F8700000000F8F000000000000000
|
||||||
|
0008F700000000FF8F8F8F8F8F8F8F8F8F8F8700000000F8F8F8F8F8F8F8F8F8
|
||||||
|
F8F8F700000000FF8F8F8F8F8F8F8F8F8F8F8700000000F8F000000000000000
|
||||||
|
0008F700000000FF8F8F8F8F8F8F8F8F8F8F87000C0000F99999999999999999
|
||||||
|
999997000CC000F99999999999999999999997000CCE00F99FFFFFFFFFFFFFFF
|
||||||
|
FFF997000CE000F99999999999999999999997000E0000F99999999999999999
|
||||||
|
99999700000000FF8F8F8F8F8F8F8F8F8F8F8700000000F8F000000000000000
|
||||||
|
0008F700000000FF8F8F8F8F8F8F8F8F8F8F8700000000F8F8F8F8F8F8F8F8F8
|
||||||
|
F8F8F700000000FF8F8F8F8F8F8F8F8F8F8F8700000000F8F0000000000008F8
|
||||||
|
77777700000000FF8F8F8F8F8F8F8F8000000000000000F8F8F8F8F8F8F8F8F0
|
||||||
|
FFFFF000000000FF8F8F8F8F8F8F8F80FFFF0000000000F8F0000000000008F0
|
||||||
|
FFF00000000000FF8F8F8F8F8F8F8F80FF000000000000F8F8F8F8F8F8F8F8F0
|
||||||
|
F0000000000000FFFFFFFFFFFFFFFFF000000000000000000000000000000000
|
||||||
|
00000000FFFFFFFFF8000001F8000001F8000001F8000001F8000001F8000001
|
||||||
|
F8000001F8000001F8000001F800000178000001380000011800000108000001
|
||||||
|
0000000108000001180000013800000178000001F8000001F8000001F8000001
|
||||||
|
F8000001F8000001F8000003F8000007F800000FF800001FF800003FF800007F
|
||||||
|
F80000FF}
|
||||||
|
end
|
||||||
|
object TLabel
|
||||||
|
Left = 56
|
||||||
|
Top = 8
|
||||||
|
Width = 130
|
||||||
|
Height = 16
|
||||||
|
Caption = 'ComponentSwitcher'
|
||||||
|
Font.Charset = DEFAULT_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -13
|
||||||
|
Font.Name = 'Tahoma'
|
||||||
|
Font.Style = [fsBold]
|
||||||
|
ParentFont = False
|
||||||
|
end
|
||||||
|
object lblVersion: TLabel
|
||||||
|
Left = 56
|
||||||
|
Top = 23
|
||||||
|
Width = 54
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Version 0.1'
|
||||||
|
end
|
||||||
|
object TLabel
|
||||||
|
Left = 160
|
||||||
|
Top = 23
|
||||||
|
Width = 145
|
||||||
|
Height = 13
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
Caption = 'Copyright '#169' 2007 X'#178'Software'
|
||||||
|
end
|
||||||
|
object TLabel
|
||||||
|
Left = 56
|
||||||
|
Top = 90
|
||||||
|
Width = 241
|
||||||
|
Height = 41
|
||||||
|
AutoSize = False
|
||||||
|
Caption =
|
||||||
|
'ComponentSwitcher is released as open-source under the zlib/libp' +
|
||||||
|
'ng OSI-approved license. See license.txt for details.'
|
||||||
|
WordWrap = True
|
||||||
|
end
|
||||||
|
object lblBugReport: TLabel
|
||||||
|
Left = 56
|
||||||
|
Top = 328
|
||||||
|
Width = 75
|
||||||
|
Height = 13
|
||||||
|
Cursor = crHandPoint
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
Caption = 'Report a bug...'
|
||||||
|
Font.Charset = DEFAULT_CHARSET
|
||||||
|
Font.Color = clBlue
|
||||||
|
Font.Height = -11
|
||||||
|
Font.Name = 'Tahoma'
|
||||||
|
Font.Style = [fsUnderline]
|
||||||
|
ParentFont = False
|
||||||
|
OnClick = lblBugReportClick
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object btnCancel: TButton
|
||||||
|
Left = 249
|
||||||
|
Top = 392
|
||||||
|
Width = 75
|
||||||
|
Height = 25
|
||||||
|
Anchors = [akRight, akBottom]
|
||||||
|
Cancel = True
|
||||||
|
Caption = 'Cancel'
|
||||||
|
ModalResult = 2
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object btnOk: TButton
|
||||||
|
Left = 168
|
||||||
|
Top = 392
|
||||||
|
Width = 75
|
||||||
|
Height = 25
|
||||||
|
Anchors = [akRight, akBottom]
|
||||||
|
Caption = 'OK'
|
||||||
|
Default = True
|
||||||
|
ModalResult = 1
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object dlgColor: TColorDialog
|
||||||
|
Options = [cdFullOpen]
|
||||||
|
Left = 24
|
||||||
|
Top = 364
|
||||||
|
end
|
||||||
|
object alMain: TActionList
|
||||||
|
Left = 96
|
||||||
|
Top = 364
|
||||||
|
object actAdd: TAction
|
||||||
|
Caption = '&Add...'
|
||||||
|
OnExecute = actAddExecute
|
||||||
|
end
|
||||||
|
object actEdit: TAction
|
||||||
|
Caption = '&Edit...'
|
||||||
|
Enabled = False
|
||||||
|
OnExecute = actEditExecute
|
||||||
|
end
|
||||||
|
object actRemove: TAction
|
||||||
|
Caption = '&Remove'
|
||||||
|
Enabled = False
|
||||||
|
OnExecute = actRemoveExecute
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
179
Source/CmpSwConfiguration.pas
Normal file
179
Source/CmpSwConfiguration.pas
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
{: Contains the configuration dialog.
|
||||||
|
|
||||||
|
Last changed: $Date$
|
||||||
|
Revision: $Rev$
|
||||||
|
Author: $Author$
|
||||||
|
}
|
||||||
|
unit CmpSwConfiguration;
|
||||||
|
|
||||||
|
interface
|
||||||
|
uses
|
||||||
|
ActnList,
|
||||||
|
Classes,
|
||||||
|
ComCtrls,
|
||||||
|
Controls,
|
||||||
|
Dialogs,
|
||||||
|
ExtCtrls,
|
||||||
|
Forms,
|
||||||
|
Graphics,
|
||||||
|
StdCtrls;
|
||||||
|
|
||||||
|
type
|
||||||
|
TfrmCmpSwConfiguration = class(TForm)
|
||||||
|
actAdd: TAction;
|
||||||
|
actEdit: TAction;
|
||||||
|
actRemove: TAction;
|
||||||
|
alMain: TActionList;
|
||||||
|
btnAdd: TButton;
|
||||||
|
btnCancel: TButton;
|
||||||
|
btnDefault: TButton;
|
||||||
|
btnEdit: TButton;
|
||||||
|
btnOk: TButton;
|
||||||
|
btnRemove: TButton;
|
||||||
|
chkAllowEmptyResults: TCheckBox;
|
||||||
|
dlgColor: TColorDialog;
|
||||||
|
imgAbout: TImage;
|
||||||
|
lbFilters: TListBox;
|
||||||
|
lblBugReport: TLabel;
|
||||||
|
lblVersion: TLabel;
|
||||||
|
pcConfiguration: TPageControl;
|
||||||
|
tsAbout: TTabSheet;
|
||||||
|
tsGeneral: TTabSheet;
|
||||||
|
|
||||||
|
procedure btnDefaultClick(Sender: TObject);
|
||||||
|
procedure lblBugReportClick(Sender: TObject);
|
||||||
|
procedure actAddExecute(Sender: TObject);
|
||||||
|
procedure actEditExecute(Sender: TObject);
|
||||||
|
procedure actRemoveExecute(Sender: TObject);
|
||||||
|
procedure lbFiltersClick(Sender: TObject);
|
||||||
|
procedure lbFiltersData(Control: TWinControl; Index: Integer; var Data: String);
|
||||||
|
procedure lbFiltersDataObject(Control: TWinControl; Index: Integer; var DataObject: TObject);
|
||||||
|
private
|
||||||
|
function InternalExecute(): Boolean;
|
||||||
|
|
||||||
|
procedure LoadSettings();
|
||||||
|
procedure SaveSettings();
|
||||||
|
|
||||||
|
procedure RefreshFilters();
|
||||||
|
public
|
||||||
|
class function Execute(): Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
uses
|
||||||
|
ShellAPI,
|
||||||
|
Windows,
|
||||||
|
|
||||||
|
CmpSwSettings, CmpSwFilters;
|
||||||
|
|
||||||
|
|
||||||
|
{$R *.dfm}
|
||||||
|
|
||||||
|
|
||||||
|
{ TfrmCmpSwConfiguration }
|
||||||
|
class function TfrmCmpSwConfiguration.Execute(): Boolean;
|
||||||
|
begin
|
||||||
|
with Self.Create(nil) do
|
||||||
|
try
|
||||||
|
pcConfiguration.ActivePage := tsGeneral;
|
||||||
|
|
||||||
|
Result := InternalExecute();
|
||||||
|
finally
|
||||||
|
Free();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TfrmCmpSwConfiguration.InternalExecute(): Boolean;
|
||||||
|
begin
|
||||||
|
LoadSettings();
|
||||||
|
RefreshFilters();
|
||||||
|
|
||||||
|
Result := (ShowModal() = mrOk);
|
||||||
|
if Result then
|
||||||
|
SaveSettings();
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.lblBugReportClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ShellExecute(0, 'open', 'mailto:support@x2software.net', nil, nil, SW_SHOWNORMAL);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.LoadSettings();
|
||||||
|
begin
|
||||||
|
chkAllowEmptyResults.Checked := Settings.AllowEmptyResult;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.SaveSettings();
|
||||||
|
begin
|
||||||
|
Settings.AllowEmptyResult := chkAllowEmptyResults.Checked;
|
||||||
|
Settings.Save();
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.btnDefaultClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if MessageBox(Self.Handle, 'Are you sure you want to revert the ' +
|
||||||
|
'settings? This action can not be undone.',
|
||||||
|
'Reset to default', MB_YESNO or MB_ICONQUESTION) = ID_YES then
|
||||||
|
begin
|
||||||
|
Settings.ResetDefaults();
|
||||||
|
Settings.Save();
|
||||||
|
LoadSettings();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.actAddExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.actEditExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.actRemoveExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.lbFiltersClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
itemSelected: Boolean;
|
||||||
|
|
||||||
|
begin
|
||||||
|
itemSelected := (lbFilters.ItemIndex > -1);
|
||||||
|
|
||||||
|
actEdit.Enabled := itemSelected;
|
||||||
|
actRemove.Enabled := itemSelected;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.RefreshFilters();
|
||||||
|
begin
|
||||||
|
lbFilters.Count := Settings.Filter.Count;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.lbFiltersData(Control: TWinControl; Index: Integer; var Data: String);
|
||||||
|
begin
|
||||||
|
if (Index >= 0) and (Index < Settings.Filter.Count) then
|
||||||
|
Data := Settings.Filter[Index].Name;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwConfiguration.lbFiltersDataObject(Control: TWinControl; Index: Integer; var DataObject: TObject);
|
||||||
|
begin
|
||||||
|
if (Index >= 0) and (Index < Settings.Filter.Count) then
|
||||||
|
DataObject := Settings.Filter[Index];
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -37,6 +37,15 @@ inherited frmCmpSwDialog: TfrmCmpSwDialog
|
|||||||
inherited btnOK: TButton
|
inherited btnOK: TButton
|
||||||
Left = 190
|
Left = 190
|
||||||
end
|
end
|
||||||
|
object btnConfiguration: TButton
|
||||||
|
Left = 4
|
||||||
|
Top = 5
|
||||||
|
Width = 85
|
||||||
|
Height = 25
|
||||||
|
Caption = '&Configuration'
|
||||||
|
TabOrder = 2
|
||||||
|
OnClick = btnConfigurationClick
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object pnlFilters: TPanel [3]
|
object pnlFilters: TPanel [3]
|
||||||
Left = 0
|
Left = 0
|
||||||
|
@ -51,10 +51,12 @@ type
|
|||||||
pmnItemsSortByName: TMenuItem;
|
pmnItemsSortByName: TMenuItem;
|
||||||
pmnItemsSortByType: TMenuItem;
|
pmnItemsSortByType: TMenuItem;
|
||||||
pmnItemsSep2: TMenuItem;
|
pmnItemsSep2: TMenuItem;
|
||||||
|
btnConfiguration: TButton;
|
||||||
|
|
||||||
procedure btnMoreFiltersClick(Sender: TObject);
|
procedure btnMoreFiltersClick(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure SortExecute(Sender: TObject);
|
procedure SortExecute(Sender: TObject);
|
||||||
|
procedure btnConfigurationClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
FClassFilteredList: TBaseSwItemList;
|
FClassFilteredList: TBaseSwItemList;
|
||||||
FClassFilter: TCmpSwComponentClassFilter;
|
FClassFilter: TCmpSwComponentClassFilter;
|
||||||
@ -93,6 +95,7 @@ uses
|
|||||||
SysUtils,
|
SysUtils,
|
||||||
ToolsAPI,
|
ToolsAPI,
|
||||||
|
|
||||||
|
CmpSwConfiguration,
|
||||||
CmpSwObjects,
|
CmpSwObjects,
|
||||||
CmpSwSettings;
|
CmpSwSettings;
|
||||||
|
|
||||||
@ -247,6 +250,8 @@ begin
|
|||||||
FFilterCheckBoxes := TObjectList.Create();
|
FFilterCheckBoxes := TObjectList.Create();
|
||||||
FOtherGroup := TCmpSwFilterGroup.Create(nil);
|
FOtherGroup := TCmpSwFilterGroup.Create(nil);
|
||||||
try
|
try
|
||||||
|
ClassFilter.Groups := Settings.Filter;
|
||||||
|
|
||||||
FOtherGroup.Name := 'Other';
|
FOtherGroup.Name := 'Other';
|
||||||
FOtherGroup.Enabled := False;
|
FOtherGroup.Enabled := False;
|
||||||
FOtherGroup.Visible := False;
|
FOtherGroup.Visible := False;
|
||||||
@ -471,8 +476,6 @@ begin
|
|||||||
Self.ClientHeight := Settings.Dialog.Height;
|
Self.ClientHeight := Settings.Dialog.Height;
|
||||||
MRUList.Assign(Settings.Dialog.MRUList);
|
MRUList.Assign(Settings.Dialog.MRUList);
|
||||||
|
|
||||||
Settings.LoadFilter(ClassFilter.Groups);
|
|
||||||
|
|
||||||
inherited LoadSettings();
|
inherited LoadSettings();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -486,8 +489,6 @@ begin
|
|||||||
Settings.Dialog.MRUList.Assign(MRUList);
|
Settings.Dialog.MRUList.Assign(MRUList);
|
||||||
Settings.Save();
|
Settings.Save();
|
||||||
|
|
||||||
Settings.SaveFilter(ClassFilter.Groups);
|
|
||||||
|
|
||||||
inherited SaveSettings();
|
inherited SaveSettings();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -495,7 +496,7 @@ end;
|
|||||||
|
|
||||||
function TfrmCmpSwDialog.AllowEmptyResult(): Boolean;
|
function TfrmCmpSwDialog.AllowEmptyResult(): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := Settings.AllowEmptyResult;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -533,4 +534,14 @@ begin
|
|||||||
ClassFilteredList.Sort(SortByName);
|
ClassFilteredList.Sort(SortByName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmCmpSwDialog.btnConfigurationClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if TfrmCmpSwConfiguration.Execute() then
|
||||||
|
begin
|
||||||
|
UpdateClassFilter();
|
||||||
|
UpdateSubFilters();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
62
Source/CmpSwFilterConfiguration.dfm
Normal file
62
Source/CmpSwFilterConfiguration.dfm
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
object frmCmpSwFilterConfiguration: TfrmCmpSwFilterConfiguration
|
||||||
|
Left = 317
|
||||||
|
Top = 192
|
||||||
|
BorderIcons = [biSystemMenu]
|
||||||
|
BorderStyle = bsDialog
|
||||||
|
BorderWidth = 8
|
||||||
|
Caption = 'Filter'
|
||||||
|
ClientHeight = 343
|
||||||
|
ClientWidth = 345
|
||||||
|
Color = clBtnFace
|
||||||
|
Font.Charset = DEFAULT_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -11
|
||||||
|
Font.Name = 'MS Sans Serif'
|
||||||
|
Font.Style = []
|
||||||
|
OldCreateOrder = False
|
||||||
|
Position = poScreenCenter
|
||||||
|
PixelsPerInch = 96
|
||||||
|
TextHeight = 13
|
||||||
|
object gbMain: TGroupBox
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
Width = 345
|
||||||
|
Height = 308
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object pnlButtons: TPanel
|
||||||
|
Left = 0
|
||||||
|
Top = 308
|
||||||
|
Width = 345
|
||||||
|
Height = 35
|
||||||
|
Align = alBottom
|
||||||
|
BevelOuter = bvNone
|
||||||
|
TabOrder = 1
|
||||||
|
DesignSize = (
|
||||||
|
345
|
||||||
|
35)
|
||||||
|
object btnOk: TButton
|
||||||
|
Left = 189
|
||||||
|
Top = 10
|
||||||
|
Width = 75
|
||||||
|
Height = 25
|
||||||
|
Anchors = [akRight, akBottom]
|
||||||
|
Caption = 'OK'
|
||||||
|
Default = True
|
||||||
|
ModalResult = 1
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object btnCancel: TButton
|
||||||
|
Left = 270
|
||||||
|
Top = 10
|
||||||
|
Width = 75
|
||||||
|
Height = 25
|
||||||
|
Anchors = [akRight, akBottom]
|
||||||
|
Cancel = True
|
||||||
|
Caption = 'Cancel'
|
||||||
|
ModalResult = 2
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
57
Source/CmpSwFilterConfiguration.pas
Normal file
57
Source/CmpSwFilterConfiguration.pas
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
{: Contains the filter configuration dialog.
|
||||||
|
|
||||||
|
Last changed: $Date$
|
||||||
|
Revision: $Rev$
|
||||||
|
Author: $Author$
|
||||||
|
}
|
||||||
|
unit CmpSwFilterConfiguration;
|
||||||
|
|
||||||
|
interface
|
||||||
|
uses
|
||||||
|
Classes,
|
||||||
|
Controls,
|
||||||
|
ExtCtrls,
|
||||||
|
Forms,
|
||||||
|
StdCtrls,
|
||||||
|
|
||||||
|
CmpSwFilters;
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
|
TfrmCmpSwFilterConfiguration = class(TForm)
|
||||||
|
gbMain: TGroupBox;
|
||||||
|
pnlButtons: TPanel;
|
||||||
|
btnOk: TButton;
|
||||||
|
btnCancel: TButton;
|
||||||
|
protected
|
||||||
|
function InternalExecute(AGroup: TCmpSwFilterGroup): Boolean;
|
||||||
|
public
|
||||||
|
class function Execute(AGroup: TCmpSwFilterGroup): Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
|
||||||
|
{$R *.dfm}
|
||||||
|
|
||||||
|
|
||||||
|
{ TfrmCmpSwFilterConfiguration }
|
||||||
|
class function TfrmCmpSwFilterConfiguration.Execute(AGroup: TCmpSwFilterGroup): Boolean;
|
||||||
|
begin
|
||||||
|
with Self.Create(nil) do
|
||||||
|
try
|
||||||
|
Result := InternalExecute(AGroup);
|
||||||
|
finally
|
||||||
|
Free();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TfrmCmpSwFilterConfiguration.InternalExecute(AGroup: TCmpSwFilterGroup): Boolean;
|
||||||
|
begin
|
||||||
|
Result := (ShowModal() = mrOk);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
@ -60,14 +60,17 @@ type
|
|||||||
private
|
private
|
||||||
FFilterUnmatched: Boolean;
|
FFilterUnmatched: Boolean;
|
||||||
FGroups: TCmpSwFilterGroups;
|
FGroups: TCmpSwFilterGroups;
|
||||||
|
FOwnsGroups: Boolean;
|
||||||
|
|
||||||
|
function GetGroups(): TCmpSwFilterGroups;
|
||||||
|
procedure SetGroups(const Value: TCmpSwFilterGroups);
|
||||||
protected
|
protected
|
||||||
procedure VisitItem(const AItem: TBaseSwItem); override;
|
procedure VisitItem(const AItem: TBaseSwItem); override;
|
||||||
public
|
public
|
||||||
constructor Create();
|
|
||||||
destructor Destroy(); override;
|
destructor Destroy(); override;
|
||||||
|
|
||||||
property FilterUnmatched: Boolean read FFilterUnmatched write FFilterUnmatched;
|
property FilterUnmatched: Boolean read FFilterUnmatched write FFilterUnmatched;
|
||||||
property Groups: TCmpSwFilterGroups read FGroups;
|
property Groups: TCmpSwFilterGroups read GetGroups write SetGroups;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -243,19 +246,37 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{ TCmpSwComponentClassFilter }
|
{ TCmpSwComponentClassFilter }
|
||||||
constructor TCmpSwComponentClassFilter.Create();
|
destructor TCmpSwComponentClassFilter.Destroy();
|
||||||
begin
|
begin
|
||||||
inherited;
|
if FOwnsGroups then
|
||||||
|
FreeAndNil(FGroups);
|
||||||
|
|
||||||
FGroups := TCmpSwFilterGroups.Create();
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
destructor TCmpSwComponentClassFilter.Destroy();
|
function TCmpSwComponentClassFilter.GetGroups(): TCmpSwFilterGroups;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FGroups);
|
if not Assigned(FGroups) then
|
||||||
|
begin
|
||||||
|
FGroups := TCmpSwFilterGroups.Create();
|
||||||
|
FOwnsGroups := True;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited;
|
Result := FGroups;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TCmpSwComponentClassFilter.SetGroups(const Value: TCmpSwFilterGroups);
|
||||||
|
begin
|
||||||
|
if Value <> FGroups then
|
||||||
|
begin
|
||||||
|
if FOwnsGroups then
|
||||||
|
FreeAndNil(FGroups);
|
||||||
|
|
||||||
|
FGroups := Value;
|
||||||
|
FOwnsGroups := False;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,12 +36,17 @@ type
|
|||||||
|
|
||||||
TCmpSwSettings = class(TObject)
|
TCmpSwSettings = class(TObject)
|
||||||
private
|
private
|
||||||
|
FAllowEmptyResult: Boolean;
|
||||||
FDialog: TCmpSwDialogSettings;
|
FDialog: TCmpSwDialogSettings;
|
||||||
|
FFilter: TCmpSwFilterGroups;
|
||||||
|
|
||||||
FRegistryKey: String;
|
FRegistryKey: String;
|
||||||
protected
|
protected
|
||||||
procedure Load();
|
procedure Load();
|
||||||
|
|
||||||
|
procedure LoadFilter(const AKey: String; AGroups: TCmpSwFilterGroups);
|
||||||
|
procedure SaveFilter(const AKey: String; AGroups: TCmpSwFilterGroups);
|
||||||
|
|
||||||
procedure LoadFilterGroup(ARegistry: TRegistry; AGroup: TCmpSwFilterGroup);
|
procedure LoadFilterGroup(ARegistry: TRegistry; AGroup: TCmpSwFilterGroup);
|
||||||
procedure SaveFilterGroup(ARegistry: TRegistry; AGroup: TCmpSwFilterGroup);
|
procedure SaveFilterGroup(ARegistry: TRegistry; AGroup: TCmpSwFilterGroup);
|
||||||
public
|
public
|
||||||
@ -51,10 +56,9 @@ type
|
|||||||
procedure ResetDefaults();
|
procedure ResetDefaults();
|
||||||
procedure Save();
|
procedure Save();
|
||||||
|
|
||||||
procedure LoadFilter(AGroups: TCmpSwFilterGroups);
|
property AllowEmptyResult: Boolean read FAllowEmptyResult write FAllowEmptyResult;
|
||||||
procedure SaveFilter(AGroups: TCmpSwFilterGroups);
|
property Dialog: TCmpSwDialogSettings read FDialog write FDialog;
|
||||||
|
property Filter: TCmpSwFilterGroups read FFilter;
|
||||||
property Dialog: TCmpSwDialogSettings read FDialog write FDialog;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function Settings(): TCmpSwSettings;
|
function Settings(): TCmpSwSettings;
|
||||||
@ -144,6 +148,7 @@ begin
|
|||||||
'\ComponentSwitcher';
|
'\ComponentSwitcher';
|
||||||
|
|
||||||
FDialog := TCmpSwDialogSettings.Create();
|
FDialog := TCmpSwDialogSettings.Create();
|
||||||
|
FFilter := TCmpSwFilterGroups.Create();
|
||||||
|
|
||||||
ResetDefaults();
|
ResetDefaults();
|
||||||
Load();
|
Load();
|
||||||
@ -152,6 +157,7 @@ end;
|
|||||||
|
|
||||||
destructor TCmpSwSettings.Destroy();
|
destructor TCmpSwSettings.Destroy();
|
||||||
begin
|
begin
|
||||||
|
FreeAndNil(FFilter);
|
||||||
FreeAndNil(FDialog);
|
FreeAndNil(FDialog);
|
||||||
|
|
||||||
inherited;
|
inherited;
|
||||||
@ -171,6 +177,7 @@ begin
|
|||||||
if OpenKey(FRegistryKey, False) then
|
if OpenKey(FRegistryKey, False) then
|
||||||
begin
|
begin
|
||||||
FDialog.Load(ideRegistry);
|
FDialog.Load(ideRegistry);
|
||||||
|
LoadFilter('\Filter', Filter);
|
||||||
|
|
||||||
CloseKey();
|
CloseKey();
|
||||||
end;
|
end;
|
||||||
@ -182,8 +189,46 @@ end;
|
|||||||
|
|
||||||
procedure TCmpSwSettings.ResetDefaults();
|
procedure TCmpSwSettings.ResetDefaults();
|
||||||
begin
|
begin
|
||||||
|
AllowEmptyResult := True;
|
||||||
|
|
||||||
Dialog.Width := 350;
|
Dialog.Width := 350;
|
||||||
Dialog.Height := 530;
|
Dialog.Height := 530;
|
||||||
|
|
||||||
|
{ Fill default groups }
|
||||||
|
Filter.Clear();
|
||||||
|
with Filter.Add() do
|
||||||
|
begin
|
||||||
|
Name := 'Actions';
|
||||||
|
|
||||||
|
Filter.Add('TAction');
|
||||||
|
IncludeDescendants := True;
|
||||||
|
Visible := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
with Filter.Add() do
|
||||||
|
begin
|
||||||
|
Name := 'Menu items';
|
||||||
|
|
||||||
|
Filter.Add('TMenuItem');
|
||||||
|
Visible := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
with Filter.Add() do
|
||||||
|
begin
|
||||||
|
Name := 'Dataset fields';
|
||||||
|
|
||||||
|
Filter.Add('TField');
|
||||||
|
IncludeDescendants := True;
|
||||||
|
Visible := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
with Filter.Add() do
|
||||||
|
begin
|
||||||
|
Name := 'DevEx Grid columns';
|
||||||
|
|
||||||
|
Filter.Add('TcxGridDBColumn');
|
||||||
|
Filter.Add('TcxGridColumn');
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -200,6 +245,7 @@ begin
|
|||||||
if OpenKey(FRegistryKey, True) then
|
if OpenKey(FRegistryKey, True) then
|
||||||
begin
|
begin
|
||||||
FDialog.Save(ideRegistry);
|
FDialog.Save(ideRegistry);
|
||||||
|
SaveFilter('\Filter', Filter);
|
||||||
|
|
||||||
CloseKey();
|
CloseKey();
|
||||||
end;
|
end;
|
||||||
@ -209,7 +255,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCmpSwSettings.LoadFilter(AGroups: TCmpSwFilterGroups);
|
procedure TCmpSwSettings.LoadFilter(const AKey: String; AGroups: TCmpSwFilterGroups);
|
||||||
var
|
var
|
||||||
ideRegistry: TRegistry;
|
ideRegistry: TRegistry;
|
||||||
groupCount: Integer;
|
groupCount: Integer;
|
||||||
@ -222,7 +268,7 @@ begin
|
|||||||
try
|
try
|
||||||
RootKey := HKEY_CURRENT_USER;
|
RootKey := HKEY_CURRENT_USER;
|
||||||
|
|
||||||
if OpenKey(FRegistryKey + '\Filter', False) then
|
if OpenKey(FRegistryKey + AKey, False) then
|
||||||
begin
|
begin
|
||||||
AGroups.Clear();
|
AGroups.Clear();
|
||||||
groupCount := 0;
|
groupCount := 0;
|
||||||
@ -240,42 +286,6 @@ begin
|
|||||||
CloseKey();
|
CloseKey();
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end else
|
|
||||||
begin
|
|
||||||
{ Fill default groups }
|
|
||||||
with AGroups.Add() do
|
|
||||||
begin
|
|
||||||
Name := 'Actions';
|
|
||||||
|
|
||||||
Filter.Add('TAction');
|
|
||||||
IncludeDescendants := True;
|
|
||||||
Visible := True;
|
|
||||||
end;
|
|
||||||
|
|
||||||
with AGroups.Add() do
|
|
||||||
begin
|
|
||||||
Name := 'Menu items';
|
|
||||||
|
|
||||||
Filter.Add('TMenuItem');
|
|
||||||
Visible := True;
|
|
||||||
end;
|
|
||||||
|
|
||||||
with AGroups.Add() do
|
|
||||||
begin
|
|
||||||
Name := 'Dataset fields';
|
|
||||||
|
|
||||||
Filter.Add('TField');
|
|
||||||
IncludeDescendants := True;
|
|
||||||
Visible := True;
|
|
||||||
end;
|
|
||||||
|
|
||||||
with AGroups.Add() do
|
|
||||||
begin
|
|
||||||
Name := 'DevEx Grid columns';
|
|
||||||
|
|
||||||
Filter.Add('TcxGridDBColumn');
|
|
||||||
Filter.Add('TcxGridColumn');
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
Free();
|
Free();
|
||||||
@ -283,7 +293,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCmpSwSettings.SaveFilter(AGroups: TCmpSwFilterGroups);
|
procedure TCmpSwSettings.SaveFilter(const AKey: String; AGroups: TCmpSwFilterGroups);
|
||||||
var
|
var
|
||||||
ideRegistry: TRegistry;
|
ideRegistry: TRegistry;
|
||||||
subKeys: TStringList;
|
subKeys: TStringList;
|
||||||
@ -296,7 +306,7 @@ begin
|
|||||||
try
|
try
|
||||||
RootKey := HKEY_CURRENT_USER;
|
RootKey := HKEY_CURRENT_USER;
|
||||||
|
|
||||||
if OpenKey(FRegistryKey + '\Filter', True) then
|
if OpenKey(FRegistryKey + AKey, True) then
|
||||||
begin
|
begin
|
||||||
subKeys := TStringList.Create();
|
subKeys := TStringList.Create();
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user