Fixed: Delphi 7 compatibility

This commit is contained in:
Mark van Renswoude 2006-01-06 08:11:17 +00:00
parent 9b28c55963
commit 8637a2f146
7 changed files with 300 additions and 14 deletions

View File

@ -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"..\..\Lib\D7"
-LN"c:\program files\borland\delphi7\Projects\Bpl"
-Z
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

View File

@ -0,0 +1,143 @@
[FileVersion]
Version=7.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
NamespacePrefix=
SymbolDeprecated=1
SymbolLibrary=1
SymbolPlatform=1
UnitLibrary=1
UnitPlatform=1
UnitDeprecated=1
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=UnitSwitcher
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=..\..\Lib\D7
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1043
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[HistoryLists\hlUnitAliases]
Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[HistoryLists\hlBPLOutput]
Count=2
Item0=..\..\Lib\D7
Item1=..\Lib\D7

View File

@ -0,0 +1,40 @@
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 'D7'}
{$DESIGNONLY}
{$IMPLICITBUILD OFF}
requires
rtl,
designide;
contains
UnSwClient in '..\..\Source\UnSwClient.pas',
UnSwObjects in '..\..\Source\UnSwObjects.pas',
UnSwDialog in '..\..\Source\UnSwDialog.pas' {frmUnSwDialog},
UnSwFilters in '..\..\Source\UnSwFilters.pas';
end.

Binary file not shown.

View File

@ -1,6 +1,13 @@
{$ASSERTIONS ON}
unit UnSwClient;
// Since Delphi 7 is the lowest supported version at this point, assume
// all other versions support the IOTAModuleServices.GetActiveProject method...
{$UNDEF PROJWORKAROUND}
{$IFDEF VER150}
{$DEFINE PROJWORKAROUND}
{$ENDIF}
interface
implementation
uses
@ -22,6 +29,9 @@ type
FViewFormAction: TContainedAction;
protected
function ActiveFileName(): String;
function ActiveGroup(): IOTAProjectGroup;
function ActiveProject(): IOTAProject;
procedure NewExecute(Sender: TObject); virtual;
public
constructor Create();
@ -45,6 +55,9 @@ begin
Assert(Supports(BorlandIDEServices, IOTAModuleServices),
'BorlandIDEServices does not support the ' +
'IOTAModuleServices interface.');
Assert(Supports(BorlandIDEServices, IOTAActionServices),
'BorlandIDEServices does not support the ' +
'IOTAActionServices interface.');
for iAction := 0 to Pred(ifNTA.ActionList.ActionCount) do
begin
@ -98,6 +111,53 @@ begin
end;
end;
function TUnitSwitcherHook.ActiveGroup(): IOTAProjectGroup;
var
ifModule: IOTAModule;
ifModules: IOTAModuleServices;
iModule: Integer;
begin
Result := nil;
ifModules := (BorlandIDEServices as IOTAModuleServices);
for iModule := 0 to Pred(ifModules.ModuleCount) do
begin
ifModule := ifModules.Modules[iModule];
if Supports(ifModule, IOTAProjectGroup, Result) then
break;
end;
end;
function TUnitSwitcherHook.ActiveProject(): IOTAProject;
{$IFDEF PROJWORKAROUND}
var
ifGroup: IOTAProjectGroup;
ifModule: IOTAModule;
ifModules: IOTAModuleServices;
iModule: Integer;
{$ENDIF}
begin
{$IFDEF PROJWORKAROUND}
Result := nil;
ifGroup := ActiveGroup();
if not Assigned(ifGroup) then
begin
ifModules := (BorlandIDEServices as IOTAModuleServices);
for iModule := 0 to Pred(ifModules.ModuleCount) do
begin
ifModule := ifModules.Modules[iModule];
if Supports(ifModule, IOTAProject, Result) then
break;
end;
end else
Result := ifGroup.ActiveProject;
{$ELSE}
Result := (BorlandIDEServices as IOTAModuleServices).GetActiveProject
{$ENDIF}
end;
procedure TUnitSwitcherHook.NewExecute(Sender: TObject);
var
iActive: Integer;
@ -107,7 +167,7 @@ var
pUnits: TUnSwUnitList;
begin
ifProject := (BorlandIDEServices as IOTAModuleServices).GetActiveProject;
ifProject := ActiveProject();
if not Assigned(ifProject) then
exit;

View File

@ -1,10 +1,10 @@
object frmUnSwDialog: TfrmUnSwDialog
Left = 187
Top = 83
Width = 307
Height = 454
BorderIcons = [biSystemMenu]
Caption = 'UnitSwitcher - it almosts makes coffee.'
ClientHeight = 427
ClientWidth = 299
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
@ -34,8 +34,6 @@ object frmUnSwDialog: TfrmUnSwDialog
BevelOuter = bvNone
BorderWidth = 4
TabOrder = 0
ExplicitWidth = 297
ExplicitHeight = 368
object pnlSearch: TPanel
Left = 4
Top = 4
@ -49,7 +47,6 @@ object frmUnSwDialog: TfrmUnSwDialog
Top = 0
Width = 291
Height = 21
Align = alTop
TabOrder = 0
OnChange = edtSearchChange
OnKeyDown = edtSearchKeyDown
@ -142,7 +139,7 @@ object frmUnSwDialog: TfrmUnSwDialog
Left = 8
Top = 32
Bitmap = {
494C010105000900040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
494C010105000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000003000000001002000000000000030
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -542,6 +539,7 @@ object frmUnSwDialog: TfrmUnSwDialog
E000E0000000AC0FE000E0000000BF3FE000E0000000FFFFE000600000001000
E000200000001000E00000000000B000E00020000000F000E00060000000F000
E000E0000000F000E000E0000000F000E000E0000000F000E001E0010000F000
E003E003FFFFF000E007E007FFFFF000}
E003E003FFFFF000E007E007FFFFF00000000000000000000000000000000000
000000000000}
end
end

View File

@ -24,7 +24,7 @@ type
procedure AcceptVisitor(const AVisitor: IUnSwVisitor);
end;
TUnSwNoRefIntfObject = class(TPersistent, IInterface)
protected
// IInterface
@ -38,6 +38,8 @@ type
protected
function GetName(): String; virtual;
function GetFileName(): String; virtual;
procedure OpenFile(const AFileName: String; const ASource: Boolean); virtual;
public
// IUnSwVisited
procedure AcceptVisitor(const AVisitor: IUnSwVisitor); virtual; abstract;
@ -165,6 +167,13 @@ begin
end;
procedure TUnSwUnit.OpenFile(const AFileName: String; const ASource: Boolean);
begin
(BorlandIDEServices as IOTAActionServices).OpenFile(AFileName);
// #ToDo1 (MvR) 6-1-2006: show source for forms
end;
{ TUnSwModuleUnit }
constructor TUnSwModuleUnit.Create(const AModule: IOTAModuleInfo);
begin
@ -180,10 +189,7 @@ var
begin
ifModule := FModule.OpenModule();
if Assigned(ifModule) then
if ASource then
ifModule.ShowFilename(ifModule.FileName)
else
ifModule.Show();
OpenFile(ifModule.FileName, ASource);
end;
procedure TUnSwModuleUnit.AcceptVisitor(const AVisitor: IUnSwVisitor);
@ -229,7 +235,7 @@ end;
procedure TUnSwProjectUnit.Activate(const ASource: Boolean);
begin
FProject.ShowFilename(FProject.FileName);
OpenFile(FProject.FileName, ASource);
end;
procedure TUnSwProjectUnit.AcceptVisitor(const AVisitor: IUnSwVisitor);