1
0
mirror of synced 2024-11-21 10:53:50 +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="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
</VersionInfoKeys>
<Excluded_Packages>
</VersionInfoKeys> <Excluded_Packages>
<Excluded_Packages Name="F:\Components\UnitSwitcher\Lib\D2006\UnitSwitcherD2006.bpl">UnitSwitcher</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>

View File

@ -29,7 +29,11 @@ package UnitSwitcher;
requires
rtl,
designide;
designide,
vcl,
xmlrtl,
vclactnband,
vclx;
contains
UnSwClient in '..\..\Source\UnSwClient.pas',
@ -38,6 +42,14 @@ contains
UnSwFilters in '..\..\Source\UnSwFilters.pas',
UnSwConfiguration in '..\..\Source\UnSwConfiguration.pas' {frmUnSwConfiguration},
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.

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
Left = 284
Top = 120
Width = 320
Height = 425
BorderIcons = [biSystemMenu]
Caption = 'UnitSwitcher'
ClientHeight = 398
ClientWidth = 312
Color = clBtnFace
Constraints.MinHeight = 240
Constraints.MinWidth = 290
@ -27,6 +27,7 @@ object frmBaseSwDialog: TfrmBaseSwDialog
OldCreateOrder = False
Position = poScreenCenter
OnResize = FormResize
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object sbStatus: TStatusBar
@ -83,7 +84,7 @@ object frmBaseSwDialog: TfrmBaseSwDialog
Align = alClient
ItemHeight = 20
MultiSelect = True
PopupMenu = pmnUnits
PopupMenu = pmnItems
TabOrder = 1
OnClick = lstItemsClick
OnData = lstItemsData
@ -151,409 +152,6 @@ object frmBaseSwDialog: TfrmBaseSwDialog
object ilsTypes: TImageList
Left = 28
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
object alMain: TActionList
Left = 84
@ -579,58 +177,14 @@ object frmBaseSwDialog: TfrmBaseSwDialog
OnExecute = actMRUNextExecute
end
end
object pmnUnits: TPopupMenu
object pmnItems: TPopupMenu
Left = 140
Top = 228
object pmnUnitsOpen: TMenuItem
Caption = '&Open'
ShortCut = 13
end
object pmnUnitsOpenDFM: TMenuItem
Caption = 'Open D&FM'
ShortCut = 8205
end
object pmnUnitsSep1: TMenuItem
Caption = '-'
end
object pmnUnitsSelectAll: TMenuItem
object pmnItemsSelectAll: TMenuItem
Action = actSelectAll
end
object pmnUnitsSelectInvert: TMenuItem
object pmnItemsSelectInvert: TMenuItem
Action = actSelectInvert
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

View File

@ -33,7 +33,7 @@ type
FImageIndex: Integer;
FOverlayIndex: Integer;
protected
procedure VisitItem(const AItem: TBaseSwItem);
procedure VisitItem(const AItem: TBaseSwItem); virtual;
public
property Color: TColor read FColor write FColor;
property ImageIndex: Integer read FImageIndex write FImageIndex;
@ -53,21 +53,9 @@ type
ilsTypes: TImageList;
lblSubFilters: TLabel;
lstItems: TListBox;
pmnUnits: TPopupMenu;
pmnUnitsOpen: TMenuItem;
pmnUnitsOpenDFM: 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;
pmnItems: TPopupMenu;
pmnItemsSelectAll: TMenuItem;
pmnItemsSelectInvert: TMenuItem;
pnlButtons: TPanel;
pnlMain: TPanel;
pnlSearch: TPanel;
@ -82,28 +70,23 @@ type
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 lstItemsClick(Sender: TObject);
procedure lstItemsData(Control: TWinControl; Index: Integer; var Data: string);
procedure lstItemsDblClick(Sender: TObject);
procedure lstItemsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
procedure lstItemsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure lstItemsClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
FLoading: Boolean;
FItemList: TBaseSwItemList;
FActiveItem: TBaseSwItem;
FFormsOnly: Boolean;
FMRUList: TStrings;
FMRUIndex: Integer;
FSubFilters: TStringList;
FOpenDFM: Boolean;
// FTypeFilteredList: TUnSwUnitList;
FSubFilteredList: TBaseSwItemList;
FInputFilteredList: TBaseSwItemList;
// FTypeFilter: TUnSwUnitTypeFilter;
FSubFilter: TBaseSwItemSimpleFilter;
FInputFilter: TBaseSwItemSimpleFilter;
FLastFilter: String;
@ -111,9 +94,19 @@ type
FStyleVisitor: TBaseSwStyleVisitor;
protected
function InternalExecute(): TBaseSwItemList; virtual;
// procedure UpdateTypeFilter();
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;
procedure SelectMRUItem();
@ -123,8 +116,10 @@ type
procedure LoadSettings(); virtual;
procedure SaveSettings(); virtual;
procedure UpdateUnitActions();
protected
property ActiveItem: TBaseSwItem read FActiveItem write FActiveItem;
property ItemList: TBaseSwItemList read FItemList write FItemList;
property MRUList: TStrings read FMRUList;
public
class function Execute(const AItems: TBaseSwItemList; const AActive: TBaseSwItem = nil): TBaseSwItemList;
end;
@ -132,7 +127,8 @@ type
implementation
uses
SysUtils;
Messages,
SysUtils, Dialogs;
const
@ -157,8 +153,8 @@ class function TfrmBaseSwDialog.Execute(const AItems: TBaseSwItemList;
begin
with Self.Create(nil) do
try
FItemList := AItems;
FActiveItem := AActive;
ItemList := AItems;
ActiveItem := AActive;
Result := InternalExecute();
finally
@ -173,6 +169,13 @@ begin
end;
procedure TfrmBaseSwDialog.FormShow(Sender: TObject);
begin
// Setting ListBox.Selected[x] won't work before OnShow...
UpdateSubFilters();
end;
function TfrmBaseSwDialog.InternalExecute(): TBaseSwItemList;
type
TBaseSwItemSimpleFilterClass = class of TBaseSwItemSimpleFilter;
@ -185,33 +188,37 @@ var
begin
Result := nil;
FSubFilters := TStringList.Create();
// FTypeFilteredList := TUnSwUnitList.Create();
FSubFilteredList := TBaseSwItemList.Create();
FInputFilteredList := TBaseSwItemList.Create();
// FTypeFilter := TUnSwUnitTypeFilter.Create;
FSubFilteredList := CreateItemList();
FInputFilteredList := CreateItemList();
FSubFilter := CreateInputFilter();
FInputFilter := CreateInputFilter();
FMRUList := TStringList.Create();
try
FStyleVisitor := TUnSwStyleVisitor.Create();
LoadSettings();
FStyleVisitor := CreateStyleVisitor();
try
if Self.ShowModal() = mrOk then
begin
if Length(Trim(cmbSearch.Text)) > 0 then
begin
iIndex := FMRUList.IndexOf(cmbSearch.Text);
iIndex := MRUList.IndexOf(cmbSearch.Text);
if iIndex > -1 then
FMRUList.Delete(iIndex);
MRUList.Delete(iIndex);
while FMRUList.Count >= 10 do
FMRUList.Delete(Pred(FMRUList.Count));
while MRUList.Count >= 10 do
MRUList.Delete(Pred(MRUList.Count));
mruText := cmbSearch.Text;
for subFilterIndex := Pred(FSubFilters.Count) downto 0 do
mruText := FSubFilters[subFilterIndex] + SubFilterSeparator;
FMRUList.Insert(0, mruText);
MRUList.Insert(0, mruText);
end;
Result := GetActiveUnits();
Result := GetActiveItems();
end;
SaveSettings();
@ -219,96 +226,50 @@ begin
FreeAndNil(FStyleVisitor);
end;
finally
FreeAndNil(FMRUList);
FreeAndNil(FInputFilter);
FreeAndNil(FSubFilter);
// FreeAndNil(FTypeFilter);
FreeAndNil(FSubFilteredList);
FreeAndNil(FInputFilteredList);
// FreeAndNil(FTypeFilteredList);
FreeAndNil(FSubFilters);
end;
end;
procedure TfrmBaseSwDialog.UpdateUnitActions();
var
bDFM: Boolean;
bUnits: Boolean;
iUnit: Integer;
pUnits: TUnSwUnitList;
pVisitor: TUnSwReadOnlyVisitor;
sStatus: String;
procedure TfrmBaseSwDialog.LoadSettings();
begin
{ Read-only status }
pUnits := GetActiveUnits();
if Assigned(pUnits) then
try
pVisitor := TUnSwReadOnlyVisitor.Create();
try
pUnits.AcceptVisitor(pVisitor);
actReadOnly.Checked := (pVisitor.ReadOnlyCount > 0);
cmbSearch.Items.Assign(MRUList);
end;
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;
finally
FreeAndNil(pVisitor);
end;
finally
FreeAndNil(pUnits);
end;
procedure TfrmBaseSwDialog.SaveSettings();
begin
end;
{ Properties }
bDFM := False;
bUnits := False;
pUnits := GetActiveUnits();
if Assigned(pUnits) then
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;
procedure TfrmBaseSwDialog.UpdateItemActions();
begin
end;
procedure TfrmBaseSwDialog.UpdateList();
var
activeUnit: TUnSwUnit;
activeUnits: TUnSwUnitList;
activeUnit: TBaseSwItem;
activeUnits: TBaseSwItemList;
itemIndex: Integer;
listIndex: Integer;
filteredList: TUnSwUnitList;
filteredList: TBaseSwItemList;
selStart: Integer;
begin
activeUnits := GetActiveUnits();
activeUnits := GetActiveItems();
filteredList := TUnSwUnitList.Create();
filteredList := CreateItemList();
try
filteredList.Clone(FSubFilteredList);
FInputFilter.FilterList(filteredList);
if (filteredList.Count = 0) and (not Settings.Filter.AllowEmptyResult) then
if (filteredList.Count = 0) and (not AllowEmptyResult) then
begin
{ Only enforce AllowEmptyResult when adding to the filter }
if Length(FInputFilter.Filter) > Length(FLastFilter) then
@ -355,80 +316,6 @@ begin
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();
begin
if FSubFilters.Count > 0 then
@ -445,7 +332,7 @@ var
sFilters: String;
begin
FSubFilteredList.Clone(FTypeFilteredList);
FSubFilteredList.Clone(GetBaseItemList());
if FSubFilters.Count > 0 then
begin
@ -470,7 +357,7 @@ var
sFilter: String;
begin
sFilter := Trim(AFilter);
sFilter := Trim(AFilter);
Result := (Length(sFilter) > 0) and (FSubFilters.IndexOf(AFilter) = -1);
if Result then
begin
@ -480,22 +367,22 @@ begin
end;
function TfrmBaseSwDialog.GetActiveUnits(): TUnSwUnitList;
function TfrmBaseSwDialog.GetActiveItems(): TBaseSwItemList;
var
itemIndex: Integer;
begin
Result := nil;
if Assigned(FActiveUnit) then
if Assigned(ActiveItem) then
begin
Result := TUnSwUnitList.Create();
Result := CreateItemList();
Result.OwnsObjects := False;
Result.Add(FActiveUnit);
FActiveUnit := nil;
Result.Add(ActiveItem);
ActiveItem := nil;
end else if lstItems.SelCount > 0 then
begin
Result := TUnSwUnitList.Create();
Result := CreateItemList();
Result.OwnsObjects := False;
for itemIndex := 0 to Pred(lstItems.Items.Count) do
@ -505,63 +392,39 @@ begin
end;
procedure TfrmBaseSwDialog.LoadSettings();
var
dialogSettings: TUnSwDialogSettings;
function TfrmBaseSwDialog.GetBaseItemList(): TBaseSwItemList;
begin
if FFormsOnly then
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;
Result := ItemList;
end;
procedure TfrmBaseSwDialog.SaveSettings();
var
dialogSettings: TUnSwDialogSettings;
function TfrmBaseSwDialog.GetItemDisplayName(const AItem: TBaseSwItem): String;
begin
if FFormsOnly then
dialogSettings := Settings.FormsDialog
else
dialogSettings := Settings.UnitsDialog;
Result := AItem.Name;
end;
dialogSettings.IncludeDataModules := chkDataModules.Checked;
dialogSettings.IncludeForms := chkForms.Checked;
dialogSettings.IncludeUnits := chkUnits.Checked;
dialogSettings.IncludeProjectSource := chkProjectSource.Checked;
if actSortByName.Checked then
dialogSettings.Sort := dsName
else
dialogSettings.Sort := dsType;
function TfrmBaseSwDialog.ColorsEnabled(): Boolean;
begin
Result := False;
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;
@ -581,19 +444,14 @@ begin
end;
procedure TfrmBaseSwDialog.SortExecute(Sender: TObject);
procedure TfrmBaseSwDialog.btnOKClick(Sender: TObject);
begin
(Sender as TAction).Checked := True;
UpdateTypeFilter();
ModalResult := mrOk;
end;
procedure TfrmBaseSwDialog.SelectMRUItem();
var
mruText: String;
begin
mruText := FMRUList[FMRUIndex];
cmbSearch.ItemIndex := FMRUIndex;
ActiveControl := cmbSearch;
cmbSearch.SelectAll();
@ -605,7 +463,7 @@ end;
procedure TfrmBaseSwDialog.actMRUNextExecute(Sender: TObject);
begin
if FMRUIndex < Pred(FMRUList.Count) then
if FMRUIndex < Pred(MRUList.Count) then
Inc(FMRUIndex);
SelectMRUItem();
@ -621,58 +479,6 @@ begin
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);
begin
if cmbSearch.Text <> FInputFilter.Filter then
@ -721,13 +527,6 @@ begin
end;
procedure TfrmBaseSwDialog.TypeFilterChange(Sender: TObject);
begin
if not FLoading then
UpdateTypeFilter();
end;
procedure TfrmBaseSwDialog.lstItemsDblClick(Sender: TObject);
begin
btnOK.Click();
@ -736,7 +535,7 @@ end;
procedure TfrmBaseSwDialog.lstItemsClick(Sender: TObject);
begin
UpdateUnitActions();
UpdateItemActions();
end;
@ -750,20 +549,18 @@ end;
procedure TfrmBaseSwDialog.lstItemsDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
currentUnit: TUnSwUnit;
currentItem: TBaseSwItem;
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;
currentItem := FInputFilteredList[Index];
if Assigned(FStyleVisitor) then
currentItem.AcceptVisitor(FStyleVisitor);
text := GetItemDisplayName(currentItem);
if odSelected in State then
begin
@ -772,7 +569,8 @@ begin
end else
begin
Canvas.Brush.Color := clWindow;
if Settings.Colors.Enabled then
if Assigned(FStyleVisitor) and ColorsEnabled() then
Canvas.Font.Color := FStyleVisitor.Color
else
Canvas.Font.Color := clWindowText;
@ -781,10 +579,14 @@ begin
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);
if Assigned(FStyleVisitor) then
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);
DrawText(Canvas.Handle, PChar(text), Length(text), textRect, DT_SINGLELINE or
@ -807,54 +609,9 @@ begin
begin
lstItems.ClearSelection;
lstItems.Selected[itemIndex] := True;
UpdateUnitActions();
UpdateItemActions();
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.

View File

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

View File

@ -6,6 +6,9 @@
}
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
uses
ActnList,
@ -16,26 +19,24 @@ uses
BaseSwClient;
type
TComponentSwitcherHook = class(TBaseSwitcherHook)
protected
function ActiveModule(): IOTAModule;
function ActiveEditor(): IOTAEditor;
// function ActiveFileName(): String;
// {$IFDEF DELPHI7ORLOWER}
// function ActiveGroup(): IOTAProjectGroup;
// {$ENDIF}
// function ActiveProject(): IOTAProject;
procedure NewExecute(Sender: TObject); virtual;
procedure NewExecute(Sender: TObject);
public
constructor Create();
end;
implementation
uses
BaseSwObjects,
CmpSwDialog,
CmpSwObjects, Windows;
{ TComponentSwitcherHook}
@ -52,128 +53,6 @@ begin
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;
begin
Result := (BorlandIDEServices as IOTAModuleServices).CurrentModule;
@ -193,21 +72,66 @@ begin
end;
function SortByName(Item1, Item2: Pointer): Integer;
begin
Result := CompareText(TCmpSwComponent(Item1).Name, TCmpSwComponent(Item2).Name)
end;
procedure TComponentSwitcherHook.NewExecute(Sender: TObject);
var
editor: IOTAEditor;
formEditor: IOTAFormEditor;
name: String;
editor: IOTAEditor;
formEditor: IOTAFormEditor;
formComponent: IOTAComponent;
componentIndex: Integer;
component: IOTAComponent;
itemList: TBaseSwItemList;
item: TCmpSwComponent;
selectedItems: TBaseSwItemList;
begin
editor := ActiveEditor();
if Supports(editor, IOTAFormEditor, formEditor) then
if Assigned(editor) and Supports(editor, IOTAFormEditor, formEditor) then
begin
name := '';
formEditor.GetRootComponent.GetPropValueByName('Name', name);
ShowMessage(name);
end else
OldActionExecute(Sender);
formComponent := formEditor.GetRootComponent;
itemList := TBaseSwItemList.Create();
for componentIndex := Pred(formComponent.GetComponentCount) downto 0 do
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.

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

View File

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

View File

@ -1,153 +1,21 @@
object frmUnSwDialog: TfrmUnSwDialog
Left = 284
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
inherited frmUnSwDialog: TfrmUnSwDialog
ExplicitHeight = 425
PixelsPerInch = 96
TextHeight = 13
object sbStatus: TStatusBar
Left = 0
Top = 379
Width = 312
Height = 19
Panels = <
item
Width = 50
end>
end
object pnlMain: TPanel
Left = 0
Top = 0
Width = 312
inherited pnlMain: TPanel
Height = 307
Align = alClient
BevelOuter = bvNone
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
ExplicitHeight = 307
inherited lstItems: TListBox
Height = 254
Style = lbVirtualOwnerDraw
Align = alClient
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
ExplicitTop = 47
ExplicitHeight = 254
end
end
object pnlButtons: TPanel
Left = 0
Top = 343
Width = 312
Height = 36
Align = alBottom
BevelOuter = bvNone
inherited pnlButtons: TPanel
TabOrder = 2
DesignSize = (
312
36)
object btnCancel: TButton
Left = 233
Top = 5
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Cancel = True
Caption = 'Cancel'
ModalResult = 2
inherited btnOK: TButton
TabOrder = 2
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
Left = 4
Top = 5
@ -158,7 +26,7 @@ object frmUnSwDialog: TfrmUnSwDialog
OnClick = btnConfigurationClick
end
end
object pnlIncludeTypes: TPanel
object pnlIncludeTypes: TPanel [3]
Left = 0
Top = 307
Width = 312
@ -203,11 +71,9 @@ object frmUnSwDialog: TfrmUnSwDialog
OnClick = TypeFilterChange
end
end
object ilsTypes: TImageList
Left = 28
Top = 228
inherited ilsTypes: TImageList
Bitmap = {
494C010106000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
494C010106000900040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000003000000001002000000000000030
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -340,64 +206,64 @@ object frmUnSwDialog: TfrmUnSwDialog
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000C0C0C000C0C0C000C0C0C000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000080000000
8000000080000000800000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00808080008080
8000808080008080800080808000808080008080800080808000808080008080
8000808080000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000800000008000C0C0C0000000000000000000000000000000
00000000000000000000000000000000000000000000000080000000FF000000
FF000000FF000000FF0000008000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
C000808080000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000FF000000FF000000FF00FFFF
FF00FFFFFF000000FF000000FF00000080000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00FFFFFF00C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000FF000000FF000000FF000000
FF000000FF000000FF000000FF00000080000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF0080808000808080008080
8000808080008080800080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000800000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000FF000000FF000000FF00FFFF
FF00FFFFFF000000FF000000FF00000080000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000FF000000FF000000FF00FFFF
FF00FFFFFF000000FF000000FF00000080000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0
C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF00C0C0
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
000000000000000000000000000000000000000000000000FF000000FF00FFFF
FF00FFFFFF000000FF0000008000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF
FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000FF000000
FF000000FF000000FF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -405,7 +271,7 @@ object frmUnSwDialog: TfrmUnSwDialog
C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -413,7 +279,7 @@ object frmUnSwDialog: TfrmUnSwDialog
FF00C0C0C000FFFFFF00C0C0C00000000000FF000000FF000000FF000000FF00
0000FF00000000000000C0C0C000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -421,7 +287,7 @@ object frmUnSwDialog: TfrmUnSwDialog
C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00FFFFFF00C0C0C0000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -599,30 +465,17 @@ object frmUnSwDialog: TfrmUnSwDialog
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000003FFF0000000000003FFF000000000
0003FFF0000000000000FFF0000000000000FFF0000000000000FFF000000000
0000FFF0000000000000FFF0000000000000FFF0000000000000FFF000000000
0000FFF0000000000003FFFF000000000003FFFF000000000003FFFF00000000
000000000000000000000000000000000003FFC3000000000003FF8100000000
0003FF00000000000000FF00000000000000FF00000000000000FF0000000000
0000FF81000000000000FFC3000000000000FFFF000000000000FFFF00000000
0000FFFF000000000003FFFF000000000003FFFF000000000003FFFF00000000
0003FFFF000000000003FFFF00000000E000E000FFFFEC0FE000E000FFFF840F
E000E0000000AC0FE000E0000000BF3FE000E0000000FFFFE000600000001000
E000200000001000E00000000000B000E00020000000F000E00060000000F000
E000E0000000F000E000E0000000F000E000E0000000F000E001E0010000F000
E003E003FFFFF000E007E007FFFFF00000000000000000000000000000000000
000000000000}
E003E003FFFFF000E007E007FFFFF000}
end
object 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
inherited alMain: TActionList
object actSortByName: TAction
Caption = 'Sort by &Name'
GroupIndex = 1
@ -650,16 +503,6 @@ object frmUnSwDialog: TfrmUnSwDialog
ShortCut = 24589
OnExecute = actOpenDFMPropertiesExecute
end
object actMRUPrior: TAction
Caption = 'actMRUPrior'
ShortCut = 16422
OnExecute = actMRUPriorExecute
end
object actMRUNext: TAction
Caption = 'actMRUNext'
ShortCut = 16424
OnExecute = actMRUNextExecute
end
object actReadOnly: TAction
Caption = '&Read only'
ShortCut = 49234
@ -676,49 +519,41 @@ object frmUnSwDialog: TfrmUnSwDialog
OnExecute = actOpenDFMExecute
end
end
object pmnUnits: TPopupMenu
Left = 140
Top = 228
object pmnUnitsOpen: TMenuItem
inherited pmnItems: TPopupMenu
object pmnItemsOpen: TMenuItem
Action = actOpen
end
object pmnUnitsOpenDFM: TMenuItem
object pmnItemsOpenDFM: TMenuItem
Action = actOpenDFM
end
object pmnUnitsSep1: TMenuItem
object pmnItemsSep1: TMenuItem
Caption = '-'
end
object pmnUnitsSelectAll: TMenuItem
Action = actSelectAll
end
object pmnUnitsSelectInvert: TMenuItem
Action = actSelectInvert
end
object pmnUnitsSep2: TMenuItem
object pmnItemsSep2: TMenuItem
Caption = '-'
end
object pmnUnitsSortByName: TMenuItem
object pmnItemsSortByName: TMenuItem
Action = actSortByName
end
object pmnUnitsSortByType: TMenuItem
object pmnItemsSortByType: TMenuItem
Action = actSortByType
end
object pmnUnitsSep3: TMenuItem
object pmnItemsSep3: TMenuItem
Caption = '-'
end
object pmnUnitsReadOnly: TMenuItem
object pmnItemsReadOnly: TMenuItem
Action = actReadOnly
end
object pmnUnitsSep4: TMenuItem
object pmnItemsSep4: TMenuItem
Caption = '-'
end
object pmnUnitsOpenFolder: TMenuItem
object pmnItemsOpenFolder: TMenuItem
Action = actOpenFolder
end
object pmnUnitsOpenProperties: TMenuItem
object pmnItemsOpenProperties: TMenuItem
Action = actOpenProperties
end
object pmnUnitsOpenDFMProperties: TMenuItem
object pmnItemsOpenDFMProperties: TMenuItem
Action = actOpenDFMProperties
end
end

View File

@ -22,135 +22,87 @@ uses
StdCtrls,
Windows,
BaseSwDialog,
BaseSwFilters,
BaseSwObjects,
UnSwObjects,
UnSwFilters;
type
TUnSwStyleVisitor = class(TInterfacedPersistent, IBaseSwVisitor, IUnSwVisitor)
private
FColor: TColor;
FImageIndex: Integer;
FOverlayIndex: Integer;
TUnSwStyleVisitor = class(TBaseSwStyleVisitor, IBaseSwVisitor, IUnSwVisitor)
protected
procedure VisitItem(const AItem: TBaseSwItem);
procedure VisitModule(const AUnit: TUnSwModuleUnit);
procedure VisitProject(const AUnit: TUnSwProjectUnit);
public
property Color: TColor read FColor;
property ImageIndex: Integer read FImageIndex;
property OverlayIndex: Integer read FOverlayIndex;
procedure VisitItem(const AItem: TBaseSwItem); override;
procedure VisitModule(const AUnit: TUnSwModuleUnit); virtual;
procedure VisitProject(const AUnit: TUnSwProjectUnit); virtual;
end;
TfrmUnSwDialog = class(TForm)
actMRUNext: TAction;
actMRUPrior: TAction;
TfrmUnSwDialog = class(TfrmBaseSwDialog)
actOpen: TAction;
actOpenDFM: TAction;
actOpenDFMProperties: TAction;
actOpenFolder: TAction;
actOpenProperties: TAction;
actReadOnly: TAction;
actSelectAll: TAction;
actSelectInvert: TAction;
actSortByName: TAction;
actSortByType: TAction;
alMain: TActionList;
btnCancel: TButton;
btnConfiguration: TButton;
btnOK: TButton;
chkDataModules: TCheckBox;
chkForms: TCheckBox;
chkProjectSource: TCheckBox;
chkUnits: TCheckBox;
cmbSearch: TComboBox;
ilsTypes: TImageList;
lblSubFilters: TLabel;
lstUnits: TListBox;
pmnUnits: TPopupMenu;
pmnUnitsOpen: TMenuItem;
pmnUnitsOpenDFM: 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;
pmnItemsOpen: TMenuItem;
pmnItemsOpenDFM: TMenuItem;
pmnItemsOpenDFMProperties: TMenuItem;
pmnItemsOpenFolder: TMenuItem;
pmnItemsOpenProperties: TMenuItem;
pmnItemsReadOnly: TMenuItem;
pmnItemsSep1: TMenuItem;
pmnItemsSep2: TMenuItem;
pmnItemsSep3: TMenuItem;
pmnItemsSep4: TMenuItem;
pmnItemsSortByName: TMenuItem;
pmnItemsSortByType: TMenuItem;
pnlIncludeTypes: TPanel;
pnlMain: TPanel;
pnlSearch: TPanel;
pnlSubFilters: TPanel;
sbStatus: TStatusBar;
procedure actMRUNextExecute(Sender: TObject);
procedure actMRUPriorExecute(Sender: TObject);
procedure actOpenDFMPropertiesExecute(Sender: TObject);
procedure actOpenFolderExecute(Sender: TObject);
procedure actOpenPropertiesExecute(Sender: TObject);
procedure actReadOnlyExecute(Sender: TObject);
procedure actSelectAllExecute(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 btnConfigurationClick(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 TypeFilterChange(Sender: TObject);
procedure actOpenExecute(Sender: TObject);
procedure actOpenDFMExecute(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
FLoading: Boolean;
FUnitList: TUnSwUnitList;
FActiveUnit: TUnSwUnit;
FFormsOnly: Boolean;
FMRUList: TStrings;
FMRUIndex: Integer;
FSubFilters: TStringList;
FOpenDFM: Boolean;
FTypeFilteredList: TUnSwUnitList;
FSubFilteredList: TUnSwUnitList;
FInputFilteredList: TUnSwUnitList;
FTypeFilter: TUnSwUnitTypeFilter;
FSubFilter: TBaseSwItemSimpleFilter;
FInputFilter: TBaseSwItemSimpleFilter;
FLastFilter: String;
protected
function InternalExecute(): TBaseSwItemList; override;
procedure UpdateTypeFilter(AUpdateList: Boolean);
FStyleVisitor: TUnSwStyleVisitor;
function CreateItemList(): TBaseSwItemList; override;
function CreateInputFilter(): TBaseSwItemSimpleFilter; override;
function CreateStyleVisitor(): TBaseSwStyleVisitor; override;
function InternalExecute(): TUnSwUnitList;
procedure UpdateTypeFilter();
procedure UpdateList();
function AllowEmptyResult(): Boolean; override;
function ColorsEnabled(): Boolean; override;
function GetBaseItemList(): TBaseSwItemList; override;
function GetItemDisplayName(const AItem: TBaseSwItem): String; override;
procedure UpdateItemActions(); override;
function GetActiveUnits(): TUnSwUnitList;
procedure SelectMRUItem();
function PushFilter(const AFilter: String): Boolean;
procedure PopFilter();
procedure UpdateSubFilters();
procedure LoadSettings();
procedure SaveSettings();
procedure UpdateUnitActions();
procedure LoadSettings(); override;
procedure SaveSettings(); override;
public
class function Execute(const AUnits: TUnSwUnitList;
const AFormsOnly: Boolean;
@ -391,9 +343,9 @@ end;
procedure TUnSwStyleVisitor.VisitItem(const AItem: TBaseSwItem);
begin
if (AItem is TUnSwUnit) and IsReadOnly(TUnSwUnit(AItem).FileName) then
FOverlayIndex := 5
OverlayIndex := 5
else
FOverlayIndex := -1;
OverlayIndex := -1;
end;
@ -403,22 +355,22 @@ begin
case AUnit.UnitType of
swutUnit:
begin
FColor := Settings.Colors.Units;
FImageIndex := 1;
Color := Settings.Colors.Units;
ImageIndex := 1;
end;
swutForm:
begin
FColor := Settings.Colors.Forms;
FImageIndex := 2;
Color := Settings.Colors.Forms;
ImageIndex := 2;
end;
swutDataModule:
begin
FColor := Settings.Colors.DataModules;
FImageIndex := 3;
end
Color := Settings.Colors.DataModules;
ImageIndex := 3;
end;
else
FColor := clWindowText;
FImageIndex := 0;
Color := clWindowText;
ImageIndex := 0;
end;
end;
@ -426,8 +378,8 @@ end;
procedure TUnSwStyleVisitor.VisitProject(const AUnit: TUnSwProjectUnit);
begin
VisitItem(AUnit);
FColor := Settings.Colors.ProjectSource;
FImageIndex := 4;
Color := Settings.Colors.ProjectSource;
ImageIndex := 4;
end;
@ -439,11 +391,11 @@ class function TfrmUnSwDialog.Execute(const AUnits: TUnSwUnitList;
begin
with Self.Create(nil) do
try
FUnitList := AUnits;
FActiveUnit := AActive;
ItemList := AUnits;
ActiveItem := AActive;
FFormsOnly := AFormsOnly;
Result := InternalExecute();
Result := TUnSwUnitList(InternalExecute());
AOpenDFM := FOpenDFM;
finally
Free();
@ -451,48 +403,39 @@ begin
end;
procedure TfrmUnSwDialog.FormResize(Sender: TObject);
begin
lstUnits.Invalidate();
end;
procedure TfrmUnSwDialog.FormShow(Sender: TObject);
begin
// Setting ListBox.Selected[x] won't work before OnShow...
UpdateTypeFilter();
UpdateTypeFilter(False);
inherited;
end;
function TfrmUnSwDialog.InternalExecute(): TUnSwUnitList;
type
TBaseSwItemSimpleFilterClass = class of TBaseSwItemSimpleFilter;
var
iIndex: Integer;
pClass: TBaseSwItemSimpleFilterClass;
mruText: String;
subFilterIndex: Integer;
function TfrmUnSwDialog.GetActiveUnits(): TUnSwUnitList;
begin
Result := nil;
FSubFilters := TStringList.Create();
FTypeFilteredList := TUnSwUnitList.Create();
FSubFilteredList := TUnSwUnitList.Create();
FInputFilteredList := TUnSwUnitList.Create();
FTypeFilter := TUnSwUnitTypeFilter.Create;
Result := (GetActiveItems() as TUnSwUnitList);
end;
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
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
LoadSettings();
if FFormsOnly then
begin
chkProjectSource.Visible := False;
@ -501,46 +444,15 @@ begin
end else
Self.Caption := 'UnitSwitcher - View Unit';
FStyleVisitor := TUnSwStyleVisitor.Create();
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;
Result := inherited InternalExecute();
finally
FreeAndNil(FInputFilter);
FreeAndNil(FSubFilter);
FreeAndNil(FTypeFilter);
FreeAndNil(FSubFilteredList);
FreeAndNil(FInputFilteredList);
FreeAndNil(FTypeFilteredList);
FreeAndNil(FSubFilters);
end;
end;
procedure TfrmUnSwDialog.UpdateUnitActions();
procedure TfrmUnSwDialog.UpdateItemActions();
var
bDFM: Boolean;
bUnits: Boolean;
@ -601,70 +513,6 @@ begin
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;
begin
Result := CompareText(TUnSwUnit(Item1).Name, TUnSwUnit(Item2).Name)
@ -720,14 +568,14 @@ begin
end;
procedure TfrmUnSwDialog.UpdateTypeFilter();
procedure TfrmUnSwDialog.UpdateTypeFilter(AUpdateList: Boolean);
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);
FTypeFilteredList.Clone(ItemList);
FTypeFilter.FilterList(FTypeFilteredList);
if actSortByName.Checked then
@ -735,83 +583,8 @@ begin
else
FTypeFilteredList.Sort(SortByType);
UpdateSubFilters();
end;
procedure TfrmUnSwDialog.PopFilter();
begin
if FSubFilters.Count > 0 then
begin
FSubFilters.Delete(Pred(FSubFilters.Count));
if AUpdateList then
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;
@ -837,11 +610,12 @@ begin
dsType: actSortByType.Checked := True;
end;
FMRUList := dialogSettings.MRUList;
cmbSearch.Items.Assign(FMRUList);
MRUList.Assign(dialogSettings.MRUList);
Self.ClientWidth := dialogSettings.Width;
Self.ClientHeight := dialogSettings.Height;
inherited LoadSettings();
finally
FLoading := False;
end;
@ -871,63 +645,18 @@ begin
dialogSettings.Width := Self.ClientWidth;
dialogSettings.Height := Self.ClientHeight;
dialogSettings.MRUList.Assign(MRUList);
Settings.Save();
end;
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];
inherited SaveSettings();
end;
procedure TfrmUnSwDialog.SortExecute(Sender: TObject);
begin
(Sender as TAction).Checked := True;
UpdateTypeFilter();
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();
UpdateTypeFilter(True);
end;
@ -979,62 +708,41 @@ end;
procedure TfrmUnSwDialog.btnConfigurationClick(Sender: TObject);
begin
if TfrmUnSwConfiguration.Execute() then
lstUnits.Invalidate();
lstItems.Invalidate();
end;
procedure TfrmUnSwDialog.cmbSearchChange(Sender: TObject);
function TfrmUnSwDialog.CreateItemList(): TBaseSwItemList;
begin
if cmbSearch.Text <> FInputFilter.Filter then
begin
FInputFilter.Filter := cmbSearch.Text;
UpdateList();
end;
Result := TUnSwUnitList.Create();
end;
procedure TfrmUnSwDialog.cmbSearchKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
function TfrmUnSwDialog.ColorsEnabled(): Boolean;
begin
if not cmbSearch.DroppedDown then
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;
Result := Settings.Colors.Enabled;
end;
procedure TfrmUnSwDialog.cmbSearchKeyPress(Sender: TObject; var Key: Char);
function TfrmUnSwDialog.CreateStyleVisitor(): TBaseSwStyleVisitor;
begin
// Ctrl-Backspace
if Key = #127 then
Key := #0;
Result := TUnSwStyleVisitor.Create();
end;
function TfrmUnSwDialog.CreateInputFilter(): TBaseSwItemSimpleFilter;
begin
if FFormsOnly then
Result := TUnSwUnitSimpleFormNameFilter.Create()
else
Result := TBaseSwItemSimpleNameFilter.Create();
end;
procedure TfrmUnSwDialog.TypeFilterChange(Sender: TObject);
begin
if not FLoading then
UpdateTypeFilter();
UpdateTypeFilter(True);
end;
@ -1044,85 +752,6 @@ begin
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);
var
pUnits: TUnSwUnitList;
@ -1142,12 +771,18 @@ begin
finally
FreeAndNil(pUnits);
lstUnits.Invalidate();
UpdateUnitActions();
lstItems.Invalidate();
UpdateItemActions();
end;
end;
function TfrmUnSwDialog.AllowEmptyResult(): Boolean;
begin
Result := Settings.Filter.AllowEmptyResult;
end;
procedure TfrmUnSwDialog.actOpenExecute(Sender: TObject);
begin
FOpenDFM := False;
@ -1164,7 +799,8 @@ end;
procedure TfrmUnSwDialog.btnOKClick(Sender: TObject);
begin
FOpenDFM := ((GetKeyState(VK_SHIFT) and 128) <> 0);
ModalResult := mrOk;
inherited;
end;
end.

View File

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

View File

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