1
0
mirror of synced 2024-11-15 00:43:50 +00:00

Fixed: filter configuration dialog

This commit is contained in:
Mark van Renswoude 2007-12-16 13:06:21 +00:00
parent 8faa61f358
commit bf9df045af
13 changed files with 482 additions and 89 deletions

Binary file not shown.

View File

@ -53,6 +53,8 @@ contains
CmpSwObjects in '..\..\Source\CmpSwObjects.pas', CmpSwObjects in '..\..\Source\CmpSwObjects.pas',
CmpSwFilters in '..\..\Source\CmpSwFilters.pas', CmpSwFilters in '..\..\Source\CmpSwFilters.pas',
CmpSwSettings in '..\..\Source\CmpSwSettings.pas', CmpSwSettings in '..\..\Source\CmpSwSettings.pas',
BaseSwSettings in '..\..\Source\BaseSwSettings.pas'; BaseSwSettings in '..\..\Source\BaseSwSettings.pas',
CmpSwConfiguration in '..\..\Source\CmpSwConfiguration.pas' {frmCmpSwConfiguration},
CmpSwFilterConfiguration in '..\..\Source\CmpSwFilterConfiguration.pas' {frmCmpSwFilterConfiguration};
end. end.

BIN
Resources/FilterAdd.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
Resources/FilterDelete.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
Resources/FilterEdit.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -28,68 +28,66 @@ object frmCmpSwConfiguration: TfrmCmpSwConfiguration
Anchors = [akLeft, akTop, akRight, akBottom] Anchors = [akLeft, akTop, akRight, akBottom]
TabOrder = 0 TabOrder = 0
object tsGeneral: TTabSheet object tsGeneral: TTabSheet
BorderWidth = 8
Caption = 'Filters' Caption = 'Filters'
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 0
DesignSize = ( DesignSize = (
312 296
354) 338)
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 object chkAllowEmptyResults: TCheckBox
Left = 4 Left = 0
Top = 292 Top = 320
Width = 273 Width = 273
Height = 17 Height = 17
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
Caption = 'Allow e&mpty results' Caption = 'Allow e&mpty results'
TabOrder = 1 TabOrder = 2
end end
object lbFilters: TListBox object lbFilters: TListBox
Left = 4 Left = 0
Top = 4 Top = 29
Width = 301 Width = 296
Height = 233 Height = 280
Style = lbVirtual Style = lbVirtual
Anchors = [akLeft, akTop, akRight, akBottom] Align = alTop
ItemHeight = 16 ItemHeight = 16
TabOrder = 2 TabOrder = 1
OnClick = lbFiltersClick OnClick = lbFiltersClick
OnData = lbFiltersData OnData = lbFiltersData
OnDataObject = lbFiltersDataObject OnDataObject = lbFiltersDataObject
OnDblClick = lbFiltersDblClick
ExplicitLeft = 5
ExplicitTop = 34
end end
object btnAdd: TButton object tbFilters: TToolBar
Left = 4 Left = 0
Top = 243 Top = 0
Width = 97 Width = 296
Height = 25 Height = 29
Action = actAdd ButtonWidth = 73
Anchors = [akLeft, akBottom] Caption = 'tbFilters'
TabOrder = 3 Images = ilsFilters
end List = True
object btnEdit: TButton ShowCaptions = True
Left = 108 TabOrder = 0
Top = 243 object tbFilterAdd: TToolButton
Width = 97 Left = 0
Height = 25 Top = 0
Action = actEdit Action = actAdd
Anchors = [akLeft, akBottom] end
TabOrder = 4 object tbFilterEdit: TToolButton
end Left = 73
object btnRemove: TButton Top = 0
Left = 212 Action = actEdit
Top = 243 end
Width = 93 object tbFilterRemove: TToolButton
Height = 25 Left = 146
Action = actRemove Top = 0
Anchors = [akLeft, akBottom] Action = actRemove
TabOrder = 5 end
end end
end end
object tsAbout: TTabSheet object tsAbout: TTabSheet
@ -209,27 +207,184 @@ object frmCmpSwConfiguration: TfrmCmpSwConfiguration
ModalResult = 1 ModalResult = 1
TabOrder = 2 TabOrder = 2
end end
object btnDefault: TButton
Left = 4
Top = 392
Width = 109
Height = 25
Anchors = [akLeft, akBottom]
Caption = 'Reset to &default'
TabOrder = 3
OnClick = btnDefaultClick
end
object dlgColor: TColorDialog object dlgColor: TColorDialog
Options = [cdFullOpen] Options = [cdFullOpen]
Left = 24 Left = 24
Top = 364 Top = 364
end end
object alMain: TActionList object alMain: TActionList
Images = ilsFilters
Left = 96 Left = 96
Top = 364 Top = 364
object actAdd: TAction object actAdd: TAction
Caption = '&Add...' Caption = '&Add...'
ImageIndex = 0
OnExecute = actAddExecute OnExecute = actAddExecute
end end
object actEdit: TAction object actEdit: TAction
Caption = '&Edit...' Caption = '&Edit...'
Enabled = False Enabled = False
ImageIndex = 1
OnExecute = actEditExecute OnExecute = actEditExecute
end end
object actRemove: TAction object actRemove: TAction
Caption = '&Remove' Caption = '&Remove'
Enabled = False Enabled = False
ImageIndex = 2
OnExecute = actRemoveExecute OnExecute = actRemoveExecute
end end
end end
object ilsFilters: TImageList
Left = 164
Top = 364
Bitmap = {
494C010103000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000007F7F7F0074747400BABABA00007500000070
0000006D00000000000000000000000000000000000000000000000000000000
000000000000000000007B7C8200888592009AAD9D00A1A1A100000000000000
00000000000000000000000000000000000000000000383ABC000712AC006C6C
A900000000002526AD002629BB00ADADCA008080800070707000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000A3A3A300ECECEC00D5D5D500D6D6D600007D000044DD
7700007200000000000000000000000000000000000000000000000000000000
000000000000000000009BB2C70034B356002CB44400579E5D00000000000000
000000000000000000000000000000000000000000001F20AC002C72FF001332
D2001B30BF00174EFF00155CFF003539C500D4D4D40063636300000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000009D9D9D00E9E9E90000870000008500000081000048E1
7B00007A00000075000000700000000000000000000000000000000000000000
000000000000000000008BC6A00066FF98005AEC86002EAD4500619E66000000
000000000000000000000000000000000000000000006D6DB6001023C3002C67
FF00255DFF00205BFF00141FBA00D7D8EC00A6A6A60062626200000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000009E9E9E00E6E6E600008D00005EF791005AF38D0053EC
860048E17B0045DE780000780000000000000000000000000000000000000000
00000000000000000000C4D6C90055E17D006AFF9D0055E17D0028A23B0071A0
75000000000000000000000000000000000000000000000000008B8BB2001022
BF002D66FF001C49F4006D6DC100E7E7E7009191910060606000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000008E8E8E00E2E2E20000910000008D0000008B00005AF3
8D000083000000810000007D0000000000000000000000000000000000000000
00000000000000000000A1A1A100B5DDC10053EC81006AFF9D0050DC7700229B
35000000000000000000000000000000000000000000000000001E1E9F003F7D
FF001A3DDB002961FF001122C300C4C5D900929292005C5C5C00000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000A1A1A100F5F5F500E9E9E900E0E0E000DBDBDB00008F00005EF7
910000890000D2D2D20000000000000000000000000000000000000000000000
000000000000A1A1A100F5F5F500E1E1E1009DE0B20059F6880064FF970042DA
69002F823A0000000000000000000000000000000000000000001119BC00396D
FF007E7EC7003335B0002B6DFF00282BBE00D9D9D90073737300666666000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00009F9F9F00F6F6F600DCDCDC00D0D0D000B1B1B100D1D1D100009300000091
0000008D00000000000000000000000000000000000000000000000000000000
00009D9D9D00F5F5F500DCDCDC00D1D1D100D1D1D10079D7950055FC88009AC1
A400CDBBB6006969880000000000000000000000000000000000000000003B3B
BC00D5D5D500D3D3ED003232BD00BBBBEA00CACACA0084848400646464007676
7600000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000A5A5
A500F7F7F700EEEEEE00DBDBDB00D4D4D400B9B9B900D6D6D600D6D6D600CFCF
CF00A2A2A200000000000000000000000000000000000000000000000000A1A1
A100F8F8F800F5F5F500DCDCDC00D1D1D100BCBBBA00C4C5C5009AC1A400F8F8
F8007892F500203DDC00292AA10000000000000000000000000000000000D1D1
D100F7F7F700F0F0F000EEEEEE00E2E2E200B9B9B90091919100727272005B5B
5B008A8A8A000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000E8E8
E800E3E3E300B7B7B700A1A1A1009E9E9E009898980086868600666666005151
51004A4A4A00000000000000000000000000000000000000000000000000E8E8
E800E1E1E100B7B7B7009D9D9D00A1A1A1009D9D9D008B8B8B00BCBBBA008290
D5004277FF002D4AD8001F209F0000000000000000000000000000000000E8E8
E800E3E3E300B7B7B700A2A2A2009E9E9E009898980086868600666666005151
51004A4A4A000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000A1A1A1006B6B
6B00575757006D6D6D0097979700C3C3C300E0E0E000F6F6F600FFFFFF00FAFA
FA00AEAEAE005757570000000000000000000000000000000000A1A1A1006A6A
6A00575757006A6A6A009D9D9D00C4C5C500DCDCDC00F5F5F500F8F8F800D9DC
F7003546C6002C31A800B2B2C800000000000000000000000000A1A1A1006B6B
6B00575757006D6D6D0097979700C3C3C300E0E0E000F6F6F600FFFFFF00FAFA
FA00AEAEAE005757570000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000095959500303030004D4D
4D006969690085858500A2A2A200C3C3C300D4D4D400E5E5E500F2F2F200FFFF
FF00FFFFFF00FFFFFF0079797900000000000000000096969600303030004D4D
4D006A6A6A0085858500A1A1A100C4C5C500D1D1D100E1E1E100F8F8F800F8F8
F800F8F8F800F8F8F80085858500000000000000000095959500303030004D4D
4D006969690085858500A2A2A200C3C3C300D4D4D400E5E5E500F2F2F200FFFF
FF00FFFFFF00FFFFFF0079797900000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000008B8B8B003C3C3C005E5E
5E00777777008E8E8E00A7A7A700C5C5C500D3D3D300E1E1E100ECECEC00F8F8
F800FFFFFF00FFFFFF008D8D8D0000000000000000008B8B8B003C3C3C005757
5700797979008B8B8B00A6A6A600C4C5C500D1D1D100E1E1E100E8E8E800F8F8
F800F8F8F800F8F8F8009696960000000000000000008B8B8B003C3C3C005E5E
5E00777777008E8E8E00A7A7A700C5C5C500D3D3D300E1E1E100ECECEC00F8F8
F800FFFFFF00FFFFFF008D8D8D00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000ABABAB007A7A
7A007878780093939300ADADAD00C9C9C900D7D7D700E7E7E700F5F5F500FFFF
FF00F2F2F2009D9D9D0000000000000000000000000000000000ACACAC007979
79007979790096969600ACACAC00C9C9C900DCDCDC00E8E8E800F8F8F800F8F8
F800F8F8F8009D9D9D0000000000000000000000000000000000ABABAB007A7A
7A007878780093939300ADADAD00C9C9C900D7D7D700E7E7E700F5F5F500FFFF
FF00F2F2F2009D9D9D0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000B2B2B200A8A8A800A9A9A900ACACAC00AAAAAA00A8A8A8009D9D9D008C8C
8C00000000000000000000000000000000000000000000000000000000000000
0000B7B7B700A1A1A100ACACAC00ACACAC00ACACAC00A1A1A100A1A1A1008B8B
8B00000000000000000000000000000000000000000000000000000000000000
0000B2B2B200A8A8A800A9A9A900ACACAC00AAAAAA00A8A8A8009D9D9D008C8C
8C00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000100000000100010000000000800000000000000000000000
000000000000000000000000FFFFFF00FFFFFFFFFFFF0000FE07FC3F883F0000
FC07FC3F803F0000FC01FC1F803F0000FC01FC0FC03F0000FC01FC0FC03F0000
F803F807C01F0000F007F003E00F0000E007E001E0070000E007E001E0070000
C003C001C003000080018001800100008001800180010000C003C003C0030000
F00FF00FF00F0000FFFFFFFFFFFF000000000000000000000000000000000000
000000000000}
end
end end

View File

@ -16,7 +16,12 @@ uses
ExtCtrls, ExtCtrls,
Forms, Forms,
Graphics, Graphics,
StdCtrls; ImgList,
StdCtrls,
ToolWin,
CmpSwFilters;
type type
TfrmCmpSwConfiguration = class(TForm) TfrmCmpSwConfiguration = class(TForm)
@ -24,19 +29,21 @@ type
actEdit: TAction; actEdit: TAction;
actRemove: TAction; actRemove: TAction;
alMain: TActionList; alMain: TActionList;
btnAdd: TButton;
btnCancel: TButton; btnCancel: TButton;
btnDefault: TButton; btnDefault: TButton;
btnEdit: TButton;
btnOk: TButton; btnOk: TButton;
btnRemove: TButton;
chkAllowEmptyResults: TCheckBox; chkAllowEmptyResults: TCheckBox;
dlgColor: TColorDialog; dlgColor: TColorDialog;
ilsFilters: TImageList;
imgAbout: TImage; imgAbout: TImage;
lbFilters: TListBox; lbFilters: TListBox;
lblBugReport: TLabel; lblBugReport: TLabel;
lblVersion: TLabel; lblVersion: TLabel;
pcConfiguration: TPageControl; pcConfiguration: TPageControl;
tbFilterAdd: TToolButton;
tbFilterEdit: TToolButton;
tbFilterRemove: TToolButton;
tbFilters: TToolBar;
tsAbout: TTabSheet; tsAbout: TTabSheet;
tsGeneral: TTabSheet; tsGeneral: TTabSheet;
@ -48,6 +55,7 @@ type
procedure lbFiltersClick(Sender: TObject); procedure lbFiltersClick(Sender: TObject);
procedure lbFiltersData(Control: TWinControl; Index: Integer; var Data: String); procedure lbFiltersData(Control: TWinControl; Index: Integer; var Data: String);
procedure lbFiltersDataObject(Control: TWinControl; Index: Integer; var DataObject: TObject); procedure lbFiltersDataObject(Control: TWinControl; Index: Integer; var DataObject: TObject);
procedure lbFiltersDblClick(Sender: TObject);
private private
function InternalExecute(): Boolean; function InternalExecute(): Boolean;
@ -55,6 +63,9 @@ type
procedure SaveSettings(); procedure SaveSettings();
procedure RefreshFilters(); procedure RefreshFilters();
function GetSelectedGroup(): TCmpSwFilterGroup;
property SelectedGroup: TCmpSwFilterGroup read GetSelectedGroup;
public public
class function Execute(): Boolean; class function Execute(): Boolean;
end; end;
@ -62,9 +73,11 @@ type
implementation implementation
uses uses
ShellAPI, ShellAPI,
SysUtils,
Windows, Windows,
CmpSwSettings, CmpSwFilters; CmpSwFilterConfiguration,
CmpSwSettings;
{$R *.dfm} {$R *.dfm}
@ -114,6 +127,14 @@ begin
end; end;
function TfrmCmpSwConfiguration.GetSelectedGroup(): TCmpSwFilterGroup;
begin
Result := nil;
if lbFilters.ItemIndex > -1 then
Result := TCmpSwFilterGroup(lbFilters.Items.Objects[lbFilters.ItemIndex]);
end;
procedure TfrmCmpSwConfiguration.btnDefaultClick(Sender: TObject); procedure TfrmCmpSwConfiguration.btnDefaultClick(Sender: TObject);
begin begin
if MessageBox(Self.Handle, 'Are you sure you want to revert the ' + if MessageBox(Self.Handle, 'Are you sure you want to revert the ' +
@ -128,20 +149,59 @@ end;
procedure TfrmCmpSwConfiguration.actAddExecute(Sender: TObject); procedure TfrmCmpSwConfiguration.actAddExecute(Sender: TObject);
var
newGroup: TCmpSwFilterGroup;
begin begin
// newGroup := TCmpSwFilterGroup.Create(nil);
try
if TfrmCmpSwFilterConfiguration.Execute(newGroup) then
begin
newGroup.Collection := Settings.Filter;
RefreshFilters();
end;
finally
if not Assigned(newGroup.Collection) then
FreeAndNil(newGroup);
end;
end; end;
procedure TfrmCmpSwConfiguration.actEditExecute(Sender: TObject); procedure TfrmCmpSwConfiguration.actEditExecute(Sender: TObject);
var
group: TCmpSwFilterGroup;
begin begin
// group := SelectedGroup;
if Assigned(group) then
begin
if TfrmCmpSwFilterConfiguration.Execute(group) then
lbFilters.Invalidate();
end;
end; end;
procedure TfrmCmpSwConfiguration.actRemoveExecute(Sender: TObject); procedure TfrmCmpSwConfiguration.actRemoveExecute(Sender: TObject);
var
group: TCmpSwFilterGroup;
begin begin
// group := SelectedGroup;
if Assigned(group) then
begin
if Application.MessageBox(PChar(Format('Do you want to remove the filter "%s"?',
[group.Name])), 'Remove',
MB_YESNO or MB_ICONQUESTION) = ID_YES then
begin
lbFilters.Items.BeginUpdate();
try
FreeAndNil(group);
RefreshFilters();
finally
lbFilters.Items.EndUpdate();
end;
end;
end;
end; end;
@ -176,4 +236,10 @@ begin
DataObject := Settings.Filter[Index]; DataObject := Settings.Filter[Index];
end; end;
procedure TfrmCmpSwConfiguration.lbFiltersDblClick(Sender: TObject);
begin
actEdit.Execute();
end;
end. end.

View File

@ -1,41 +1,64 @@
inherited frmCmpSwDialog: TfrmCmpSwDialog inherited frmCmpSwDialog: TfrmCmpSwDialog
Width = 358
Height = 557
Caption = 'ComponentSwitcher' Caption = 'ComponentSwitcher'
ClientHeight = 530
ClientWidth = 350
ExplicitWidth = 358
ExplicitHeight = 557
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
inherited sbStatus: TStatusBar inherited sbStatus: TStatusBar
Top = 511 Top = 511
Width = 350 Width = 350
ExplicitTop = 511
ExplicitWidth = 350
end end
inherited pnlMain: TPanel inherited pnlMain: TPanel
Width = 350 Width = 350
Height = 402 Height = 402
ExplicitWidth = 350
ExplicitHeight = 402
inherited pnlSearch: TPanel inherited pnlSearch: TPanel
Width = 342 Width = 342
TabOrder = 1
ExplicitWidth = 342
inherited cmbSearch: TComboBox inherited cmbSearch: TComboBox
Width = 342 Width = 342
ExplicitWidth = 342
end end
end end
inherited lstItems: TListBox inherited lstItems: TListBox
Width = 342 Width = 342
Height = 349 Height = 349
TabOrder = 2
ExplicitTop = 47
ExplicitWidth = 342
ExplicitHeight = 349
end end
inherited pnlSubFilters: TPanel inherited pnlSubFilters: TPanel
Width = 342 Width = 342
TabOrder = 0
ExplicitWidth = 342
inherited lblSubFilters: TLabel inherited lblSubFilters: TLabel
Width = 343 Width = 343
ExplicitWidth = 343
end end
end end
end end
inherited pnlButtons: TPanel inherited pnlButtons: TPanel
Top = 475 Top = 475
Width = 350 Width = 350
TabOrder = 2
ExplicitTop = 477
ExplicitWidth = 350
inherited btnCancel: TButton inherited btnCancel: TButton
Left = 271 Left = 271
TabOrder = 2
ExplicitLeft = 271
end end
inherited btnOK: TButton inherited btnOK: TButton
Left = 190 Left = 190
TabOrder = 1
ExplicitLeft = 190
end end
object btnConfiguration: TButton object btnConfiguration: TButton
Left = 4 Left = 4
@ -43,7 +66,7 @@ inherited frmCmpSwDialog: TfrmCmpSwDialog
Width = 85 Width = 85
Height = 25 Height = 25
Caption = '&Configuration' Caption = '&Configuration'
TabOrder = 2 TabOrder = 0
OnClick = btnConfigurationClick OnClick = btnConfigurationClick
end end
end end
@ -55,7 +78,7 @@ inherited frmCmpSwDialog: TfrmCmpSwDialog
Align = alBottom Align = alBottom
BevelOuter = bvNone BevelOuter = bvNone
BorderWidth = 4 BorderWidth = 4
TabOrder = 3 TabOrder = 1
object gbFilters: TGroupBox object gbFilters: TGroupBox
Left = 4 Left = 4
Top = 4 Top = 4

View File

@ -311,9 +311,6 @@ var
itemIndex: Integer; itemIndex: Integer;
begin begin
pnlFilters.Visible := (ClassFilter.Groups.Count > 0);
{ Update / extend the menu } { Update / extend the menu }
itemIndex := 0; itemIndex := 0;
for groupIndex := 0 to Pred(ClassFilter.Groups.Count) do for groupIndex := 0 to Pred(ClassFilter.Groups.Count) do
@ -397,13 +394,19 @@ begin
checkBox.Checked := not group.Enabled; checkBox.Checked := not group.Enabled;
checkBox.Tag := Integer(group); checkBox.Tag := Integer(group);
checkBox.OnClick := FilterCheckBoxClick; checkBox.OnClick := FilterCheckBoxClick;
checkBox.Width := gbFilters.ClientWidth - 24;
checkBox.Anchors := [akLeft, akTop, akRight];
checkBox.Parent := gbFilters; checkBox.Parent := gbFilters;
Inc(checkBoxTop, 20); Inc(checkBoxTop, 20);
end; end;
end; end;
btnMoreFilters.BringToFront();
pnlFilters.Height := (2 * pnlFilters.BorderWidth) + checkBoxTop + 11; pnlFilters.Height := (2 * pnlFilters.BorderWidth) + checkBoxTop + 11;
pnlButtons.Top := pnlFilters.Top + pnlFilters.Height;
sbStatus.Top := MaxInt;
end; end;

View File

@ -5,8 +5,8 @@ object frmCmpSwFilterConfiguration: TfrmCmpSwFilterConfiguration
BorderStyle = bsDialog BorderStyle = bsDialog
BorderWidth = 8 BorderWidth = 8
Caption = 'Filter' Caption = 'Filter'
ClientHeight = 343 ClientHeight = 477
ClientWidth = 345 ClientWidth = 371
Color = clBtnFace Color = clBtnFace
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
@ -20,24 +20,124 @@ object frmCmpSwFilterConfiguration: TfrmCmpSwFilterConfiguration
object gbMain: TGroupBox object gbMain: TGroupBox
Left = 0 Left = 0
Top = 0 Top = 0
Width = 345 Width = 371
Height = 308 Height = 442
Align = alClient Align = alClient
TabOrder = 0 TabOrder = 0
DesignSize = (
371
442)
object lblName: TLabel
Left = 12
Top = 20
Width = 31
Height = 13
Caption = '&Name:'
end
object lblFilter: TLabel
Left = 12
Top = 48
Width = 44
Height = 13
Caption = '&Matches:'
end
object lblHelp: TLabel
Left = 12
Top = 260
Width = 25
Height = 13
Caption = 'Help:'
end
object lblHelpText: TLabel
Left = 72
Top = 260
Width = 285
Height = 41
AutoSize = False
Caption =
'Enter one match per line in the '#39'Matches'#39' box. If any of the lin' +
'es match a component class name, the filter will apply to that c' +
'omponent.'
WordWrap = True
end
object lblHelpText2: TLabel
Left = 72
Top = 312
Width = 249
Height = 45
AutoSize = False
Caption =
'You may use wildcards to specify a match. For example: '#39'TId*'#39' to' +
' match all Indy components. See Delphi'#39's TMask documentation for' +
' more information.'
WordWrap = True
end
object lblHelpText3: TLabel
Left = 72
Top = 368
Width = 285
Height = 57
AutoSize = False
Caption =
#39'Match descendant classes'#39' only applies to match lines which do ' +
'not include wildcards. For example: '#39'TIdBaseComponent'#39' with '#39'Mat' +
'ch descendant classes'#39' will match all Indy components.'
WordWrap = True
end
object bvlHelp: TBevel
Left = 12
Top = 248
Width = 349
Height = 13
Shape = bsTopLine
end
object chkIncludeDescendants: TCheckBox
Left = 72
Top = 196
Width = 161
Height = 17
Caption = 'Match &descendant classes'
TabOrder = 2
end
object edtName: TEdit
Left = 72
Top = 16
Width = 289
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 0
end
object mmoFilter: TMemo
Left = 72
Top = 44
Width = 289
Height = 145
ScrollBars = ssVertical
TabOrder = 1
WordWrap = False
end
object chkVisible: TCheckBox
Left = 72
Top = 220
Width = 129
Height = 17
Caption = 'Show as &checkbox'
TabOrder = 3
end
end end
object pnlButtons: TPanel object pnlButtons: TPanel
Left = 0 Left = 0
Top = 308 Top = 442
Width = 345 Width = 371
Height = 35 Height = 35
Align = alBottom Align = alBottom
BevelOuter = bvNone BevelOuter = bvNone
TabOrder = 1 TabOrder = 1
DesignSize = ( DesignSize = (
345 371
35) 35)
object btnOk: TButton object btnOk: TButton
Left = 189 Left = 215
Top = 10 Top = 10
Width = 75 Width = 75
Height = 25 Height = 25
@ -48,7 +148,7 @@ object frmCmpSwFilterConfiguration: TfrmCmpSwFilterConfiguration
TabOrder = 0 TabOrder = 0
end end
object btnCancel: TButton object btnCancel: TButton
Left = 270 Left = 296
Top = 10 Top = 10
Width = 75 Width = 75
Height = 25 Height = 25

View File

@ -19,10 +19,21 @@ uses
type type
TfrmCmpSwFilterConfiguration = class(TForm) TfrmCmpSwFilterConfiguration = class(TForm)
gbMain: TGroupBox; btnCancel: TButton;
pnlButtons: TPanel; btnOk: TButton;
btnOk: TButton; bvlHelp: TBevel;
btnCancel: TButton; chkIncludeDescendants: TCheckBox;
chkVisible: TCheckBox;
edtName: TEdit;
gbMain: TGroupBox;
lblFilter: TLabel;
lblHelp: TLabel;
lblHelpText: TLabel;
lblHelpText2: TLabel;
lblHelpText3: TLabel;
lblName: TLabel;
mmoFilter: TMemo;
pnlButtons: TPanel;
protected protected
function InternalExecute(AGroup: TCmpSwFilterGroup): Boolean; function InternalExecute(AGroup: TCmpSwFilterGroup): Boolean;
public public
@ -50,7 +61,20 @@ end;
function TfrmCmpSwFilterConfiguration.InternalExecute(AGroup: TCmpSwFilterGroup): Boolean; function TfrmCmpSwFilterConfiguration.InternalExecute(AGroup: TCmpSwFilterGroup): Boolean;
begin begin
edtName.Text := AGroup.Name;
chkIncludeDescendants.Checked := AGroup.IncludeDescendants;
chkVisible.Checked := AGroup.Visible;
mmoFilter.Lines.Assign(AGroup.Filter);
Result := (ShowModal() = mrOk); Result := (ShowModal() = mrOk);
if Result then
begin
AGroup.Name := edtName.Text;
AGroup.IncludeDescendants := chkIncludeDescendants.Checked;
AGroup.Visible := chkVisible.Checked;
AGroup.Filter.Assign(mmoFilter.Lines);
end;
end; end;
end. end.

View File

@ -95,7 +95,7 @@ begin
FFilter := TStringList.Create(); FFilter := TStringList.Create();
TStringList(FFilter).OnChange := FilterChange; TStringList(FFilter).OnChange := FilterChange;
FEnabled := True; FEnabled := False;
FVisible := False; FVisible := False;
end; end;
@ -181,14 +181,20 @@ begin
for filterIndex := Pred(Filter.Count) downto 0 do for filterIndex := Pred(Filter.Count) downto 0 do
begin begin
if ContainsMask(Filter[filterIndex]) then if Length(Trim(Filter[filterIndex])) = 0 then
begin begin
mask := TMask.Create(Filter[filterIndex]); Filter.Delete(filterIndex);
FilterMasks.Add(mask);
Filter.Objects[filterIndex] := mask;
end else end else
Filter.Objects[filterIndex] := nil; begin
if ContainsMask(Filter[filterIndex]) then
begin
mask := TMask.Create(Filter[filterIndex]);
FilterMasks.Add(mask);
Filter.Objects[filterIndex] := mask;
end else
Filter.Objects[filterIndex] := nil;
end;
end; end;
FFilterChanged := False; FFilterChanged := False;

View File

@ -347,9 +347,23 @@ var
begin begin
AGroup.Name := ARegistry.ReadString('Name'); AGroup.Name := ARegistry.ReadString('Name');
AGroup.Enabled := ARegistry.ReadBool('Enabled');
AGroup.IncludeDescendants := ARegistry.ReadBool('IncludeDescendants');
AGroup.Visible := ARegistry.ReadBool('Visible'); if ARegistry.ValueExists('Enabled') then
AGroup.Enabled := ARegistry.ReadBool('Enabled')
else
AGroup.Enabled := False;
if ARegistry.ValueExists('IncludeDescendants') then
AGroup.IncludeDescendants := ARegistry.ReadBool('IncludeDescendants')
else
AGroup.IncludeDescendants := False;
if ARegistry.ValueExists('Visible') then
AGroup.Visible := ARegistry.ReadBool('Visible')
else
AGroup.Visible := False;
if ARegistry.ValueExists('Filter') then if ARegistry.ValueExists('Filter') then
begin begin