1
0
mirror of synced 2024-11-24 04:13:51 +00:00

Added: working ComponentSwitcher implementation

This commit is contained in:
Mark van Renswoude 2007-12-09 12:02:11 +00:00
parent ec7bcfeb28
commit 6a34259518
18 changed files with 636 additions and 1656 deletions

Binary file not shown.

View File

@ -165,8 +165,7 @@
<VersionInfoKeys Name="ProductName"></VersionInfoKeys> <VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys> <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys> <VersionInfoKeys Name="Comments"></VersionInfoKeys>
</VersionInfoKeys> </VersionInfoKeys> <Excluded_Packages>
<Excluded_Packages>
<Excluded_Packages Name="F:\Components\UnitSwitcher\Lib\D2006\UnitSwitcherD2006.bpl">UnitSwitcher</Excluded_Packages> <Excluded_Packages Name="F:\Components\UnitSwitcher\Lib\D2006\UnitSwitcherD2006.bpl">UnitSwitcher</Excluded_Packages>
</Excluded_Packages> </Excluded_Packages>
</Delphi.Personality> </Delphi.Personality>

View File

@ -29,7 +29,11 @@ package UnitSwitcher;
requires requires
rtl, rtl,
designide; designide,
vcl,
xmlrtl,
vclactnband,
vclx;
contains contains
UnSwClient in '..\..\Source\UnSwClient.pas', UnSwClient in '..\..\Source\UnSwClient.pas',
@ -38,6 +42,14 @@ contains
UnSwFilters in '..\..\Source\UnSwFilters.pas', UnSwFilters in '..\..\Source\UnSwFilters.pas',
UnSwConfiguration in '..\..\Source\UnSwConfiguration.pas' {frmUnSwConfiguration}, UnSwConfiguration in '..\..\Source\UnSwConfiguration.pas' {frmUnSwConfiguration},
UnSwSettings in '..\..\Source\UnSwSettings.pas', UnSwSettings in '..\..\Source\UnSwSettings.pas',
UnSwShortcuts in '..\..\Source\UnSwShortcuts.pas' {frmUnSwShortcuts}; UnSwShortcuts in '..\..\Source\UnSwShortcuts.pas' {frmUnSwShortcuts},
CmpSwClient in '..\..\Source\CmpSwClient.pas',
BaseSwClient in '..\..\Source\BaseSwClient.pas',
BaseSwDialog in '..\..\Source\BaseSwDialog.pas' {frmBaseSwDialog},
BaseSwFilters in '..\..\Source\BaseSwFilters.pas',
BaseSwObjects in '..\..\Source\BaseSwObjects.pas',
UnSwReg in '..\..\Source\UnSwReg.pas',
CmpSwDialog in '..\..\Source\CmpSwDialog.pas' {frmCmpSwDialog},
CmpSwObjects in '..\..\Source\CmpSwObjects.pas';
end. end.

BIN
Resources/Component.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

@ -1,10 +1,10 @@
object frmBaseSwDialog: TfrmBaseSwDialog object frmBaseSwDialog: TfrmBaseSwDialog
Left = 284 Left = 284
Top = 120 Top = 120
Width = 320
Height = 425
BorderIcons = [biSystemMenu] BorderIcons = [biSystemMenu]
Caption = 'UnitSwitcher' Caption = 'UnitSwitcher'
ClientHeight = 398
ClientWidth = 312
Color = clBtnFace Color = clBtnFace
Constraints.MinHeight = 240 Constraints.MinHeight = 240
Constraints.MinWidth = 290 Constraints.MinWidth = 290
@ -27,6 +27,7 @@ object frmBaseSwDialog: TfrmBaseSwDialog
OldCreateOrder = False OldCreateOrder = False
Position = poScreenCenter Position = poScreenCenter
OnResize = FormResize OnResize = FormResize
OnShow = FormShow
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
object sbStatus: TStatusBar object sbStatus: TStatusBar
@ -83,7 +84,7 @@ object frmBaseSwDialog: TfrmBaseSwDialog
Align = alClient Align = alClient
ItemHeight = 20 ItemHeight = 20
MultiSelect = True MultiSelect = True
PopupMenu = pmnUnits PopupMenu = pmnItems
TabOrder = 1 TabOrder = 1
OnClick = lstItemsClick OnClick = lstItemsClick
OnData = lstItemsData OnData = lstItemsData
@ -151,409 +152,6 @@ object frmBaseSwDialog: TfrmBaseSwDialog
object ilsTypes: TImageList object ilsTypes: TImageList
Left = 28 Left = 28
Top = 228 Top = 228
Bitmap = {
494C010106000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000003000000001002000000000000030
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000C0C0C000C0C0C000C0C0C000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00808080008080
8000808080008080800080808000808080008080800080808000808080008080
8000808080000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000800000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000808080000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00FFFFFF00C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF0080808000808080008080
8000808080008080800080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000800000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C00000000000FF000000FF000000FF000000FF00
0000FF00000000000000C0C0C000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00FFFFFF00C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00808080000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FF000000FF000000FF00
0000FF000000FF000000FF00000000000000C0C0C00000000000C0C0C0000000
0000C0C0C0000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000008000
0000000000000000000080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF008080800080808000808080008080800080808000808080008080
8000808080008080800080808000000000000000000000000000000000000000
0000FFFFFF008080800080808000808080008080800080808000808080008080
8000808080008080800080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000080000000800000008000
0000800000000000000080808000C0C0C000C0C0C000C0C0C000C0C0C0000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000080000000000000008000
0000000000000000000080808000808080008080800000000000808080008080
8000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C000808080000000000000000000FFFFFF00808080008080
8000808080008080800080808000808080008080800080808000808080008080
8000808080008080800080808000000000000000000080000000000000000000
0000000000000000000000000000000000008080800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000FFFFFF00FFFFFF0000000000000000000000000000000000000000000000
000000000000FFFFFF00808080000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C000808080000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000008080800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000FFFFFF000000FF000000FF000000FF000000FF000000FF000000FF000000
FF000000FF000000FF00808080000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000008080800080808000000000000000
000000000000FFFFFF0080808000808080008080800080808000808080008080
8000808080008080800080808000000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000080000000000000000000
0000FFFFFF000000FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF000000FF00808080000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
000000000000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000FFFFFF000000FF000000FF000000FF000000FF000000FF000000FF000000
FF000000FF000000FF00808080000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
000000000000FFFFFF00FFFFFF00C0C0C0000000FF000000FF000000FF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C000808080000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
000000000000FFFFFF00C0C0C000FFFFFF000000FF000000FF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000FFFFFF00FFFFFF0000000000000000000000000000000000000000000000
0000C0C0C000FFFFFF00808080000000000000000000FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000
000000000000FFFFFF00FFFFFF00C0C0C0000000FF00C0C0C0000000FF000000
FF00FFFFFF00C0C0C00080808000000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF008080800080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF0000000000000000000000000000000000C0C0C000FFFF
FF000000000000000000000000000000000000000000FF000000FF000000FF00
0000FF000000FF000000FF000000FF000000FF00000000000000C0C0C0000000
0000C0C0C00000000000C0C0C000000000000000000000000000000000000000
000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C00000000000FFFFFF0000000000000000000000000000000000000000000000
0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C00000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000FF000000FF000000FF000000FF00000000000000C0C0C0000000
0000C0C0C00000000000C0C0C000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000300000000100010000000000800100000000000000000000
000000000000000000000000FFFFFF0000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000003FFF0000000000003FFF000000000
0003FFF0000000000000FFF0000000000000FFF0000000000000FFF000000000
0000FFF0000000000000FFF0000000000000FFF0000000000000FFF000000000
0000FFF0000000000003FFFF000000000003FFFF000000000003FFFF00000000
0003FFFF000000000003FFFF00000000E000E000FFFFEC0FE000E000FFFF840F
E000E0000000AC0FE000E0000000BF3FE000E0000000FFFFE000600000001000
E000200000001000E00000000000B000E00020000000F000E00060000000F000
E000E0000000F000E000E0000000F000E000E0000000F000E001E0010000F000
E003E003FFFFF000E007E007FFFFF00000000000000000000000000000000000
000000000000}
end end
object alMain: TActionList object alMain: TActionList
Left = 84 Left = 84
@ -579,58 +177,14 @@ object frmBaseSwDialog: TfrmBaseSwDialog
OnExecute = actMRUNextExecute OnExecute = actMRUNextExecute
end end
end end
object pmnUnits: TPopupMenu object pmnItems: TPopupMenu
Left = 140 Left = 140
Top = 228 Top = 228
object pmnUnitsOpen: TMenuItem object pmnItemsSelectAll: TMenuItem
Caption = '&Open'
ShortCut = 13
end
object pmnUnitsOpenDFM: TMenuItem
Caption = 'Open D&FM'
ShortCut = 8205
end
object pmnUnitsSep1: TMenuItem
Caption = '-'
end
object pmnUnitsSelectAll: TMenuItem
Action = actSelectAll Action = actSelectAll
end end
object pmnUnitsSelectInvert: TMenuItem object pmnItemsSelectInvert: TMenuItem
Action = actSelectInvert Action = actSelectInvert
end end
object pmnUnitsSep2: TMenuItem
Caption = '-'
end
object pmnUnitsSortByName: TMenuItem
Caption = 'Sort by &Name'
ShortCut = 49230
end
object pmnUnitsSortByType: TMenuItem
Caption = 'Sort by &Type'
ShortCut = 49236
end
object pmnUnitsSep3: TMenuItem
Caption = '-'
end
object pmnUnitsReadOnly: TMenuItem
Caption = '&Read only'
ShortCut = 49234
end
object pmnUnitsSep4: TMenuItem
Caption = '-'
end
object pmnUnitsOpenFolder: TMenuItem
Caption = 'Open containing &folder'
ShortCut = 49222
end
object pmnUnitsOpenProperties: TMenuItem
Caption = '.PAS &Properties'
ShortCut = 49165
end
object pmnUnitsOpenDFMProperties: TMenuItem
Caption = '.&DFM Properties'
ShortCut = 24589
end
end end
end end

View File

@ -33,7 +33,7 @@ type
FImageIndex: Integer; FImageIndex: Integer;
FOverlayIndex: Integer; FOverlayIndex: Integer;
protected protected
procedure VisitItem(const AItem: TBaseSwItem); procedure VisitItem(const AItem: TBaseSwItem); virtual;
public public
property Color: TColor read FColor write FColor; property Color: TColor read FColor write FColor;
property ImageIndex: Integer read FImageIndex write FImageIndex; property ImageIndex: Integer read FImageIndex write FImageIndex;
@ -53,21 +53,9 @@ type
ilsTypes: TImageList; ilsTypes: TImageList;
lblSubFilters: TLabel; lblSubFilters: TLabel;
lstItems: TListBox; lstItems: TListBox;
pmnUnits: TPopupMenu; pmnItems: TPopupMenu;
pmnUnitsOpen: TMenuItem; pmnItemsSelectAll: TMenuItem;
pmnUnitsOpenDFM: TMenuItem; pmnItemsSelectInvert: TMenuItem;
pmnUnitsOpenDFMProperties: TMenuItem;
pmnUnitsOpenFolder: TMenuItem;
pmnUnitsOpenProperties: TMenuItem;
pmnUnitsReadOnly: TMenuItem;
pmnUnitsSelectAll: TMenuItem;
pmnUnitsSelectInvert: TMenuItem;
pmnUnitsSep1: TMenuItem;
pmnUnitsSep2: TMenuItem;
pmnUnitsSep3: TMenuItem;
pmnUnitsSep4: TMenuItem;
pmnUnitsSortByName: TMenuItem;
pmnUnitsSortByType: TMenuItem;
pnlButtons: TPanel; pnlButtons: TPanel;
pnlMain: TPanel; pnlMain: TPanel;
pnlSearch: TPanel; pnlSearch: TPanel;
@ -82,28 +70,23 @@ type
procedure cmbSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure cmbSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure cmbSearchKeyPress(Sender: TObject; var Key: Char); procedure cmbSearchKeyPress(Sender: TObject; var Key: Char);
procedure FormResize(Sender: TObject); procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure lstItemsClick(Sender: TObject);
procedure lstItemsData(Control: TWinControl; Index: Integer; var Data: string); procedure lstItemsData(Control: TWinControl; Index: Integer; var Data: string);
procedure lstItemsDblClick(Sender: TObject); procedure lstItemsDblClick(Sender: TObject);
procedure lstItemsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); procedure lstItemsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
procedure lstItemsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure lstItemsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure lstItemsClick(Sender: TObject);
procedure btnOKClick(Sender: TObject); procedure btnOKClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private private
FLoading: Boolean;
FItemList: TBaseSwItemList; FItemList: TBaseSwItemList;
FActiveItem: TBaseSwItem; FActiveItem: TBaseSwItem;
FFormsOnly: Boolean;
FMRUList: TStrings; FMRUList: TStrings;
FMRUIndex: Integer; FMRUIndex: Integer;
FSubFilters: TStringList; FSubFilters: TStringList;
FOpenDFM: Boolean;
// FTypeFilteredList: TUnSwUnitList;
FSubFilteredList: TBaseSwItemList; FSubFilteredList: TBaseSwItemList;
FInputFilteredList: TBaseSwItemList; FInputFilteredList: TBaseSwItemList;
// FTypeFilter: TUnSwUnitTypeFilter;
FSubFilter: TBaseSwItemSimpleFilter; FSubFilter: TBaseSwItemSimpleFilter;
FInputFilter: TBaseSwItemSimpleFilter; FInputFilter: TBaseSwItemSimpleFilter;
FLastFilter: String; FLastFilter: String;
@ -111,9 +94,19 @@ type
FStyleVisitor: TBaseSwStyleVisitor; FStyleVisitor: TBaseSwStyleVisitor;
protected protected
function InternalExecute(): TBaseSwItemList; virtual; function InternalExecute(): TBaseSwItemList; virtual;
// procedure UpdateTypeFilter();
procedure UpdateList(); virtual; procedure UpdateList(); virtual;
function CreateItemList(): TBaseSwItemList; virtual;
function CreateInputFilter(): TBaseSwItemSimpleFilter; virtual;
function CreateStyleVisitor(): TBaseSwStyleVisitor; virtual;
function AllowEmptyResult(): Boolean; virtual; abstract;
function ColorsEnabled(): Boolean; virtual;
function GetBaseItemList(): TBaseSwItemList; virtual;
function GetItemDisplayName(const AItem: TBaseSwItem): String; virtual;
procedure UpdateItemActions(); virtual;
function GetActiveItems(): TBaseSwItemList; function GetActiveItems(): TBaseSwItemList;
procedure SelectMRUItem(); procedure SelectMRUItem();
@ -123,8 +116,10 @@ type
procedure LoadSettings(); virtual; procedure LoadSettings(); virtual;
procedure SaveSettings(); virtual; procedure SaveSettings(); virtual;
protected
procedure UpdateUnitActions(); property ActiveItem: TBaseSwItem read FActiveItem write FActiveItem;
property ItemList: TBaseSwItemList read FItemList write FItemList;
property MRUList: TStrings read FMRUList;
public public
class function Execute(const AItems: TBaseSwItemList; const AActive: TBaseSwItem = nil): TBaseSwItemList; class function Execute(const AItems: TBaseSwItemList; const AActive: TBaseSwItem = nil): TBaseSwItemList;
end; end;
@ -132,7 +127,8 @@ type
implementation implementation
uses uses
SysUtils; Messages,
SysUtils, Dialogs;
const const
@ -157,8 +153,8 @@ class function TfrmBaseSwDialog.Execute(const AItems: TBaseSwItemList;
begin begin
with Self.Create(nil) do with Self.Create(nil) do
try try
FItemList := AItems; ItemList := AItems;
FActiveItem := AActive; ActiveItem := AActive;
Result := InternalExecute(); Result := InternalExecute();
finally finally
@ -173,6 +169,13 @@ begin
end; end;
procedure TfrmBaseSwDialog.FormShow(Sender: TObject);
begin
// Setting ListBox.Selected[x] won't work before OnShow...
UpdateSubFilters();
end;
function TfrmBaseSwDialog.InternalExecute(): TBaseSwItemList; function TfrmBaseSwDialog.InternalExecute(): TBaseSwItemList;
type type
TBaseSwItemSimpleFilterClass = class of TBaseSwItemSimpleFilter; TBaseSwItemSimpleFilterClass = class of TBaseSwItemSimpleFilter;
@ -185,33 +188,37 @@ var
begin begin
Result := nil; Result := nil;
FSubFilters := TStringList.Create(); FSubFilters := TStringList.Create();
// FTypeFilteredList := TUnSwUnitList.Create(); FSubFilteredList := CreateItemList();
FSubFilteredList := TBaseSwItemList.Create(); FInputFilteredList := CreateItemList();
FInputFilteredList := TBaseSwItemList.Create();
// FTypeFilter := TUnSwUnitTypeFilter.Create;
FSubFilter := CreateInputFilter();
FInputFilter := CreateInputFilter();
FMRUList := TStringList.Create();
try try
FStyleVisitor := TUnSwStyleVisitor.Create(); LoadSettings();
FStyleVisitor := CreateStyleVisitor();
try try
if Self.ShowModal() = mrOk then if Self.ShowModal() = mrOk then
begin begin
if Length(Trim(cmbSearch.Text)) > 0 then if Length(Trim(cmbSearch.Text)) > 0 then
begin begin
iIndex := FMRUList.IndexOf(cmbSearch.Text); iIndex := MRUList.IndexOf(cmbSearch.Text);
if iIndex > -1 then if iIndex > -1 then
FMRUList.Delete(iIndex); MRUList.Delete(iIndex);
while FMRUList.Count >= 10 do while MRUList.Count >= 10 do
FMRUList.Delete(Pred(FMRUList.Count)); MRUList.Delete(Pred(MRUList.Count));
mruText := cmbSearch.Text; mruText := cmbSearch.Text;
for subFilterIndex := Pred(FSubFilters.Count) downto 0 do for subFilterIndex := Pred(FSubFilters.Count) downto 0 do
mruText := FSubFilters[subFilterIndex] + SubFilterSeparator; mruText := FSubFilters[subFilterIndex] + SubFilterSeparator;
FMRUList.Insert(0, mruText); MRUList.Insert(0, mruText);
end; end;
Result := GetActiveUnits(); Result := GetActiveItems();
end; end;
SaveSettings(); SaveSettings();
@ -219,96 +226,50 @@ begin
FreeAndNil(FStyleVisitor); FreeAndNil(FStyleVisitor);
end; end;
finally finally
FreeAndNil(FMRUList);
FreeAndNil(FInputFilter); FreeAndNil(FInputFilter);
FreeAndNil(FSubFilter); FreeAndNil(FSubFilter);
// FreeAndNil(FTypeFilter);
FreeAndNil(FSubFilteredList); FreeAndNil(FSubFilteredList);
FreeAndNil(FInputFilteredList); FreeAndNil(FInputFilteredList);
// FreeAndNil(FTypeFilteredList);
FreeAndNil(FSubFilters); FreeAndNil(FSubFilters);
end; end;
end; end;
procedure TfrmBaseSwDialog.UpdateUnitActions(); procedure TfrmBaseSwDialog.LoadSettings();
var
bDFM: Boolean;
bUnits: Boolean;
iUnit: Integer;
pUnits: TUnSwUnitList;
pVisitor: TUnSwReadOnlyVisitor;
sStatus: String;
begin begin
{ Read-only status } cmbSearch.Items.Assign(MRUList);
pUnits := GetActiveUnits(); end;
if Assigned(pUnits) then
try
pVisitor := TUnSwReadOnlyVisitor.Create();
try
pUnits.AcceptVisitor(pVisitor);
actReadOnly.Checked := (pVisitor.ReadOnlyCount > 0);
sStatus := '';
if pVisitor.ReadOnlyCount > 0 then
if pVisitor.ReadOnlyCount = 1 then
sStatus := '1 read-only unit selected'
else
sStatus := Format('%d read-only units selected',
[pVisitor.ReadOnlyCount]);
sbStatus.Panels[0].Text := sStatus; procedure TfrmBaseSwDialog.SaveSettings();
finally begin
FreeAndNil(pVisitor); end;
end;
finally
FreeAndNil(pUnits);
end;
{ Properties }
bDFM := False;
bUnits := False;
pUnits := GetActiveUnits(); procedure TfrmBaseSwDialog.UpdateItemActions();
if Assigned(pUnits) then begin
try
bUnits := (pUnits.Count > 0);
for iUnit := 0 to Pred(pUnits.Count) do
if (pUnits[iUnit] is TUnSwModuleUnit) and
(TUnSwModuleUnit(pUnits[iUnit]).UnitType in [swutForm, swutDataModule]) then
begin
bDFM := True;
break;
end;
finally
FreeAndNil(pUnits);
end;
actOpenFolder.Enabled := bUnits;
actOpenProperties.Enabled := bUnits;
actOpenDFMProperties.Enabled := bDFM;
end; end;
procedure TfrmBaseSwDialog.UpdateList(); procedure TfrmBaseSwDialog.UpdateList();
var var
activeUnit: TUnSwUnit; activeUnit: TBaseSwItem;
activeUnits: TUnSwUnitList; activeUnits: TBaseSwItemList;
itemIndex: Integer; itemIndex: Integer;
listIndex: Integer; listIndex: Integer;
filteredList: TUnSwUnitList; filteredList: TBaseSwItemList;
selStart: Integer; selStart: Integer;
begin begin
activeUnits := GetActiveUnits(); activeUnits := GetActiveItems();
filteredList := TUnSwUnitList.Create(); filteredList := CreateItemList();
try try
filteredList.Clone(FSubFilteredList); filteredList.Clone(FSubFilteredList);
FInputFilter.FilterList(filteredList); FInputFilter.FilterList(filteredList);
if (filteredList.Count = 0) and (not Settings.Filter.AllowEmptyResult) then if (filteredList.Count = 0) and (not AllowEmptyResult) then
begin begin
{ Only enforce AllowEmptyResult when adding to the filter } { Only enforce AllowEmptyResult when adding to the filter }
if Length(FInputFilter.Filter) > Length(FLastFilter) then if Length(FInputFilter.Filter) > Length(FLastFilter) then
@ -355,80 +316,6 @@ begin
end; end;
function SortByName(Item1, Item2: Pointer): Integer;
begin
Result := CompareText(TUnSwUnit(Item1).Name, TUnSwUnit(Item2).Name)
end;
function SortByType(Item1, Item2: Pointer): Integer;
const
Above = -1;
Equal = 0;
Below = 1;
function SortByModuleType(Item1, Item2: TUnSwUnitType): Integer;
begin
Result := Equal;
if Item1 <> Item2 then
case Item1 of
swutForm:
case Item2 of
swutDataModule: Result := Below;
swutUnit: Result := Above;
end;
swutDataModule: Result := Above;
swutUnit: Result := Below;
end;
end;
var
pItem1: TUnSwUnit;
pItem2: TUnSwUnit;
begin
// #ToDo3 Refactor SortByType
// The following order is assumed:
// Project source, DataModules, Forms, Units
Result := Equal;
pItem1 := TUnSwUnit(Item1);
pItem2 := TUnSwUnit(Item2);
if pItem1.ClassType <> pItem2.ClassType then
begin
if pItem1 is TUnSwProjectUnit then
Result := Above
else if pItem2 is TUnSwProjectUnit then
Result := Below;
end else if pItem1 is TUnSwModuleUnit then
Result := SortByModuleType(TUnSwModuleUnit(pItem1).UnitType,
TUnSwModuleUnit(pItem2).UnitType);
if Result = Equal then
Result := SortByName(Item1, Item2);
end;
procedure TfrmBaseSwDialog.UpdateTypeFilter();
begin
FTypeFilter.IncludeUnits := ((not FFormsOnly) and chkUnits.Checked);
FTypeFilter.IncludeProjectSource := ((not FFormsOnly) and chkProjectSource.Checked);
FTypeFilter.IncludeForms := chkForms.Checked;
FTypeFilter.IncludeDataModules := chkDataModules.Checked;
FTypeFilteredList.Clone(FUnitList);
FTypeFilter.FilterList(FTypeFilteredList);
if actSortByName.Checked then
FTypeFilteredList.Sort(SortByName)
else
FTypeFilteredList.Sort(SortByType);
UpdateSubFilters();
end;
procedure TfrmBaseSwDialog.PopFilter(); procedure TfrmBaseSwDialog.PopFilter();
begin begin
if FSubFilters.Count > 0 then if FSubFilters.Count > 0 then
@ -445,7 +332,7 @@ var
sFilters: String; sFilters: String;
begin begin
FSubFilteredList.Clone(FTypeFilteredList); FSubFilteredList.Clone(GetBaseItemList());
if FSubFilters.Count > 0 then if FSubFilters.Count > 0 then
begin begin
@ -470,7 +357,7 @@ var
sFilter: String; sFilter: String;
begin begin
sFilter := Trim(AFilter); sFilter := Trim(AFilter);
Result := (Length(sFilter) > 0) and (FSubFilters.IndexOf(AFilter) = -1); Result := (Length(sFilter) > 0) and (FSubFilters.IndexOf(AFilter) = -1);
if Result then if Result then
begin begin
@ -480,22 +367,22 @@ begin
end; end;
function TfrmBaseSwDialog.GetActiveUnits(): TUnSwUnitList; function TfrmBaseSwDialog.GetActiveItems(): TBaseSwItemList;
var var
itemIndex: Integer; itemIndex: Integer;
begin begin
Result := nil; Result := nil;
if Assigned(FActiveUnit) then if Assigned(ActiveItem) then
begin begin
Result := TUnSwUnitList.Create(); Result := CreateItemList();
Result.OwnsObjects := False; Result.OwnsObjects := False;
Result.Add(FActiveUnit); Result.Add(ActiveItem);
FActiveUnit := nil; ActiveItem := nil;
end else if lstItems.SelCount > 0 then end else if lstItems.SelCount > 0 then
begin begin
Result := TUnSwUnitList.Create(); Result := CreateItemList();
Result.OwnsObjects := False; Result.OwnsObjects := False;
for itemIndex := 0 to Pred(lstItems.Items.Count) do for itemIndex := 0 to Pred(lstItems.Items.Count) do
@ -505,63 +392,39 @@ begin
end; end;
procedure TfrmBaseSwDialog.LoadSettings(); function TfrmBaseSwDialog.GetBaseItemList(): TBaseSwItemList;
var
dialogSettings: TUnSwDialogSettings;
begin begin
if FFormsOnly then Result := ItemList;
dialogSettings := Settings.FormsDialog
else
dialogSettings := Settings.UnitsDialog;
FLoading := True;
try
chkDataModules.Checked := dialogSettings.IncludeDataModules;
chkForms.Checked := dialogSettings.IncludeForms;
chkUnits.Checked := dialogSettings.IncludeUnits;
chkProjectSource.Checked := dialogSettings.IncludeProjectSource;
case dialogSettings.Sort of
dsName: actSortByName.Checked := True;
dsType: actSortByType.Checked := True;
end;
FMRUList := dialogSettings.MRUList;
cmbSearch.Items.Assign(FMRUList);
Self.ClientWidth := dialogSettings.Width;
Self.ClientHeight := dialogSettings.Height;
finally
FLoading := False;
end;
end; end;
procedure TfrmBaseSwDialog.SaveSettings(); function TfrmBaseSwDialog.GetItemDisplayName(const AItem: TBaseSwItem): String;
var
dialogSettings: TUnSwDialogSettings;
begin begin
if FFormsOnly then Result := AItem.Name;
dialogSettings := Settings.FormsDialog end;
else
dialogSettings := Settings.UnitsDialog;
dialogSettings.IncludeDataModules := chkDataModules.Checked;
dialogSettings.IncludeForms := chkForms.Checked;
dialogSettings.IncludeUnits := chkUnits.Checked;
dialogSettings.IncludeProjectSource := chkProjectSource.Checked;
if actSortByName.Checked then function TfrmBaseSwDialog.ColorsEnabled(): Boolean;
dialogSettings.Sort := dsName begin
else Result := False;
dialogSettings.Sort := dsType; end;
dialogSettings.Width := Self.ClientWidth;
dialogSettings.Height := Self.ClientHeight;
Settings.Save(); function TfrmBaseSwDialog.CreateItemList(): TBaseSwItemList;
begin
Result := TBaseSwItemList.Create();
end;
function TfrmBaseSwDialog.CreateInputFilter(): TBaseSwItemSimpleFilter;
begin
Result := TBaseSwItemSimpleNameFilter.Create();
end;
function TfrmBaseSwDialog.CreateStyleVisitor(): TBaseSwStyleVisitor;
begin
Result := nil;
end; end;
@ -581,19 +444,14 @@ begin
end; end;
procedure TfrmBaseSwDialog.SortExecute(Sender: TObject); procedure TfrmBaseSwDialog.btnOKClick(Sender: TObject);
begin begin
(Sender as TAction).Checked := True; ModalResult := mrOk;
UpdateTypeFilter();
end; end;
procedure TfrmBaseSwDialog.SelectMRUItem(); procedure TfrmBaseSwDialog.SelectMRUItem();
var
mruText: String;
begin begin
mruText := FMRUList[FMRUIndex];
cmbSearch.ItemIndex := FMRUIndex; cmbSearch.ItemIndex := FMRUIndex;
ActiveControl := cmbSearch; ActiveControl := cmbSearch;
cmbSearch.SelectAll(); cmbSearch.SelectAll();
@ -605,7 +463,7 @@ end;
procedure TfrmBaseSwDialog.actMRUNextExecute(Sender: TObject); procedure TfrmBaseSwDialog.actMRUNextExecute(Sender: TObject);
begin begin
if FMRUIndex < Pred(FMRUList.Count) then if FMRUIndex < Pred(MRUList.Count) then
Inc(FMRUIndex); Inc(FMRUIndex);
SelectMRUItem(); SelectMRUItem();
@ -621,58 +479,6 @@ begin
end; end;
procedure TfrmBaseSwDialog.actOpenFolderExecute(Sender: TObject);
var
pUnits: TUnSwUnitList;
begin
pUnits := GetActiveUnits();
if Assigned(pUnits) then
try
pUnits.AcceptVisitor(TUnSwOpenFolderVisitor.Create());
finally
FreeAndNil(pUnits);
end;
end;
procedure TfrmBaseSwDialog.actOpenPropertiesExecute(Sender: TObject);
var
pUnits: TUnSwUnitList;
begin
pUnits := GetActiveUnits();
if Assigned(pUnits) then
try
pUnits.AcceptVisitor(TUnSwOpenPropertiesVisitor.Create());
finally
FreeAndNil(pUnits);
end;
end;
procedure TfrmBaseSwDialog.actOpenDFMPropertiesExecute(Sender: TObject);
var
pUnits: TUnSwUnitList;
begin
pUnits := GetActiveUnits();
if Assigned(pUnits) then
try
pUnits.AcceptVisitor(TUnSwOpenDFMPropertiesVisitor.Create());
finally
FreeAndNil(pUnits);
end;
end;
procedure TfrmBaseSwDialog.btnConfigurationClick(Sender: TObject);
begin
if TfrmUnSwConfiguration.Execute() then
lstItems.Invalidate();
end;
procedure TfrmBaseSwDialog.cmbSearchChange(Sender: TObject); procedure TfrmBaseSwDialog.cmbSearchChange(Sender: TObject);
begin begin
if cmbSearch.Text <> FInputFilter.Filter then if cmbSearch.Text <> FInputFilter.Filter then
@ -721,13 +527,6 @@ begin
end; end;
procedure TfrmBaseSwDialog.TypeFilterChange(Sender: TObject);
begin
if not FLoading then
UpdateTypeFilter();
end;
procedure TfrmBaseSwDialog.lstItemsDblClick(Sender: TObject); procedure TfrmBaseSwDialog.lstItemsDblClick(Sender: TObject);
begin begin
btnOK.Click(); btnOK.Click();
@ -736,7 +535,7 @@ end;
procedure TfrmBaseSwDialog.lstItemsClick(Sender: TObject); procedure TfrmBaseSwDialog.lstItemsClick(Sender: TObject);
begin begin
UpdateUnitActions(); UpdateItemActions();
end; end;
@ -750,20 +549,18 @@ end;
procedure TfrmBaseSwDialog.lstItemsDrawItem(Control: TWinControl; Index: Integer; procedure TfrmBaseSwDialog.lstItemsDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState); Rect: TRect; State: TOwnerDrawState);
var var
currentUnit: TUnSwUnit; currentItem: TBaseSwItem;
textRect: TRect; textRect: TRect;
text: String; text: String;
begin begin
with TListBox(Control) do with TListBox(Control) do
begin begin
currentUnit := FInputFilteredList[Index]; currentItem := FInputFilteredList[Index];
currentUnit.AcceptVisitor(FStyleVisitor); if Assigned(FStyleVisitor) then
currentItem.AcceptVisitor(FStyleVisitor);
if FFormsOnly and (currentUnit is TUnSwModuleUnit) then
text := TUnSwModuleUnit(currentUnit).FormName text := GetItemDisplayName(currentItem);
else
text := currentUnit.Name;
if odSelected in State then if odSelected in State then
begin begin
@ -772,7 +569,8 @@ begin
end else end else
begin begin
Canvas.Brush.Color := clWindow; Canvas.Brush.Color := clWindow;
if Settings.Colors.Enabled then
if Assigned(FStyleVisitor) and ColorsEnabled() then
Canvas.Font.Color := FStyleVisitor.Color Canvas.Font.Color := FStyleVisitor.Color
else else
Canvas.Font.Color := clWindowText; Canvas.Font.Color := clWindowText;
@ -781,10 +579,14 @@ begin
textRect := Rect; textRect := Rect;
InflateRect(textRect, -2, -2); InflateRect(textRect, -2, -2);
ilsTypes.Draw(Canvas, textRect.Left, textRect.Top, FStyleVisitor.ImageIndex);
if FStyleVisitor.OverlayIndex > -1 then if Assigned(FStyleVisitor) then
ilsTypes.Draw(Canvas, textRect.Left, textRect.Top, FStyleVisitor.OverlayIndex); begin
ilsTypes.Draw(Canvas, textRect.Left, textRect.Top, FStyleVisitor.ImageIndex);
if FStyleVisitor.OverlayIndex > -1 then
ilsTypes.Draw(Canvas, textRect.Left, textRect.Top, FStyleVisitor.OverlayIndex);
end;
Inc(textRect.Left, ilsTypes.Width + 4); Inc(textRect.Left, ilsTypes.Width + 4);
DrawText(Canvas.Handle, PChar(text), Length(text), textRect, DT_SINGLELINE or DrawText(Canvas.Handle, PChar(text), Length(text), textRect, DT_SINGLELINE or
@ -807,54 +609,9 @@ begin
begin begin
lstItems.ClearSelection; lstItems.ClearSelection;
lstItems.Selected[itemIndex] := True; lstItems.Selected[itemIndex] := True;
UpdateUnitActions(); UpdateItemActions();
end; end;
end; end;
end; end;
procedure TfrmBaseSwDialog.actReadOnlyExecute(Sender: TObject);
var
pUnits: TUnSwUnitList;
pVisitor: TUnSwSetReadOnlyVisitor;
begin
pUnits := GetActiveUnits();
if Assigned(pUnits) then
try
pVisitor := TUnSwSetReadOnlyVisitor.Create();
try
pVisitor.ReadOnlyFlag := not actReadOnly.Checked;
pUnits.AcceptVisitor(pVisitor);
finally
FreeAndNil(pVisitor);
end;
finally
FreeAndNil(pUnits);
lstItems.Invalidate();
UpdateUnitActions();
end;
end;
procedure TfrmBaseSwDialog.actOpenExecute(Sender: TObject);
begin
FOpenDFM := False;
ModalResult := mrOk;
end;
procedure TfrmBaseSwDialog.actOpenDFMExecute(Sender: TObject);
begin
FOpenDFM := True;
ModalResult := mrOk;
end;
procedure TfrmBaseSwDialog.btnOKClick(Sender: TObject);
begin
FOpenDFM := ((GetKeyState(VK_SHIFT) and 128) <> 0);
ModalResult := mrOk;
end;
end. end.

View File

@ -18,7 +18,7 @@ type
FList: TBaseSwItemList; FList: TBaseSwItemList;
protected protected
// IBaseSwVisitor // IBaseSwVisitor
procedure VisitItem(AItem: TBaseSwItem); virtual; procedure VisitItem(const AItem: TBaseSwItem); virtual;
procedure FilterItem(const AItem: TBaseSwItem); virtual; procedure FilterItem(const AItem: TBaseSwItem); virtual;
public public
@ -38,7 +38,7 @@ type
TBaseSwItemSimpleNameFilter = class(TBaseSwItemSimpleFilter) TBaseSwItemSimpleNameFilter = class(TBaseSwItemSimpleFilter)
protected protected
procedure VisitItem(AItem: TBaseSwItem); override; procedure VisitItem(const AItem: TBaseSwItem); override;
end; end;
@ -65,7 +65,7 @@ begin
end; end;
procedure TBaseSwItemFilter.VisitItem(AItem: TBaseSwItem); procedure TBaseSwItemFilter.VisitItem(const AItem: TBaseSwItem);
begin begin
end; end;
@ -78,7 +78,7 @@ end;
{ TBaseSwItemSimpleNameFilter } { TBaseSwItemSimpleNameFilter }
procedure TBaseSwItemSimpleNameFilter.VisitItem(AItem: TBaseSwItem); procedure TBaseSwItemSimpleNameFilter.VisitItem(const AItem: TBaseSwItem);
begin begin
if (Length(Filter) > 0) and if (Length(Filter) > 0) and
(AnsiPos(Filter, LowerCase(AItem.Name)) = 0) then (AnsiPos(Filter, LowerCase(AItem.Name)) = 0) then

View File

@ -6,6 +6,9 @@
} }
unit CmpSwClient; unit CmpSwClient;
// #ToDo2 (MvR) 9-12-2007: Ctrl activates the designer guidelines in BDS 2006
// and up, which get drawn over our dialog. messy.
interface interface
uses uses
ActnList, ActnList,
@ -16,26 +19,24 @@ uses
BaseSwClient; BaseSwClient;
type type
TComponentSwitcherHook = class(TBaseSwitcherHook) TComponentSwitcherHook = class(TBaseSwitcherHook)
protected protected
function ActiveModule(): IOTAModule; function ActiveModule(): IOTAModule;
function ActiveEditor(): IOTAEditor; function ActiveEditor(): IOTAEditor;
// function ActiveFileName(): String; procedure NewExecute(Sender: TObject);
// {$IFDEF DELPHI7ORLOWER}
// function ActiveGroup(): IOTAProjectGroup;
// {$ENDIF}
// function ActiveProject(): IOTAProject;
procedure NewExecute(Sender: TObject); virtual;
public public
constructor Create(); constructor Create();
end; end;
implementation implementation
uses
BaseSwObjects,
CmpSwDialog,
CmpSwObjects, Windows;
{ TComponentSwitcherHook} { TComponentSwitcherHook}
@ -52,128 +53,6 @@ begin
end; end;
(*
function TUnitSwitcherHook.ActiveFileName(): String;
var
module: IOTAModule;
begin
Result := '';
module := (BorlandIDEServices as IOTAModuleServices).CurrentModule;
if Assigned(module) then
begin
if Assigned(module.CurrentEditor) then
Result := module.FileName;
end;
end;
{$IFDEF DELPHI7ORLOWER}
function TUnitSwitcherHook.ActiveGroup(): IOTAProjectGroup;
var
module: IOTAModule;
moduleServices: IOTAModuleServices;
moduleIndex: Integer;
begin
Result := nil;
moduleServices := (BorlandIDEServices as IOTAModuleServices);
for moduleIndex := 0 to Pred(moduleServices.ModuleCount) do
begin
module := moduleServices.Modules[moduleIndex];
if Supports(module, IOTAProjectGroup, Result) then
break;
end;
end;
{$ENDIF}
function TUnitSwitcherHook.ActiveProject(): IOTAProject;
{$IFDEF DELPHI7ORLOWER}
var
projectGroup: IOTAProjectGroup;
module: IOTAModule;
moduleServices: IOTAModuleServices;
moduleIndex: Integer;
{$ENDIF}
begin
{$IFDEF DELPHI7ORLOWER}
Result := nil;
projectGroup := ActiveGroup();
if not Assigned(projectGroup) then
begin
moduleServices := (BorlandIDEServices as IOTAModuleServices);
for moduleIndex := 0 to Pred(moduleServices.ModuleCount) do
begin
module := moduleServices.Modules[moduleIndex];
if Supports(module, IOTAProject, Result) then
break;
end;
end else
Result := projectGroup.ActiveProject;
{$ELSE}
Result := (BorlandIDEServices as IOTAModuleServices).GetActiveProject();
{$ENDIF}
end;
procedure TUnitSwitcherHook.NewExecute(Sender: TObject);
var
activeIndex: Integer;
activeUnit: TUnSwUnit;
itemIndex: Integer;
moduleIndex: Integer;
project: IOTAProject;
selectedUnits: TUnSwUnitList;
unitList: TUnSwUnitList;
openDFM: Boolean;
openType: TUnSwActivateType;
fileName: string;
begin
project := ActiveProject();
if not Assigned(project) then
exit;
unitList := TUnSwUnitList.Create();
try
unitList.Add(TUnSwProjectUnit.Create(project));
for moduleIndex := 0 to Pred(project.GetModuleCount) do
unitList.Add(TUnSwModuleUnit.Create(project.GetModule(moduleIndex)));
activeUnit := nil;
fileName := ActiveFileName();
if SameText(ExtractFileExt(fileName), '.dfm') then
fileName := ChangeFileExt(fileName, '.pas');
activeIndex := unitList.IndexOfFileName(fileName);
if activeIndex > -1 then
activeUnit := unitList[activeIndex];
selectedUnits := TfrmUnSwDialog.Execute(unitList, (Sender = FViewFormAction),
openDFM, activeUnit);
if Assigned(selectedUnits) then
try
openType := atSource;
if openDFM then
openType := atDFM
else if Sender = FViewFormAction then
openType := atForm;
for itemIndex := 0 to Pred(selectedUnits.Count) do
selectedUnits[itemIndex].Activate(openType);
finally
FreeAndNil(selectedUnits);
end;
finally
FreeAndNil(unitList);
end;
end;
*)
function TComponentSwitcherHook.ActiveModule(): IOTAModule; function TComponentSwitcherHook.ActiveModule(): IOTAModule;
begin begin
Result := (BorlandIDEServices as IOTAModuleServices).CurrentModule; Result := (BorlandIDEServices as IOTAModuleServices).CurrentModule;
@ -193,21 +72,66 @@ begin
end; end;
function SortByName(Item1, Item2: Pointer): Integer;
begin
Result := CompareText(TCmpSwComponent(Item1).Name, TCmpSwComponent(Item2).Name)
end;
procedure TComponentSwitcherHook.NewExecute(Sender: TObject); procedure TComponentSwitcherHook.NewExecute(Sender: TObject);
var var
editor: IOTAEditor; editor: IOTAEditor;
formEditor: IOTAFormEditor; formEditor: IOTAFormEditor;
name: String; formComponent: IOTAComponent;
componentIndex: Integer;
component: IOTAComponent;
itemList: TBaseSwItemList;
item: TCmpSwComponent;
selectedItems: TBaseSwItemList;
begin begin
editor := ActiveEditor(); editor := ActiveEditor();
if Supports(editor, IOTAFormEditor, formEditor) then if Assigned(editor) and Supports(editor, IOTAFormEditor, formEditor) then
begin begin
name := ''; formComponent := formEditor.GetRootComponent;
formEditor.GetRootComponent.GetPropValueByName('Name', name); itemList := TBaseSwItemList.Create();
ShowMessage(name);
end else for componentIndex := Pred(formComponent.GetComponentCount) downto 0 do
OldActionExecute(Sender); begin
component := formComponent.GetComponent(componentIndex);
item := TCmpSwComponent.TryCreate(component);
if Assigned(item) then
itemList.Add(item);
end;
if itemList.Count > 0 then
begin
itemList.Sort(SortByName);
(*
ps := (borlandideservices as IOTAPackageServices);
for pi := 0 to Pred(ps.PackageCount) do
begin
for ci := 0 to Pred(ps.ComponentCount[pi]) do
begin
itemList.Add(TTestItem.Create(ps.PackageNames[pi] + ' - ' + ps.ComponentNames[pi, ci]));
end;
end;
*)
selectedItems := TfrmCmpSwDialog.Execute(itemList);
if Assigned(selectedItems) then
begin
for componentIndex := 0 to Pred(selectedItems.Count) do
begin
item := TCmpSwComponent(selectedItems[componentIndex]);
item.Activate(componentIndex = 0);
end;
end;
end;
end;
end; end;
end. end.

151
Source/CmpSwDialog.dfm Normal file
View File

@ -0,0 +1,151 @@
inherited frmCmpSwDialog: TfrmCmpSwDialog
Caption = 'ComponentSwitcher'
PixelsPerInch = 96
TextHeight = 13
inherited pnlMain: TPanel
inherited lstItems: TListBox
ExplicitTop = 47
end
end
inherited ilsTypes: TImageList
Bitmap = {
494C010101000200040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000002C7C2C001274
1200729872000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000005990
AC0010719F000673A6005A8FB40066A0660018801800007E000000870000078F
0C00006E00004F8D4F0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000639AB2000679AC000082
B5000091C3000D84B3000064AD0000811000008F000001970100049E080019AC
270000720000006E00004E874E00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000218EB500009BCE0000A0
D40000AADD001B90BA000064AD00059417000CA8150012AB260018B1320030C7
52000072000000720000317E3100000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000001A97C50000AFE30000B3
E60009C3F400249BC200006BB200129C370020BB3D0025BE4A0028C2560044DE
7500007E0000007E0000257C2500000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000012A3D30000C2F80000C9
FD000DE5FF0029A0C7000070B60014A24F0032DB6C003FDB760052EB88006AFF
A300078F0C00007E0000187B1800000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000BBFE10001F9FF0027FF
FF0036FFFF0029E2FF00007ABA00476A2B00819542005FFF980055FF920051F0
7E0053EE7D0020BB3D000D7B0D00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000026B9CD0012DCFD0000D6
FF003D979C009B591C00CB460000CC510000BA410000A8270000767223002CC5
43001AB42D0036B03E0067A46900000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000048A2
C700C3660700DC680000D56D0000D9720000BE611800A9410000AA3300009E39
1100000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000DC680000E0790000E0790000E67F0000CB702400A9410000A9410000B341
0B00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000E7800000EC860000EC860000F38B0000D47F3000B44E0000AE480000B344
0400000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000F38B0000FD940000FD940000FF9B0000DE8D3B00B84D0000B44E0000A941
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFB65400FFC77600FFCA8600FFCF9500F6BB7F00D47F2E00BF5C0800B44E
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000C0936B00C9936200CE8B4F00CF813900CB7B3600C57B3B00C07E4C00B77A
5300000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000100000000100010000000000800000000000000000000000
000000000000000000000000FFFFFF00FFFF000000000000FFC7000000000000
E003000000000000800100000000000080010000000000008001000000000000
800100000000000080010000000000008001000000000000E00F000000000000
F00F000000000000F00F000000000000F00F000000000000F00F000000000000
F00F000000000000FFFF00000000000000000000000000000000000000000000
000000000000}
end
end

52
Source/CmpSwDialog.pas Normal file
View File

@ -0,0 +1,52 @@
unit CmpSwDialog;
interface
uses
ActnList,
Classes,
ComCtrls,
Controls,
ExtCtrls,
ImgList,
Menus,
StdCtrls,
BaseSwDialog,
BaseSwObjects;
type
TCmpSwStyleVisitor = class(TBaseSwStyleVisitor)
protected
procedure VisitItem(const AItem: TBaseSwItem); override;
end;
TfrmCmpSwDialog = class(TfrmBaseSwDialog)
protected
function CreateStyleVisitor(): TBaseSwStyleVisitor; override;
end;
implementation
{$R *.dfm}
{ TCmpSwStyleVisitor }
procedure TCmpSwStyleVisitor.VisitItem(const AItem: TBaseSwItem);
begin
inherited;
ImageIndex := 0;
end;
{ TfrmCmpSwDialog }
function TfrmCmpSwDialog.CreateStyleVisitor(): TBaseSwStyleVisitor;
begin
Result := TCmpSwStyleVisitor.Create();
end;
end.

60
Source/CmpSwObjects.pas Normal file
View File

@ -0,0 +1,60 @@
unit CmpSwObjects;
interface
uses
ToolsAPI,
BaseSwObjects;
type
TCmpSwComponent = class(TBaseSwItem)
private
FComponent: IOTAComponent;
FName: String;
protected
function GetName(): String; override;
public
constructor Create(AComponent: IOTAComponent);
procedure Activate(const AClearSelection: Boolean);
class function TryCreate(AComponent: IOTAComponent): TCmpSwComponent;
end;
implementation
uses
SysUtils;
{ TCmpSwComponent }
class function TCmpSwComponent.TryCreate(AComponent: IOTAComponent): TCmpSwComponent;
begin
Result := TCmpSwComponent.Create(AComponent);
if Length(Result.Name) = 0 then
FreeAndNil(Result);
end;
constructor TCmpSwComponent.Create(AComponent: IOTAComponent);
begin
inherited Create();
FComponent := AComponent;
FComponent.GetPropValueByName('Name', FName);
end;
procedure TCmpSwComponent.Activate(const AClearSelection: Boolean);
begin
FComponent.Select(not AClearSelection);
end;
function TCmpSwComponent.GetName(): String;
begin
Result := FName;
end;
end.

View File

@ -24,7 +24,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
Top = 4 Top = 4
Width = 295 Width = 295
Height = 231 Height = 231
ActivePage = tsGeneral ActivePage = tsAbout
Anchors = [akLeft, akTop, akRight, akBottom] Anchors = [akLeft, akTop, akRight, akBottom]
TabOrder = 0 TabOrder = 0
object tsGeneral: TTabSheet object tsGeneral: TTabSheet
@ -276,7 +276,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
Top = 23 Top = 23
Width = 54 Width = 54
Height = 13 Height = 13
Caption = 'Version 0.5' Caption = 'Version 0.6'
end end
object TLabel object TLabel
Left = 135 Left = 135

View File

@ -104,7 +104,7 @@ end;
procedure TfrmUnSwConfiguration.lblBugReportClick(Sender: TObject); procedure TfrmUnSwConfiguration.lblBugReportClick(Sender: TObject);
begin begin
ShellExecute(0, 'open', 'http://projects.kamadev.net/', nil, nil, SW_SHOWNORMAL); ShellExecute(0, 'open', 'mailto:support@x2software.net', nil, nil, SW_SHOWNORMAL);
end; end;

View File

@ -1,153 +1,21 @@
object frmUnSwDialog: TfrmUnSwDialog inherited frmUnSwDialog: TfrmUnSwDialog
Left = 284 ExplicitHeight = 425
Top = 120
Width = 320
Height = 425
BorderIcons = [biSystemMenu]
Caption = 'UnitSwitcher'
Color = clBtnFace
Constraints.MinHeight = 240
Constraints.MinWidth = 290
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Icon.Data = {
0000010001001010100001000400280100001600000028000000100000002000
0000010004000000000080000000000000000000000000000000000000000000
000000008000008000000080800080000000800080008080000080808000C0C0
C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000
0000000000000000F777777777700000FF8F8F8F8F700000F8F8F8F8F8700000
FF0000000F700000F8F8F8F8F8700000F999999999700400F9FFFFFFF9700000
F999999999700000F8F8F8F8F8700000FF0000008F700000F8F8F8F8F7700000
FF00008F00000000F8F8F8F80F000000FFFFFFFF00000000000000000000E000
0000E0000000E0000000E0000000E00000006000000020000000000000002000
000060000000E0000000E0000000E0000000E0010000E0030000E0070000}
OldCreateOrder = False
Position = poScreenCenter
OnResize = FormResize
OnShow = FormShow
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
object sbStatus: TStatusBar inherited pnlMain: TPanel
Left = 0
Top = 379
Width = 312
Height = 19
Panels = <
item
Width = 50
end>
end
object pnlMain: TPanel
Left = 0
Top = 0
Width = 312
Height = 307 Height = 307
Align = alClient ExplicitHeight = 307
BevelOuter = bvNone inherited lstItems: TListBox
BorderWidth = 4
TabOrder = 0
object pnlSearch: TPanel
Left = 4
Top = 24
Width = 304
Height = 25
Align = alTop
BevelOuter = bvNone
TabOrder = 0
DesignSize = (
304
25)
object cmbSearch: TComboBox
Left = 0
Top = 0
Width = 304
Height = 21
AutoComplete = False
Anchors = [akLeft, akTop, akRight]
DropDownCount = 10
ItemHeight = 13
TabOrder = 0
OnChange = cmbSearchChange
OnKeyDown = cmbSearchKeyDown
OnKeyPress = cmbSearchKeyPress
end
end
object lstUnits: TListBox
Left = 4
Top = 49
Width = 304
Height = 254 Height = 254
Style = lbVirtualOwnerDraw ExplicitTop = 47
Align = alClient ExplicitHeight = 254
ItemHeight = 20
MultiSelect = True
PopupMenu = pmnUnits
TabOrder = 1
OnClick = lstUnitsClick
OnData = lstUnitsData
OnDblClick = lstUnitsDblClick
OnDrawItem = lstUnitsDrawItem
OnMouseDown = lstUnitsMouseDown
end
object pnlSubFilters: TPanel
Left = 4
Top = 4
Width = 304
Height = 20
Align = alTop
BevelOuter = bvNone
TabOrder = 2
Visible = False
DesignSize = (
304
20)
object lblSubFilters: TLabel
Left = 0
Top = 1
Width = 305
Height = 13
Anchors = [akLeft, akTop, akRight]
AutoSize = False
Caption = 'frm '#187' Dialog '#187
end
end end
end end
object pnlButtons: TPanel inherited pnlButtons: TPanel
Left = 0
Top = 343
Width = 312
Height = 36
Align = alBottom
BevelOuter = bvNone
TabOrder = 2 TabOrder = 2
DesignSize = ( inherited btnOK: TButton
312
36)
object btnCancel: TButton
Left = 233
Top = 5
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 2 TabOrder = 2
end end
object btnOK: TButton
Left = 152
Top = 5
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'OK'
Default = True
TabOrder = 1
OnClick = btnOKClick
end
object btnConfiguration: TButton object btnConfiguration: TButton
Left = 4 Left = 4
Top = 5 Top = 5
@ -158,7 +26,7 @@ object frmUnSwDialog: TfrmUnSwDialog
OnClick = btnConfigurationClick OnClick = btnConfigurationClick
end end
end end
object pnlIncludeTypes: TPanel object pnlIncludeTypes: TPanel [3]
Left = 0 Left = 0
Top = 307 Top = 307
Width = 312 Width = 312
@ -203,11 +71,9 @@ object frmUnSwDialog: TfrmUnSwDialog
OnClick = TypeFilterChange OnClick = TypeFilterChange
end end
end end
object ilsTypes: TImageList inherited ilsTypes: TImageList
Left = 28
Top = 228
Bitmap = { Bitmap = {
494C010106000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 494C010106000900040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000003000000001002000000000000030 0000000000003600000028000000400000003000000001002000000000000030
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -340,64 +206,64 @@ object frmUnSwDialog: TfrmUnSwDialog
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000080000000
0000C0C0C000C0C0C000C0C0C000C0C0C0000000000000000000000000000000 8000000080000000800000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00808080008080 00000000000000000000000000000000000000000000FFFFFF00808080008080
8000808080008080800080808000808080008080800080808000808080008080 8000808080008080800080808000808080008080800080808000808080008080
8000808080000000000000000000000000000000000000000000000000000000 8000808080000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000080000000FF000000
0000FFFFFF000000800000008000C0C0C0000000000000000000000000000000 FF000000FF000000FF0000008000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000808080000000000000000000000000000000000000000000000000000000 C000808080000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000FF000000FF000000FF00FFFF
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000 FF00FFFFFF000000FF000000FF00000080000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF 00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C000000000000000000000000000000000000000 FF00C0C0C000FFFFFF00C0C0C000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000FF000000FF000000FF000000
0000FFFFFF00FFFFFF00FFFFFF00C0C0C0000000000000000000000000000000 FF000000FF000000FF000000FF00000080000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF0080808000808080008080 C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF0080808000808080008080
8000808080008080800080808000000000000000000000000000000000000000 8000808080008080800080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000FF000000FF000000FF00FFFF
0000FFFFFF000000800000008000C0C0C0000000000000000000000000000000 FF00FFFFFF000000FF000000FF00000080000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF 00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00C0C0C000FFFF FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000 FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000FF000000FF000000FF00FFFF
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000 FF00FFFFFF000000FF000000FF00000080000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF00C0C0 C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000 C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000FF000000FF00FFFF
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000 FF00FFFFFF000000FF0000008000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF 00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00FFFFFF00FFFF FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000 FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000FF000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000 FF000000FF000000FF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -405,7 +271,7 @@ object frmUnSwDialog: TfrmUnSwDialog
C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000 C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -413,7 +279,7 @@ object frmUnSwDialog: TfrmUnSwDialog
FF00C0C0C000FFFFFF00C0C0C00000000000FF000000FF000000FF000000FF00 FF00C0C0C000FFFFFF00C0C0C00000000000FF000000FF000000FF000000FF00
0000FF00000000000000C0C0C000000000000000000000000000000000000000 0000FF00000000000000C0C0C000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -421,7 +287,7 @@ object frmUnSwDialog: TfrmUnSwDialog
C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000 C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00FFFFFF00C0C0C0000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -599,30 +465,17 @@ object frmUnSwDialog: TfrmUnSwDialog
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000003FFF0000000000003FFF000000000 000000000000000000000000000000000003FFC3000000000003FF8100000000
0003FFF0000000000000FFF0000000000000FFF0000000000000FFF000000000 0003FF00000000000000FF00000000000000FF00000000000000FF0000000000
0000FFF0000000000000FFF0000000000000FFF0000000000000FFF000000000 0000FF81000000000000FFC3000000000000FFFF000000000000FFFF00000000
0000FFF0000000000003FFFF000000000003FFFF000000000003FFFF00000000 0000FFFF000000000003FFFF000000000003FFFF000000000003FFFF00000000
0003FFFF000000000003FFFF00000000E000E000FFFFEC0FE000E000FFFF840F 0003FFFF000000000003FFFF00000000E000E000FFFFEC0FE000E000FFFF840F
E000E0000000AC0FE000E0000000BF3FE000E0000000FFFFE000600000001000 E000E0000000AC0FE000E0000000BF3FE000E0000000FFFFE000600000001000
E000200000001000E00000000000B000E00020000000F000E00060000000F000 E000200000001000E00000000000B000E00020000000F000E00060000000F000
E000E0000000F000E000E0000000F000E000E0000000F000E001E0010000F000 E000E0000000F000E000E0000000F000E000E0000000F000E001E0010000F000
E003E003FFFFF000E007E007FFFFF00000000000000000000000000000000000 E003E003FFFFF000E007E007FFFFF000}
000000000000}
end end
object alMain: TActionList inherited alMain: TActionList
Left = 84
Top = 228
object actSelectAll: TAction
Caption = 'Select &All'
ShortCut = 16449
OnExecute = actSelectAllExecute
end
object actSelectInvert: TAction
Caption = '&Invert Selection'
ShortCut = 16457
OnExecute = actSelectInvertExecute
end
object actSortByName: TAction object actSortByName: TAction
Caption = 'Sort by &Name' Caption = 'Sort by &Name'
GroupIndex = 1 GroupIndex = 1
@ -650,16 +503,6 @@ object frmUnSwDialog: TfrmUnSwDialog
ShortCut = 24589 ShortCut = 24589
OnExecute = actOpenDFMPropertiesExecute OnExecute = actOpenDFMPropertiesExecute
end end
object actMRUPrior: TAction
Caption = 'actMRUPrior'
ShortCut = 16422
OnExecute = actMRUPriorExecute
end
object actMRUNext: TAction
Caption = 'actMRUNext'
ShortCut = 16424
OnExecute = actMRUNextExecute
end
object actReadOnly: TAction object actReadOnly: TAction
Caption = '&Read only' Caption = '&Read only'
ShortCut = 49234 ShortCut = 49234
@ -676,49 +519,41 @@ object frmUnSwDialog: TfrmUnSwDialog
OnExecute = actOpenDFMExecute OnExecute = actOpenDFMExecute
end end
end end
object pmnUnits: TPopupMenu inherited pmnItems: TPopupMenu
Left = 140 object pmnItemsOpen: TMenuItem
Top = 228
object pmnUnitsOpen: TMenuItem
Action = actOpen Action = actOpen
end end
object pmnUnitsOpenDFM: TMenuItem object pmnItemsOpenDFM: TMenuItem
Action = actOpenDFM Action = actOpenDFM
end end
object pmnUnitsSep1: TMenuItem object pmnItemsSep1: TMenuItem
Caption = '-' Caption = '-'
end end
object pmnUnitsSelectAll: TMenuItem object pmnItemsSep2: TMenuItem
Action = actSelectAll
end
object pmnUnitsSelectInvert: TMenuItem
Action = actSelectInvert
end
object pmnUnitsSep2: TMenuItem
Caption = '-' Caption = '-'
end end
object pmnUnitsSortByName: TMenuItem object pmnItemsSortByName: TMenuItem
Action = actSortByName Action = actSortByName
end end
object pmnUnitsSortByType: TMenuItem object pmnItemsSortByType: TMenuItem
Action = actSortByType Action = actSortByType
end end
object pmnUnitsSep3: TMenuItem object pmnItemsSep3: TMenuItem
Caption = '-' Caption = '-'
end end
object pmnUnitsReadOnly: TMenuItem object pmnItemsReadOnly: TMenuItem
Action = actReadOnly Action = actReadOnly
end end
object pmnUnitsSep4: TMenuItem object pmnItemsSep4: TMenuItem
Caption = '-' Caption = '-'
end end
object pmnUnitsOpenFolder: TMenuItem object pmnItemsOpenFolder: TMenuItem
Action = actOpenFolder Action = actOpenFolder
end end
object pmnUnitsOpenProperties: TMenuItem object pmnItemsOpenProperties: TMenuItem
Action = actOpenProperties Action = actOpenProperties
end end
object pmnUnitsOpenDFMProperties: TMenuItem object pmnItemsOpenDFMProperties: TMenuItem
Action = actOpenDFMProperties Action = actOpenDFMProperties
end end
end end

View File

@ -22,135 +22,87 @@ uses
StdCtrls, StdCtrls,
Windows, Windows,
BaseSwDialog,
BaseSwFilters, BaseSwFilters,
BaseSwObjects, BaseSwObjects,
UnSwObjects, UnSwObjects,
UnSwFilters; UnSwFilters;
type type
TUnSwStyleVisitor = class(TInterfacedPersistent, IBaseSwVisitor, IUnSwVisitor) TUnSwStyleVisitor = class(TBaseSwStyleVisitor, IBaseSwVisitor, IUnSwVisitor)
private
FColor: TColor;
FImageIndex: Integer;
FOverlayIndex: Integer;
protected protected
procedure VisitItem(const AItem: TBaseSwItem); procedure VisitItem(const AItem: TBaseSwItem); override;
procedure VisitModule(const AUnit: TUnSwModuleUnit); procedure VisitModule(const AUnit: TUnSwModuleUnit); virtual;
procedure VisitProject(const AUnit: TUnSwProjectUnit); procedure VisitProject(const AUnit: TUnSwProjectUnit); virtual;
public
property Color: TColor read FColor;
property ImageIndex: Integer read FImageIndex;
property OverlayIndex: Integer read FOverlayIndex;
end; end;
TfrmUnSwDialog = class(TForm) TfrmUnSwDialog = class(TfrmBaseSwDialog)
actMRUNext: TAction;
actMRUPrior: TAction;
actOpen: TAction; actOpen: TAction;
actOpenDFM: TAction; actOpenDFM: TAction;
actOpenDFMProperties: TAction; actOpenDFMProperties: TAction;
actOpenFolder: TAction; actOpenFolder: TAction;
actOpenProperties: TAction; actOpenProperties: TAction;
actReadOnly: TAction; actReadOnly: TAction;
actSelectAll: TAction;
actSelectInvert: TAction;
actSortByName: TAction; actSortByName: TAction;
actSortByType: TAction; actSortByType: TAction;
alMain: TActionList;
btnCancel: TButton;
btnConfiguration: TButton;
btnOK: TButton;
chkDataModules: TCheckBox; chkDataModules: TCheckBox;
chkForms: TCheckBox; chkForms: TCheckBox;
chkProjectSource: TCheckBox; chkProjectSource: TCheckBox;
chkUnits: TCheckBox; chkUnits: TCheckBox;
cmbSearch: TComboBox; pmnItemsOpen: TMenuItem;
ilsTypes: TImageList; pmnItemsOpenDFM: TMenuItem;
lblSubFilters: TLabel; pmnItemsOpenDFMProperties: TMenuItem;
lstUnits: TListBox; pmnItemsOpenFolder: TMenuItem;
pmnUnits: TPopupMenu; pmnItemsOpenProperties: TMenuItem;
pmnUnitsOpen: TMenuItem; pmnItemsReadOnly: TMenuItem;
pmnUnitsOpenDFM: TMenuItem; pmnItemsSep1: TMenuItem;
pmnUnitsOpenDFMProperties: TMenuItem; pmnItemsSep2: TMenuItem;
pmnUnitsOpenFolder: TMenuItem; pmnItemsSep3: TMenuItem;
pmnUnitsOpenProperties: TMenuItem; pmnItemsSep4: TMenuItem;
pmnUnitsReadOnly: TMenuItem; pmnItemsSortByName: TMenuItem;
pmnUnitsSelectAll: TMenuItem; pmnItemsSortByType: TMenuItem;
pmnUnitsSelectInvert: TMenuItem;
pmnUnitsSep1: TMenuItem;
pmnUnitsSep2: TMenuItem;
pmnUnitsSep3: TMenuItem;
pmnUnitsSep4: TMenuItem;
pmnUnitsSortByName: TMenuItem;
pmnUnitsSortByType: TMenuItem;
pnlButtons: TPanel;
pnlIncludeTypes: TPanel; pnlIncludeTypes: TPanel;
pnlMain: TPanel;
pnlSearch: TPanel;
pnlSubFilters: TPanel;
sbStatus: TStatusBar;
procedure actMRUNextExecute(Sender: TObject);
procedure actMRUPriorExecute(Sender: TObject);
procedure actOpenDFMPropertiesExecute(Sender: TObject); procedure actOpenDFMPropertiesExecute(Sender: TObject);
procedure actOpenFolderExecute(Sender: TObject); procedure actOpenFolderExecute(Sender: TObject);
procedure actOpenPropertiesExecute(Sender: TObject); procedure actOpenPropertiesExecute(Sender: TObject);
procedure actReadOnlyExecute(Sender: TObject); procedure actReadOnlyExecute(Sender: TObject);
procedure actSelectAllExecute(Sender: TObject); procedure btnConfigurationClick(Sender: TObject);
procedure actSelectInvertExecute(Sender: TObject);
procedure btnConfigurationClick(Sender: TObject);
procedure cmbSearchChange(Sender: TObject);
procedure cmbSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure cmbSearchKeyPress(Sender: TObject; var Key: Char);
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure lstUnitsClick(Sender: TObject);
procedure lstUnitsData(Control: TWinControl; Index: Integer; var Data: string);
procedure lstUnitsDblClick(Sender: TObject); procedure lstUnitsDblClick(Sender: TObject);
procedure lstUnitsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
procedure lstUnitsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure SortExecute(Sender: TObject); procedure SortExecute(Sender: TObject);
procedure TypeFilterChange(Sender: TObject); procedure TypeFilterChange(Sender: TObject);
procedure actOpenExecute(Sender: TObject); procedure actOpenExecute(Sender: TObject);
procedure actOpenDFMExecute(Sender: TObject); procedure actOpenDFMExecute(Sender: TObject);
procedure btnOKClick(Sender: TObject); procedure btnOKClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private private
FLoading: Boolean; FLoading: Boolean;
FUnitList: TUnSwUnitList;
FActiveUnit: TUnSwUnit;
FFormsOnly: Boolean; FFormsOnly: Boolean;
FMRUList: TStrings;
FMRUIndex: Integer;
FSubFilters: TStringList;
FOpenDFM: Boolean; FOpenDFM: Boolean;
FTypeFilteredList: TUnSwUnitList; FTypeFilteredList: TUnSwUnitList;
FSubFilteredList: TUnSwUnitList;
FInputFilteredList: TUnSwUnitList;
FTypeFilter: TUnSwUnitTypeFilter; FTypeFilter: TUnSwUnitTypeFilter;
FSubFilter: TBaseSwItemSimpleFilter; protected
FInputFilter: TBaseSwItemSimpleFilter; function InternalExecute(): TBaseSwItemList; override;
FLastFilter: String; procedure UpdateTypeFilter(AUpdateList: Boolean);
FStyleVisitor: TUnSwStyleVisitor; function CreateItemList(): TBaseSwItemList; override;
function CreateInputFilter(): TBaseSwItemSimpleFilter; override;
function CreateStyleVisitor(): TBaseSwStyleVisitor; override;
function InternalExecute(): TUnSwUnitList; function AllowEmptyResult(): Boolean; override;
procedure UpdateTypeFilter(); function ColorsEnabled(): Boolean; override;
procedure UpdateList();
function GetBaseItemList(): TBaseSwItemList; override;
function GetItemDisplayName(const AItem: TBaseSwItem): String; override;
procedure UpdateItemActions(); override;
function GetActiveUnits(): TUnSwUnitList; function GetActiveUnits(): TUnSwUnitList;
procedure SelectMRUItem();
function PushFilter(const AFilter: String): Boolean; procedure LoadSettings(); override;
procedure PopFilter(); procedure SaveSettings(); override;
procedure UpdateSubFilters();
procedure LoadSettings();
procedure SaveSettings();
procedure UpdateUnitActions();
public public
class function Execute(const AUnits: TUnSwUnitList; class function Execute(const AUnits: TUnSwUnitList;
const AFormsOnly: Boolean; const AFormsOnly: Boolean;
@ -391,9 +343,9 @@ end;
procedure TUnSwStyleVisitor.VisitItem(const AItem: TBaseSwItem); procedure TUnSwStyleVisitor.VisitItem(const AItem: TBaseSwItem);
begin begin
if (AItem is TUnSwUnit) and IsReadOnly(TUnSwUnit(AItem).FileName) then if (AItem is TUnSwUnit) and IsReadOnly(TUnSwUnit(AItem).FileName) then
FOverlayIndex := 5 OverlayIndex := 5
else else
FOverlayIndex := -1; OverlayIndex := -1;
end; end;
@ -403,22 +355,22 @@ begin
case AUnit.UnitType of case AUnit.UnitType of
swutUnit: swutUnit:
begin begin
FColor := Settings.Colors.Units; Color := Settings.Colors.Units;
FImageIndex := 1; ImageIndex := 1;
end; end;
swutForm: swutForm:
begin begin
FColor := Settings.Colors.Forms; Color := Settings.Colors.Forms;
FImageIndex := 2; ImageIndex := 2;
end; end;
swutDataModule: swutDataModule:
begin begin
FColor := Settings.Colors.DataModules; Color := Settings.Colors.DataModules;
FImageIndex := 3; ImageIndex := 3;
end end;
else else
FColor := clWindowText; Color := clWindowText;
FImageIndex := 0; ImageIndex := 0;
end; end;
end; end;
@ -426,8 +378,8 @@ end;
procedure TUnSwStyleVisitor.VisitProject(const AUnit: TUnSwProjectUnit); procedure TUnSwStyleVisitor.VisitProject(const AUnit: TUnSwProjectUnit);
begin begin
VisitItem(AUnit); VisitItem(AUnit);
FColor := Settings.Colors.ProjectSource; Color := Settings.Colors.ProjectSource;
FImageIndex := 4; ImageIndex := 4;
end; end;
@ -439,11 +391,11 @@ class function TfrmUnSwDialog.Execute(const AUnits: TUnSwUnitList;
begin begin
with Self.Create(nil) do with Self.Create(nil) do
try try
FUnitList := AUnits; ItemList := AUnits;
FActiveUnit := AActive; ActiveItem := AActive;
FFormsOnly := AFormsOnly; FFormsOnly := AFormsOnly;
Result := InternalExecute(); Result := TUnSwUnitList(InternalExecute());
AOpenDFM := FOpenDFM; AOpenDFM := FOpenDFM;
finally finally
Free(); Free();
@ -451,48 +403,39 @@ begin
end; end;
procedure TfrmUnSwDialog.FormResize(Sender: TObject);
begin
lstUnits.Invalidate();
end;
procedure TfrmUnSwDialog.FormShow(Sender: TObject); procedure TfrmUnSwDialog.FormShow(Sender: TObject);
begin begin
// Setting ListBox.Selected[x] won't work before OnShow... UpdateTypeFilter(False);
UpdateTypeFilter(); inherited;
end; end;
function TfrmUnSwDialog.InternalExecute(): TUnSwUnitList; function TfrmUnSwDialog.GetActiveUnits(): TUnSwUnitList;
type
TBaseSwItemSimpleFilterClass = class of TBaseSwItemSimpleFilter;
var
iIndex: Integer;
pClass: TBaseSwItemSimpleFilterClass;
mruText: String;
subFilterIndex: Integer;
begin begin
Result := nil; Result := (GetActiveItems() as TUnSwUnitList);
FSubFilters := TStringList.Create(); end;
FTypeFilteredList := TUnSwUnitList.Create();
FSubFilteredList := TUnSwUnitList.Create();
FInputFilteredList := TUnSwUnitList.Create();
FTypeFilter := TUnSwUnitTypeFilter.Create;
if FFormsOnly then
pClass := TUnSwUnitSimpleFormNameFilter function TfrmUnSwDialog.GetBaseItemList(): TBaseSwItemList;
begin
Result := FTypeFilteredList;
end;
function TfrmUnSwDialog.GetItemDisplayName(const AItem: TBaseSwItem): String;
begin
if FFormsOnly and (AItem is TUnSwModuleUnit) then
Result := TUnSwModuleUnit(AItem).FormName
else else
pClass := TBaseSwItemSimpleNameFilter; Result := inherited GetItemDisplayName(AItem);
end;
FSubFilter := pClass.Create;
FInputFilter := pClass.Create;
function TfrmUnSwDialog.InternalExecute(): TBaseSwItemList;
begin
FTypeFilteredList := TUnSwUnitList.Create();
FTypeFilter := TUnSwUnitTypeFilter.Create;
try try
LoadSettings();
if FFormsOnly then if FFormsOnly then
begin begin
chkProjectSource.Visible := False; chkProjectSource.Visible := False;
@ -501,46 +444,15 @@ begin
end else end else
Self.Caption := 'UnitSwitcher - View Unit'; Self.Caption := 'UnitSwitcher - View Unit';
FStyleVisitor := TUnSwStyleVisitor.Create(); Result := inherited InternalExecute();
try
if Self.ShowModal() = mrOk then
begin
if Length(Trim(cmbSearch.Text)) > 0 then
begin
iIndex := FMRUList.IndexOf(cmbSearch.Text);
if iIndex > -1 then
FMRUList.Delete(iIndex);
while FMRUList.Count >= 10 do
FMRUList.Delete(Pred(FMRUList.Count));
mruText := cmbSearch.Text;
for subFilterIndex := Pred(FSubFilters.Count) downto 0 do
mruText := FSubFilters[subFilterIndex] + SubFilterSeparator;
FMRUList.Insert(0, mruText);
end;
Result := GetActiveUnits();
end;
SaveSettings();
finally
FreeAndNil(FStyleVisitor);
end;
finally finally
FreeAndNil(FInputFilter);
FreeAndNil(FSubFilter);
FreeAndNil(FTypeFilter); FreeAndNil(FTypeFilter);
FreeAndNil(FSubFilteredList);
FreeAndNil(FInputFilteredList);
FreeAndNil(FTypeFilteredList); FreeAndNil(FTypeFilteredList);
FreeAndNil(FSubFilters);
end; end;
end; end;
procedure TfrmUnSwDialog.UpdateUnitActions(); procedure TfrmUnSwDialog.UpdateItemActions();
var var
bDFM: Boolean; bDFM: Boolean;
bUnits: Boolean; bUnits: Boolean;
@ -601,70 +513,6 @@ begin
end; end;
procedure TfrmUnSwDialog.UpdateList();
var
activeUnit: TUnSwUnit;
activeUnits: TUnSwUnitList;
itemIndex: Integer;
listIndex: Integer;
filteredList: TUnSwUnitList;
selStart: Integer;
begin
activeUnits := GetActiveUnits();
filteredList := TUnSwUnitList.Create();
try
filteredList.Clone(FSubFilteredList);
FInputFilter.FilterList(filteredList);
if (filteredList.Count = 0) and (not Settings.Filter.AllowEmptyResult) then
begin
{ Only enforce AllowEmptyResult when adding to the filter }
if Length(FInputFilter.Filter) > Length(FLastFilter) then
begin
FInputFilter.Filter := FLastFilter;
selStart := cmbSearch.SelStart;
cmbSearch.Text := FLastFilter;
cmbSearch.SelStart := selStart;
Exit;
end;
end;
FLastFilter := FInputFilter.Filter;
FInputFilteredList.Clone(filteredList);
finally
FreeAndNil(filteredList);
end;
lstUnits.Count := FInputFilteredList.Count;
if FInputFilteredList.Count > 0 then
begin
lstUnits.ClearSelection();
if Assigned(activeUnits) then
try
for itemIndex := 0 to Pred(activeUnits.Count) do
begin
activeUnit := activeUnits[itemIndex];
listIndex := FInputFilteredList.IndexOf(activeUnit);
if listIndex > -1 then
lstUnits.Selected[listIndex] := True;
end;
finally
FreeAndNil(activeUnits);
end;
if lstUnits.SelCount = 0 then
lstUnits.Selected[0] := True;
end;
if Assigned(lstUnits.OnClick) then
lstUnits.OnClick(nil);
end;
function SortByName(Item1, Item2: Pointer): Integer; function SortByName(Item1, Item2: Pointer): Integer;
begin begin
Result := CompareText(TUnSwUnit(Item1).Name, TUnSwUnit(Item2).Name) Result := CompareText(TUnSwUnit(Item1).Name, TUnSwUnit(Item2).Name)
@ -720,14 +568,14 @@ begin
end; end;
procedure TfrmUnSwDialog.UpdateTypeFilter(); procedure TfrmUnSwDialog.UpdateTypeFilter(AUpdateList: Boolean);
begin begin
FTypeFilter.IncludeUnits := ((not FFormsOnly) and chkUnits.Checked); FTypeFilter.IncludeUnits := ((not FFormsOnly) and chkUnits.Checked);
FTypeFilter.IncludeProjectSource := ((not FFormsOnly) and chkProjectSource.Checked); FTypeFilter.IncludeProjectSource := ((not FFormsOnly) and chkProjectSource.Checked);
FTypeFilter.IncludeForms := chkForms.Checked; FTypeFilter.IncludeForms := chkForms.Checked;
FTypeFilter.IncludeDataModules := chkDataModules.Checked; FTypeFilter.IncludeDataModules := chkDataModules.Checked;
FTypeFilteredList.Clone(FUnitList); FTypeFilteredList.Clone(ItemList);
FTypeFilter.FilterList(FTypeFilteredList); FTypeFilter.FilterList(FTypeFilteredList);
if actSortByName.Checked then if actSortByName.Checked then
@ -735,83 +583,8 @@ begin
else else
FTypeFilteredList.Sort(SortByType); FTypeFilteredList.Sort(SortByType);
UpdateSubFilters(); if AUpdateList then
end;
procedure TfrmUnSwDialog.PopFilter();
begin
if FSubFilters.Count > 0 then
begin
FSubFilters.Delete(Pred(FSubFilters.Count));
UpdateSubFilters(); UpdateSubFilters();
end;
end;
procedure TfrmUnSwDialog.UpdateSubFilters();
var
iFilter: Integer;
sFilters: String;
begin
FSubFilteredList.Clone(FTypeFilteredList);
if FSubFilters.Count > 0 then
begin
for iFilter := 0 to Pred(FSubFilters.Count) do
begin
sFilters := sFilters + FSubFilters[iFilter] + SubFilterSeparator;
FSubFilter.Filter := FSubFilters[iFilter];
FSubFilter.FilterList(FSubFilteredList);
end;
lblSubFilters.Caption := Trim(sFilters);
pnlSubFilters.Visible := True;
end else
pnlSubFilters.Visible := False;
UpdateList();
end;
function TfrmUnSwDialog.PushFilter(const AFilter: String): Boolean;
var
sFilter: String;
begin
sFilter := Trim(AFilter);
Result := (Length(sFilter) > 0) and (FSubFilters.IndexOf(AFilter) = -1);
if Result then
begin
FSubFilters.Add(AFilter);
UpdateSubFilters();
end;
end;
function TfrmUnSwDialog.GetActiveUnits(): TUnSwUnitList;
var
itemIndex: Integer;
begin
Result := nil;
if Assigned(FActiveUnit) then
begin
Result := TUnSwUnitList.Create();
Result.OwnsObjects := False;
Result.Add(FActiveUnit);
FActiveUnit := nil;
end else if lstUnits.SelCount > 0 then
begin
Result := TUnSwUnitList.Create();
Result.OwnsObjects := False;
for itemIndex := 0 to Pred(lstUnits.Items.Count) do
if lstUnits.Selected[itemIndex] then
Result.Add(FInputFilteredList[itemIndex]);
end;
end; end;
@ -837,11 +610,12 @@ begin
dsType: actSortByType.Checked := True; dsType: actSortByType.Checked := True;
end; end;
FMRUList := dialogSettings.MRUList; MRUList.Assign(dialogSettings.MRUList);
cmbSearch.Items.Assign(FMRUList);
Self.ClientWidth := dialogSettings.Width; Self.ClientWidth := dialogSettings.Width;
Self.ClientHeight := dialogSettings.Height; Self.ClientHeight := dialogSettings.Height;
inherited LoadSettings();
finally finally
FLoading := False; FLoading := False;
end; end;
@ -871,63 +645,18 @@ begin
dialogSettings.Width := Self.ClientWidth; dialogSettings.Width := Self.ClientWidth;
dialogSettings.Height := Self.ClientHeight; dialogSettings.Height := Self.ClientHeight;
dialogSettings.MRUList.Assign(MRUList);
Settings.Save(); Settings.Save();
end;
inherited SaveSettings();
procedure TfrmUnSwDialog.actSelectAllExecute(Sender: TObject);
begin
lstUnits.SelectAll();
end;
procedure TfrmUnSwDialog.actSelectInvertExecute(Sender: TObject);
var
iItem: Integer;
begin
for iItem := Pred(lstUnits.Count) downto 0 do
lstUnits.Selected[iItem] := not lstUnits.Selected[iItem];
end; end;
procedure TfrmUnSwDialog.SortExecute(Sender: TObject); procedure TfrmUnSwDialog.SortExecute(Sender: TObject);
begin begin
(Sender as TAction).Checked := True; (Sender as TAction).Checked := True;
UpdateTypeFilter(); UpdateTypeFilter(True);
end;
procedure TfrmUnSwDialog.SelectMRUItem();
var
mruText: String;
begin
mruText := FMRUList[FMRUIndex];
cmbSearch.ItemIndex := FMRUIndex;
ActiveControl := cmbSearch;
cmbSearch.SelectAll();
if Assigned(cmbSearch.OnChange) then
cmbSearch.OnChange(nil);
end;
procedure TfrmUnSwDialog.actMRUNextExecute(Sender: TObject);
begin
if FMRUIndex < Pred(FMRUList.Count) then
Inc(FMRUIndex);
SelectMRUItem();
end;
procedure TfrmUnSwDialog.actMRUPriorExecute(Sender: TObject);
begin
if FMRUIndex >= -1 then
Dec(FMRUIndex);
SelectMRUItem();
end; end;
@ -979,62 +708,41 @@ end;
procedure TfrmUnSwDialog.btnConfigurationClick(Sender: TObject); procedure TfrmUnSwDialog.btnConfigurationClick(Sender: TObject);
begin begin
if TfrmUnSwConfiguration.Execute() then if TfrmUnSwConfiguration.Execute() then
lstUnits.Invalidate(); lstItems.Invalidate();
end; end;
procedure TfrmUnSwDialog.cmbSearchChange(Sender: TObject); function TfrmUnSwDialog.CreateItemList(): TBaseSwItemList;
begin begin
if cmbSearch.Text <> FInputFilter.Filter then Result := TUnSwUnitList.Create();
begin
FInputFilter.Filter := cmbSearch.Text;
UpdateList();
end;
end; end;
procedure TfrmUnSwDialog.cmbSearchKeyDown(Sender: TObject; var Key: Word; function TfrmUnSwDialog.ColorsEnabled(): Boolean;
Shift: TShiftState);
begin begin
if not cmbSearch.DroppedDown then Result := Settings.Colors.Enabled;
if ((Shift = []) and (Key in [VK_UP, VK_DOWN, VK_PRIOR, VK_NEXT])) or
((Shift = [ssCtrl]) and (Key in [VK_HOME, VK_END])) or
((Shift = [ssShift]) and (Key in [VK_UP, VK_DOWN, VK_PRIOR, VK_NEXT])) then
begin
lstUnits.Perform(WM_KEYDOWN, Key, 0);
Key := 0;
end else if Shift = [ssCtrl] then
case Key of
VK_TAB:
begin
if PushFilter(cmbSearch.Text) then
cmbSearch.Text := '';
Key := 0;
end;
VK_BACK:
begin
cmbSearch.Text := '';
FInputFilter.Filter := '';
PopFilter();
Key := 0;
end;
end;
end; end;
procedure TfrmUnSwDialog.cmbSearchKeyPress(Sender: TObject; var Key: Char); function TfrmUnSwDialog.CreateStyleVisitor(): TBaseSwStyleVisitor;
begin begin
// Ctrl-Backspace Result := TUnSwStyleVisitor.Create();
if Key = #127 then end;
Key := #0;
function TfrmUnSwDialog.CreateInputFilter(): TBaseSwItemSimpleFilter;
begin
if FFormsOnly then
Result := TUnSwUnitSimpleFormNameFilter.Create()
else
Result := TBaseSwItemSimpleNameFilter.Create();
end; end;
procedure TfrmUnSwDialog.TypeFilterChange(Sender: TObject); procedure TfrmUnSwDialog.TypeFilterChange(Sender: TObject);
begin begin
if not FLoading then if not FLoading then
UpdateTypeFilter(); UpdateTypeFilter(True);
end; end;
@ -1044,85 +752,6 @@ begin
end; end;
procedure TfrmUnSwDialog.lstUnitsClick(Sender: TObject);
begin
UpdateUnitActions();
end;
procedure TfrmUnSwDialog.lstUnitsData(Control: TWinControl; Index: Integer;
var Data: string);
begin
Data := FInputFilteredList[Index].Name;
end;
procedure TfrmUnSwDialog.lstUnitsDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
currentUnit: TUnSwUnit;
textRect: TRect;
text: String;
begin
with TListBox(Control) do
begin
currentUnit := FInputFilteredList[Index];
currentUnit.AcceptVisitor(FStyleVisitor);
if FFormsOnly and (currentUnit is TUnSwModuleUnit) then
text := TUnSwModuleUnit(currentUnit).FormName
else
text := currentUnit.Name;
if odSelected in State then
begin
Canvas.Brush.Color := clHighlight;
Canvas.Font.Color := clHighlightText;
end else
begin
Canvas.Brush.Color := clWindow;
if Settings.Colors.Enabled then
Canvas.Font.Color := FStyleVisitor.Color
else
Canvas.Font.Color := clWindowText;
end;
Canvas.FillRect(Rect);
textRect := Rect;
InflateRect(textRect, -2, -2);
ilsTypes.Draw(Canvas, textRect.Left, textRect.Top, FStyleVisitor.ImageIndex);
if FStyleVisitor.OverlayIndex > -1 then
ilsTypes.Draw(Canvas, textRect.Left, textRect.Top, FStyleVisitor.OverlayIndex);
Inc(textRect.Left, ilsTypes.Width + 4);
DrawText(Canvas.Handle, PChar(text), Length(text), textRect, DT_SINGLELINE or
DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS);
end;
end;
procedure TfrmUnSwDialog.lstUnitsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
itemIndex: Integer;
begin
{ Bij rechtermuisknop het item selecteren indien deze niet al
geselecteerd was }
if Button = mbRight then
begin
itemIndex := lstUnits.ItemAtPos(Point(X, Y), True);
if (itemIndex > -1) and (not lstUnits.Selected[itemIndex]) then
begin
lstUnits.ClearSelection;
lstUnits.Selected[itemIndex] := True;
UpdateUnitActions();
end;
end;
end;
procedure TfrmUnSwDialog.actReadOnlyExecute(Sender: TObject); procedure TfrmUnSwDialog.actReadOnlyExecute(Sender: TObject);
var var
pUnits: TUnSwUnitList; pUnits: TUnSwUnitList;
@ -1142,12 +771,18 @@ begin
finally finally
FreeAndNil(pUnits); FreeAndNil(pUnits);
lstUnits.Invalidate(); lstItems.Invalidate();
UpdateUnitActions(); UpdateItemActions();
end; end;
end; end;
function TfrmUnSwDialog.AllowEmptyResult(): Boolean;
begin
Result := Settings.Filter.AllowEmptyResult;
end;
procedure TfrmUnSwDialog.actOpenExecute(Sender: TObject); procedure TfrmUnSwDialog.actOpenExecute(Sender: TObject);
begin begin
FOpenDFM := False; FOpenDFM := False;
@ -1164,7 +799,8 @@ end;
procedure TfrmUnSwDialog.btnOKClick(Sender: TObject); procedure TfrmUnSwDialog.btnOKClick(Sender: TObject);
begin begin
FOpenDFM := ((GetKeyState(VK_SHIFT) and 128) <> 0); FOpenDFM := ((GetKeyState(VK_SHIFT) and 128) <> 0);
ModalResult := mrOk;
inherited;
end; end;
end. end.

View File

@ -23,7 +23,7 @@ type
end; end;
TUnSwUnitTypeFilter = class(TBaseSwItemFilter) TUnSwUnitTypeFilter = class(TBaseSwItemFilter, IBaseSwVisitor, IUnSwVisitor)
private private
FIncludeDataModules: Boolean; FIncludeDataModules: Boolean;
FIncludeForms: Boolean; FIncludeForms: Boolean;
@ -33,7 +33,7 @@ type
procedure VisitModule(const AUnit: TUnSwModuleUnit); procedure VisitModule(const AUnit: TUnSwModuleUnit);
procedure VisitProject(const AUnit: TUnSwProjectUnit); procedure VisitProject(const AUnit: TUnSwProjectUnit);
public public
constructor Create; constructor Create();
property IncludeDataModules: Boolean read FIncludeDataModules write FIncludeDataModules; property IncludeDataModules: Boolean read FIncludeDataModules write FIncludeDataModules;
property IncludeForms: Boolean read FIncludeForms write FIncludeForms; property IncludeForms: Boolean read FIncludeForms write FIncludeForms;
@ -63,7 +63,7 @@ end;
{ TUnSwUnitTypeFilter } { TUnSwUnitTypeFilter }
constructor TUnSwUnitTypeFilter.Create; constructor TUnSwUnitTypeFilter.Create();
begin begin
inherited; inherited;

View File

@ -272,7 +272,7 @@ begin
end; end;
end; end;
{$ELSE} {$ELSE}
OpenModule(FProject, True); OpenModule(FProject, atSource);
{$ENDIF} {$ENDIF}
end; end;