implemented uninstalling packages

git-svn-id: trunk@4104 -
This commit is contained in:
mattias 2003-04-28 10:20:05 +00:00
parent 1f4d722551
commit e291edc8ee
6 changed files with 272 additions and 82 deletions

View File

@ -61,6 +61,7 @@ type
TPkgCompileFlag = ( TPkgCompileFlag = (
pcfCleanCompile, // append -B to the compiler options pcfCleanCompile, // append -B to the compiler options
pcfDoNotCompileDependencies, pcfDoNotCompileDependencies,
pcfCompileDependenciesClean,
pcfOnlyIfNeeded, pcfOnlyIfNeeded,
pcfDoNotSaveEditorFiles pcfDoNotSaveEditorFiles
); );
@ -130,6 +131,7 @@ const
PkgCompileFlagNames: array[TPkgCompileFlag] of string = ( PkgCompileFlagNames: array[TPkgCompileFlag] of string = (
'pcfCleanCompile', 'pcfCleanCompile',
'pcfDoNotCompileDependencies', 'pcfDoNotCompileDependencies',
'pcfCompileDependenciesClean',
'pcfOnlyIfNeeded', 'pcfOnlyIfNeeded',
'pcfAutomatic' 'pcfAutomatic'
); );

View File

@ -391,8 +391,6 @@ type
TLazPackageFlag = ( TLazPackageFlag = (
lpfAutoIncrementVersionOnBuild, // increment version before lpfAutoIncrementVersionOnBuild, // increment version before
lpfModified, // package needs saving lpfModified, // package needs saving
lpfAutoUpdate, // auto compile, if this package
// or any required package has been modified
lpfNeeded, // Set by PackageGraph, if package is in use lpfNeeded, // Set by PackageGraph, if package is in use
// (for example because it is Installed or an Installed // (for example because it is Installed or an Installed
// package requires this package) // package requires this package)
@ -405,24 +403,34 @@ type
); );
TLazPackageFlags = set of TLazPackageFlag; TLazPackageFlags = set of TLazPackageFlag;
TIterateComponentClassesEvent =
procedure(PkgComponent: TPkgComponent) of object;
TPackageInstallType = ( TPackageInstallType = (
pitNope, pitNope,
pitStatic, pitStatic,
pitDynamic pitDynamic
); );
TPackageUpdatePolicy = (
pupManually,
pupOnRebuildingAll,
pupAsNeeded
);
TPackageUpdatePolicies = set of TPackageUpdatePolicy;
const
pupAllAuto = [pupAsNeeded,pupOnRebuildingAll];
type
TIterateComponentClassesEvent =
procedure(PkgComponent: TPkgComponent) of object;
TPkgChangeNameEvent = procedure(Pkg: TLazPackage; TPkgChangeNameEvent = procedure(Pkg: TLazPackage;
const OldName: string) of object; const OldName: string) of object;
TLazPackage = class(TLazPackageID) TLazPackage = class(TLazPackageID)
private private
FAuthor: string; FAuthor: string;
FAutoCreated: boolean; FAutoCreated: boolean;
FAutoInstall: TPackageInstallType; FAutoInstall: TPackageInstallType;
FBroken: boolean; FAutoUpdate: TPackageUpdatePolicy;
FCompilerOptions: TPkgCompilerOptions; FCompilerOptions: TPkgCompilerOptions;
FComponents: TList; // TList of TPkgComponent FComponents: TList; // TList of TPkgComponent
FDefineTemplates: TLazPackageDefineTemplates; FDefineTemplates: TLazPackageDefineTemplates;
@ -442,6 +450,7 @@ type
FLastCompilerParams: string; FLastCompilerParams: string;
FLicense: string; FLicense: string;
FMacros: TTransferMacroList; FMacros: TTransferMacroList;
FMissing: boolean;
FModifiedLock: integer; FModifiedLock: integer;
FOutputStateFile: string; FOutputStateFile: string;
FPackageEditor: TBasePackageEditor; FPackageEditor: TBasePackageEditor;
@ -454,7 +463,6 @@ type
FUpdateLock: integer; FUpdateLock: integer;
FUsageOptions: TPkgAdditionalCompilerOptions; FUsageOptions: TPkgAdditionalCompilerOptions;
function GetAutoIncrementVersionOnBuild: boolean; function GetAutoIncrementVersionOnBuild: boolean;
function GetAutoUpdate: boolean;
function GetComponentCount: integer; function GetComponentCount: integer;
function GetComponents(Index: integer): TPkgComponent; function GetComponents(Index: integer): TPkgComponent;
function GetRemovedCount: integer; function GetRemovedCount: integer;
@ -466,7 +474,7 @@ type
procedure SetAutoCreated(const AValue: boolean); procedure SetAutoCreated(const AValue: boolean);
procedure SetAutoIncrementVersionOnBuild(const AValue: boolean); procedure SetAutoIncrementVersionOnBuild(const AValue: boolean);
procedure SetAutoInstall(const AValue: TPackageInstallType); procedure SetAutoInstall(const AValue: TPackageInstallType);
procedure SetAutoUpdate(const AValue: boolean); procedure SetAutoUpdate(const AValue: TPackageUpdatePolicy);
procedure SetDescription(const AValue: string); procedure SetDescription(const AValue: string);
procedure SetFilename(const AValue: string); procedure SetFilename(const AValue: string);
procedure SetFlags(const AValue: TLazPackageFlags); procedure SetFlags(const AValue: TLazPackageFlags);
@ -555,11 +563,13 @@ type
property Author: string read FAuthor write SetAuthor; property Author: string read FAuthor write SetAuthor;
property AutoCreated: boolean read FAutoCreated write SetAutoCreated; property AutoCreated: boolean read FAutoCreated write SetAutoCreated;
property AutoIncrementVersionOnBuild: boolean property AutoIncrementVersionOnBuild: boolean
read GetAutoIncrementVersionOnBuild write SetAutoIncrementVersionOnBuild; read GetAutoIncrementVersionOnBuild
write SetAutoIncrementVersionOnBuild;
property AutoInstall: TPackageInstallType read FAutoInstall property AutoInstall: TPackageInstallType read FAutoInstall
write SetAutoInstall; write SetAutoInstall;
property AutoUpdate: boolean read GetAutoUpdate write SetAutoUpdate; property AutoUpdate: TPackageUpdatePolicy read FAutoUpdate
property Broken: boolean read FBroken write FBroken; write SetAutoUpdate;
property Missing: boolean read FMissing write FMissing;
property CompilerOptions: TPkgCompilerOptions read FCompilerOptions; property CompilerOptions: TPkgCompilerOptions read FCompilerOptions;
property ComponentCount: integer read GetComponentCount; property ComponentCount: integer read GetComponentCount;
property Components[Index: integer]: TPkgComponent read GetComponents; property Components[Index: integer]: TPkgComponent read GetComponents;
@ -629,9 +639,15 @@ const
LazPackageTypeIdents: array[TLazPackageType] of string = ( LazPackageTypeIdents: array[TLazPackageType] of string = (
'RunTime', 'DesignTime', 'RunAndDesignTime'); 'RunTime', 'DesignTime', 'RunAndDesignTime');
LazPackageFlagNames: array[TLazPackageFlag] of string = ( LazPackageFlagNames: array[TLazPackageFlag] of string = (
'lpfAutoIncrementVersionOnBuild', 'lpfModified', 'lpfAutoUpdate', 'lpfAutoIncrementVersionOnBuild', 'lpfModified',
'lpfNeeded', 'lpfVisited', 'lpfDestroying', 'lpfLoading', 'lpfSkipSaving', 'lpfNeeded', 'lpfVisited', 'lpfDestroying', 'lpfLoading', 'lpfSkipSaving',
'lpfCircle', 'lpfStateFileLoaded'); 'lpfCircle', 'lpfStateFileLoaded');
PackageUpdatePolicies: array[TPackageUpdatePolicy] of string = (
'pupManually', 'pupOnRebuildingAll', 'pupAsNeeded'
);
AutoUpdateNames: array[TPackageUpdatePolicy] of string = (
'Manually', 'OnRebuildingAll', 'AsNeeded'
);
var var
// All TPkgDependency are added to this AVL tree (sorted for names, not version!) // All TPkgDependency are added to this AVL tree (sorted for names, not version!)
@ -651,6 +667,7 @@ function GetUsageOptionsList(PackageList: TList): TList;
function PkgFileTypeIdentToType(const s: string): TPkgFileType; function PkgFileTypeIdentToType(const s: string): TPkgFileType;
function LazPackageTypeIdentToType(const s: string): TLazPackageType; function LazPackageTypeIdentToType(const s: string): TLazPackageType;
function GetPkgFileTypeLocalizedName(FileType: TPkgFileType): string; function GetPkgFileTypeLocalizedName(FileType: TPkgFileType): string;
function NameToAutoUpdatePolicy(const s: string): TPackageUpdatePolicy;
procedure SortDependencyList(Dependencies: TList); procedure SortDependencyList(Dependencies: TList);
procedure LoadPkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string; procedure LoadPkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string;
@ -677,7 +694,6 @@ function GetDependencyOwnerAsString(Dependency: TPkgDependency): string;
function PackageFileNameIsValid(const AFilename: string): boolean; function PackageFileNameIsValid(const AFilename: string): boolean;
implementation implementation
@ -709,6 +725,13 @@ begin
end; end;
end; end;
function NameToAutoUpdatePolicy(const s: string): TPackageUpdatePolicy;
begin
for Result:=Low(TPackageUpdatePolicy) to High(TPackageUpdatePolicy) do
if AnsiCompareText(AutoUpdateNames[Result],s)=0 then exit;
Result:=pupAsNeeded;
end;
procedure LoadPkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string; procedure LoadPkgDependencyList(XMLConfig: TXMLConfig; const ThePath: string;
var First: TPkgDependency; ListType: TPkgDependencyList; Owner: TObject; var First: TPkgDependency; ListType: TPkgDependencyList; Owner: TObject;
HoldPackages: boolean); HoldPackages: boolean);
@ -1559,11 +1582,6 @@ begin
Result:=lpfAutoIncrementVersionOnBuild in FFlags; Result:=lpfAutoIncrementVersionOnBuild in FFlags;
end; end;
function TLazPackage.GetAutoUpdate: boolean;
begin
Result:=lpfAutoUpdate in FFlags;
end;
function TLazPackage.GetComponentCount: integer; function TLazPackage.GetComponentCount: integer;
begin begin
Result:=FComponents.Count; Result:=FComponents.Count;
@ -1629,13 +1647,10 @@ begin
FAutoInstall:=AValue; FAutoInstall:=AValue;
end; end;
procedure TLazPackage.SetAutoUpdate(const AValue: boolean); procedure TLazPackage.SetAutoUpdate(const AValue: TPackageUpdatePolicy);
begin begin
if AValue=AutoUpdate then exit; if AValue=AutoUpdate then exit;
if AValue then FAutoUpdate:=AValue;
Include(FFlags,lpfAutoUpdate)
else
Exclude(FFlags,lpfAutoUpdate);
Modified:=true; Modified:=true;
end; end;
@ -1670,7 +1685,7 @@ begin
if FFlags=AValue then exit; if FFlags=AValue then exit;
ChangedFlags:=FFlags+AValue-(FFlags*AValue); ChangedFlags:=FFlags+AValue-(FFlags*AValue);
FFlags:=AValue; FFlags:=AValue;
if ChangedFlags*[lpfAutoIncrementVersionOnBuild,lpfAutoUpdate]<>[] then if ChangedFlags*[lpfAutoIncrementVersionOnBuild]<>[] then
Modified:=true; Modified:=true;
end; end;
@ -1829,7 +1844,8 @@ begin
UpdateSourceDirectories; UpdateSourceDirectories;
// set some nice start values // set some nice start values
if not (lpfDestroying in FFlags) then begin if not (lpfDestroying in FFlags) then begin
FFlags:=[lpfAutoIncrementVersionOnBuild,lpfAutoUpdate]; FFlags:=[lpfAutoIncrementVersionOnBuild];
FAutoUpdate:=pupAsNeeded;
fCompilerOptions.UnitOutputDirectory:='lib'+PathDelim; fCompilerOptions.UnitOutputDirectory:='lib'+PathDelim;
FUsageOptions.UnitPath:='$(PkgOutDir)'; FUsageOptions.UnitPath:='$(PkgOutDir)';
end else begin end else begin
@ -1899,10 +1915,6 @@ var
Include(FFlags,lpfAutoIncrementVersionOnBuild) Include(FFlags,lpfAutoIncrementVersionOnBuild)
else else
Exclude(FFlags,lpfAutoIncrementVersionOnBuild); Exclude(FFlags,lpfAutoIncrementVersionOnBuild);
if XMLConfig.GetValue(ThePath+'AutoUpdate/Value',true) then
Include(FFlags,lpfAutoUpdate)
else
Exclude(FFlags,lpfAutoUpdate);
end; end;
begin begin
@ -1916,6 +1928,8 @@ begin
LockModified; LockModified;
Name:=XMLConfig.GetValue(Path+'Name/Value',''); Name:=XMLConfig.GetValue(Path+'Name/Value','');
FAuthor:=XMLConfig.GetValue(Path+'Author/Value',''); FAuthor:=XMLConfig.GetValue(Path+'Author/Value','');
FAutoUpdate:=NameToAutoUpdatePolicy(
XMLConfig.GetValue(Path+'AutoUpdate/Value',''));
FCompilerOptions.LoadFromXMLConfig(XMLConfig,Path+'CompilerOptions/'); FCompilerOptions.LoadFromXMLConfig(XMLConfig,Path+'CompilerOptions/');
FDescription:=XMLConfig.GetValue(Path+'Description/Value',''); FDescription:=XMLConfig.GetValue(Path+'Description/Value','');
FLicense:=XMLConfig.GetValue(Path+'License/Value',''); FLicense:=XMLConfig.GetValue(Path+'License/Value','');
@ -1955,12 +1969,13 @@ procedure TLazPackage.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string
begin begin
XMLConfig.SetDeleteValue(ThePath+'AutoIncrementVersionOnBuild/Value', XMLConfig.SetDeleteValue(ThePath+'AutoIncrementVersionOnBuild/Value',
AutoIncrementVersionOnBuild,true); AutoIncrementVersionOnBuild,true);
XMLConfig.SetDeleteValue(ThePath+'AutoUpdate/Value',AutoUpdate,true);
end; end;
begin begin
XMLConfig.SetDeleteValue(Path+'Name/Value',FName,''); XMLConfig.SetDeleteValue(Path+'Name/Value',FName,'');
XMLConfig.SetDeleteValue(Path+'Author/Value',FAuthor,''); XMLConfig.SetDeleteValue(Path+'Author/Value',FAuthor,'');
XMLConfig.SetDeleteValue(Path+'AutoUpdate/Value',AutoUpdateNames[FAutoUpdate],
AutoUpdateNames[pupAsNeeded]);
FCompilerOptions.SaveToXMLConfig(XMLConfig,Path+'CompilerOptions/'); FCompilerOptions.SaveToXMLConfig(XMLConfig,Path+'CompilerOptions/');
XMLConfig.SetDeleteValue(Path+'Description/Value',FDescription,''); XMLConfig.SetDeleteValue(Path+'Description/Value',FDescription,'');
XMLConfig.SetDeleteValue(Path+'License/Value',FLicense,''); XMLConfig.SetDeleteValue(Path+'License/Value',FLicense,'');

View File

@ -53,9 +53,11 @@ type
SaveAs: boolean): TModalResult of object; SaveAs: boolean): TModalResult of object;
TOnCompilePackage = TOnCompilePackage =
function(Sender: TObject; APackage: TLazPackage; function(Sender: TObject; APackage: TLazPackage;
CompileAll: boolean): TModalResult of object; CompileClean, CompileRequired: boolean): TModalResult of object;
TOnInstallPackage = TOnInstallPackage =
function(Sender: TObject; APackage: TLazPackage): TModalResult of object; function(Sender: TObject; APackage: TLazPackage): TModalResult of object;
TOnUninstallPackage =
function(Sender: TObject; APackage: TLazPackage): TModalResult of object;
TOnCreateNewPkgFile = TOnCreateNewPkgFile =
function(Sender: TObject; function(Sender: TObject;
const Params: TAddToPkgResult): TModalResult of object; const Params: TAddToPkgResult): TModalResult of object;
@ -109,7 +111,8 @@ type
procedure ApplyDependencyButtonClick(Sender: TObject); procedure ApplyDependencyButtonClick(Sender: TObject);
procedure CallRegisterProcCheckBoxClick(Sender: TObject); procedure CallRegisterProcCheckBoxClick(Sender: TObject);
procedure ChangeFileTypeMenuItemClick(Sender: TObject); procedure ChangeFileTypeMenuItemClick(Sender: TObject);
procedure CompileAllClick(Sender: TObject); procedure CompileAllCleanClick(Sender: TObject);
procedure CompileCleanClick(Sender: TObject);
procedure CompileBitBtnClick(Sender: TObject); procedure CompileBitBtnClick(Sender: TObject);
procedure CompilerOptionsBitBtnClick(Sender: TObject); procedure CompilerOptionsBitBtnClick(Sender: TObject);
procedure FilePropsGroupBoxResize(Sender: TObject); procedure FilePropsGroupBoxResize(Sender: TObject);
@ -132,6 +135,7 @@ type
procedure RemoveBitBtnClick(Sender: TObject); procedure RemoveBitBtnClick(Sender: TObject);
procedure SaveBitBtnClick(Sender: TObject); procedure SaveBitBtnClick(Sender: TObject);
procedure SaveAsClick(Sender: TObject); procedure SaveAsClick(Sender: TObject);
procedure UninstallClick(Sender: TObject);
procedure UseMaxVersionCheckBoxClick(Sender: TObject); procedure UseMaxVersionCheckBoxClick(Sender: TObject);
procedure UseMinVersionCheckBoxClick(Sender: TObject); procedure UseMinVersionCheckBoxClick(Sender: TObject);
private private
@ -159,7 +163,7 @@ type
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure DoSave(SaveAs: boolean); procedure DoSave(SaveAs: boolean);
procedure DoCompile(CompileAll: boolean); procedure DoCompile(CompileClean, CompileRequired: boolean);
public public
property LazPackage: TLazPackage read FLazPackage write SetLazPackage; property LazPackage: TLazPackage read FLazPackage write SetLazPackage;
end; end;
@ -180,6 +184,7 @@ type
FOnOpenFile: TOnOpenFile; FOnOpenFile: TOnOpenFile;
FOnOpenPackage: TOnOpenPackage; FOnOpenPackage: TOnOpenPackage;
FOnSavePackage: TOnSavePackage; FOnSavePackage: TOnSavePackage;
FOnUninstallPackage: TOnUninstallPackage;
function GetEditors(Index: integer): TPackageEditorForm; function GetEditors(Index: integer): TPackageEditorForm;
procedure ApplyLayout(AnEditor: TPackageEditorForm); procedure ApplyLayout(AnEditor: TPackageEditorForm);
procedure SaveLayout(AnEditor: TPackageEditorForm); procedure SaveLayout(AnEditor: TPackageEditorForm);
@ -203,9 +208,10 @@ type
const Params: TAddToPkgResult): TModalResult; const Params: TAddToPkgResult): TModalResult;
function SavePackage(APackage: TLazPackage; SaveAs: boolean): TModalResult; function SavePackage(APackage: TLazPackage; SaveAs: boolean): TModalResult;
function CompilePackage(APackage: TLazPackage; function CompilePackage(APackage: TLazPackage;
CompileAll: boolean): TModalResult; CompileClean,CompileRequired: boolean): TModalResult;
procedure UpdateAllEditors; procedure UpdateAllEditors;
function InstallPackage(APackage: TLazPackage): TModalResult; function InstallPackage(APackage: TLazPackage): TModalResult;
function UninstallPackage(APackage: TLazPackage): TModalResult;
public public
property Editors[Index: integer]: TPackageEditorForm read GetEditors; property Editors[Index: integer]: TPackageEditorForm read GetEditors;
property OnCreateNewFile: TOnCreateNewPkgFile read FOnCreateNewFile property OnCreateNewFile: TOnCreateNewPkgFile read FOnCreateNewFile
@ -222,6 +228,8 @@ type
write FOnCompilePackage; write FOnCompilePackage;
property OnInstallPackage: TOnInstallPackage read FOnInstallPackage property OnInstallPackage: TOnInstallPackage read FOnInstallPackage
write FOnInstallPackage; write FOnInstallPackage;
property OnUninstallPackage: TOnUninstallPackage read FOnUninstallPackage
write FOnUninstallPackage;
end; end;
var var
@ -428,11 +436,18 @@ begin
AddPopupMenuItem('Save',@SaveBitBtnClick,SaveBitBtn.Enabled); AddPopupMenuItem('Save',@SaveBitBtnClick,SaveBitBtn.Enabled);
AddPopupMenuItem('Save As',@SaveAsClick,not LazPackage.AutoCreated); AddPopupMenuItem('Save As',@SaveAsClick,not LazPackage.AutoCreated);
AddPopupMenuItem('-',nil,true);
AddPopupMenuItem('Compile',@CompileBitBtnClick,CompileBitBtn.Enabled); AddPopupMenuItem('Compile',@CompileBitBtnClick,CompileBitBtn.Enabled);
AddPopupMenuItem('Compile All',@CompileAllClick,CompileBitBtn.Enabled); AddPopupMenuItem('Recompile clean',@CompileCleanClick,CompileBitBtn.Enabled);
AddPopupMenuItem('Recompile all required',@CompileAllCleanClick,CompileBitBtn.Enabled);
AddPopupMenuItem('-',nil,true);
AddPopupMenuItem('Add',@AddBitBtnClick,AddBitBtn.Enabled); AddPopupMenuItem('Add',@AddBitBtnClick,AddBitBtn.Enabled);
AddPopupMenuItem('Remove',@RemoveBitBtnClick,RemoveBitBtn.Enabled); AddPopupMenuItem('Remove',@RemoveBitBtnClick,RemoveBitBtn.Enabled);
AddPopupMenuItem('-',nil,true);
AddPopupMenuItem('Install',@InstallBitBtnClick,InstallBitBtn.Enabled); AddPopupMenuItem('Install',@InstallBitBtnClick,InstallBitBtn.Enabled);
AddPopupMenuItem('Uninstall',@UninstallClick,
(LazPackage.Installed<>pitNope) or (LazPackage.AutoInstall<>pitNope));
AddPopupMenuItem('-',nil,true);
AddPopupMenuItem('General Options',@OptionsBitBtnClick,OptionsBitBtn.Enabled); AddPopupMenuItem('General Options',@OptionsBitBtnClick,OptionsBitBtn.Enabled);
AddPopupMenuItem('Compiler Options',@CompilerOptionsBitBtnClick,CompilerOptionsBitBtn.Enabled); AddPopupMenuItem('Compiler Options',@CompilerOptionsBitBtnClick,CompilerOptionsBitBtn.Enabled);
@ -653,6 +668,11 @@ begin
DoSave(true); DoSave(true);
end; end;
procedure TPackageEditorForm.UninstallClick(Sender: TObject);
begin
PackageEditors.UninstallPackage(LazPackage);
end;
procedure TPackageEditorForm.UseMaxVersionCheckBoxClick(Sender: TObject); procedure TPackageEditorForm.UseMaxVersionCheckBoxClick(Sender: TObject);
begin begin
MaxVersionEdit.Enabled:=UseMaxVersionCheckBox.Checked; MaxVersionEdit.Enabled:=UseMaxVersionCheckBox.Checked;
@ -876,14 +896,19 @@ begin
end; end;
end; end;
procedure TPackageEditorForm.CompileAllClick(Sender: TObject); procedure TPackageEditorForm.CompileAllCleanClick(Sender: TObject);
begin begin
DoCompile(true); DoCompile(true,true);
end;
procedure TPackageEditorForm.CompileCleanClick(Sender: TObject);
begin
DoCompile(true,false);
end; end;
procedure TPackageEditorForm.CompileBitBtnClick(Sender: TObject); procedure TPackageEditorForm.CompileBitBtnClick(Sender: TObject);
begin begin
DoCompile(false); DoCompile(false,false);
end; end;
procedure TPackageEditorForm.CompilerOptionsBitBtnClick(Sender: TObject); procedure TPackageEditorForm.CompilerOptionsBitBtnClick(Sender: TObject);
@ -1535,9 +1560,9 @@ begin
UpdateStatusBar; UpdateStatusBar;
end; end;
procedure TPackageEditorForm.DoCompile(CompileAll: boolean); procedure TPackageEditorForm.DoCompile(CompileClean, CompileRequired: boolean);
begin begin
PackageEditors.CompilePackage(LazPackage,CompileAll); PackageEditors.CompilePackage(LazPackage,CompileClean,CompileRequired);
UpdateButtons; UpdateButtons;
UpdateTitle; UpdateTitle;
UpdateStatusBar; UpdateStatusBar;
@ -1799,10 +1824,10 @@ begin
end; end;
function TPackageEditors.CompilePackage(APackage: TLazPackage; function TPackageEditors.CompilePackage(APackage: TLazPackage;
CompileAll: boolean): TModalResult; CompileClean, CompileRequired: boolean): TModalResult;
begin begin
if Assigned(OnCompilePackage) then if Assigned(OnCompilePackage) then
Result:=OnCompilePackage(Self,APackage,CompileAll); Result:=OnCompilePackage(Self,APackage,CompileClean,CompileRequired);
end; end;
procedure TPackageEditors.UpdateAllEditors; procedure TPackageEditors.UpdateAllEditors;
@ -1814,7 +1839,14 @@ end;
function TPackageEditors.InstallPackage(APackage: TLazPackage): TModalResult; function TPackageEditors.InstallPackage(APackage: TLazPackage): TModalResult;
begin begin
if Assigned(OnInstallPackage) then Result:=OnInstallPackage(Self,APackage); if Assigned(OnInstallPackage) then
Result:=OnInstallPackage(Self,APackage);
end;
function TPackageEditors.UninstallPackage(APackage: TLazPackage): TModalResult;
begin
if Assigned(OnUninstallPackage) then
Result:=OnUninstallPackage(Self,APackage);
end; end;
{ TPackageEditorLayout } { TPackageEditorLayout }

View File

@ -129,6 +129,7 @@ type
FirstDependency: TPkgDependency): TList; FirstDependency: TPkgDependency): TList;
function FindUnsavedDependencyPath(APackage: TLazPackage; function FindUnsavedDependencyPath(APackage: TLazPackage;
FirstDependency: TPkgDependency): TList; FirstDependency: TPkgDependency): TList;
function FindAutoInstallDependencyPath(ChildPackage: TLazPackage): TList;
function FindFileInAllPackages(const TheFilename: string; function FindFileInAllPackages(const TheFilename: string;
ResolveLinks, IgnoreDeleted: boolean): TPkgFile; ResolveLinks, IgnoreDeleted: boolean): TPkgFile;
function FindLowestPkgNodeByName(const PkgName: string): TAVLTreeNode; function FindLowestPkgNodeByName(const PkgName: string): TAVLTreeNode;
@ -145,7 +146,8 @@ type
function FindUnitInAllPackages(const TheUnitName: string; function FindUnitInAllPackages(const TheUnitName: string;
IgnoreDeleted: boolean): TPkgFile; IgnoreDeleted: boolean): TPkgFile;
function GetAutoCompilationOrder(APackage: TLazPackage; function GetAutoCompilationOrder(APackage: TLazPackage;
FirstDependency: TPkgDependency): TList; FirstDependency: TPkgDependency;
Policies: TPackageUpdatePolicies): TList;
function GetBrokenDependenciesWhenChangingPkgID(APackage: TLazPackage; function GetBrokenDependenciesWhenChangingPkgID(APackage: TLazPackage;
const NewName: string; NewVersion: TPkgVersion): TList; const NewName: string; NewVersion: TPkgVersion): TList;
function PackageCanBeReplaced(OldPackage, NewPackage: TLazPackage): boolean; function PackageCanBeReplaced(OldPackage, NewPackage: TLazPackage): boolean;
@ -803,7 +805,7 @@ begin
Author:='FPC team'; Author:='FPC team';
License:='LGPL-2'; License:='LGPL-2';
AutoInstall:=pitStatic; AutoInstall:=pitStatic;
AutoUpdate:=false; AutoUpdate:=pupManually;
Description:='The FCL - FreePascal Component Library ' Description:='The FCL - FreePascal Component Library '
+'provides the base classes for object pascal.'; +'provides the base classes for object pascal.';
PackageType:=lptDesignTime; PackageType:=lptDesignTime;
@ -838,7 +840,7 @@ begin
Author:='Lazarus'; Author:='Lazarus';
License:='LGPL-2'; License:='LGPL-2';
AutoInstall:=pitStatic; AutoInstall:=pitStatic;
AutoUpdate:=false; AutoUpdate:=pupManually;
Description:='The LCL - Lazarus Component Library ' Description:='The LCL - Lazarus Component Library '
+'contains all base components for form editing.'; +'contains all base components for form editing.';
PackageType:=lptDesignTime; PackageType:=lptDesignTime;
@ -890,7 +892,7 @@ begin
Author:='SynEdit - http://sourceforge.net/projects/synedit/'; Author:='SynEdit - http://sourceforge.net/projects/synedit/';
License:='LGPL-2'; License:='LGPL-2';
AutoInstall:=pitStatic; AutoInstall:=pitStatic;
AutoUpdate:=false; AutoUpdate:=pupManually;
Description:='SynEdit - the editor component used by Lazarus. ' Description:='SynEdit - the editor component used by Lazarus. '
+'http://sourceforge.net/projects/synedit/'; +'http://sourceforge.net/projects/synedit/';
PackageType:=lptDesignTime; PackageType:=lptDesignTime;
@ -937,7 +939,7 @@ begin
Version.SetValues(1,0,1,1); Version.SetValues(1,0,1,1);
Author:='Anonymous'; Author:='Anonymous';
AutoInstall:=pitStatic; AutoInstall:=pitStatic;
AutoUpdate:=false; AutoUpdate:=pupManually;
Description:='This is the default package. ' Description:='This is the default package. '
+'Used only for components without a package. ' +'Used only for components without a package. '
+'These components are outdated.'; +'These components are outdated.';
@ -1214,10 +1216,53 @@ begin
Result.Insert(0,APackage); Result.Insert(0,APackage);
end; end;
function TLazPackageGraph.GetAutoCompilationOrder(APackage: TLazPackage; function TLazPackageGraph.FindAutoInstallDependencyPath(
FirstDependency: TPkgDependency): TList; ChildPackage: TLazPackage): TList;
procedure GetTopologicalOrder(Dependency: TPkgDependency); procedure FindAutoInstallParent(APackage: TLazPackage);
var
ParentPackage: TLazPackage;
Dependency: TPkgDependency;
begin
Dependency:=APackage.FirstUsedByDependency;
while Dependency<>nil do begin
if Dependency.Owner is TLazPackage then begin
ParentPackage:=TLazPackage(Dependency.Owner);
if not (lpfVisited in ParentPackage.Flags) then begin
ParentPackage.Flags:=ParentPackage.Flags+[lpfVisited];
if ParentPackage.AutoInstall<>pitNope then begin
// auto install parent found
if Result=nil then Result:=TList.Create;
Result.Add(ParentPackage);
Result.Add(APackage);
exit;
end;
FindAutoInstallParent(ParentPackage);
if Result<>nil then begin
// build path
Result.Add(APackage);
exit;
end;
end;
end;
Dependency:=Dependency.NextRequiresDependency;
end;
end;
begin
Result:=nil;
MarkAllPackagesAsNotVisited;
ChildPackage.Flags:=ChildPackage.Flags+[lpfVisited];
FindAutoInstallParent(ChildPackage);
end;
function TLazPackageGraph.GetAutoCompilationOrder(APackage: TLazPackage;
FirstDependency: TPkgDependency; Policies: TPackageUpdatePolicies): TList;
// Returns all required auto update packages, including indirect requirements.
// The packages will be in topological order, with the package that should be
// compiled first at the end.
procedure GetLevelOrder(Dependency: TPkgDependency);
var var
RequiredPackage: TLazPackage; RequiredPackage: TLazPackage;
begin begin
@ -1226,9 +1271,9 @@ function TLazPackageGraph.GetAutoCompilationOrder(APackage: TLazPackage;
RequiredPackage:=Dependency.RequiredPackage; RequiredPackage:=Dependency.RequiredPackage;
if not (lpfVisited in RequiredPackage.Flags) then begin if not (lpfVisited in RequiredPackage.Flags) then begin
RequiredPackage.Flags:=RequiredPackage.Flags+[lpfVisited]; RequiredPackage.Flags:=RequiredPackage.Flags+[lpfVisited];
if RequiredPackage.AutoUpdate then begin if RequiredPackage.AutoUpdate in Policies then begin
// add first all needed packages // add first all needed packages
GetTopologicalOrder(RequiredPackage.FirstRequiredDependency); GetLevelOrder(RequiredPackage.FirstRequiredDependency);
// then add this package // then add this package
if Result=nil then Result:=TList.Create; if Result=nil then Result:=TList.Create;
Result.Add(RequiredPackage); Result.Add(RequiredPackage);
@ -1246,7 +1291,7 @@ begin
APackage.Flags:=APackage.Flags+[lpfVisited]; APackage.Flags:=APackage.Flags+[lpfVisited];
FirstDependency:=APackage.FirstRequiredDependency; FirstDependency:=APackage.FirstRequiredDependency;
end; end;
GetTopologicalOrder(FirstDependency); GetLevelOrder(FirstDependency);
end; end;
procedure TLazPackageGraph.MarkAllPackagesAsNotVisited; procedure TLazPackageGraph.MarkAllPackagesAsNotVisited;
@ -1368,7 +1413,7 @@ var
Dependency: TPkgDependency; Dependency: TPkgDependency;
begin begin
Result:=false; Result:=false;
if OldPackage.Broken and (AnsiCompareText(OldPackage.Name,NewPackage.Name)=0) if OldPackage.Missing and (AnsiCompareText(OldPackage.Name,NewPackage.Name)=0)
then begin then begin
Result:=true; Result:=true;
exit; exit;
@ -1557,14 +1602,14 @@ begin
BrokenPackage:=TLazPackage.Create; BrokenPackage:=TLazPackage.Create;
with BrokenPackage do begin with BrokenPackage do begin
BeginUpdate; BeginUpdate;
Broken:=true; Missing:=true;
AutoCreated:=true; AutoCreated:=true;
Name:=Dependency.PackageName; Name:=Dependency.PackageName;
Filename:=''; Filename:='';
Version.SetValues(0,0,0,0); Version.SetValues(0,0,0,0);
Author:='?'; Author:='?';
License:='?'; License:='?';
AutoUpdate:=false; AutoUpdate:=pupManually;
Description:='This package is installed, but the lpk file was not found.' Description:='This package is installed, but the lpk file was not found.'
+'All its components are deactivated. Please fix this.'; +'All its components are deactivated. Please fix this.';
PackageType:=lptDesignTime; PackageType:=lptDesignTime;

View File

@ -59,11 +59,14 @@ type
TPkgManager = class(TBasePkgManager) TPkgManager = class(TBasePkgManager)
// events // events
function OnPackageEditorCompilePackage(Sender: TObject; function OnPackageEditorCompilePackage(Sender: TObject;
APackage: TLazPackage; CompileAll: boolean): TModalResult; APackage: TLazPackage;
CompileClean, CompileRequired: boolean): TModalResult;
function OnPackageEditorCreateFile(Sender: TObject; function OnPackageEditorCreateFile(Sender: TObject;
const Params: TAddToPkgResult): TModalResult; const Params: TAddToPkgResult): TModalResult;
function OnPackageEditorInstallPackage(Sender: TObject; function OnPackageEditorInstallPackage(Sender: TObject;
APackage: TLazPackage): TModalResult; APackage: TLazPackage): TModalResult;
function OnPackageEditorUninstallPackage(Sender: TObject;
APackage: TLazPackage): TModalResult;
function OnPackageEditorOpenPackage(Sender: TObject; APackage: TLazPackage function OnPackageEditorOpenPackage(Sender: TObject; APackage: TLazPackage
): TModalResult; ): TModalResult;
function OnPackageEditorSavePackage(Sender: TObject; APackage: TLazPackage; function OnPackageEditorSavePackage(Sender: TObject; APackage: TLazPackage;
@ -98,7 +101,8 @@ type
// helper functions // helper functions
function DoShowSavePackageAsDialog(APackage: TLazPackage): TModalResult; function DoShowSavePackageAsDialog(APackage: TLazPackage): TModalResult;
function CompileRequiredPackages(APackage: TLazPackage; function CompileRequiredPackages(APackage: TLazPackage;
FirstDependency: TPkgDependency): TModalResult; FirstDependency: TPkgDependency;
Policies: TPackageUpdatePolicies): TModalResult;
function CheckPackageGraphForCompilation(APackage: TLazPackage; function CheckPackageGraphForCompilation(APackage: TLazPackage;
FirstDependency: TPkgDependency): TModalResult; FirstDependency: TPkgDependency): TModalResult;
function DoPreparePackageOutputDirectory(APackage: TLazPackage): TModalResult; function DoPreparePackageOutputDirectory(APackage: TLazPackage): TModalResult;
@ -168,6 +172,7 @@ type
NewFilename: string): TModalResult; override; NewFilename: string): TModalResult; override;
function DoAddActiveUnitToAPackage: TModalResult; function DoAddActiveUnitToAPackage: TModalResult;
function DoInstallPackage(APackage: TLazPackage): TModalResult; function DoInstallPackage(APackage: TLazPackage): TModalResult;
function DoUninstallPackage(APackage: TLazPackage): TModalResult;
function DoCompileAutoInstallPackages(Flags: TPkgCompileFlags function DoCompileAutoInstallPackages(Flags: TPkgCompileFlags
): TModalResult; override; ): TModalResult; override;
function DoSaveAutoInstallConfig: TModalResult; override; function DoSaveAutoInstallConfig: TModalResult; override;
@ -253,12 +258,13 @@ begin
end; end;
function TPkgManager.OnPackageEditorCompilePackage(Sender: TObject; function TPkgManager.OnPackageEditorCompilePackage(Sender: TObject;
APackage: TLazPackage; CompileAll: boolean): TModalResult; APackage: TLazPackage; CompileClean, CompileRequired: boolean): TModalResult;
var var
Flags: TPkgCompileFlags; Flags: TPkgCompileFlags;
begin begin
Flags:=[]; Flags:=[];
if CompileAll then Include(Flags,pcfCleanCompile); if CompileClean then Include(Flags,pcfCleanCompile);
if CompileRequired then Include(Flags,pcfCompileDependenciesClean);
Result:=DoCompilePackage(APackage,Flags); Result:=DoCompilePackage(APackage,Flags);
end; end;
@ -318,6 +324,12 @@ begin
Result:=DoInstallPackage(APackage); Result:=DoInstallPackage(APackage);
end; end;
function TPkgManager.OnPackageEditorUninstallPackage(Sender: TObject;
APackage: TLazPackage): TModalResult;
begin
Result:=DoUninstallPackage(APackage);
end;
procedure TPkgManager.OnPackageEditorFreeEditor(APackage: TLazPackage); procedure TPkgManager.OnPackageEditorFreeEditor(APackage: TLazPackage);
begin begin
APackage.Editor:=nil; APackage.Editor:=nil;
@ -622,13 +634,15 @@ begin
end; end;
function TPkgManager.CompileRequiredPackages(APackage: TLazPackage; function TPkgManager.CompileRequiredPackages(APackage: TLazPackage;
FirstDependency: TPkgDependency): TModalResult; FirstDependency: TPkgDependency;
Policies: TPackageUpdatePolicies): TModalResult;
var var
AutoPackages: TList; AutoPackages: TList;
i: Integer; i: Integer;
begin begin
writeln('TPkgManager.CompileRequiredPackages A '); writeln('TPkgManager.CompileRequiredPackages A ');
AutoPackages:=PackageGraph.GetAutoCompilationOrder(APackage,FirstDependency); AutoPackages:=PackageGraph.GetAutoCompilationOrder(APackage,FirstDependency,
Policies);
if AutoPackages<>nil then begin if AutoPackages<>nil then begin
writeln('TPkgManager.CompileRequiredPackages B Count=',AutoPackages.Count); writeln('TPkgManager.CompileRequiredPackages B Count=',AutoPackages.Count);
try try
@ -1166,15 +1180,17 @@ constructor TPkgManager.Create(TheOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
OnGetDependencyOwnerDescription:=@GetDependencyOwnerDescription; OnGetDependencyOwnerDescription:=@GetDependencyOwnerDescription;
// componentpalette
IDEComponentPalette:=TComponentPalette.Create; IDEComponentPalette:=TComponentPalette.Create;
IDEComponentPalette.OnEndUpdate:=@IDEComponentPaletteEndUpdate; IDEComponentPalette.OnEndUpdate:=@IDEComponentPaletteEndUpdate;
TComponentPalette(IDEComponentPalette).OnOpenPackage:=@IDEComponentPaletteOpenPackage; TComponentPalette(IDEComponentPalette).OnOpenPackage:=@IDEComponentPaletteOpenPackage;
// package links
PkgLinks:=TPackageLinks.Create; PkgLinks:=TPackageLinks.Create;
PkgLinks.UpdateAll; PkgLinks.UpdateAll;
// package graph
PackageGraph:=TLazPackageGraph.Create; PackageGraph:=TLazPackageGraph.Create;
PackageGraph.OnChangePackageName:=@PackageGraphChangePackageName; PackageGraph.OnChangePackageName:=@PackageGraphChangePackageName;
PackageGraph.OnAddPackage:=@PackageGraphAddPackage; PackageGraph.OnAddPackage:=@PackageGraphAddPackage;
@ -1183,6 +1199,7 @@ begin
PackageGraph.OnBeginUpdate:=@PackageGraphBeginUpdate; PackageGraph.OnBeginUpdate:=@PackageGraphBeginUpdate;
PackageGraph.OnEndUpdate:=@PackageGraphEndUpdate; PackageGraph.OnEndUpdate:=@PackageGraphEndUpdate;
// package editors
PackageEditors:=TPackageEditors.Create; PackageEditors:=TPackageEditors.Create;
PackageEditors.OnOpenFile:=@MainIDE.DoOpenMacroFile; PackageEditors.OnOpenFile:=@MainIDE.DoOpenMacroFile;
PackageEditors.OnOpenPackage:=@OnPackageEditorOpenPackage; PackageEditors.OnOpenPackage:=@OnPackageEditorOpenPackage;
@ -1193,7 +1210,9 @@ begin
PackageEditors.OnSavePackage:=@OnPackageEditorSavePackage; PackageEditors.OnSavePackage:=@OnPackageEditorSavePackage;
PackageEditors.OnCompilePackage:=@OnPackageEditorCompilePackage; PackageEditors.OnCompilePackage:=@OnPackageEditorCompilePackage;
PackageEditors.OnInstallPackage:=@OnPackageEditorInstallPackage; PackageEditors.OnInstallPackage:=@OnPackageEditorInstallPackage;
PackageEditors.OnUninstallPackage:=@OnPackageEditorUninstallPackage;
// package macros
CodeToolBoss.DefineTree.MacroFunctions.AddExtended( CodeToolBoss.DefineTree.MacroFunctions.AddExtended(
'PKGSRCPATH',nil,@MacroFunctionPkgSrcPath); 'PKGSRCPATH',nil,@MacroFunctionPkgSrcPath);
CodeToolBoss.DefineTree.MacroFunctions.AddExtended( CodeToolBoss.DefineTree.MacroFunctions.AddExtended(
@ -1201,6 +1220,7 @@ begin
CodeToolBoss.DefineTree.MacroFunctions.AddExtended( CodeToolBoss.DefineTree.MacroFunctions.AddExtended(
'PKGINCPATH',nil,@MacroFunctionPkgIncPath); 'PKGINCPATH',nil,@MacroFunctionPkgIncPath);
// idle handler
Application.AddOnIdleHandler(@OnApplicationIdle); Application.AddOnIdleHandler(@OnApplicationIdle);
end; end;
@ -1685,7 +1705,8 @@ begin
try try
// automatically compile required packages // automatically compile required packages
if not (pcfDoNotCompileDependencies in Flags) then begin if not (pcfDoNotCompileDependencies in Flags) then begin
Result:=CompileRequiredPackages(nil,AProject.FirstRequiredDependency); Result:=CompileRequiredPackages(nil,AProject.FirstRequiredDependency,
[pupAsNeeded]);
if Result<>mrOk then exit; if Result<>mrOk then exit;
end; end;
finally finally
@ -1703,6 +1724,7 @@ var
CompilerParams: String; CompilerParams: String;
EffektiveCompilerParams: String; EffektiveCompilerParams: String;
SrcFilename: String; SrcFilename: String;
CompilePolicies: TPackageUpdatePolicies;
begin begin
Result:=mrCancel; Result:=mrCancel;
@ -1726,7 +1748,10 @@ begin
try try
// automatically compile required packages // automatically compile required packages
if not (pcfDoNotCompileDependencies in Flags) then begin if not (pcfDoNotCompileDependencies in Flags) then begin
Result:=CompileRequiredPackages(APackage,nil); CompilePolicies:=[pupAsNeeded];
if pcfCompileDependenciesClean in Flags then
Include(CompilePolicies,pupOnRebuildingAll);
Result:=CompileRequiredPackages(APackage,nil,[pupAsNeeded]);
if Result<>mrOk then exit; if Result<>mrOk then exit;
end; end;
@ -2047,6 +2072,7 @@ begin
'The package "'+APackage.IDAsString+'" was marked for installation.'#13 'The package "'+APackage.IDAsString+'" was marked for installation.'#13
+'Currently lazarus only supports static linked packages. The real ' +'Currently lazarus only supports static linked packages. The real '
+'installation needs rebuilding of lazarus.'#13 +'installation needs rebuilding of lazarus.'#13
+#13
+'Should lazarus now be rebuilt?', +'Should lazarus now be rebuilt?',
mtConfirmation,[mbYes,mbNo],0); mtConfirmation,[mbYes,mbNo],0);
if Result=mrNo then begin if Result=mrNo then begin
@ -2064,6 +2090,70 @@ begin
Result:=mrOk; Result:=mrOk;
end; end;
function TPkgManager.DoUninstallPackage(APackage: TLazPackage): TModalResult;
var
DependencyPath: TList;
ParentPackage: TLazPackage;
Dependency: TPkgDependency;
begin
if (APackage.Installed=pitNope) and (APackage.AutoInstall=pitNope) then exit;
// check if package is required by auto install package
DependencyPath:=PackageGraph.FindAutoInstallDependencyPath(APackage);
if DependencyPath<>nil then begin
DoShowPackageGraphPathList(DependencyPath);
ParentPackage:=TLazPackage(DependencyPath[0]);
Result:=MessageDlg('Package is required',
'The package '+APackage.IDAsString+' is required by '
+ParentPackage.IDAsString+', which is marked for installation.'#13
+'See package graph.',
mtError,[mbCancel,mbAbort],0);
exit;
end;
PackageGraph.BeginUpdate(false);
try
// save package
if APackage.IsVirtual or APackage.Modified then begin
Result:=DoSavePackage(APackage,[]);
if Result<>mrOk then exit;
end;
// remove package from auto installed packages
if APackage.AutoInstall<>pitNope then begin
APackage.AutoInstall:=pitNope;
Dependency:=FindCompatibleDependencyInList(FirstAutoInstallDependency,
pdlRequires,APackage);
if Dependency<>nil then begin
Dependency.RemoveFromList(FirstAutoInstallDependency,pdlRequires);
Dependency.Free;
end;
SaveAutoInstallDependencies;
end;
// ask user to rebuilt Lazarus now
Result:=MessageDlg('Rebuild Lazarus?',
'The package "'+APackage.IDAsString+'" was marked.'#13
+'Currently lazarus only supports static linked packages. The real '
+'un-installation needs rebuilding of lazarus.'#13
+#13
+'Should lazarus now be rebuilt?',
mtConfirmation,[mbYes,mbNo],0);
if Result=mrNo then begin
Result:=mrOk;
exit;
end;
// rebuild Lazarus
Result:=MainIDE.DoBuildLazarus([blfWithStaticPackages]);
if Result<>mrOk then exit;
finally
PackageGraph.EndUpdate;
end;
Result:=mrOk;
end;
function TPkgManager.DoCompileAutoInstallPackages( function TPkgManager.DoCompileAutoInstallPackages(
Flags: TPkgCompileFlags): TModalResult; Flags: TPkgCompileFlags): TModalResult;
var var
@ -2100,7 +2190,7 @@ begin
end; end;
// compile all auto install dependencies // compile all auto install dependencies
Result:=CompileRequiredPackages(nil,FirstAutoInstallDependency); Result:=CompileRequiredPackages(nil,FirstAutoInstallDependency,[pupAsNeeded]);
if Result<>mrOk then exit; if Result<>mrOk then exit;
finally finally

View File

@ -303,13 +303,13 @@ begin
x:=3; x:=3;
y:=3; y:=3;
w:=(IDEPage.ClientWidth-2*x); w:=(IDEPage.ClientWidth-2*x);
h:=85; h:=90;
with PkgTypeRadioGroup do begin with PkgTypeRadioGroup do begin
SetBounds(x,y,w,h); SetBounds(x,y,w,h);
inc(y,h+5); inc(y,h+10);
end; end;
h:=75; h:=90;
with UpdateRadioGroup do with UpdateRadioGroup do
SetBounds(x,y,w,h); SetBounds(x,y,w,h);
end; end;
@ -381,7 +381,11 @@ begin
// Usage page // Usage page
LazPackage.PackageType:=NewPackageType; LazPackage.PackageType:=NewPackageType;
LazPackage.AutoUpdate:=(UpdateRadioGroup.ItemIndex=0); case UpdateRadioGroup.ItemIndex of
2: LazPackage.AutoUpdate:=pupManually;
1: LazPackage.AutoUpdate:=pupOnRebuildingAll;
else LazPackage.AutoUpdate:=pupAsNeeded;
end;
with LazPackage.UsageOptions do begin with LazPackage.UsageOptions do begin
UnitPath:=UnitPathEdit.Text; UnitPath:=UnitPathEdit.Text;
IncludePath:=IncludePathEdit.Text; IncludePath:=IncludePathEdit.Text;
@ -664,8 +668,9 @@ begin
Caption:='Update/Rebuild'; Caption:='Update/Rebuild';
with Items do begin with Items do begin
BeginUpdate; BeginUpdate;
Add('Automatically re-compile as needed'); Add('Automatically rebuild as needed');
Add('Manual compilation'); Add('Auto rebuild when rebuilding all');
Add('Manual compilation (never automatically)');
EndUpdate; EndUpdate;
end; end;
ItemIndex:=0; ItemIndex:=0;
@ -835,10 +840,11 @@ begin
// Usage page // Usage page
ReadPkgTypeFromPackage; ReadPkgTypeFromPackage;
if LazPackage.AutoUpdate then case LazPackage.AutoUpdate of
UpdateRadioGroup.ItemIndex:=0 pupAsNeeded: UpdateRadioGroup.ItemIndex:=0;
else pupOnRebuildingAll: UpdateRadioGroup.ItemIndex:=1;
UpdateRadioGroup.ItemIndex:=1; else UpdateRadioGroup.ItemIndex:=2;
end;
with LazPackage.UsageOptions do begin with LazPackage.UsageOptions do begin
UnitPathEdit.Text:=UnitPath; UnitPathEdit.Text:=UnitPath;