📄 jclinstall.pas
字号:
Result := TStringList.Create;
try
BuildUnitList(SourceDir, Result);
except
Result.Free;
end;
FUnits.AddObject(SourceDir, Result);
end
else
Result := FUnits.Objects[I] as TStrings;
end;
function TJclInstallation.InitOptions: Boolean;
var
GUI: TObject;
ExpertOptions: TJediInstallGUIOptions;
InstallationNode, ProductNode, TempNode, MakeNode: TObject;
function AddNode(Parent: TObject; Option: TJediInstallOption;
GUIOptions: TJediInstallGUIOptions = [goChecked]): TObject;
begin
if StoredOption(Option, goChecked in GUIOptions) then
Include(GUIOptions, goChecked)
else
Exclude(GUIOptions, goChecked);
Result := Tool.GUIAddOption(GUI, Parent, Option, Description(Option), GUIOptions);
end;
procedure AddMakeNodes(Parent: TObject; DebugSettings: Boolean);
const
Option: array[Boolean, Boolean] of TJediInstallOption = (
(ioJclMakeRelease, ioJclMakeReleaseVClx),
(ioJclMakeDebug, ioJclMakeDebugVClx));
var
Node: TObject;
begin
Node := AddNode(Parent, Option[DebugSettings, False], [goStandAloneParent, goChecked]);
if Target.SupportsVisualCLX then
AddNode(Node, Option[DebugSettings, True]);
end;
begin
Result := Assigned(Target) and Target.Valid;
if not Result then
Exit;
GUI := Tool.OptionGUI(Target);
InstallationNode := AddNode(nil, ioTarget);
//InstallationNode.StateIndex := 0;
ProductNode := AddNode(InstallationNode, ioJCL);
AddNode(ProductNode, ioJclDefThreadSafe);
AddNode(ProductNode, ioJclDefDropObsoleteCode);
AddNode(ProductNode, ioJclDefMathPrecSingle, [goRadioButton]);
AddNode(ProductNode, ioJclDefMathPrecDouble, [goRadioButton]);
AddNode(ProductNode, ioJclDefMathPrecExtended, [goRadioButton, goChecked]);
TempNode := AddNode(ProductNode, ioJclEnv);
AddNode(TempNode, ioJclEnvLibPath);
AddNode(TempNode, ioJclEnvBrowsingPath);
AddNode(TempNode, ioJclEnvDebugDCUPath);
MakeNode := AddNode(ProductNode, ioJclMake, [goExpandable, goChecked]);
AddMakeNodes(MakeNode, False);
AddMakeNodes(MakeNode, True);
if (Target is TJclBCBInstallation) then
AddNode(MakeNode, ioJclCopyHppFiles, []);
{$IFDEF MSWINDOWS}
{ TODO : Help integration for Delphi 2005 }
if Target.VersionNumber <= 7 then
with Distribution do
if (HlpHelpFileName <> '') or (ChmHelpFileName <> '') then
begin
TempNode := AddNode(ProductNode, ioJclHelp);
if HlpHelpFileName <> '' then
AddNode(TempNode, ioJclHelpHlp);
if ChmHelpFileName <> '' then
AddNode(TempNode, ioJclHelpChm);
end;
{ TODO : Object Repository access for D 2005 }
if Target.VersionNumber <= 7 then
{$ENDIF MSWINDOWS}
begin
TempNode := AddNode(ProductNode, ioJclExcDialog);
{$IFDEF MSWINDOWS}
AddNode(TempNode, ioJclExcDialogVCL);
AddNode(TempNode, ioJclExcDialogVCLSnd);
if Target.SupportsVisualCLX then
{$ENDIF MSWINDOWS}
AddNode(TempNode, ioJclExcDialogCLX);
end;
TempNode := AddNode(ProductNode, ioJclPackages, [goStandAloneParent, goChecked]);
if (Target is TJclBCBInstallation) then
AddNode(TempNode, ioJclCopyPackagesHppFiles, []);
{$IFDEF MSWINDOWS}
if not (Target is TJclBCBInstallation) then
begin
{ TODO :
It has been reported that IDE experts don't work under Win98.
Leave these options unchecked for Win9x/WinME until that has been examined. }
if IsWinNT then
ExpertOptions := [goChecked]
else
ExpertOptions := [];
TempNode := AddNode(TempNode, ioJclExperts, [goExpandable, goChecked]);
AddNode(TempNode, ioJclExpertDebug, ExpertOptions);
AddNode(TempNode, ioJclExpertAnalyzer, ExpertOptions);
AddNode(TempNode, ioJclExpertFavorite, ExpertOptions);
if Target.VersionNumber <= 6 then
AddNode(TempNode, ioJclExpertsThrNames, ExpertOptions);
//(usc) no packages and tests for D7 & D9 so far
if Target.VersionNumber <= 6 then
AddNode(TempNode, ioJclExpertUses, ExpertOptions);
end;
{$ENDIF MSWINDOWS}
Tool.BPLPath[Target] := StoredBplPath;
Tool.DCPPath[Target] := StoredDcpPath;
end;
function TJclInstallation.InstallSelectedOptions: Boolean;
function BorRADToolVersionStr: string;
begin
Result := Format('%s Build %s ', [Target.Name, Target.IdeExeBuildNumber]);
end;
var
Option: TJediInstallOption;
begin
Tool.UpdateStatus(Format(RsStatusMessage, [Target.Name]));
WriteLog(StrPadRight(BorRADToolVersionStr, 44, '='));
Result := CheckDirectories;
if Result then
begin
CleanupRepository;
Defines.Clear;
for Option := ioJCL to ioJclLast do
if OptionSelected(Option) then
Result := Result and InstallOption(Option);
end;
WriteLog('');
end;
function TJclInstallation.InstallOption(Option: TJediInstallOption): Boolean;
begin
Result := True;
case Option of
ioJclDefThreadSafe:
Defines.Add('THREAD_SAFE');
ioJclDefDropObsoleteCode:
Defines.Add('DROP_OBSOLETE_CODE');
ioJclDefMathPrecSingle:
Defines.Add('MATH_SINGLE_PRECISION');
ioJclDefMathPrecDouble:
Defines.Add('MATH_DOUBLE_PRECISION');
ioJclDefMathPrecExtended:
Defines.Add('MATH_EXTENDED_PRECISION');
ioJclEnvLibPath:
if Target.AddToLibrarySearchPath(LibDir) and Target.AddToLibrarySearchPath(Distribution.SourceDir) then
WriteLog(Format(LineBreak + 'Added "%s;%s" to library path.', [LibDir, Distribution.SourceDir]));
ioJclEnvBrowsingPath:
if Target.AddToLibraryBrowsingPath(Distribution.SourcePath) then
WriteLog(Format(LineBreak + 'Added "%s" to library browsing path.', [Distribution.SourcePath]));
ioJclEnvDebugDCUPath:
if Target.AddToDebugDCUPath(DebugDcuDir) then
WriteLog(Format(LineBreak + 'Added "%s" to Debug DCU Path.', [DebugDcuDir]));
// ioJclMake:
ioJclMakeRelease:
Result := MakeUnits(False);
// ioJclMakeReleaseVClx: handled with ioJclMakeRelease
ioJclMakeDebug:
Result := MakeUnits(True);
// ioJclMakeDebugVClx: handled with ioJclMakeDebug
// ioJclCopyHppFiles: handled by InstallPackageSourceFile
ioJclPackages:
begin
Result := InstallRunTimePackage('Jcl');
if Target.SupportsVisualCLX then
Result := Result and InstallRunTimePackage('JclVClx');
if Target.VersionNumber >= 6 then
Result := Result and InstallRunTimePackage('JclVcl');
end;
{$IFDEF MSWINDOWS}
// ioJclExperts:
ioJclExpertDebug..ioJclExpertUses:
Result := InstallPackageSourceFile(ExpertPaths[Option]);
// ioJclCopyPackagesHppFiles: handled by InstallPackageSourceFile
// ioJclExcDialog:
ioJclExcDialogVCL:
with Distribution do
AddDialogToRepository(VclDialogName, FVclDialogFileName, FVclDialogIconFileName,
BorRADToolRepositoryDesignerDfm);
ioJclExcDialogVCLSnd:
with Distribution do
AddDialogToRepository(VclDialogNameSend, FVclDialogSendFileName,
FVclDialogSendIconFileName, BorRADToolRepositoryDesignerDfm, FVclDialogFileName);
{$ENDIF MSWINDOWS}
ioJclExcDialogCLX:
with Distribution do
AddDialogToRepository(ClxDialogName, FClxDialogFileName, FClxDialogIconFileName,
BorRADToolRepositoryDesignerXfm);
{$IFDEF MSWINDOWS}
// ioJclHelp:
ioJclHelpHlp:
AddHelpToOpenHelp;
ioJclHelpChm:
AddHelpToIdeTools;
{$ENDIF MSWINDOWS}
end;
if not (Option in [ioJclMakeRelease, ioJclMakeDebug]) then
Progress(ProgressWeight(Option));
end;
function TJclInstallation.UninstallOption(Option: TJediInstallOption): Boolean;
begin
Result := True;
case Option of
ioJclEnvLibPath:
if Target.RemoveFromLibrarySearchPath(LibDir) and Target.RemoveFromLibrarySearchPath(Distribution.SourceDir) then
WriteLog(Format(LineBreak + 'Removed "%s;%s" from library path.', [LibDir, Distribution.SourceDir]));
ioJclEnvBrowsingPath:
if Target.RemoveFromLibraryBrowsingPath(Distribution.SourcePath) then
WriteLog(Format(LineBreak + 'Removed "%s" from library browsing path.', [Distribution.SourcePath]));
ioJclEnvDebugDCUPath:
if Target.RemoveFromDebugDCUPath(DebugDcuDir) then
WriteLog(Format(LineBreak + 'Removed "%s" from Debug DCU Path.', [DebugDcuDir]));
// ioJclMake:
ioJclMakeRelease: { TODO : Delete generated files };
ioJclMakeDebug: { TODO : Delete generated files };
ioJclCopyHppFiles: { TODO : Delete copied files };
ioJclPackages:
begin
Result := UninstallRunTimePackage('Jcl');
if Target.SupportsVisualCLX then
Result := Result and UninstallRunTimePackage('JclVClx');
if Target.VersionNumber >= 6 then
Result := Result and UninstallRunTimePackage('JclVcl');
end;
{$IFDEF MSWINDOWS}
// ioJclExperts:
ioJclExpertDebug..ioJclExpertUses:
Result := UninstallPackage(ExpertPaths[Option]);
// ioJclCopyPackagesHppFiles:
// ioJclExcDialog:
ioJclExcDialogVCL:
with Distribution do
RemoveDialogFromRepository(VclDialogName, VclDialogFileName);
ioJclExcDialogVCLSnd:
with Distribution do
RemoveDialogFromRepository(VclDialogNameSend, VclDlgSndFileName);
{$ENDIF MSWINDOWS}
ioJclExcDialogCLX:
with Distribution do
RemoveDialogFromRepository(ClxDialogName, ClxDialogFileName);
{$IFDEF MSWINDOWS}
// ioJclHelp:
ioJclHelpHlp:
RemoveHelpFromOpenHelp;
ioJclHelpChm:
RemoveHelpFromIdeTools;
{$ENDIF MSWINDOWS}
end;
if not (Option in [ioJclMakeRelease, ioJclMakeDebug]) then
Progress(ProgressWeight(Option));
end;
procedure TJclInstallation.InstallationStarted;
begin
with FDistribution do
if Assigned(FOnStarting) then
FOnStarting(Target);
end;
procedure TJclInstallation.InstallationFinished;
begin
with FDistribution do
if Assigned(FOnEnding) then
FOnEnding(Target);
end;
procedure TJclInstallation.InstallFailedOn(const InstallObj: string);
begin
Tool.Dialog(Format(RsInstallFailed, [InstallObj, LogFileName]), dtError);
end;
function TJclInstallation.InstallPackageSourceFile(const Name: string): Boolean;
const
{$IFDEF MSWINDOWS}
Bcb2MakTemplate = '\BCB.bmk';
{$ENDIF MSWINDOWS}
{$IFDEF KYLIX}
Bcb2MakTemplate = '/bcb.gmk';
{$ENDIF KYLIX}
var
PackageFileName: string;
begin
Result := True;
PackageFileName := Distribution.Path + Format(Name, [Target.VersionNumber]);
WriteLog(Format(LineBreak + 'Installing package %s...', [PackageFileName]));
Tool.UpdateStatus(Format(RsStatusDetailMessage, [ExtractFileName(PackageFileName), Target.Name]));
if IsDelphiPackage(Name) then
begin
Result := Target.InstallPackage(PackageFileName, BplPath,
DcpPath);
end
else
if Target is TJclBCBInstallation then
with TJclBCBInstallation(Target) do
begin
Bpr2Mak.Options.Clear;
Bpr2Mak.Options.Add('-t..' + Bcb2MakTemplate);
{$IFDEF KYLIX}
SetEnvironmentVar('OBJDIR', LibObjDir);
SetEnvironmentVar('BPILIBDIR', DcpPath);
SetEnvironmentVar('BPLDIR', BplPath);
{$ELSE}
Make.Options.Clear;
Make.AddPathOption('DBPILIBDIR=', DcpPath);
Make.AddPathOption('DBPLDIR=', BplPath);
if OptionSelected(ioJclCopyPackagesHppFiles) then
Make.AddPathOption('DHPPDIR=', (Target as TJclBCBInstallation).VclIncludeDir);
{$ENDIF}
Result := Target.InstallPackage(PackageFileName, BplPath,
DcpPath);
end;
WriteLog('...done.');
if not Result then
InstallFailedOn(PackageFileName);
end;
function TJclInstallation.InstallRunTimePackage(const BaseName: string): Boolean;
begin
Result := InstallPackageSourceFile(FullPackageFileName(Target, BaseName));
end;
function TJclInstallation.LogFileName: string;
begin
Result := JclInstall.LogFileName(Target);
end;
function TJclInstallation.MakePath(const FormatStr: string): string;
begin
{$IFDEF KYLIX}
Result := Format(FormatStr, [Target.VersionNumber]);
{$ELSE ~KYLIX}
with Target do
Result := Format(FormatStr, [Prefixes[RADToolKind], VersionNumber]);
{$ENDIF ~KYLIX}
end;
function TJclInstallation.MakeUnits(Debug: Boolean): Boolean;
var
I: Integer;
begin
Result := True;
for I := Low(JclSourceDirs) to High(JclSourceDirs) do
begin
{$IFDEF MSWINDOWS}
if (JclSourceDirs[I] = 'visclx') and
not (OptionSelected(ioJclMakeReleaseVClx) or OptionSelected(ioJclMakeDebugVClx)) then
Continue;
{$ENDIF MSWINDOWS}
Result := Result and CompileLibraryUnits(JclSourceDirs[I], Debug);
end;
end;
function TJclInstallation.OptionSelected(Option: TJediInstallOption): Boolean;
begin
Result := Tool.FeatureChecked(Ord(Option), Target);
end;
procedure TJclInstallation.Progress(Steps: Integer);
begin
Distribution.InstallProgress(Steps);
end;
function TJclInstallation.ProgressWeight(Option: TJediInstallOption): Integer;
begin
case Option of
ioJclEnvLibPath,
ioJclEnvBrowsingPath,
ioJclEnvDebugDCUPath:
Result := 1;
ioJclMakeRelease,
ioJclMakeDebug:
begin
Result := TotalUnitCount;
{$IFDEF KYLIX}
Result := Result * 2; // .dcu + .dpu
{$ENDIF KYLIX}
end;
ioJclMakeReleaseVClx,
ioJclMakeDebugVClx:
Result := 0;
ioJclCopyHppFiles:
Result := 2;
ioJclPackages:
Result := 10;
ioJclExpertDebug,
ioJclExpertAnalyzer,
ioJclExpertFavorite,
ioJclExpertsThrNames,
ioJclExpertUses:
Result := 5;
ioJclCopyPackagesHppFiles:
Result := 2;
ioJclExcDialog,
ioJclExcDialogVCL,
ioJclExcDialogVCLSnd,
ioJclExcDialogCLX,
ioJclHelpHlp,
ioJclHelpChm:
Result := 1;
else
Result := 0;
end;
end;
procedure TJclInstallation.RemoveDialogFromRepository(const DialogName, DialogFileName: string);
begin
Target.Repository.RemoveObjects(DialogsPath, DialogFileName, BorRADToolRepositoryFormTemplate);
WriteLog(Format(LineBreak + 'Removed %s.', [DialogName]));
end;
{$IFDEF MSWINDOWS}
procedure TJclInstallation.RemoveHelpFromIdeTools;
begin
{ TODO : Implement }
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -