diff --git a/Lib/D2006/UnitSwitcherD2006.bpl b/Lib/D2006/UnitSwitcherD2006.bpl index 07ce049..0a4b02e 100644 Binary files a/Lib/D2006/UnitSwitcherD2006.bpl and b/Lib/D2006/UnitSwitcherD2006.bpl differ diff --git a/Packages/D2006/UnitSwitcher.dpk b/Packages/D2006/UnitSwitcher.dpk index 97712c4..327dcab 100644 --- a/Packages/D2006/UnitSwitcher.dpk +++ b/Packages/D2006/UnitSwitcher.dpk @@ -53,6 +53,8 @@ contains CmpSwObjects in '..\..\Source\CmpSwObjects.pas', CmpSwFilters in '..\..\Source\CmpSwFilters.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. diff --git a/Resources/FilterAdd.ico b/Resources/FilterAdd.ico new file mode 100644 index 0000000..0ce72e7 Binary files /dev/null and b/Resources/FilterAdd.ico differ diff --git a/Resources/FilterDelete.ico b/Resources/FilterDelete.ico new file mode 100644 index 0000000..7abe7e6 Binary files /dev/null and b/Resources/FilterDelete.ico differ diff --git a/Resources/FilterEdit.ico b/Resources/FilterEdit.ico new file mode 100644 index 0000000..07825db Binary files /dev/null and b/Resources/FilterEdit.ico differ diff --git a/Source/CmpSwConfiguration.dfm b/Source/CmpSwConfiguration.dfm index 86cd5da..2e4a046 100644 --- a/Source/CmpSwConfiguration.dfm +++ b/Source/CmpSwConfiguration.dfm @@ -28,68 +28,66 @@ object frmCmpSwConfiguration: TfrmCmpSwConfiguration Anchors = [akLeft, akTop, akRight, akBottom] TabOrder = 0 object tsGeneral: TTabSheet + BorderWidth = 8 Caption = 'Filters' + ExplicitLeft = 0 + ExplicitTop = 0 + ExplicitWidth = 0 + ExplicitHeight = 0 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 + 296 + 338) object chkAllowEmptyResults: TCheckBox - Left = 4 - Top = 292 + Left = 0 + Top = 320 Width = 273 Height = 17 Anchors = [akLeft, akBottom] Caption = 'Allow e&mpty results' - TabOrder = 1 + TabOrder = 2 end object lbFilters: TListBox - Left = 4 - Top = 4 - Width = 301 - Height = 233 + Left = 0 + Top = 29 + Width = 296 + Height = 280 Style = lbVirtual - Anchors = [akLeft, akTop, akRight, akBottom] + Align = alTop ItemHeight = 16 - TabOrder = 2 + TabOrder = 1 OnClick = lbFiltersClick OnData = lbFiltersData OnDataObject = lbFiltersDataObject + OnDblClick = lbFiltersDblClick + ExplicitLeft = 5 + ExplicitTop = 34 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 + object tbFilters: TToolBar + Left = 0 + Top = 0 + Width = 296 + Height = 29 + ButtonWidth = 73 + Caption = 'tbFilters' + Images = ilsFilters + List = True + ShowCaptions = True + TabOrder = 0 + object tbFilterAdd: TToolButton + Left = 0 + Top = 0 + Action = actAdd + end + object tbFilterEdit: TToolButton + Left = 73 + Top = 0 + Action = actEdit + end + object tbFilterRemove: TToolButton + Left = 146 + Top = 0 + Action = actRemove + end end end object tsAbout: TTabSheet @@ -209,27 +207,184 @@ object frmCmpSwConfiguration: TfrmCmpSwConfiguration ModalResult = 1 TabOrder = 2 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 Options = [cdFullOpen] Left = 24 Top = 364 end object alMain: TActionList + Images = ilsFilters Left = 96 Top = 364 object actAdd: TAction Caption = '&Add...' + ImageIndex = 0 OnExecute = actAddExecute end object actEdit: TAction Caption = '&Edit...' Enabled = False + ImageIndex = 1 OnExecute = actEditExecute end object actRemove: TAction Caption = '&Remove' Enabled = False + ImageIndex = 2 OnExecute = actRemoveExecute 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 diff --git a/Source/CmpSwConfiguration.pas b/Source/CmpSwConfiguration.pas index fce9a5e..83da239 100644 --- a/Source/CmpSwConfiguration.pas +++ b/Source/CmpSwConfiguration.pas @@ -16,7 +16,12 @@ uses ExtCtrls, Forms, Graphics, - StdCtrls; + ImgList, + StdCtrls, + ToolWin, + + CmpSwFilters; + type TfrmCmpSwConfiguration = class(TForm) @@ -24,19 +29,21 @@ type actEdit: TAction; actRemove: TAction; alMain: TActionList; - btnAdd: TButton; btnCancel: TButton; btnDefault: TButton; - btnEdit: TButton; btnOk: TButton; - btnRemove: TButton; chkAllowEmptyResults: TCheckBox; dlgColor: TColorDialog; + ilsFilters: TImageList; imgAbout: TImage; lbFilters: TListBox; lblBugReport: TLabel; lblVersion: TLabel; pcConfiguration: TPageControl; + tbFilterAdd: TToolButton; + tbFilterEdit: TToolButton; + tbFilterRemove: TToolButton; + tbFilters: TToolBar; tsAbout: TTabSheet; tsGeneral: TTabSheet; @@ -48,6 +55,7 @@ type procedure lbFiltersClick(Sender: TObject); procedure lbFiltersData(Control: TWinControl; Index: Integer; var Data: String); procedure lbFiltersDataObject(Control: TWinControl; Index: Integer; var DataObject: TObject); + procedure lbFiltersDblClick(Sender: TObject); private function InternalExecute(): Boolean; @@ -55,6 +63,9 @@ type procedure SaveSettings(); procedure RefreshFilters(); + function GetSelectedGroup(): TCmpSwFilterGroup; + + property SelectedGroup: TCmpSwFilterGroup read GetSelectedGroup; public class function Execute(): Boolean; end; @@ -62,9 +73,11 @@ type implementation uses ShellAPI, + SysUtils, Windows, - CmpSwSettings, CmpSwFilters; + CmpSwFilterConfiguration, + CmpSwSettings; {$R *.dfm} @@ -88,7 +101,7 @@ function TfrmCmpSwConfiguration.InternalExecute(): Boolean; begin LoadSettings(); RefreshFilters(); - + Result := (ShowModal() = mrOk); if Result then SaveSettings(); @@ -114,6 +127,14 @@ begin 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); begin if MessageBox(Self.Handle, 'Are you sure you want to revert the ' + @@ -128,20 +149,59 @@ end; procedure TfrmCmpSwConfiguration.actAddExecute(Sender: TObject); +var + newGroup: TCmpSwFilterGroup; + 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; procedure TfrmCmpSwConfiguration.actEditExecute(Sender: TObject); +var + group: TCmpSwFilterGroup; + begin - // + group := SelectedGroup; + if Assigned(group) then + begin + if TfrmCmpSwFilterConfiguration.Execute(group) then + lbFilters.Invalidate(); + end; end; procedure TfrmCmpSwConfiguration.actRemoveExecute(Sender: TObject); +var + group: TCmpSwFilterGroup; + 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; @@ -176,4 +236,10 @@ begin DataObject := Settings.Filter[Index]; end; + +procedure TfrmCmpSwConfiguration.lbFiltersDblClick(Sender: TObject); +begin + actEdit.Execute(); +end; + end. diff --git a/Source/CmpSwDialog.dfm b/Source/CmpSwDialog.dfm index 1ca437d..44c6753 100644 --- a/Source/CmpSwDialog.dfm +++ b/Source/CmpSwDialog.dfm @@ -1,41 +1,64 @@ inherited frmCmpSwDialog: TfrmCmpSwDialog - Width = 358 - Height = 557 Caption = 'ComponentSwitcher' + ClientHeight = 530 + ClientWidth = 350 + ExplicitWidth = 358 + ExplicitHeight = 557 PixelsPerInch = 96 TextHeight = 13 inherited sbStatus: TStatusBar Top = 511 Width = 350 + ExplicitTop = 511 + ExplicitWidth = 350 end inherited pnlMain: TPanel Width = 350 Height = 402 + ExplicitWidth = 350 + ExplicitHeight = 402 inherited pnlSearch: TPanel Width = 342 + TabOrder = 1 + ExplicitWidth = 342 inherited cmbSearch: TComboBox Width = 342 + ExplicitWidth = 342 end end inherited lstItems: TListBox Width = 342 Height = 349 + TabOrder = 2 + ExplicitTop = 47 + ExplicitWidth = 342 + ExplicitHeight = 349 end inherited pnlSubFilters: TPanel Width = 342 + TabOrder = 0 + ExplicitWidth = 342 inherited lblSubFilters: TLabel Width = 343 + ExplicitWidth = 343 end end end inherited pnlButtons: TPanel Top = 475 Width = 350 + TabOrder = 2 + ExplicitTop = 477 + ExplicitWidth = 350 inherited btnCancel: TButton Left = 271 + TabOrder = 2 + ExplicitLeft = 271 end inherited btnOK: TButton Left = 190 + TabOrder = 1 + ExplicitLeft = 190 end object btnConfiguration: TButton Left = 4 @@ -43,7 +66,7 @@ inherited frmCmpSwDialog: TfrmCmpSwDialog Width = 85 Height = 25 Caption = '&Configuration' - TabOrder = 2 + TabOrder = 0 OnClick = btnConfigurationClick end end @@ -55,7 +78,7 @@ inherited frmCmpSwDialog: TfrmCmpSwDialog Align = alBottom BevelOuter = bvNone BorderWidth = 4 - TabOrder = 3 + TabOrder = 1 object gbFilters: TGroupBox Left = 4 Top = 4 diff --git a/Source/CmpSwDialog.pas b/Source/CmpSwDialog.pas index 42dba27..8491ec7 100644 --- a/Source/CmpSwDialog.pas +++ b/Source/CmpSwDialog.pas @@ -27,7 +27,7 @@ type FImageMap: TStringHash; protected procedure VisitItem(const AItem: TBaseSwItem); override; - + function GetComponentPackage(const AClassName: String): String; function LoadComponentImage(const APackageName, AClassName: String): Integer; procedure ResizeBitmap(const ABitmap: Graphics.TBitmap; const AWidth, AHeight: Integer); @@ -311,9 +311,6 @@ var itemIndex: Integer; begin - pnlFilters.Visible := (ClassFilter.Groups.Count > 0); - - { Update / extend the menu } itemIndex := 0; for groupIndex := 0 to Pred(ClassFilter.Groups.Count) do @@ -388,7 +385,7 @@ begin begin group := ClassFilter.Groups[groupIndex]; - if group.Visible then + if group.Visible then begin checkBox := TCheckBox.Create(Self); checkBox.Top := checkBoxTop; @@ -397,13 +394,19 @@ begin checkBox.Checked := not group.Enabled; checkBox.Tag := Integer(group); checkBox.OnClick := FilterCheckBoxClick; + checkBox.Width := gbFilters.ClientWidth - 24; + checkBox.Anchors := [akLeft, akTop, akRight]; checkBox.Parent := gbFilters; Inc(checkBoxTop, 20); end; end; + btnMoreFilters.BringToFront(); + pnlFilters.Height := (2 * pnlFilters.BorderWidth) + checkBoxTop + 11; + pnlButtons.Top := pnlFilters.Top + pnlFilters.Height; + sbStatus.Top := MaxInt; end; diff --git a/Source/CmpSwFilterConfiguration.dfm b/Source/CmpSwFilterConfiguration.dfm index 7a5d428..9c6463b 100644 --- a/Source/CmpSwFilterConfiguration.dfm +++ b/Source/CmpSwFilterConfiguration.dfm @@ -5,8 +5,8 @@ object frmCmpSwFilterConfiguration: TfrmCmpSwFilterConfiguration BorderStyle = bsDialog BorderWidth = 8 Caption = 'Filter' - ClientHeight = 343 - ClientWidth = 345 + ClientHeight = 477 + ClientWidth = 371 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -20,24 +20,124 @@ object frmCmpSwFilterConfiguration: TfrmCmpSwFilterConfiguration object gbMain: TGroupBox Left = 0 Top = 0 - Width = 345 - Height = 308 + Width = 371 + Height = 442 Align = alClient 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 object pnlButtons: TPanel Left = 0 - Top = 308 - Width = 345 + Top = 442 + Width = 371 Height = 35 Align = alBottom BevelOuter = bvNone TabOrder = 1 DesignSize = ( - 345 + 371 35) object btnOk: TButton - Left = 189 + Left = 215 Top = 10 Width = 75 Height = 25 @@ -48,7 +148,7 @@ object frmCmpSwFilterConfiguration: TfrmCmpSwFilterConfiguration TabOrder = 0 end object btnCancel: TButton - Left = 270 + Left = 296 Top = 10 Width = 75 Height = 25 diff --git a/Source/CmpSwFilterConfiguration.pas b/Source/CmpSwFilterConfiguration.pas index 6adcbe3..2cbabd9 100644 --- a/Source/CmpSwFilterConfiguration.pas +++ b/Source/CmpSwFilterConfiguration.pas @@ -19,10 +19,21 @@ uses type TfrmCmpSwFilterConfiguration = class(TForm) - gbMain: TGroupBox; - pnlButtons: TPanel; - btnOk: TButton; - btnCancel: TButton; + btnCancel: TButton; + btnOk: TButton; + bvlHelp: TBevel; + 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 function InternalExecute(AGroup: TCmpSwFilterGroup): Boolean; public @@ -50,7 +61,20 @@ end; function TfrmCmpSwFilterConfiguration.InternalExecute(AGroup: TCmpSwFilterGroup): Boolean; begin + edtName.Text := AGroup.Name; + chkIncludeDescendants.Checked := AGroup.IncludeDescendants; + chkVisible.Checked := AGroup.Visible; + mmoFilter.Lines.Assign(AGroup.Filter); + 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. diff --git a/Source/CmpSwFilters.pas b/Source/CmpSwFilters.pas index 0808ae9..a2df82c 100644 --- a/Source/CmpSwFilters.pas +++ b/Source/CmpSwFilters.pas @@ -95,7 +95,7 @@ begin FFilter := TStringList.Create(); TStringList(FFilter).OnChange := FilterChange; - FEnabled := True; + FEnabled := False; FVisible := False; end; @@ -181,14 +181,20 @@ begin for filterIndex := Pred(Filter.Count) downto 0 do begin - if ContainsMask(Filter[filterIndex]) then + if Length(Trim(Filter[filterIndex])) = 0 then begin - mask := TMask.Create(Filter[filterIndex]); - - FilterMasks.Add(mask); - Filter.Objects[filterIndex] := mask; + Filter.Delete(filterIndex); 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; FFilterChanged := False; diff --git a/Source/CmpSwSettings.pas b/Source/CmpSwSettings.pas index e8c17d5..bbc5b05 100644 --- a/Source/CmpSwSettings.pas +++ b/Source/CmpSwSettings.pas @@ -347,9 +347,23 @@ var begin 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 begin