Added: ProjectSwitcher

Added: D2007 package
This commit is contained in:
Mark van Renswoude 2010-02-16 12:39:29 +00:00
parent a1762e05e8
commit cfc7ce27d5
18 changed files with 1220 additions and 212 deletions

Binary file not shown.

View File

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<PersonalityInfo>
<Option>
<Option Name="Personality">Delphi.Personality</Option>
<Option Name="ProjectType"></Option>
<Option Name="Version">1.0</Option>
<Option Name="GUID">{9DCE4F2A-AAF1-4F8E-ACA7-C36AFC829E47}</Option>
</Option>
</PersonalityInfo>
<Delphi.Personality>
<Source>
<Source Name="MainSource">UnitSwitcher.dpk</Source>
</Source>
<FileVersion>
<FileVersion Name="Version">7.0</FileVersion>
</FileVersion>
<Compiler>
<Compiler Name="A">8</Compiler>
<Compiler Name="B">0</Compiler>
<Compiler Name="C">1</Compiler>
<Compiler Name="D">1</Compiler>
<Compiler Name="E">0</Compiler>
<Compiler Name="F">0</Compiler>
<Compiler Name="G">1</Compiler>
<Compiler Name="H">1</Compiler>
<Compiler Name="I">1</Compiler>
<Compiler Name="J">0</Compiler>
<Compiler Name="K">0</Compiler>
<Compiler Name="L">1</Compiler>
<Compiler Name="M">0</Compiler>
<Compiler Name="N">1</Compiler>
<Compiler Name="O">1</Compiler>
<Compiler Name="P">1</Compiler>
<Compiler Name="Q">0</Compiler>
<Compiler Name="R">0</Compiler>
<Compiler Name="S">0</Compiler>
<Compiler Name="T">0</Compiler>
<Compiler Name="U">0</Compiler>
<Compiler Name="V">1</Compiler>
<Compiler Name="W">0</Compiler>
<Compiler Name="X">1</Compiler>
<Compiler Name="Y">1</Compiler>
<Compiler Name="Z">1</Compiler>
<Compiler Name="ShowHints">True</Compiler>
<Compiler Name="ShowWarnings">True</Compiler>
<Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler>
<Compiler Name="NamespacePrefix"></Compiler>
<Compiler Name="GenerateDocumentation">False</Compiler>
<Compiler Name="DefaultNamespace"></Compiler>
<Compiler Name="SymbolDeprecated">True</Compiler>
<Compiler Name="SymbolLibrary">True</Compiler>
<Compiler Name="SymbolPlatform">True</Compiler>
<Compiler Name="SymbolExperimental">True</Compiler>
<Compiler Name="UnitLibrary">True</Compiler>
<Compiler Name="UnitPlatform">True</Compiler>
<Compiler Name="UnitDeprecated">True</Compiler>
<Compiler Name="UnitExperimental">True</Compiler>
<Compiler Name="HResultCompat">True</Compiler>
<Compiler Name="HidingMember">True</Compiler>
<Compiler Name="HiddenVirtual">True</Compiler>
<Compiler Name="Garbage">True</Compiler>
<Compiler Name="BoundsError">True</Compiler>
<Compiler Name="ZeroNilCompat">True</Compiler>
<Compiler Name="StringConstTruncated">True</Compiler>
<Compiler Name="ForLoopVarVarPar">True</Compiler>
<Compiler Name="TypedConstVarPar">True</Compiler>
<Compiler Name="AsgToTypedConst">True</Compiler>
<Compiler Name="CaseLabelRange">True</Compiler>
<Compiler Name="ForVariable">True</Compiler>
<Compiler Name="ConstructingAbstract">True</Compiler>
<Compiler Name="ComparisonFalse">True</Compiler>
<Compiler Name="ComparisonTrue">True</Compiler>
<Compiler Name="ComparingSignedUnsigned">True</Compiler>
<Compiler Name="CombiningSignedUnsigned">True</Compiler>
<Compiler Name="UnsupportedConstruct">True</Compiler>
<Compiler Name="FileOpen">True</Compiler>
<Compiler Name="FileOpenUnitSrc">True</Compiler>
<Compiler Name="BadGlobalSymbol">True</Compiler>
<Compiler Name="DuplicateConstructorDestructor">True</Compiler>
<Compiler Name="InvalidDirective">True</Compiler>
<Compiler Name="PackageNoLink">True</Compiler>
<Compiler Name="PackageThreadVar">True</Compiler>
<Compiler Name="ImplicitImport">True</Compiler>
<Compiler Name="HPPEMITIgnored">True</Compiler>
<Compiler Name="NoRetVal">True</Compiler>
<Compiler Name="UseBeforeDef">True</Compiler>
<Compiler Name="ForLoopVarUndef">True</Compiler>
<Compiler Name="UnitNameMismatch">True</Compiler>
<Compiler Name="NoCFGFileFound">True</Compiler>
<Compiler Name="ImplicitVariants">True</Compiler>
<Compiler Name="UnicodeToLocale">True</Compiler>
<Compiler Name="LocaleToUnicode">True</Compiler>
<Compiler Name="ImagebaseMultiple">True</Compiler>
<Compiler Name="SuspiciousTypecast">True</Compiler>
<Compiler Name="PrivatePropAccessor">True</Compiler>
<Compiler Name="UnsafeType">False</Compiler>
<Compiler Name="UnsafeCode">False</Compiler>
<Compiler Name="UnsafeCast">False</Compiler>
<Compiler Name="OptionTruncated">True</Compiler>
<Compiler Name="WideCharReduced">True</Compiler>
<Compiler Name="DuplicatesIgnored">True</Compiler>
<Compiler Name="UnitInitSeq">True</Compiler>
<Compiler Name="LocalPInvoke">True</Compiler>
<Compiler Name="MessageDirective">True</Compiler>
<Compiler Name="CodePage"></Compiler>
</Compiler>
<Linker>
<Linker Name="MapFile">0</Linker>
<Linker Name="OutputObjs">0</Linker>
<Linker Name="GenerateHpps">False</Linker>
<Linker Name="ConsoleApp">1</Linker>
<Linker Name="DebugInfo">False</Linker>
<Linker Name="RemoteSymbols">False</Linker>
<Linker Name="GenerateDRC">False</Linker>
<Linker Name="MinStackSize">16384</Linker>
<Linker Name="MaxStackSize">1048576</Linker>
<Linker Name="ImageBase">4194304</Linker>
<Linker Name="ExeDescription">UnitSwitcher</Linker>
</Linker>
<Directories>
<Directories Name="OutputDir"></Directories>
<Directories Name="UnitOutputDir">..\..\Lib\D2006</Directories>
<Directories Name="PackageDLLOutputDir">..\..\Lib\D2006</Directories>
<Directories Name="PackageDCPOutputDir"></Directories>
<Directories Name="SearchPath"></Directories>
<Directories Name="Packages"></Directories>
<Directories Name="Conditionals"></Directories>
<Directories Name="DebugSourceDirs"></Directories>
<Directories Name="UsePackages">False</Directories>
</Directories>
<Parameters>
<Parameters Name="RunParams"></Parameters>
<Parameters Name="HostApplication"></Parameters>
<Parameters Name="Launcher"></Parameters>
<Parameters Name="UseLauncher">False</Parameters>
<Parameters Name="DebugCWD"></Parameters>
<Parameters Name="Debug Symbols Search Path"></Parameters>
<Parameters Name="LoadAllSymbols">True</Parameters>
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
</Parameters>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">True</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">1043</VersionInfo>
<VersionInfo Name="CodePage">1252</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
</VersionInfoKeys>
<Excluded_Packages>
<Excluded_Packages Name="F:\Components\UnitSwitcher\Lib\D2006\UnitSwitcherD2006.bpl">UnitSwitcher</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<StarTeamAssociation></StarTeamAssociation>
<StarTeamNonRelativeFiles></StarTeamNonRelativeFiles>
</BorlandProject>

View File

@ -0,0 +1,64 @@
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 'D2007'}
{$DESIGNONLY}
{$IMPLICITBUILD OFF}
requires
rtl,
designide,
vcl,
xmlrtl,
vclactnband,
vclx;
contains
UnSwClient in '..\..\Source\UnSwClient.pas',
UnSwObjects in '..\..\Source\UnSwObjects.pas',
UnSwDialog in '..\..\Source\UnSwDialog.pas' {frmUnSwDialog},
UnSwFilters in '..\..\Source\UnSwFilters.pas',
UnSwConfiguration in '..\..\Source\UnSwConfiguration.pas' {frmUnSwConfiguration},
UnSwSettings in '..\..\Source\UnSwSettings.pas',
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',
CmpSwFilters in '..\..\Source\CmpSwFilters.pas',
CmpSwSettings in '..\..\Source\CmpSwSettings.pas',
BaseSwSettings in '..\..\Source\BaseSwSettings.pas',
CmpSwConfiguration in '..\..\Source\CmpSwConfiguration.pas' {frmCmpSwConfiguration},
CmpSwFilterConfiguration in '..\..\Source\CmpSwFilterConfiguration.pas' {frmCmpSwFilterConfiguration},
ProjSwClient in '..\..\Source\ProjSwClient.pas',
ProjSwDialog in '..\..\Source\ProjSwDialog.pas' {frmProjSwDialog},
ProjSwObjects in '..\..\Source\ProjSwObjects.pas',
ProjSwSettings in '..\..\Source\ProjSwSettings.pas';
end.

View File

@ -0,0 +1,90 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{9dce4f2a-aaf1-4f8e-aca7-c36afc829e47}</ProjectGuid>
<MainSource>UnitSwitcher.dpk</MainSource>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
<DCC_DependencyCheckOutputName>..\..\Lib\D2007\UnitSwitcherD2007.bpl</DCC_DependencyCheckOutputName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Version>7.0</Version>
<DCC_DebugInformation>False</DCC_DebugInformation>
<DCC_LocalDebugSymbols>False</DCC_LocalDebugSymbols>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DcuOutput>..\..\Lib\D2006</DCC_DcuOutput>
<DCC_ObjOutput>..\..\Lib\D2006</DCC_ObjOutput>
<DCC_HppOutput>..\..\Lib\D2006</DCC_HppOutput>
<DCC_BplOutput>..\..\Lib\D2006</DCC_BplOutput>
<DCC_Define>RELEASE</DCC_Define>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Version>7.0</Version>
<DCC_DcuOutput>..\..\Lib\D2007</DCC_DcuOutput>
<DCC_ObjOutput>..\..\Lib\D2007</DCC_ObjOutput>
<DCC_HppOutput>..\..\Lib\D2007</DCC_HppOutput>
<DCC_BplOutput>..\..\Lib\D2007</DCC_BplOutput>
</PropertyGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality</Borland.Personality>
<Borland.ProjectType>Package</Borland.ProjectType>
<BorlandProject>
<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Package_Options><Package_Options Name="PackageDescription">UnitSwitcher</Package_Options><Package_Options Name="ImplicitBuild">False</Package_Options><Package_Options Name="DesigntimeOnly">True</Package_Options><Package_Options Name="RuntimeOnly">False</Package_Options><Package_Options Name="LibSuffix">D2007</Package_Options></Package_Options><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1043</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Excluded_Packages>
<Excluded_Packages Name="F:\Components\UnitSwitcher\Lib\D2006\UnitSwitcherD2006.bpl">UnitSwitcher</Excluded_Packages>
</Excluded_Packages><Source><Source Name="MainSource">UnitSwitcher.dpk</Source></Source></Delphi.Personality></BorlandProject></BorlandProject>
</ProjectExtensions>
<Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" />
<ItemGroup>
<DelphiCompile Include="UnitSwitcher.dpk">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\..\Source\BaseSwClient.pas" />
<DCCReference Include="..\..\Source\BaseSwDialog.pas">
<Form>frmBaseSwDialog</Form>
</DCCReference>
<DCCReference Include="..\..\Source\BaseSwFilters.pas" />
<DCCReference Include="..\..\Source\BaseSwObjects.pas" />
<DCCReference Include="..\..\Source\BaseSwSettings.pas" />
<DCCReference Include="..\..\Source\CmpSwClient.pas" />
<DCCReference Include="..\..\Source\CmpSwConfiguration.pas">
<Form>frmCmpSwConfiguration</Form>
</DCCReference>
<DCCReference Include="..\..\Source\CmpSwDialog.pas">
<Form>frmCmpSwDialog</Form>
</DCCReference>
<DCCReference Include="..\..\Source\CmpSwFilterConfiguration.pas">
<Form>frmCmpSwFilterConfiguration</Form>
</DCCReference>
<DCCReference Include="..\..\Source\CmpSwFilters.pas" />
<DCCReference Include="..\..\Source\CmpSwObjects.pas" />
<DCCReference Include="..\..\Source\CmpSwSettings.pas" />
<DCCReference Include="..\..\Source\ProjSwClient.pas" />
<DCCReference Include="..\..\Source\ProjSwDialog.pas">
<Form>frmProjSwDialog</Form>
</DCCReference>
<DCCReference Include="..\..\Source\ProjSwObjects.pas" />
<DCCReference Include="..\..\Source\ProjSwSettings.pas" />
<DCCReference Include="..\..\Source\UnSwClient.pas" />
<DCCReference Include="..\..\Source\UnSwConfiguration.pas">
<Form>frmUnSwConfiguration</Form>
</DCCReference>
<DCCReference Include="..\..\Source\UnSwDialog.pas">
<Form>frmUnSwDialog</Form>
</DCCReference>
<DCCReference Include="..\..\Source\UnSwFilters.pas" />
<DCCReference Include="..\..\Source\UnSwObjects.pas" />
<DCCReference Include="..\..\Source\UnSwReg.pas" />
<DCCReference Include="..\..\Source\UnSwSettings.pas" />
<DCCReference Include="..\..\Source\UnSwShortcuts.pas">
<Form>frmUnSwShortcuts</Form>
</DCCReference>
<DCCReference Include="P:\algemeen\packages\delphiexperts\UnitSwitcher\Packages\D2006\designide.dcp" />
<DCCReference Include="P:\algemeen\packages\delphiexperts\UnitSwitcher\Packages\D2006\rtl.dcp" />
<DCCReference Include="P:\algemeen\packages\delphiexperts\UnitSwitcher\Packages\D2006\vcl.dcp" />
<DCCReference Include="P:\algemeen\packages\delphiexperts\UnitSwitcher\Packages\D2006\vclactnband.dcp" />
<DCCReference Include="P:\algemeen\packages\delphiexperts\UnitSwitcher\Packages\D2006\vclx.dcp" />
<DCCReference Include="P:\algemeen\packages\delphiexperts\UnitSwitcher\Packages\D2006\xmlrtl.dcp" />
</ItemGroup>
</Project>

Binary file not shown.

BIN
Resources/ProjectBDS.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

View File

@ -29,6 +29,8 @@ type
private
FHookedActions: TList;
protected
function GetIDEActionList: TCustomActionList;
function GetHookedActionIndex(AAction: TContainedAction): Integer;
function GetHookedAction(AAction: TContainedAction): PHookedAction;
@ -76,6 +78,20 @@ begin
end;
function TBaseSwitcherHook.GetIDEActionList: TCustomActionList;
var
ntaServices: INTAServices;
begin
Assert(Assigned(BorlandIDEServices), 'BorlandIDEServices not available.');
Assert(Supports(BorlandIDEServices, INTAServices, ntaServices),
'BorlandIDEServices does not support the ' +
'INTAServices interface.');
Result := ntaServices.ActionList;
end;
function TBaseSwitcherHook.GetHookedActionIndex(AAction: TContainedAction): Integer;
var
actionIndex: Integer;
@ -132,20 +148,17 @@ end;
function TBaseSwitcherHook.HookIDEAction(const AName: String;
AOnExecute, AOnUpdate: TNotifyEvent): TContainedAction;
var
actionList: TCustomActionList;
actionIndex: Integer;
ntaServices: INTAServices;
action: TContainedAction;
begin
Result := nil;
Assert(Assigned(BorlandIDEServices), 'BorlandIDEServices not available.');
Assert(Supports(BorlandIDEServices, INTAServices, ntaServices),
'BorlandIDEServices does not support the ' +
'INTAServices interface.');
Result := nil;
actionList := GetIDEActionList;
for actionIndex := 0 to Pred(ntaServices.ActionList.ActionCount) do
for actionIndex := 0 to Pred(actionList.ActionCount) do
begin
action := ntaServices.ActionList.Actions[actionIndex];
action := actionList.Actions[actionIndex];
if action.Name = AName then
begin
Result := action;

View File

@ -1,10 +1,10 @@
object frmBaseSwDialog: TfrmBaseSwDialog
Left = 284
Top = 120
Width = 320
Height = 425
BorderIcons = [biSystemMenu]
Caption = 'UnitSwitcher'
ClientHeight = 389
ClientWidth = 304
Color = clBtnFace
Constraints.MinHeight = 240
Constraints.MinWidth = 290
@ -32,8 +32,8 @@ object frmBaseSwDialog: TfrmBaseSwDialog
TextHeight = 13
object sbStatus: TStatusBar
Left = 0
Top = 379
Width = 312
Top = 370
Width = 304
Height = 19
Panels = <
item
@ -43,8 +43,8 @@ object frmBaseSwDialog: TfrmBaseSwDialog
object pnlMain: TPanel
Left = 0
Top = 0
Width = 312
Height = 343
Width = 304
Height = 334
Align = alClient
BevelOuter = bvNone
BorderWidth = 4
@ -52,13 +52,13 @@ object frmBaseSwDialog: TfrmBaseSwDialog
object pnlSearch: TPanel
Left = 4
Top = 24
Width = 304
Width = 296
Height = 25
Align = alTop
BevelOuter = bvNone
TabOrder = 0
DesignSize = (
304
296
25)
object cmbSearch: TComboBox
Left = 0
@ -78,8 +78,8 @@ object frmBaseSwDialog: TfrmBaseSwDialog
object lstItems: TListBox
Left = 4
Top = 49
Width = 304
Height = 290
Width = 296
Height = 281
Style = lbVirtualOwnerDraw
Align = alClient
ItemHeight = 20
@ -95,14 +95,14 @@ object frmBaseSwDialog: TfrmBaseSwDialog
object pnlSubFilters: TPanel
Left = 4
Top = 4
Width = 304
Width = 296
Height = 20
Align = alTop
BevelOuter = bvNone
TabOrder = 2
Visible = False
DesignSize = (
304
296
20)
object lblSubFilters: TLabel
Left = 0
@ -117,14 +117,14 @@ object frmBaseSwDialog: TfrmBaseSwDialog
end
object pnlButtons: TPanel
Left = 0
Top = 343
Width = 312
Top = 334
Width = 304
Height = 36
Align = alBottom
BevelOuter = bvNone
TabOrder = 1
DesignSize = (
312
304
36)
object btnCancel: TButton
Left = 233

View File

@ -119,6 +119,7 @@ type
procedure SaveSettings(); virtual;
procedure SettingsChanged(); virtual;
procedure SelectItem(AItemIndex: Integer);
procedure DrawItemText(ACanvas: TCanvas; AItem: TBaseSwItem; ARect: TRect; AState: TOwnerDrawState); virtual;
protected
property ActiveItem: TBaseSwItem read FActiveItem write FActiveItem;
@ -313,14 +314,21 @@ begin
activeUnit := activeUnits[itemIndex];
listIndex := FInputFilteredList.IndexOf(activeUnit);
if listIndex > -1 then
lstItems.Selected[listIndex] := True;
SelectItem(listIndex);
end;
finally
FreeAndNil(activeUnits);
end;
if lstItems.SelCount = 0 then
lstItems.Selected[0] := True;
if lstItems.MultiSelect then
begin
if lstItems.SelCount = 0 then
SelectItem(0);
end else
begin
if lstItems.ItemIndex = -1 then
SelectItem(0);
end;
end;
if Assigned(lstItems.OnClick) then
@ -382,24 +390,38 @@ end;
function TfrmBaseSwDialog.GetActiveItems(): TBaseSwItemList;
var
itemIndex: Integer;
hasSelection: Boolean;
begin
Result := nil;
if lstItems.MultiSelect then
hasSelection := (lstItems.SelCount > 0)
else
hasSelection := (lstItems.ItemIndex > -1);
if Assigned(ActiveItem) then
begin
Result := CreateItemList();
Result.OwnsObjects := False;
Result.Add(ActiveItem);
ActiveItem := nil;
end else if lstItems.SelCount > 0 then
end else if hasSelection then
begin
Result := CreateItemList();
Result.OwnsObjects := False;
for itemIndex := 0 to Pred(lstItems.Items.Count) do
if lstItems.Selected[itemIndex] then
if lstItems.MultiSelect then
begin
for itemIndex := 0 to Pred(lstItems.Items.Count) do
if lstItems.Selected[itemIndex] then
Result.Add(FInputFilteredList[itemIndex]);
end else
begin
itemIndex := lstItems.ItemIndex;
if itemIndex > -1 then
Result.Add(FInputFilteredList[itemIndex]);
end;
end;
end;
@ -451,8 +473,11 @@ var
iItem: Integer;
begin
for iItem := Pred(lstItems.Count) downto 0 do
lstItems.Selected[iItem] := not lstItems.Selected[iItem];
if lstItems.MultiSelect then
begin
for iItem := Pred(lstItems.Count) downto 0 do
lstItems.Selected[iItem] := not lstItems.Selected[iItem];
end;
end;
@ -558,6 +583,15 @@ begin
end;
procedure TfrmBaseSwDialog.SelectItem(AItemIndex: Integer);
begin
if lstItems.MultiSelect then
lstItems.Selected[AItemIndex] := True
else
lstItems.ItemIndex := AItemIndex;
end;
procedure TfrmBaseSwDialog.DrawItemText(ACanvas: TCanvas; AItem: TBaseSwItem; ARect: TRect; AState: TOwnerDrawState);
var
text: String;
@ -627,7 +661,7 @@ begin
if (itemIndex > -1) and (not lstItems.Selected[itemIndex]) then
begin
lstItems.ClearSelection;
lstItems.Selected[itemIndex] := True;
SelectItem(itemIndex);
UpdateItemActions();
end;
end;

View File

@ -90,28 +90,32 @@ begin
begin
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
selectedItems := TfrmCmpSwDialog.Execute(itemList);
if Assigned(selectedItems) then
try
for componentIndex := Pred(formComponent.GetComponentCount) downto 0 do
begin
for componentIndex := 0 to Pred(selectedItems.Count) do
begin
item := TCmpSwComponent(selectedItems[componentIndex]);
item.Activate(componentIndex = 0);
component := formComponent.GetComponent(componentIndex);
item := TCmpSwComponent.TryCreate(component);
if Assigned(item) then
itemList.Add(item);
end;
if itemList.Count > 0 then
begin
selectedItems := TfrmCmpSwDialog.Execute(itemList);
if Assigned(selectedItems) then
try
for componentIndex := 0 to Pred(selectedItems.Count) do
begin
item := TCmpSwComponent(selectedItems[componentIndex]);
item.Activate(componentIndex = 0);
end;
finally
FreeAndNil(selectedItems);
end;
end;
finally
FreeAndNil(itemList);
end;
end;
end;

View File

@ -1,47 +1,63 @@
inherited frmCmpSwDialog: TfrmCmpSwDialog
Width = 358
Height = 557
Caption = 'ComponentSwitcher'
ClientHeight = 521
ClientWidth = 342
ExplicitWidth = 358
ExplicitHeight = 557
PixelsPerInch = 96
TextHeight = 13
inherited sbStatus: TStatusBar
Top = 511
Width = 350
Top = 502
Width = 342
ExplicitTop = 502
ExplicitWidth = 342
end
inherited pnlMain: TPanel
Width = 350
Height = 402
Width = 342
Height = 393
ExplicitWidth = 342
ExplicitHeight = 393
inherited pnlSearch: TPanel
Width = 342
Width = 334
TabOrder = 1
ExplicitWidth = 334
inherited cmbSearch: TComboBox
Width = 342
ExplicitWidth = 342
end
end
inherited lstItems: TListBox
Width = 342
Height = 349
Width = 334
Height = 340
TabOrder = 2
ExplicitWidth = 334
ExplicitHeight = 340
end
inherited pnlSubFilters: TPanel
Width = 342
Width = 334
TabOrder = 0
ExplicitWidth = 334
inherited lblSubFilters: TLabel
Width = 343
ExplicitWidth = 343
end
end
end
inherited pnlButtons: TPanel
Top = 475
Width = 350
Top = 466
Width = 342
TabOrder = 2
ExplicitTop = 466
ExplicitWidth = 342
inherited btnCancel: TButton
Left = 271
Left = 263
TabOrder = 2
ExplicitLeft = 263
end
inherited btnOK: TButton
Left = 190
Left = 182
TabOrder = 1
ExplicitLeft = 182
end
object btnConfiguration: TButton
Left = 4
@ -55,8 +71,8 @@ inherited frmCmpSwDialog: TfrmCmpSwDialog
end
object pnlFilters: TPanel [3]
Left = 0
Top = 402
Width = 350
Top = 393
Width = 342
Height = 73
Align = alBottom
BevelOuter = bvNone
@ -65,15 +81,15 @@ inherited frmCmpSwDialog: TfrmCmpSwDialog
object gbFilters: TGroupBox
Left = 4
Top = 4
Width = 342
Width = 334
Height = 65
Align = alClient
TabOrder = 0
DesignSize = (
342
334
65)
object btnMoreFilters: TButton
Left = 304
Left = 296
Top = 32
Width = 31
Height = 25

129
Source/ProjSwClient.pas Normal file
View File

@ -0,0 +1,129 @@
{: Connects ProjectSwitcher to the IDE.
Last changed: $Date$
Revision: $Rev$
Author: $Author$
}
unit ProjSwClient;
interface
uses
ActnList,
Classes,
Dialogs,
SysUtils,
ToolsAPI,
BaseSwClient;
type
TProjectSwitcherHook = class(TBaseSwitcherHook)
private
FSwitchAction: TAction;
protected
procedure SwitchExecute(Sender: TObject);
public
constructor Create;
destructor Destroy; override;
end;
implementation
uses
Menus,
Windows,
BaseSwObjects,
ProjSwDialog,
ProjSwObjects;
{ TProjectSwitcherHook}
constructor TProjectSwitcherHook.Create;
var
actionList: TCustomActionList;
begin
inherited;
actionList := GetIDEActionList;
FSwitchAction := TAction.Create(actionList);
FSwitchAction.Caption := 'ProjectSwitcher';
FSwitchAction.ShortCut := ShortCut(VK_F12, [ssCtrl, ssAlt, ssShift]);
FSwitchAction.OnExecute := SwitchExecute;
FSwitchAction.ActionList := actionList;
end;
destructor TProjectSwitcherHook.Destroy;
begin
FreeAndNil(FSwitchAction);
inherited;
end;
function SortByName(Item1, Item2: Pointer): Integer;
begin
Result := CompareText(TProjSwProject(Item1).Name, TProjSwProject(Item2).Name)
end;
procedure TProjectSwitcherHook.SwitchExecute(Sender: TObject);
var
projectList: TBaseSwItemList;
activeItem: TProjSwProject;
projectItem: TProjSwProject;
moduleServices: IOTAModuleServices;
project: IOTAProject;
activeProject: IOTAProject;
projectIndex: Integer;
selectedItems: TBaseSwItemList;
begin
projectList := TBaseSwItemList.Create;
try
activeItem := nil;
moduleServices := (BorlandIDEServices as IOTAModuleServices);
if not Assigned(moduleServices.MainProjectGroup) then
Exit;
activeProject := moduleServices.GetActiveProject;
for projectIndex := Pred(moduleServices.MainProjectGroup.ProjectCount) downto 0 do
begin
project := moduleServices.MainProjectGroup.Projects[projectIndex];
projectItem := TProjSwProject.Create(project);
if project = activeProject then
activeItem := projectItem;
projectList.Add(projectItem);
end;
if projectList.Count > 0 then
begin
projectList.Sort(SortByName);
selectedItems := TfrmProjSwDialog.Execute(projectList, activeItem);
if Assigned(selectedItems) then
try
if selectedItems.Count > 0 then
begin
projectItem := TProjSwProject(selectedItems[0]);
projectItem.Activate(True);
end;
finally
FreeAndNil(selectedItems);
end;
end;
finally
FreeAndNil(projectList);
end;
end;
end.

163
Source/ProjSwDialog.dfm Normal file
View File

@ -0,0 +1,163 @@
inherited frmProjSwDialog: TfrmProjSwDialog
Caption = 'ProjectSwitcher'
ExplicitHeight = 425
PixelsPerInch = 96
TextHeight = 13
inherited pnlMain: TPanel
inherited lstItems: TListBox
MultiSelect = False
PopupMenu = nil
end
end
inherited pnlButtons: TPanel
inherited btnCancel: TButton
Left = 225
ExplicitLeft = 225
end
inherited btnOK: TButton
Left = 144
ExplicitLeft = 144
end
end
inherited ilsTypes: TImageList
Bitmap = {
494C010101000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
000000000000000000000000000000000000000000000000000000000000A5A5
A500636363006363630063636300636363006363630063636300A5A5A5000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000006363
6300DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF00636363000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000A5A5A500636363006363
6300DEFFFF00A5A5A500737373007373730073737300DEFFFF00636363000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000063636300DEFFFF006363
6300DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF00636363000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000063636300DEFFFF006363
6300DEFFFF00A5A5A500737373007373730073737300DEFFFF0063636300A5A5
A5006363630063636300A5A5A500000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000063636300DEFFFF006363
6300DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF0063636300A5F7
FF00A5F7FF00A5F7FF0063636300000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000063636300DEFFFF006363
6300DEFFFF00A5A5A500737373007373730073737300DEFFFF0063636300DEFF
FF00DEFFFF00A5F7FF0063636300000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000063636300DEFFFF006363
6300DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF0063636300DEFF
FF00DEFFFF00A5F7FF0063636300000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000063636300DEFFFF00A5A5
A500636363006363630063636300636363006363630063636300A5A5A500DEFF
FF00DEFFFF00A5F7FF0063636300000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000063636300DEFFFF00DEFF
FF00DEFFFF00DEFFFF00DEFFFF00DEFFFF0063636300DEFFFF00DEFFFF00DEFF
FF00DEFFFF00A5F7FF0063636300000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000A5A5A500636363006363
630063636300636363006363630063636300A5A5A500DEFFFF00DEFFFF00DEFF
FF00DEFFFF00A5F7FF0063636300000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000A5A5
A500DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFFFF00DEFF
FF00DEFFFF00A5F7FF0063636300000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000006331
6300636363006363630063636300636363006363630063636300636363006363
6300636363006363630063636300000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000006331
6300633163006331630063316300633163006331630063316300633163006331
6300633163006331630063636300000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000CE73
CE00CE73CE00CE73CE00CE73CE00CE73CE00CE73CE00CE73CE00CE73CE00CE73
CE00CE73CE00CE73CE00CE73CE00000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000100000000100010000000000800000000000000000000000
000000000000000000000000FFFFFF00E01F000000000000E01F000000000000
801F000000000000801F00000000000080010000000000008001000000000000
8001000000000000800100000000000080010000000000008001000000000000
8001000000000000E001000000000000E001000000000000E001000000000000
E001000000000000FFFF00000000000000000000000000000000000000000000
000000000000}
end
end

130
Source/ProjSwDialog.pas Normal file
View File

@ -0,0 +1,130 @@
unit ProjSwDialog;
interface
uses
ActnList,
Classes,
ComCtrls,
Contnrs,
Controls,
ExtCtrls,
Graphics,
ImgList,
IniFiles,
Menus,
StdCtrls,
Windows,
BaseSwDialog,
BaseSwObjects;
type
TProjSwStyleVisitor = class(TBaseSwStyleVisitor)
protected
procedure VisitItem(const AItem: TBaseSwItem); override;
end;
TfrmProjSwDialog = class(TfrmBaseSwDialog)
protected
function InternalExecute: TBaseSwItemList; override;
function CreateStyleVisitor: TBaseSwStyleVisitor; override;
function AllowEmptyResult: Boolean; override;
function ColorsEnabled: Boolean; override;
function Wildchars: Boolean; override;
procedure LoadSettings; override;
procedure SaveSettings; override;
end;
implementation
uses
SysUtils,
ToolsAPI,
ProjSwObjects,
ProjSwSettings;
{$R *.dfm}
{ TProjSwStyleVisitor }
procedure TProjSwStyleVisitor.VisitItem(const AItem: TBaseSwItem);
begin
ImageIndex := 0;
end;
{ TfrmProjSwDialog }
function TfrmProjSwDialog.InternalExecute: TBaseSwItemList;
begin
Result := inherited InternalExecute;
end;
function TfrmProjSwDialog.CreateStyleVisitor: TBaseSwStyleVisitor;
begin
Result := TProjSwStyleVisitor.Create;
end;
procedure TfrmProjSwDialog.LoadSettings;
begin
Self.ClientWidth := Settings.Dialog.Width;
Self.ClientHeight := Settings.Dialog.Height;
MRUList.Assign(Settings.Dialog.MRUList);
inherited LoadSettings;
end;
procedure TfrmProjSwDialog.SaveSettings;
begin
// #ToDo2 (MvR) 12-12-2007: save 'sort by ...'
Settings.Dialog.Width := Self.ClientWidth;
Settings.Dialog.Height := Self.ClientHeight;
Settings.Dialog.MRUList.Assign(MRUList);
Settings.Save;
inherited SaveSettings;
end;
function TfrmProjSwDialog.AllowEmptyResult: Boolean;
begin
Result := Settings.Filter.AllowEmptyResult;
end;
function TfrmProjSwDialog.ColorsEnabled: Boolean;
begin
Result := inherited ColorsEnabled;
end;
function TfrmProjSwDialog.Wildchars: Boolean;
begin
Result := Settings.Filter.Wildchars;
end;
(*
procedure TfrmProjSwDialog.btnConfigurationClick(Sender: TObject);
begin
if TfrmProjSwConfiguration.Execute then
begin
SettingsChanged;
UpdateClassFilter;
UpdateSubFilters;
end;
end;
*)
end.

58
Source/ProjSwObjects.pas Normal file
View File

@ -0,0 +1,58 @@
unit ProjSwObjects;
interface
uses
ToolsAPI,
BaseSwObjects;
type
TProjSwProject = class(TBaseSwItem)
private
FProject: IOTAProject;
FName: String;
protected
function GetName: String; override;
public
constructor Create(AProject: IOTAProject);
procedure Activate(const AClearSelection: Boolean);
end;
implementation
uses
SysUtils, Dialogs;
{ TProjSwProject }
constructor TProjSwProject.Create(AProject: IOTAProject);
begin
inherited Create;
FProject := AProject;
FName := ExtractFileName(FProject.ProjectOptions.TargetName);
end;
procedure TProjSwProject.Activate(const AClearSelection: Boolean);
var
moduleServices: IOTAModuleServices;
projectGroup: IOTAProjectGroup;
begin
moduleServices := (BorlandIDEServices as IOTAModuleServices);
projectGroup := moduleServices.MainProjectGroup;
if Assigned(projectGroup) then
projectGroup.ActiveProject := FProject;
end;
function TProjSwProject.GetName: String;
begin
Result := FName;
end;
end.

247
Source/ProjSwSettings.pas Normal file
View File

@ -0,0 +1,247 @@
{: Encapsulates the ProjectSwitcher settings.
Last changed: $Date$
Revision: $Rev$
Author: $Author$
}
unit ProjSwSettings;
interface
uses
Classes,
Registry,
BaseSwSettings;
type
TProjSwDialogSettings = class(TBaseSwSettings)
private
FHeight: Integer;
FMRUList: TStrings;
FWidth: Integer;
protected
procedure Load(const ARegistry: TRegistry); override;
procedure Save(const ARegistry: TRegistry); override;
public
constructor Create;
destructor Destroy; override;
public
property Height: Integer read FHeight write FHeight;
property MRUList: TStrings read FMRUList write FMRUList;
property Width: Integer read FWidth write FWidth;
end;
TProjSwFilterSettings = class(TBaseSwSettings)
private
FAllowEmptyResult: Boolean;
FWildchars: Boolean;
protected
procedure Load(const ARegistry: TRegistry); override;
procedure Save(const ARegistry: TRegistry); override;
public
property AllowEmptyResult: Boolean read FAllowEmptyResult write FAllowEmptyResult;
property Wildchars: Boolean read FWildchars write FWildchars;
end;
TProjSwSettings = class(TObject)
private
FDialog: TProjSwDialogSettings;
FFilter: TProjSwFilterSettings;
FRegistryKey: String;
protected
procedure Load;
public
constructor Create;
destructor Destroy; override;
procedure ResetDefaults;
procedure Save;
property Dialog: TProjSwDialogSettings read FDialog write FDialog;
property Filter: TProjSwFilterSettings read FFilter write FFilter;
end;
function Settings: TProjSwSettings;
implementation
uses
SysUtils,
ToolsAPI,
Windows;
var
GSettings: TProjSwSettings;
function Settings: TProjSwSettings;
begin
if not Assigned(GSettings) then
GSettings := TProjSwSettings.Create;
Result := GSettings;
end;
{ TProjSwDialogSettings }
constructor TProjSwDialogSettings.Create;
begin
inherited Create;
FMRUList := TStringList.Create;
TStringList(FMRUList).CaseSensitive := False
end;
destructor TProjSwDialogSettings.Destroy;
begin
FreeAndNil(FMRUList);
inherited;
end;
procedure TProjSwDialogSettings.Load(const ARegistry: TRegistry);
var
sMRU: String;
begin
ReadIntegerDef(ARegistry, FWidth, 'Width');
ReadIntegerDef(ARegistry, FHeight, 'Height');
if ARegistry.ValueExists(GetKeyName('MRU')) then
begin
SetLength(sMRU, ARegistry.GetDataSize(GetKeyName('MRU')));
if Length(sMRU) > 0 then
begin
ARegistry.ReadBinaryData(GetKeyName('MRU'), PChar(sMRU)^, Length(sMRU));
FMRUList.Text := Trim(sMRU);
end;
end;
end;
procedure TProjSwDialogSettings.Save(const ARegistry: TRegistry);
var
sMRU: String;
begin
WriteInteger(ARegistry, FWidth, 'Width');
WriteInteger(ARegistry, FHeight, 'Height');
if FMRUList.Count > 0 then
begin
sMRU := FMRUList.Text;
ARegistry.WriteBinaryData(GetKeyName('MRU'), PChar(sMRU)^, Length(sMRU));
end else
ARegistry.DeleteValue(GetKeyName('MRU'));
end;
{ TProjSwFilterSettings }
procedure TProjSwFilterSettings.Load(const ARegistry: TRegistry);
begin
ReadBoolDef(ARegistry, FAllowEmptyResult, 'AllowEmptyResult');
ReadBoolDef(ARegistry, FWildchars, 'Wildchars');
end;
procedure TProjSwFilterSettings.Save(const ARegistry: TRegistry);
begin
WriteBool(ARegistry, FAllowEmptyResult, 'AllowEmptyResult');
WriteBool(ARegistry, FWildchars, 'Wildchars');
end;
{ TProjSwSettings }
constructor TProjSwSettings.Create;
begin
inherited;
FRegistryKey := (BorlandIDEServices as IOTAServices).GetBaseRegistryKey +
'\ComponentSwitcher';
FDialog := TProjSwDialogSettings.Create;
FFilter := TProjSwFilterSettings.Create;
ResetDefaults;
Load;
end;
destructor TProjSwSettings.Destroy;
begin
FreeAndNil(FFilter);
FreeAndNil(FDialog);
inherited;
end;
procedure TProjSwSettings.Load;
var
ideRegistry: TRegistry;
begin
ideRegistry := TRegistry.Create;
with ideRegistry do
try
RootKey := HKEY_CURRENT_USER;
if OpenKey(FRegistryKey, False) then
begin
FDialog.Load(ideRegistry);
FFilter.Load(ideRegistry);
CloseKey;
end;
finally
Free;
end;
end;
procedure TProjSwSettings.ResetDefaults;
begin
Filter.AllowEmptyResult := True;
Filter.Wildchars := True;
Dialog.Width := 350;
Dialog.Height := 530;
end;
procedure TProjSwSettings.Save;
var
ideRegistry: TRegistry;
begin
ideRegistry := TRegistry.Create;
with ideRegistry do
try
RootKey := HKEY_CURRENT_USER;
if OpenKey(FRegistryKey, True) then
begin
FDialog.Save(ideRegistry);
FFilter.Save(ideRegistry);
CloseKey;
end;
finally
Free;
end;
end;
initialization
finalization
FreeAndNil(GSettings);
end.

View File

@ -2,15 +2,23 @@ inherited frmUnSwDialog: TfrmUnSwDialog
PixelsPerInch = 96
TextHeight = 13
inherited pnlMain: TPanel
Height = 307
Height = 298
ExplicitHeight = 298
inherited lstItems: TListBox
Height = 254
Height = 245
ExplicitHeight = 245
end
end
inherited pnlButtons: TPanel
TabOrder = 2
inherited btnCancel: TButton
Left = 225
ExplicitLeft = 225
end
inherited btnOK: TButton
Left = 144
TabOrder = 2
ExplicitLeft = 144
end
object btnConfiguration: TButton
Left = 4
@ -24,8 +32,8 @@ inherited frmUnSwDialog: TfrmUnSwDialog
end
object pnlIncludeTypes: TPanel [3]
Left = 0
Top = 307
Width = 312
Top = 298
Width = 304
Height = 36
Align = alBottom
BevelOuter = bvNone
@ -70,135 +78,7 @@ inherited frmUnSwDialog: TfrmUnSwDialog
inherited ilsTypes: TImageList
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
0000000000003600000028000000400000002000000001002000000000000020
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -456,12 +336,8 @@ inherited frmUnSwDialog: TfrmUnSwDialog
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000300000000100010000000000800100000000000000000000
000000000000000000000000FFFFFF0000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000003FFC3000000000003FF8100000000
2800000040000000200000000100010000000000000100000000000000000000
000000000000000000000000FFFFFF000003FFC3000000000003FF8100000000
0003FF00000000000000FF00000000000000FF00000000000000FF0000000000
0000FF81000000000000FFC3000000000000FFFF000000000000FFFF00000000
0000FFFF000000000003FFFF000000000003FFFF000000000003FFFF00000000

View File

@ -1,24 +1,33 @@
unit UnSwReg;
{$I BaseSwDefines.inc}
interface
implementation
uses
SysUtils,
CmpSwClient,
ProjSwClient,
UnSwClient;
var
GComponentSwitcher: TComponentSwitcherHook;
GUnitSwitcher: TUnitSwitcherHook;
GProjectSwitcher: TProjectSwitcherHook;
initialization
GComponentSwitcher := TComponentSwitcherHook.Create();
GUnitSwitcher := TUnitSwitcherHook.Create();
GComponentSwitcher := TComponentSwitcherHook.Create;
GUnitSwitcher := TUnitSwitcherHook.Create;
{$IFNDEF DELPHI7ORLOWER}
GProjectSwitcher := TProjectSwitcherHook.Create;
{$ENDIF}
finalization
FreeAndNil(GProjectSwitcher);
FreeAndNil(GUnitSwitcher);
FreeAndNil(GComponentSwitcher);