mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-16 04:40:40 +01:00
IDE: package options: work on real package and restore via backup
git-svn-id: trunk@30886 -
This commit is contained in:
parent
8359cb4b2e
commit
430d0550d3
@ -622,6 +622,7 @@ type
|
||||
constructor Create(TheOwner: TObject);
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
procedure AssignOptions(Source: TObject); virtual;
|
||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
AdjustPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||
@ -1318,7 +1319,7 @@ begin
|
||||
{ Target }
|
||||
p:=Path+'Target/';
|
||||
TargetFilename := f(aXMLConfig.GetValue(p+'Filename/Value', ''));
|
||||
TargetFilenameAppplyConventions := aXMLConfig.GetValue(p+'Filename/ApplyConventions', true);
|
||||
TargetFilenameApplyConventions := aXMLConfig.GetValue(p+'Filename/ApplyConventions', true);
|
||||
|
||||
{ SearchPaths }
|
||||
p:=Path+'SearchPaths/';
|
||||
@ -1534,7 +1535,7 @@ begin
|
||||
{ Target }
|
||||
p:=Path+'Target/';
|
||||
aXMLConfig.SetDeleteValue(p+'Filename/Value', f(TargetFilename),'');
|
||||
aXMLConfig.SetDeleteValue(p+'Filename/ApplyConventions', TargetFilenameAppplyConventions,true);
|
||||
aXMLConfig.SetDeleteValue(p+'Filename/ApplyConventions', TargetFilenameApplyConventions,true);
|
||||
|
||||
{ SearchPaths }
|
||||
p:=Path+'SearchPaths/';
|
||||
@ -1778,7 +1779,7 @@ begin
|
||||
Result:=CreateAbsolutePath(OutFilename,UnitOutDir);
|
||||
end;
|
||||
Result:=TrimFilename(Result);
|
||||
if TargetFilenameAppplyConventions then begin
|
||||
if TargetFilenameApplyConventions then begin
|
||||
AppendDefaultExt;
|
||||
PrependDefaultType;
|
||||
end;
|
||||
@ -2780,6 +2781,8 @@ begin
|
||||
// append custom options as last, so they can override
|
||||
if not (ccloNoMacroParams in Flags) then
|
||||
begin
|
||||
//debugln(['TBaseCompilerOptions.MakeOptionsString ',DbgSName(Self)]);
|
||||
//DumpStack;
|
||||
CurCustomOptions:=GetCustomOptions(coptParsed);
|
||||
if CurCustomOptions<>'' then
|
||||
switches := switches+' '+CurCustomOptions;
|
||||
@ -2989,7 +2992,7 @@ begin
|
||||
|
||||
// Target
|
||||
TargetFilename := CompOpts.TargetFilename;
|
||||
TargetFilenameAppplyConventions := CompOpts.TargetFilenameAppplyConventions;
|
||||
TargetFilenameApplyConventions := CompOpts.TargetFilenameApplyConventions;
|
||||
|
||||
// Search Paths
|
||||
StorePathDelim := CompOpts.StorePathDelim;
|
||||
@ -3357,6 +3360,23 @@ begin
|
||||
ObjectPath:='';
|
||||
end;
|
||||
|
||||
procedure TAdditionalCompilerOptions.AssignOptions(Source: TObject);
|
||||
var
|
||||
Src: TAdditionalCompilerOptions;
|
||||
begin
|
||||
if not (Source is TAdditionalCompilerOptions) then
|
||||
raise Exception.Create('TAdditionalCompilerOptions.AssignOptions: Can not copy from '+DbgSName(Source));
|
||||
Src:=TAdditionalCompilerOptions(Source);
|
||||
UnitPath:=Src.UnitPath;
|
||||
IncludePath:=Src.IncludePath;
|
||||
SrcPath:=Src.SrcPath;
|
||||
ObjectPath:=Src.ObjectPath;
|
||||
LibraryPath:=Src.LibraryPath;
|
||||
LinkerOptions:=Src.LinkerOptions;
|
||||
CustomOptions:=Src.CustomOptions;
|
||||
BaseDirectory:=Src.BaseDirectory;
|
||||
end;
|
||||
|
||||
procedure TAdditionalCompilerOptions.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||
const Path: string; AdjustPathDelims: boolean);
|
||||
|
||||
|
||||
@ -62,7 +62,6 @@ type
|
||||
procedure DoLoadSave(Sender: TObject);
|
||||
protected
|
||||
procedure DoSaveSettings(AOptions: TAbstractIDEOptions);
|
||||
function GetTargetFilename: string;
|
||||
procedure UpdateTargetFileLabel;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
@ -227,58 +226,35 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCompilerPathOptionsFrame.DoShowOptions(Sender: TObject);
|
||||
var
|
||||
Options: TBaseCompilerOptions;
|
||||
begin
|
||||
Options := TBaseCompilerOptionsClass(FCompilerOpts.ClassType).Create(FCompilerOpts.Owner);
|
||||
try
|
||||
Options.BaseDirectory:=FCompilerOpts.BaseDirectory;
|
||||
DoSaveSettings(Options);
|
||||
Options.TargetFilename:=GetTargetFilename;
|
||||
ShowCompilerOptionsDialog(FDialog, Options);
|
||||
finally
|
||||
Options.Free;
|
||||
end;
|
||||
DoSaveSettings(FCompilerOpts);
|
||||
ShowCompilerOptionsDialog(FDialog, FCompilerOpts);
|
||||
end;
|
||||
|
||||
procedure TCompilerPathOptionsFrame.DoCheck(Sender: TObject);
|
||||
var
|
||||
Options: TBaseCompilerOptions;
|
||||
begin
|
||||
Options := TBaseCompilerOptionsClass(FCompilerOpts.ClassType).Create(FCompilerOpts.Owner);
|
||||
try
|
||||
Options.BaseDirectory:=FCompilerOpts.BaseDirectory;
|
||||
DoSaveSettings(Options);
|
||||
if Assigned(TestCompilerOptions) then
|
||||
begin
|
||||
btnCheck.Enabled := False;
|
||||
try
|
||||
TestCompilerOptions(Options);
|
||||
finally
|
||||
btnCheck.Enabled := True;
|
||||
end;
|
||||
DoSaveSettings(FCompilerOpts);
|
||||
if Assigned(TestCompilerOptions) then
|
||||
begin
|
||||
btnCheck.Enabled := False;
|
||||
try
|
||||
TestCompilerOptions(FCompilerOpts);
|
||||
finally
|
||||
btnCheck.Enabled := True;
|
||||
end;
|
||||
finally
|
||||
Options.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCompilerPathOptionsFrame.DoLoadSave(Sender: TObject);
|
||||
var
|
||||
Options: TBaseCompilerOptions;
|
||||
ImportExportResult: TImportExportOptionsResult;
|
||||
begin
|
||||
Options := TBaseCompilerOptionsClass(FCompilerOpts.ClassType).Create(FCompilerOpts.Owner);
|
||||
try
|
||||
DoSaveSettings(Options);
|
||||
if (MainIDEInterface.DoImExportCompilerOptions(Options, ImportExportResult) = mrOK) and
|
||||
(ImportExportResult = ieorImport) then
|
||||
begin
|
||||
if Assigned(OnLoadIDEOptions) then
|
||||
OnLoadIDEOptions(Self, Options);
|
||||
end;
|
||||
finally
|
||||
Options.Free;
|
||||
DoSaveSettings(FCompilerOpts);
|
||||
if (MainIDEInterface.DoImExportCompilerOptions(FCompilerOpts, ImportExportResult) = mrOK) and
|
||||
(ImportExportResult = ieorImport) then
|
||||
begin
|
||||
if Assigned(OnLoadIDEOptions) then
|
||||
OnLoadIDEOptions(Self, FCompilerOpts);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -288,12 +264,6 @@ begin
|
||||
OnSaveIDEOptions(Self, AOptions);
|
||||
end;
|
||||
|
||||
function TCompilerPathOptionsFrame.GetTargetFilename: string;
|
||||
begin
|
||||
if FCompilerOpts is TProjectCompilerOptions then
|
||||
Result:=ProjTargetFileEdit.Text;
|
||||
end;
|
||||
|
||||
procedure TCompilerPathOptionsFrame.UpdateTargetFileLabel;
|
||||
begin
|
||||
if ProjTargetFileEdit.Text<>'' then
|
||||
@ -782,7 +752,7 @@ begin
|
||||
ProjTargetFileEdit.Visible:=true;
|
||||
ProjTargetFileLabel.Visible:=true;
|
||||
ProjTargetFileEdit.Text:=TProjectCompilerOptions(AOptions).TargetFilename;
|
||||
ProjTargetApplyConventionsCheckBox.Checked:=TProjectCompilerOptions(AOptions).TargetFilenameAppplyConventions;
|
||||
ProjTargetApplyConventionsCheckBox.Checked:=TProjectCompilerOptions(AOptions).TargetFilenameApplyConventions;
|
||||
ProjTargetApplyConventionsCheckBox.Visible:=true;
|
||||
LCLWidgetTypeLabel.Visible:=true;;
|
||||
UpdateTargetFileLabel;
|
||||
@ -810,7 +780,7 @@ procedure TCompilerPathOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions)
|
||||
begin
|
||||
if AOptions is TProjectCompilerOptions then begin
|
||||
TProjectCompilerOptions(AOptions).TargetFilename:=ProjTargetFileEdit.Text;
|
||||
TProjectCompilerOptions(AOptions).TargetFilenameAppplyConventions:=ProjTargetApplyConventionsCheckBox.Checked;
|
||||
TProjectCompilerOptions(AOptions).TargetFilenameApplyConventions:=ProjTargetApplyConventionsCheckBox.Checked;
|
||||
end;
|
||||
|
||||
with AOptions as TBaseCompilerOptions do
|
||||
|
||||
@ -13373,7 +13373,6 @@ begin
|
||||
DebugLn('WARNING: Macro not defined: "'+MacroName+'".');
|
||||
s:='';
|
||||
//MessageDlg('Unknown Macro','Macro not defined: "'+s+'".',mtError,[mbAbort],0);
|
||||
//DumpStack;
|
||||
Handled:=true;
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -306,7 +306,7 @@ type
|
||||
|
||||
// target:
|
||||
property TargetFilename: String read fTargetFilename write SetTargetFilename;
|
||||
property TargetFilenameAppplyConventions: boolean read FTargetFilenameAppplyConventions write SetTargetFilenameAppplyConventions;
|
||||
property TargetFilenameApplyConventions: boolean read FTargetFilenameAppplyConventions write SetTargetFilenameAppplyConventions;
|
||||
|
||||
// parsing:
|
||||
property SyntaxMode: string read FSyntaxMode write SetSyntaxMode;
|
||||
|
||||
@ -95,6 +95,7 @@ type
|
||||
procedure UpdateIDAsString;
|
||||
procedure VersionChanged(Sender: TObject); virtual;
|
||||
public
|
||||
procedure AssignOptions(Source: TPersistent); virtual;
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
function StringToID(const s: string): boolean;
|
||||
@ -128,6 +129,7 @@ type
|
||||
function GetRemovedCount: integer; virtual; abstract;
|
||||
function GetRemovedPkgFiles(Index: integer): TLazPackageFile; virtual; abstract;
|
||||
public
|
||||
procedure AssignOptions(Source: TPersistent); override;
|
||||
function IsVirtual: boolean; virtual; abstract;
|
||||
function ReadOnly: boolean; virtual; abstract;
|
||||
constructor Create;
|
||||
@ -577,6 +579,20 @@ begin
|
||||
UpdateIDAsString;
|
||||
end;
|
||||
|
||||
procedure TLazPackageID.AssignOptions(Source: TPersistent);
|
||||
var
|
||||
aSource: TLazPackageID;
|
||||
begin
|
||||
if Source is TLazPackageID then
|
||||
begin
|
||||
aSource:=TLazPackageID(Source);
|
||||
aSource.FVersion.Assign(FVersion);
|
||||
Name:=aSource.FName;
|
||||
UpdateIDAsString;
|
||||
end else
|
||||
raise Exception.Create('TLazPackageID.AssignOptions: can not copy from '+DbgSName(Source));
|
||||
end;
|
||||
|
||||
function TLazPackageID.StringToID(const s: string): boolean;
|
||||
var
|
||||
IdentEndPos: Integer;
|
||||
@ -638,6 +654,20 @@ end;
|
||||
|
||||
{ TIDEPackage }
|
||||
|
||||
procedure TIDEPackage.AssignOptions(Source: TPersistent);
|
||||
var
|
||||
aSource: TIDEPackage;
|
||||
begin
|
||||
inherited AssignOptions(Source);
|
||||
if Source is TIDEPackage then
|
||||
begin
|
||||
aSource:=TIDEPackage(Source);
|
||||
LazCompilerOptions.Assign(aSource.LazCompilerOptions);
|
||||
// ToDo:
|
||||
//FCustomOptions:=aSource.FCustomOptions;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TIDEPackage.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
@ -409,6 +409,7 @@ type
|
||||
procedure SetSrcPath(const AValue: string); override;
|
||||
public
|
||||
constructor Create(ThePackage: TLazPackage);
|
||||
procedure AssignOptions(Source: TObject); override;
|
||||
function GetOwnerName: string; override;
|
||||
function GetBaseCompilerOptions: TBaseCompilerOptions; override;
|
||||
public
|
||||
@ -562,6 +563,7 @@ type
|
||||
FAutoCreated: boolean;
|
||||
FAutoInstall: TPackageInstallType;
|
||||
FAutoUpdate: TPackageUpdatePolicy;
|
||||
FOptionsBackup: TLazPackage;
|
||||
FCompilerOptions: TPkgCompilerOptions;
|
||||
FComponents: TFPList; // TFPList of TPkgComponent
|
||||
FDefineTemplates: TLazPackageDefineTemplates;
|
||||
@ -652,11 +654,14 @@ type
|
||||
function GetRemovedCount: integer; override;
|
||||
function GetRemovedPkgFiles(Index: integer): TLazPackageFile; override;
|
||||
public
|
||||
procedure AssignOptions(Source: TPersistent); override;
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
// IDE options
|
||||
class function GetGroupCaption: string; override;
|
||||
class function GetInstance: TAbstractIDEOptions; override;
|
||||
procedure BackupOptions;
|
||||
procedure RestoreOptions;
|
||||
// modified
|
||||
procedure BeginUpdate;
|
||||
procedure EndUpdate;
|
||||
@ -800,6 +805,7 @@ type
|
||||
property Macros: TTransferMacroList read FMacros;
|
||||
property MainUnit: TPkgFile read FMainUnit;
|
||||
property Missing: boolean read FMissing write FMissing;
|
||||
property OptionsBackup: TLazPackage read FOptionsBackup;
|
||||
property OutputStateFile: string read FOutputStateFile write SetOutputStateFile;
|
||||
property PackageType: TLazPackageType read FPackageType
|
||||
write SetPackageType;
|
||||
@ -937,7 +943,7 @@ procedure PkgVersionLoadFromXMLConfig(Version: TPkgVersion;
|
||||
XMLConfig: TXMLConfig);
|
||||
|
||||
var
|
||||
CurPackage: TLazPackage; // don't use it - only for options dialog
|
||||
Package1: TLazPackage; // don't use it - only for options dialog
|
||||
|
||||
implementation
|
||||
|
||||
@ -2112,7 +2118,8 @@ begin
|
||||
if Macro<>nil then
|
||||
begin
|
||||
s:=GetCTCSVariableAsString(Macro);
|
||||
//debugln(['TLazPackage.OnMacroListSubstitution Pkg=',Name,' Macro=',MacroName,' Value="',s,'"']);
|
||||
//if MacroName='MyPackageOptions' then
|
||||
// debugln(['TLazPackage.OnMacroListSubstitution Pkg=',Name,' Macro=',MacroName,' Value="',s,'"']);
|
||||
Handled:=true;
|
||||
exit;
|
||||
end;
|
||||
@ -2207,6 +2214,35 @@ begin
|
||||
Result:=GetRemovedFiles(Index);
|
||||
end;
|
||||
|
||||
procedure TLazPackage.AssignOptions(Source: TPersistent);
|
||||
var
|
||||
aSource: TLazPackage;
|
||||
begin
|
||||
inherited AssignOptions(Source);
|
||||
if Source is TLazPackage then
|
||||
begin
|
||||
aSource:=TLazPackage(Source);
|
||||
UserReadOnly:=aSource.UserReadOnly;
|
||||
Translated:=aSource.Translated;
|
||||
StorePathDelim:=aSource.StorePathDelim;
|
||||
// ToDo: PublishOptions.AssignOptions(aSource.PublishOptions);
|
||||
Provides.Assign(aSource.Provides);
|
||||
POOutputDirectory:=aSource.POOutputDirectory;
|
||||
PackageType:=aSource.PackageType;
|
||||
OutputStateFile:=aSource.OutputStateFile;
|
||||
License:=aSource.License;
|
||||
LazDocPaths:=aSource.LazDocPaths;
|
||||
IconFile:=aSource.IconFile;
|
||||
UsageOptions.AssignOptions(aSource.UsageOptions);
|
||||
EnableI18N:=aSource.EnableI18N;
|
||||
Description:=aSource.Description;
|
||||
AutoUpdate:=aSource.AutoUpdate;
|
||||
AutoIncrementVersionOnBuild:=aSource.AutoIncrementVersionOnBuild;
|
||||
Author:=aSource.Author;
|
||||
AddToProjectUsesSection:=aSource.AddToProjectUsesSection;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLazPackage.GetRemovedFiles(Index: integer): TPkgFile;
|
||||
begin
|
||||
Result:=TPkgFile(FRemovedFiles[Index]);
|
||||
@ -2489,6 +2525,7 @@ destructor TLazPackage.Destroy;
|
||||
begin
|
||||
Include(FFlags,lpfDestroying);
|
||||
Clear;
|
||||
FreeAndNil(FOptionsBackup);
|
||||
FreeAndNil(fPublishOptions);
|
||||
FreeAndNil(FProvides);
|
||||
FreeAndNil(FDefineTemplates);
|
||||
@ -2509,7 +2546,25 @@ end;
|
||||
|
||||
class function TLazPackage.GetInstance: TAbstractIDEOptions;
|
||||
begin
|
||||
Result := CurPackage;
|
||||
Result := Package1;
|
||||
end;
|
||||
|
||||
procedure TLazPackage.BackupOptions;
|
||||
begin
|
||||
if FOptionsBackup=nil then
|
||||
FOptionsBackup:=TLazPackage.Create;
|
||||
FOptionsBackup.AssignOptions(Self);
|
||||
if lpfModified in FFlags then
|
||||
FOptionsBackup.FFlags:=FOptionsBackup.FFlags-[lpfModified]+[lpfModified]*FFlags;
|
||||
FOptionsBackup.CompilerOptions.Modified:=CompilerOptions.Modified
|
||||
end;
|
||||
|
||||
procedure TLazPackage.RestoreOptions;
|
||||
begin
|
||||
if FOptionsBackup=nil then exit;
|
||||
AssignOptions(FOptionsBackup);
|
||||
FFlags:=FFlags-[lpfModified]+[lpfModified]*FOptionsBackup.FFlags;
|
||||
CompilerOptions.Modified:=FOptionsBackup.CompilerOptions.Modified
|
||||
end;
|
||||
|
||||
procedure TLazPackage.BeginUpdate;
|
||||
@ -3832,7 +3887,7 @@ end;
|
||||
|
||||
class function TPkgCompilerOptions.GetInstance: TAbstractIDEOptions;
|
||||
begin
|
||||
Result := CurPackage.CompilerOptions;
|
||||
Result := Package1.CompilerOptions;
|
||||
end;
|
||||
|
||||
function TPkgCompilerOptions.IsActive: boolean;
|
||||
@ -3971,6 +4026,15 @@ begin
|
||||
FLazPackage:=ThePackage;
|
||||
end;
|
||||
|
||||
procedure TPkgAdditionalCompilerOptions.AssignOptions(Source: TObject);
|
||||
begin
|
||||
inherited AssignOptions(Source);
|
||||
if Source is TPkgAdditionalCompilerOptions then begin
|
||||
//Src:=TPkgAdditionalCompilerOptions(Source);
|
||||
// nothing to do
|
||||
end;
|
||||
end;
|
||||
|
||||
function TPkgAdditionalCompilerOptions.GetOwnerName: string;
|
||||
begin
|
||||
Result:=LazPackage.IDAsString;
|
||||
|
||||
@ -318,6 +318,8 @@ type
|
||||
private
|
||||
FItems: TList; // list of TPackageEditorForm
|
||||
FOnAddToProject: TOnAddPkgToProject;
|
||||
FOnAfterWritePackage: TIDEOptionsWriteEvent;
|
||||
FOnBeforeReadPackage: TNotifyEvent;
|
||||
FOnCompilePackage: TOnCompilePackage;
|
||||
FOnCreateNewFile: TOnCreateNewPkgFile;
|
||||
FOnCreatePkgMakefile: TOnCreatePkgMakefile;
|
||||
@ -369,41 +371,45 @@ type
|
||||
function CreateMakefile(APackage: TLazPackage): TModalResult;
|
||||
public
|
||||
property Editors[Index: integer]: TPackageEditorForm read GetEditors;
|
||||
property OnAddToProject: TOnAddPkgToProject read FOnAddToProject
|
||||
write FOnAddToProject;
|
||||
property OnAfterWritePackage: TIDEOptionsWriteEvent read FOnAfterWritePackage
|
||||
write FOnAfterWritePackage;
|
||||
property OnBeforeReadPackage: TNotifyEvent read FOnBeforeReadPackage
|
||||
write FOnBeforeReadPackage;
|
||||
property OnCompilePackage: TOnCompilePackage read FOnCompilePackage
|
||||
write FOnCompilePackage;
|
||||
property OnCreateMakefile: TOnCreatePkgMakefile read FOnCreatePkgMakefile
|
||||
write FOnCreatePkgMakefile;
|
||||
property OnCreateNewFile: TOnCreateNewPkgFile read FOnCreateNewFile
|
||||
write FOnCreateNewFile;
|
||||
property OnOpenFile: TOnOpenFile read FOnOpenFile write FOnOpenFile;
|
||||
property OnOpenPkgFile: TOnOpenPkgFile read FOnOpenPkgFile
|
||||
write FOnOpenPkgFile;
|
||||
property OnOpenPackage: TOnOpenPackage read FOnOpenPackage
|
||||
write FOnOpenPackage;
|
||||
property OnDeleteAmbiguousFiles: TOnDeleteAmbiguousFiles
|
||||
read FOnDeleteAmbiguousFiles write FOnDeleteAmbiguousFiles;
|
||||
property OnFreeEditor: TOnFreePkgEditor read FOnFreeEditor
|
||||
write FOnFreeEditor;
|
||||
property OnGetIDEFileInfo: TGetIDEFileStateEvent read FOnGetIDEFileInfo
|
||||
write FOnGetIDEFileInfo;
|
||||
property OnGetUnitRegisterInfo: TOnGetUnitRegisterInfo
|
||||
read FOnGetUnitRegisterInfo write FOnGetUnitRegisterInfo;
|
||||
property OnFreeEditor: TOnFreePkgEditor read FOnFreeEditor
|
||||
write FOnFreeEditor;
|
||||
property OnSavePackage: TOnSavePackage read FOnSavePackage
|
||||
write FOnSavePackage;
|
||||
property OnRevertPackage: TOnRevertPackage read FOnRevertPackage
|
||||
write FOnRevertPackage;
|
||||
property OnPublishPackage: TOnPublishPackage read FOnPublishPackage
|
||||
write FOnPublishPackage;
|
||||
property OnCompilePackage: TOnCompilePackage read FOnCompilePackage
|
||||
write FOnCompilePackage;
|
||||
property OnInstallPackage: TOnInstallPackage read FOnInstallPackage
|
||||
write FOnInstallPackage;
|
||||
property OnOpenFile: TOnOpenFile read FOnOpenFile write FOnOpenFile;
|
||||
property OnOpenPackage: TOnOpenPackage read FOnOpenPackage
|
||||
write FOnOpenPackage;
|
||||
property OnOpenPkgFile: TOnOpenPkgFile read FOnOpenPkgFile
|
||||
write FOnOpenPkgFile;
|
||||
property OnPublishPackage: TOnPublishPackage read FOnPublishPackage
|
||||
write FOnPublishPackage;
|
||||
property OnRevertPackage: TOnRevertPackage read FOnRevertPackage
|
||||
write FOnRevertPackage;
|
||||
property OnSavePackage: TOnSavePackage read FOnSavePackage
|
||||
write FOnSavePackage;
|
||||
property OnUninstallPackage: TOnUninstallPackage read FOnUninstallPackage
|
||||
write FOnUninstallPackage;
|
||||
property OnViewPackageSource: TOnViewPackageSource read FOnViewPackageSource
|
||||
write FOnViewPackageSource;
|
||||
property OnViewPackageToDos: TOnViewPackageToDos read FOnViewPackageToDos
|
||||
write FOnViewPackageToDos;
|
||||
property OnDeleteAmbiguousFiles: TOnDeleteAmbiguousFiles
|
||||
read FOnDeleteAmbiguousFiles write FOnDeleteAmbiguousFiles;
|
||||
property OnAddToProject: TOnAddPkgToProject read FOnAddToProject
|
||||
write FOnAddToProject;
|
||||
property OnCreateMakefile: TOnCreatePkgMakefile read FOnCreatePkgMakefile
|
||||
write FOnCreatePkgMakefile;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -917,7 +923,9 @@ const
|
||||
[ioesReadOnly]
|
||||
);
|
||||
begin
|
||||
CurPackage := LazPackage;
|
||||
Package1 := LazPackage;
|
||||
Package1.OnBeforeRead:=PackageEditors.OnBeforeReadPackage;
|
||||
Package1.OnAfterWrite:=PackageEditors.OnAfterWritePackage;
|
||||
LazarusIDE.DoOpenIDEOptions(nil,
|
||||
Format(lisPckEditCompilerOptionsForPackage, [LazPackage.IDAsString]),
|
||||
[TLazPackage, TPkgCompilerOptions], Settings[LazPackage.ReadOnly]);
|
||||
|
||||
@ -72,33 +72,35 @@ type
|
||||
TPkgManager = class(TBasePkgManager)
|
||||
// events - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// package editor
|
||||
function OnPackageEditorAddToProject(Sender: TObject; APackage: TLazPackage;
|
||||
OnlyTestIfPossible: boolean): TModalResult;
|
||||
function OnPackageEditorCompilePackage(Sender: TObject;
|
||||
APackage: TLazPackage;
|
||||
CompileClean, CompileRequired: boolean): TModalResult;
|
||||
function OnPackageEditorCreateMakefile(Sender: TObject;
|
||||
APackage: TLazPackage): TModalResult;
|
||||
function OnPackageEditorCreateFile(Sender: TObject;
|
||||
Params: TAddToPkgResult): TModalResult;
|
||||
function OnPackageEditorCreateMakefile(Sender: TObject;
|
||||
APackage: TLazPackage): TModalResult;
|
||||
function OnPackageEditorDeleteAmbiguousFiles(Sender: TObject;
|
||||
APackage: TLazPackage; const Filename: string): TModalResult;
|
||||
function OnPackageEditorAddToProject(Sender: TObject; APackage: TLazPackage;
|
||||
OnlyTestIfPossible: boolean): TModalResult;
|
||||
function OnPackageEditorInstallPackage(Sender: TObject;
|
||||
APackage: TLazPackage): TModalResult;
|
||||
function OnPackageEditorOpenPackage(Sender: TObject; APackage: TLazPackage
|
||||
): TModalResult;
|
||||
function OnPackageEditorOpenPkgFile(Sender: TObject; PkgFile: TPkgFile
|
||||
): TModalResult;
|
||||
function OnPackageEditorPublishPackage(Sender: TObject;
|
||||
APackage: TLazPackage): TModalResult;
|
||||
function OnPackageEditorRevertPackage(Sender: TObject; APackage: TLazPackage
|
||||
): TModalResult;
|
||||
function OnPackageEditorUninstallPackage(Sender: TObject;
|
||||
APackage: TLazPackage): TModalResult;
|
||||
function OnPackageEditorOpenPkgFile(Sender: TObject; PkgFile: TPkgFile
|
||||
): TModalResult;
|
||||
function OnPackageEditorOpenPackage(Sender: TObject; APackage: TLazPackage
|
||||
): TModalResult;
|
||||
function OnPackageEditorSavePackage(Sender: TObject; APackage: TLazPackage;
|
||||
SaveAs: boolean): TModalResult;
|
||||
function OnPackageEditorUninstallPackage(Sender: TObject;
|
||||
APackage: TLazPackage): TModalResult;
|
||||
function OnPackageEditorViewPkgSource(Sender: TObject;
|
||||
APackage: TLazPackage): TModalResult;
|
||||
procedure OnAfterWritePackage(Sender: TObject; Restore: boolean);
|
||||
procedure OnBeforeReadPackage(Sender: TObject);
|
||||
procedure OnPackageEditorFreeEditor(APackage: TLazPackage);
|
||||
procedure OnPackageEditorGetUnitRegisterInfo(Sender: TObject;
|
||||
const AFilename: string; var TheUnitName: string;
|
||||
@ -572,6 +574,23 @@ begin
|
||||
DoOpenPackageFile(PkgFile.LazPackage.Filename,[pofAddToRecent],false);
|
||||
end;
|
||||
|
||||
procedure TPkgManager.OnAfterWritePackage(Sender: TObject; Restore: boolean);
|
||||
var
|
||||
APackage: TLazPackage absolute Sender;
|
||||
begin
|
||||
//debugln(['TPkgManager.OnAfterWritePackage ',DbgSName(APackage),' Restore=',Restore]);
|
||||
if Restore then
|
||||
APackage.RestoreOptions;
|
||||
end;
|
||||
|
||||
procedure TPkgManager.OnBeforeReadPackage(Sender: TObject);
|
||||
var
|
||||
APackage: TLazPackage absolute Sender;
|
||||
begin
|
||||
//debugln(['TPkgManager.OnBeforeReadPackage ',DbgSName(APackage)]);
|
||||
APackage.BackupOptions;
|
||||
end;
|
||||
|
||||
function TPkgManager.OnPackageEditorCompilePackage(Sender: TObject;
|
||||
APackage: TLazPackage; CompileClean, CompileRequired: boolean): TModalResult;
|
||||
var
|
||||
@ -1479,6 +1498,8 @@ begin
|
||||
PackageEditors.OnPublishPackage:=@OnPackageEditorPublishPackage;
|
||||
PackageEditors.OnCompilePackage:=@OnPackageEditorCompilePackage;
|
||||
PackageEditors.OnAddToProject:=@OnPackageEditorAddToProject;
|
||||
PackageEditors.OnBeforeReadPackage:=@OnBeforeReadPackage;
|
||||
PackageEditors.OnAfterWritePackage:=@OnAfterWritePackage;
|
||||
PackageEditors.OnInstallPackage:=@OnPackageEditorInstallPackage;
|
||||
PackageEditors.OnUninstallPackage:=@OnPackageEditorUninstallPackage;
|
||||
PackageEditors.OnViewPackageSource:=@OnPackageEditorViewPkgSource;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user