From 4e7456ac74ab89216c1c267a084e1c8b68f457a2 Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Thu, 5 Jan 2006 06:03:24 +0000 Subject: [PATCH] Initial commit --- Packages/D2006/UnitSwitcher.bdsproj | 172 ++++++++++ Packages/D2006/UnitSwitcher.cfg | 39 +++ Packages/D2006/UnitSwitcher.dpk | 39 +++ Packages/D2006/UnitSwitcher.res | Bin 0 -> 5056 bytes Resources/DataModule.ico | Bin 0 -> 318 bytes Resources/Form.ico | Bin 0 -> 318 bytes Resources/Project.ico | Bin 0 -> 318 bytes Resources/Unit.ico | Bin 0 -> 318 bytes Source/UnSwClient.pas | 107 ++++++ Source/UnSwDialog.dfm | 512 ++++++++++++++++++++++++++++ Source/UnSwDialog.pas | 191 +++++++++++ Source/UnSwObjects.pas | 256 ++++++++++++++ 12 files changed, 1316 insertions(+) create mode 100644 Packages/D2006/UnitSwitcher.bdsproj create mode 100644 Packages/D2006/UnitSwitcher.cfg create mode 100644 Packages/D2006/UnitSwitcher.dpk create mode 100644 Packages/D2006/UnitSwitcher.res create mode 100644 Resources/DataModule.ico create mode 100644 Resources/Form.ico create mode 100644 Resources/Project.ico create mode 100644 Resources/Unit.ico create mode 100644 Source/UnSwClient.pas create mode 100644 Source/UnSwDialog.dfm create mode 100644 Source/UnSwDialog.pas create mode 100644 Source/UnSwObjects.pas diff --git a/Packages/D2006/UnitSwitcher.bdsproj b/Packages/D2006/UnitSwitcher.bdsproj new file mode 100644 index 0000000..ad9c071 --- /dev/null +++ b/Packages/D2006/UnitSwitcher.bdsproj @@ -0,0 +1,172 @@ + + + + + + + + + + + + UnitSwitcher.dpk + + + 7.0 + + + 8 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + True + True + WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; + + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + False + False + False + True + True + True + True + True + True + + + + 0 + 0 + False + 1 + False + False + False + 16384 + 1048576 + 4194304 + UnitSwitcher + + + + + + + + + + + False + + + + + + False + + + True + False + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1043 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + diff --git a/Packages/D2006/UnitSwitcher.cfg b/Packages/D2006/UnitSwitcher.cfg new file mode 100644 index 0000000..12d4a5a --- /dev/null +++ b/Packages/D2006/UnitSwitcher.cfg @@ -0,0 +1,39 @@ +-$A8 +-$B- +-$C+ +-$D+ +-$E- +-$F- +-$G+ +-$H+ +-$I+ +-$J- +-$K- +-$L+ +-$M- +-$N+ +-$O+ +-$P+ +-$Q- +-$R- +-$S- +-$T- +-$U- +-$V+ +-$W- +-$X+ +-$YD +-$Z1 +-cg +-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +-H+ +-W+ +-M +-$M16384,1048576 +-K$00400000 +-LE"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl" +-LN"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl" +-Z +-w-UNSAFE_TYPE +-w-UNSAFE_CODE +-w-UNSAFE_CAST diff --git a/Packages/D2006/UnitSwitcher.dpk b/Packages/D2006/UnitSwitcher.dpk new file mode 100644 index 0000000..9fd73e4 --- /dev/null +++ b/Packages/D2006/UnitSwitcher.dpk @@ -0,0 +1,39 @@ +package UnitSwitcher; + +{$R *.res} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO ON} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION ON} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES OFF} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DESCRIPTION 'UnitSwitcher'} +{$LIBSUFFIX 'D2006'} +{$DESIGNONLY} +{$IMPLICITBUILD OFF} + +requires + rtl, + designide; + +contains + UnSwClient in '..\..\Source\UnSwClient.pas', + UnSwObjects in '..\..\Source\UnSwObjects.pas', + UnSwDialog in '..\..\Source\UnSwDialog.pas' {frmUnSwDialog}; + +end. diff --git a/Packages/D2006/UnitSwitcher.res b/Packages/D2006/UnitSwitcher.res new file mode 100644 index 0000000000000000000000000000000000000000..9f716014ef5fa480e86c4caec3875580f31cdcdb GIT binary patch literal 5056 zcmbW5zi%8>5XZ-fC8)qssA$eY2q7295$P91h!hD3B3#;)1tCNvP83W*wf;{o1wv>G z{sXkGkt>uE$tmbbNr70tpP4tidzW*tS!r(Gk9qU`e&@Y?cRDk(ZCT%ksk!w0w3YK0 z6|>=UTU(blGw5wKwq@_hHoT>V*8JaRUeE3D@X*?(aZfw#hsTd?Ud@e|@H>e5()nF|eueP-nH1gM0Noj(p1F_4hT@e`nx|epIrKM_Qk+(%xtu}t4+RhYLsm?O? z#5C7-tR+UK{B!zUtOp+qG>7iidc|Zv@Rhrf3HRvtBacUa+qB-N-qvUzh^fI&4)}t* zge?yAHJA8kB{$xAbVWNkH8!t9x5sob1_%1=zhf_iJ%guwEk9#j=(lF79ef#c4SODW zp8fh`aOi@Azq5_<$gBomXY9BiFzLh9@fV6AwwABLsE_McKG(Z|gW8?2F|E(q_b1w~ z?ujJ_IDr}10*E^Cxb+&v6HYem@)FP>;Io(SjJ&zd>u^pmySiU$5Wm zuUw8ibH<4 zvt||F`?~A=yCX4X$^4NKwL;dZ59hqIko|?U+ z+^-5_Cag-BeSdVZf6dHxWqtpOeQfXBb^Ap2f!&bLXZpVe|7Pg_jO}gzSA%~+HtgVn z`9B+?hVOs(sVP&?i=wRwKo{PQ33g)tJjDw=vWWijGi z|M<-ZZrXu8vb(l#ckG({J-e;U`}UPRP}I*JvujuEvb`&{SHuBEZz$V_v_7!=_R#he z|GiZ2sdsw-*zuUmc~vvt+82)XP?&eMc7KT7wU-s0v9}caNYP`=WqU{HX^9Wd1CQMo z_PrGbZ#n))n!n?-uze_=sJ&xfYh^sabBz035qtKf*4>wXWZ#HMJ`sDP{{1S|7m;8V{CR@9yN4Ewtw6rOSA^}^PIHeToRqG@z zl2%yY9eQs>ufGb8&4^Eg+87b)>-Rj?LgO= ihjq{4?|X}ruEaI-2r)-GZVvf#0~dzDvHRCY?$qC$_e@{_ literal 0 HcmV?d00001 diff --git a/Resources/Unit.ico b/Resources/Unit.ico new file mode 100644 index 0000000000000000000000000000000000000000..1f4d17b9e5addaacbcf0462584e40ee7007410ab GIT binary patch literal 318 zcmZvYF%H8Z5CqqXrIe;hP3dR(3GUMJ1K0TtPvI916`8e_h(uXDcibKalBIzaLLiQs z2k9nhh5!-lTj_}Z0v$I~IunsCB;}lGwBu82-T}*&!$ + end + object pnlMain: TPanel + Left = 0 + Top = 0 + Width = 299 + Height = 334 + Align = alClient + BevelOuter = bvNone + BorderWidth = 4 + TabOrder = 1 + ExplicitWidth = 297 + ExplicitHeight = 368 + object pnlSearch: TPanel + Left = 4 + Top = 4 + Width = 291 + Height = 25 + Align = alTop + BevelOuter = bvNone + TabOrder = 0 + object edtSearch: TEdit + Left = 0 + Top = 0 + Width = 291 + Height = 21 + Align = alTop + TabOrder = 0 + OnChange = edtSearchChange + OnKeyDown = edtSearchKeyDown + end + end + object lstUnits: TListBox + Left = 4 + Top = 29 + Width = 291 + Height = 301 + Style = lbVirtualOwnerDraw + Align = alClient + ItemHeight = 20 + TabOrder = 1 + OnData = lstUnitsData + OnDrawItem = lstUnitsDrawItem + end + end + object Panel1: TPanel + Left = 0 + Top = 334 + Width = 299 + Height = 34 + Align = alBottom + BevelOuter = bvNone + TabOrder = 2 + DesignSize = ( + 299 + 34) + object btnCancel: TButton + Left = 220 + Top = 2 + Width = 75 + Height = 25 + Anchors = [akTop, akRight] + Cancel = True + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 0 + end + object btnOK: TButton + Left = 139 + Top = 2 + Width = 75 + Height = 25 + Anchors = [akTop, akRight] + Caption = 'OK' + Default = True + ModalResult = 1 + TabOrder = 1 + end + end + object ilsTypes: TImageList + Left = 8 + Top = 32 + Bitmap = { + 494C010104000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 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 + 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 + 0000000000000000000000000000000000000000000000000000000000008000 + 0000000000000000000080808000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF008080800080808000808080008080800080808000808080008080 + 8000808080008080800080808000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000080000000800000008000 + 0000800000000000000080808000C0C0C000C0C0C000C0C0C000C0C0C0000000 + 00000000000000000000000000000000000000000000FFFFFF00808080008080 + 8000808080008080800080808000808080008080800080808000808080008080 + 8000808080000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000080000000000000008000 + 0000000000000000000080808000808080008080800000000000808080008080 + 80000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000808080000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF00C0C0C000808080000000000000000000FFFFFF00808080008080 + 8000808080008080800080808000808080008080800080808000808080008080 + 8000808080008080800080808000000000000000000080000000000000000000 + 0000000000000000000000000000000000008080800000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF00C0C0C000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 000000000000FFFFFF00808080000000000000000000FFFFFF00FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF0080808000808080008080 + 8000808080008080800080808000000000000000000000000000000000000000 + 0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF00C0C0C000808080000000000000000000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF0080808000000000008080800000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000 + 0000FFFFFF000000FF000000FF000000FF000000FF000000FF000000FF000000 + FF000000FF000000FF00808080000000000000000000FFFFFF00FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF00C0C0C00080808000000000008080800080808000000000000000 + 000000000000FFFFFF0080808000808080008080800080808000808080008080 + 80008080800080808000808080000000000000000000FFFFFF00FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF00C0C0C00080808000000000000000000080000000000000000000 + 0000FFFFFF000000FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000FF00808080000000000000000000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000 + 000000000000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF00808080000000000000000000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000 + 0000FFFFFF000000FF000000FF000000FF000000FF000000FF000000FF000000 + FF000000FF000000FF00808080000000000000000000FFFFFF00FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000 + 000000000000FFFFFF00FFFFFF00C0C0C0000000FF000000FF000000FF00C0C0 + C000FFFFFF00C0C0C000808080000000000000000000FFFFFF00FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF00C0C0C000808080000000000000000000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000 + 000000000000FFFFFF00C0C0C000FFFFFF000000FF000000FF00C0C0C000FFFF + FF00C0C0C000FFFFFF00808080000000000000000000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF00C0C0C00000000000FF000000FF000000FF000000FF00 + 0000FF00000000000000C0C0C000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF0000000000000000000000000000000000000000000000 + 0000C0C0C000FFFFFF00808080000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000 + 000000000000FFFFFF00FFFFFF00C0C0C0000000FF00C0C0C0000000FF000000 + FF00FFFFFF00C0C0C000808080000000000000000000FFFFFF00FFFFFF00C0C0 + C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C000FFFFFF008080800080808000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF00808080000000000000000000FFFFFF00C0C0C000FFFF + FF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFF + FF00808080000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF0000000000000000000000000000000000C0C0C000FFFF + FF000000000000000000000000000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF000000FF000000FF00000000000000C0C0C0000000 + 0000C0C0C00000000000C0C0C000000000000000000000000000000000000000 + 000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF000000000000000000FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0 + C00000000000FFFFFF0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000FF000000FF000000FF000000FF00000000000000C0C0C0000000 + 0000C0C0C00000000000C0C0C0000000000000000000FF000000FF000000FF00 + 0000FF000000FF000000FF00000000000000C0C0C00000000000C0C0C0000000 + 0000C0C0C0000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000424D3E000000000000003E000000 + 2800000040000000300000000100010000000000800100000000000000000000 + 000000000000000000000000FFFFFF0000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000E000FFFFEC0F0003E000FFFF840F0003 + E0000000AC0F0003E0000000BF3F0000E0000000FFFF00006000000010000000 + 200000001000000000000000B000000020000000F000000060000000F0000000 + E0000000F0000000E0000000F0000003E0000000F0000003E0010000F0000003 + E003FFFFF0000003E007FFFFF000000300000000000000000000000000000000 + 000000000000} + end +end diff --git a/Source/UnSwDialog.pas b/Source/UnSwDialog.pas new file mode 100644 index 0000000..f5542ff --- /dev/null +++ b/Source/UnSwDialog.pas @@ -0,0 +1,191 @@ +unit UnSwDialog; + +interface +uses + Classes, + ComCtrls, + Controls, + ExtCtrls, + Forms, + ImgList, + StdCtrls, + Windows, + + UnSwObjects; + +type + TfrmUnSwDialog = class(TForm) + edtSearch: TEdit; + ilsTypes: TImageList; + lstUnits: TListBox; + pnlMain: TPanel; + pnlSearch: TPanel; + sbStatus: TStatusBar; + Panel1: TPanel; + btnCancel: TButton; + btnOK: TButton; + + procedure edtSearchChange(Sender: TObject); + procedure edtSearchKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure lstUnitsData(Control: TWinControl; Index: Integer; var Data: string); + procedure lstUnitsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); + private + FUnitList: TUnSwUnitList; + FTypeFilteredList: TUnSwUnitList; + FInputFilteredList: TUnSwUnitList; + + FTypeFilter: TUnSwUnitTypeFilter; + FInputFilter: TUnSwUnitSimpleFilter; + + function InternalExecute(const AUnits: TUnSwUnitList): Integer; + procedure UpdateList(); + + function GetActiveUnit(): TUnSwUnit; + public + class function Execute(const AUnits: TUnSwUnitList): Integer; + end; + +implementation +uses + SysUtils, + Graphics; + +{$R *.dfm} + +{ TfrmUnSwDialog } +class function TfrmUnSwDialog.Execute(const AUnits: TUnSwUnitList): Integer; +begin + with Self.Create(nil) do + try + Result := InternalExecute(AUnits); + finally + Free(); + end; +end; + + +function SortByName(Item1, Item2: Pointer): Integer; +begin + Result := CompareText(TUnSwUnit(Item1).Name, TUnSwUnit(Item2).Name) +end; + +function TfrmUnSwDialog.InternalExecute(const AUnits: TUnSwUnitList): Integer; +begin + Result := -1; + FUnitList := AUnits; + + FTypeFilteredList := TUnSwUnitList.Create(); + FInputFilteredList := TUnSwUnitList.Create(); + FTypeFilter := TUnSwUnitTypeFilter.Create(); + FInputFilter := TUnSwUnitSimpleFilter.Create(); + try + FTypeFilteredList.Clone(FUnitList); + FTypeFilteredList.ApplyFilter(FTypeFilter); + FTypeFilteredList.Sort(SortByName); + UpdateList(); + + Self.ShowModal(); + finally + FreeAndNil(FInputFilter); + FreeAndNil(FTypeFilter); + FreeAndNil(FInputFilteredList); + FreeAndNil(FTypeFilteredList); + end; +end; + +procedure TfrmUnSwDialog.UpdateList(); +var + pActive: TUnSwUnit; + +begin + pActive := GetActiveUnit(); + // #ToDo1 Try to select the previous unit, otherwise select the first + + FInputFilteredList.Clone(FTypeFilteredList); + FInputFilteredList.ApplyFilter(FInputFilter); + + lstUnits.Count := FInputFilteredList.Count; + if FInputFilteredList.Count > 0 then + begin + if Assigned(pActive) then + lstUnits.ItemIndex := FInputFilteredList.IndexOf(pActive); + + if lstUnits.ItemIndex = -1 then + lstUnits.ItemIndex := 0; + end; +end; + +function TfrmUnSwDialog.GetActiveUnit(): TUnSwUnit; +begin + Result := nil; + if lstUnits.ItemIndex > -1 then + Result := FInputFilteredList[lstUnits.ItemIndex]; +end; + +procedure TfrmUnSwDialog.edtSearchChange(Sender: TObject); +begin + FInputFilter.Filter := edtSearch.Text; + UpdateList(); +end; + +procedure TfrmUnSwDialog.edtSearchKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); +begin + if Shift = [] then + case Key of + VK_UP: + if lstUnits.ItemIndex > 0 then + lstUnits.ItemIndex := Pred(lstUnits.ItemIndex); + VK_DOWN: + if lstUnits.ItemIndex < Pred(lstUnits.Items.Count) then + lstUnits.ItemIndex := Succ(lstUnits.ItemIndex); + end; +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 + iIcon: Integer; + rText: TRect; + sText: String; + +begin + with TListBox(Control) do + begin + if odSelected in State then + begin + Canvas.Brush.Color := clHighlight; + Canvas.Font.Color := clHighlightText; + end else + begin + Canvas.Brush.Color := clWindow; + Canvas.Font.Color := clWindowText; + end; + Canvas.FillRect(Rect); + + rText := Rect; + InflateRect(rText, -2, -2); + + iIcon := 0; + case FInputFilteredList[Index].UnitType of + swutForm: iIcon := 1; + swutDataModule: iIcon := 2; + swutProjUnit: iIcon := 3; + end; + ilsTypes.Draw(Canvas, rText.Left, rText.Top, iIcon); + + Inc(rText.Left, ilsTypes.Width + 4); + sText := FInputFilteredList[Index].Name; + DrawText(Canvas.Handle, PChar(sText), Length(sText), rText, DT_SINGLELINE or + DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS); + end; +end; + +end. diff --git a/Source/UnSwObjects.pas b/Source/UnSwObjects.pas new file mode 100644 index 0000000..2460f88 --- /dev/null +++ b/Source/UnSwObjects.pas @@ -0,0 +1,256 @@ +unit UnSwObjects; + +interface +uses + Classes, + Contnrs, + ToolsAPI; + +type + // Forward declarations + TUnSwUnitFilter = class; + + TUnSwUnitType = ( + swutForm = 0, + swutDataModule = 1, + swutProjUnit = 2, + swutUnit = 3, + swutRc = 4, + swutAsm = 5, + swutDef = 6, + swutObj = 7, + swutRes = 8, + swutLib = 9, + swutTypeLib = 10, + swutPackageImport = 11, + swutFormResource = 12, + swutCustom = 13, + swutIDL = 14 + ); + TUnSwUnitTypes = set of TUnSwUnitType; + + TUnSwUnit = class(TPersistent) + private + FModule: IOTAModuleInfo; + + function GetName(): String; + function GetFileName(): String; + function GetUnitType(): TUnSwUnitType; + public + constructor Create(const AModule: IOTAModuleInfo); virtual; + + property Name: String read GetName; + property FileName: String read GetFileName; + property UnitType: TUnSwUnitType read GetUnitType; + end; + + TUnSwUnitList = class(TPersistent) + private + FItems: TObjectList; + + function GetCount(): Integer; + function GetItem(Index: Integer): TUnSwUnit; + procedure SetItem(Index: Integer; Value: TUnSwUnit); + public + constructor Create(); + destructor Destroy(); override; + + function Add(const AUnit: TUnSwUnit): Integer; virtual; + function IndexOf(const AUnit: TUnSwUnit): Integer; + procedure Sort(Compare: TListSortCompare); + + procedure Clone(const ASource: TUnSwUnitList); virtual; + procedure ApplyFilter(const AFilter: TUnSwUnitFilter); virtual; + + property Count: Integer read GetCount; + property Items[Index: Integer]: TUnSwUnit read GetItem + write SetItem; default; + end; + + TUnSwUnitFilter = class(TObject) + protected + function IsFiltered(const AUnit: TUnSwUnit): Boolean; virtual; abstract; + public + constructor Create(); virtual; + end; + + TUnSwUnitSimpleFilter = class(TUnSwUnitFilter) + private + FFilter: String; + + procedure SetFilter(const Value: String); + protected + function IsFiltered(const AUnit: TUnSwUnit): Boolean; override; + public + property Filter: String read FFilter write SetFilter; + end; + + TUnSwUnitTypeFilter = class(TUnSwUnitFilter) + private + FIncludeDataModules: Boolean; + FIncludeForms: Boolean; + FIncludeProjectSource: Boolean; + protected + function IsFiltered(const AUnit: TUnSwUnit): Boolean; override; + public + constructor Create(); override; + + property IncludeDataModules: Boolean read FIncludeDataModules write FIncludeDataModules; + property IncludeForms: Boolean read FIncludeForms write FIncludeForms; + property IncludeProjectSource: Boolean read FIncludeProjectSource write FIncludeProjectSource; + end; + +implementation +uses + SysUtils; + + +{ TUnSwUnit } +constructor TUnSwUnit.Create(const AModule: IOTAModuleInfo); +begin + inherited Create(); + + FModule := AModule; +end; + + +function TUnSwUnit.GetName(): String; +begin + Result := FModule.Name; +end; + +function TUnSwUnit.GetFileName(): String; +begin + Result := FModule.FileName; +end; + +function TUnSwUnit.GetUnitType(): TUnSwUnitType; +begin + Result := TUnSwUnitType(FModule.ModuleType); + if (Result = swutForm) and (Length(FModule.FormName) = 0) then + Result := swutUnit; +end; + + +{ TUnSwUnitList} +constructor TUnSwUnitList.Create(); +begin + inherited Create(); + + FItems := TObjectList.Create(True); +end; + + +destructor TUnSwUnitList.Destroy(); +begin + FreeAndNil(FItems); + + inherited; +end; + + +function TUnSwUnitList.Add(const AUnit: TUnSwUnit): Integer; +begin + Result := FItems.Add(AUnit); +end; + +function TUnSwUnitList.IndexOf(const AUnit: TUnSwUnit): Integer; +begin + Result := FItems.IndexOf(AUnit); +end; + +procedure TUnSwUnitList.Sort(Compare: TListSortCompare); +begin + FItems.Sort(Compare); +end; + + +procedure TUnSwUnitList.ApplyFilter(const AFilter: TUnSwUnitFilter); +var + iItem: Integer; + +begin + for iItem := Pred(Count) downto 0 do + if AFilter.IsFiltered(Items[iItem]) then + FItems.Delete(iItem); +end; + +procedure TUnSwUnitList.Clone(const ASource: TUnSwUnitList); +var + iItem: Integer; + +begin + FItems.Clear(); + FItems.OwnsObjects := False; + + for iItem := 0 to Pred(ASource.Count) do + FItems.Add(ASource[iItem]); +end; + + +function TUnSwUnitList.GetCount(): Integer; +begin + Result := FItems.Count; +end; + +function TUnSwUnitList.GetItem(Index: Integer): TUnSwUnit; +begin + Result := TUnSwUnit(FItems[Index]); +end; + +procedure TUnSwUnitList.SetItem(Index: Integer; Value: TUnSwUnit); +begin + FItems[Index] := Value; +end; + + +{ TUnSwUnitFilter } +constructor TUnSwUnitFilter.Create(); +begin + inherited Create(); +end; + + +{ TUnSwUnitSimpleFilter } +function TUnSwUnitSimpleFilter.IsFiltered(const AUnit: TUnSwUnit): Boolean; +begin + Result := (Length(FFilter) > 0) and + (AnsiPos(FFilter, LowerCase(AUnit.Name)) = 0); +end; + +procedure TUnSwUnitSimpleFilter.SetFilter(const Value: String); +begin + FFilter := LowerCase(Value); +end; + + +{ TUnSwUnitTypeFilter } +constructor TUnSwUnitTypeFilter.Create(); +begin + inherited; + + FIncludeDataModules := True; + FIncludeForms := True; + FIncludeProjectSource := True; +end; + +function TUnSwUnitTypeFilter.IsFiltered(const AUnit: TUnSwUnit): Boolean; +var + eValidTypes: TUnSwUnitTypes; + +begin + eValidTypes := [swutUnit]; + + if FIncludeDataModules then + Include(eValidTypes, swutDataModule); + + if FIncludeForms then + Include(eValidTypes, swutForm); + + if FIncludeProjectSource then + Include(eValidTypes, swutProjUnit); + + Result := not (AUnit.UnitType in eValidTypes); +end; + +end.