mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-26 01:07:10 +01:00
TLazIDEInterface: add OnPackageBuilding handler
This commit is contained in:
parent
76e16c5bd1
commit
ba918c5eb2
@ -22,7 +22,7 @@ uses
|
|||||||
// LazUtils
|
// LazUtils
|
||||||
UITypes, LazMethodList, AvgLvlTree,
|
UITypes, LazMethodList, AvgLvlTree,
|
||||||
// BuildIntf
|
// BuildIntf
|
||||||
BaseIDEIntf, IDEOptionsIntf, CompOptsIntf, ProjectIntf, IDEExternToolIntf,
|
BaseIDEIntf, IDEOptionsIntf, CompOptsIntf, ProjectIntf, IDEExternToolIntf, PackageIntf,
|
||||||
// IdeIntf
|
// IdeIntf
|
||||||
IDEOptEditorIntf, SrcEditorIntf, IDEWindowIntf;
|
IDEOptEditorIntf, SrcEditorIntf, IDEWindowIntf;
|
||||||
|
|
||||||
@ -208,6 +208,7 @@ type
|
|||||||
AProject: TLazProject): TModalResult of object;
|
AProject: TLazProject): TModalResult of object;
|
||||||
TModalHandledFunction = function(Sender: TObject; var Handled: boolean
|
TModalHandledFunction = function(Sender: TObject; var Handled: boolean
|
||||||
): TModalResult of object;
|
): TModalResult of object;
|
||||||
|
TLazPackageBuildingEvent = function(Package: TIDEPackage): TModalResult of object;
|
||||||
TGetFPCFrontEndParams = function(Sender: TObject;
|
TGetFPCFrontEndParams = function(Sender: TObject;
|
||||||
var Params: string // these parameters are passed to fpc.
|
var Params: string // these parameters are passed to fpc.
|
||||||
// Global options should be prependended, project options should be appended.
|
// Global options should be prependended, project options should be appended.
|
||||||
@ -241,6 +242,7 @@ type
|
|||||||
lihtProjectBuilding, // called before IDE builds the project
|
lihtProjectBuilding, // called before IDE builds the project
|
||||||
lihtProjectDependenciesCompiling, // called before IDE compiles dependencies of project
|
lihtProjectDependenciesCompiling, // called before IDE compiles dependencies of project
|
||||||
lihtProjectDependenciesCompiled, // called after IDE compiled dependencies of project
|
lihtProjectDependenciesCompiled, // called after IDE compiled dependencies of project
|
||||||
|
lihtPackageBuilding, // called before IDE builds a package
|
||||||
lihtProjectBuildingFinished, // called after IDE builds the project
|
lihtProjectBuildingFinished, // called after IDE builds the project
|
||||||
lihtLazarusBuilding, // called before IDE builds Lazarus IDE
|
lihtLazarusBuilding, // called before IDE builds Lazarus IDE
|
||||||
lihtLazarusBuildingFinished, // called after IDE builds Lazarus IDE
|
lihtLazarusBuildingFinished, // called after IDE builds Lazarus IDE
|
||||||
@ -389,6 +391,7 @@ type
|
|||||||
function GetProjectFileForProjectEditor(AEditor: TSourceEditorInterface): TLazProjectFile; virtual; abstract;
|
function GetProjectFileForProjectEditor(AEditor: TSourceEditorInterface): TLazProjectFile; virtual; abstract;
|
||||||
function DoCallProjectChangedHandler(HandlerType: TLazarusIDEHandlerType;
|
function DoCallProjectChangedHandler(HandlerType: TLazarusIDEHandlerType;
|
||||||
AProject: TLazProject): TModalResult;
|
AProject: TLazProject): TModalResult;
|
||||||
|
function DoCallPackageBuildingHandler(APackage: TIDEPackage): TModalResult;
|
||||||
function DoCallRunDebugInit(var Handled: boolean): TModalResult;
|
function DoCallRunDebugInit(var Handled: boolean): TModalResult;
|
||||||
function DoCallRunDebug(var Handled: boolean): TModalResult;
|
function DoCallRunDebug(var Handled: boolean): TModalResult;
|
||||||
function DoCallRunWithoutDebugBuilding(var Handled: boolean): TModalResult;
|
function DoCallRunWithoutDebugBuilding(var Handled: boolean): TModalResult;
|
||||||
@ -515,6 +518,11 @@ type
|
|||||||
AsLast: boolean = false);
|
AsLast: boolean = false);
|
||||||
procedure RemoveHandlerOnProjectDependenciesCompiled(
|
procedure RemoveHandlerOnProjectDependenciesCompiled(
|
||||||
const OnProjDependenciesCompiledEvent: TModalResultFunction);
|
const OnProjDependenciesCompiledEvent: TModalResultFunction);
|
||||||
|
procedure AddHandlerOnPackageBuilding(
|
||||||
|
const OnPkgBuildingEvent: TLazPackageBuildingEvent;
|
||||||
|
AsLast: boolean = false);
|
||||||
|
procedure RemoveHandlerOnPackageBuilding(
|
||||||
|
const OnPkgBuildingEvent: TLazPackageBuildingEvent);
|
||||||
procedure AddHandlerOnLazarusBuilding(
|
procedure AddHandlerOnLazarusBuilding(
|
||||||
const OnLazBuildingEvent: TModalResultFunction;
|
const OnLazBuildingEvent: TModalResultFunction;
|
||||||
AsLast: boolean = false);
|
AsLast: boolean = false);
|
||||||
@ -756,6 +764,24 @@ begin
|
|||||||
FLazarusIDEHandlers[HandlerType].CallNotifyEvents(Sender);
|
FLazarusIDEHandlers[HandlerType].CallNotifyEvents(Sender);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TLazIDEInterface.DoCallPackageBuildingHandler(APackage: TIDEPackage): TModalResult;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
Handler: TLazPackageBuildingEvent;
|
||||||
|
CurResult: TModalResult;
|
||||||
|
begin
|
||||||
|
Result := mrOK;
|
||||||
|
for I := 0 to FLazarusIDEHandlers[lihtPackageBuilding].Count-1 do
|
||||||
|
begin
|
||||||
|
Handler := TLazPackageBuildingEvent(FLazarusIDEHandlers[lihtPackageBuilding][I]);
|
||||||
|
CurResult := Handler(APackage);
|
||||||
|
if CurResult=mrAbort then
|
||||||
|
Exit(mrAbort);
|
||||||
|
if CurResult<>mrOK then
|
||||||
|
Result := mrCancel;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazIDEInterface.DoCallShowDesignerFormOfSourceHandler(Sender: TObject;
|
procedure TLazIDEInterface.DoCallShowDesignerFormOfSourceHandler(Sender: TObject;
|
||||||
AEditor: TSourceEditorInterface; AComponentPaletteClassSelected: Boolean);
|
AEditor: TSourceEditorInterface; AComponentPaletteClassSelected: Boolean);
|
||||||
var
|
var
|
||||||
@ -938,12 +964,25 @@ begin
|
|||||||
AddHandler(lihtLoadSafeCustomData,TMethod(OnLoadSaveEvent),AsLast);
|
AddHandler(lihtLoadSafeCustomData,TMethod(OnLoadSaveEvent),AsLast);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLazIDEInterface.AddHandlerOnPackageBuilding(const OnPkgBuildingEvent: TLazPackageBuildingEvent;
|
||||||
|
AsLast: boolean);
|
||||||
|
begin
|
||||||
|
AddHandler(lihtPackageBuilding,
|
||||||
|
TMethod(OnPkgBuildingEvent),AsLast);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazIDEInterface.RemoveHandlerOnLoadSaveCustomData(
|
procedure TLazIDEInterface.RemoveHandlerOnLoadSaveCustomData(
|
||||||
const OnLoadSaveEvent: TLazLoadSaveCustomDataEvent; AsLast: boolean);
|
const OnLoadSaveEvent: TLazLoadSaveCustomDataEvent; AsLast: boolean);
|
||||||
begin
|
begin
|
||||||
RemoveHandler(lihtLoadSafeCustomData,TMethod(OnLoadSaveEvent));
|
RemoveHandler(lihtLoadSafeCustomData,TMethod(OnLoadSaveEvent));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLazIDEInterface.RemoveHandlerOnPackageBuilding(const OnPkgBuildingEvent: TLazPackageBuildingEvent);
|
||||||
|
begin
|
||||||
|
RemoveHandler(lihtPackageBuilding,
|
||||||
|
TMethod(OnPkgBuildingEvent));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazIDEInterface.AddHandlerOnIDEClose(
|
procedure TLazIDEInterface.AddHandlerOnIDEClose(
|
||||||
const OnIDECloseEvent: TNotifyEvent; AsLast: boolean);
|
const OnIDECloseEvent: TNotifyEvent; AsLast: boolean);
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -4262,6 +4262,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Result := LazarusIDE.DoCallPackageBuildingHandler(APackage);
|
||||||
|
if Result<>mrOK then
|
||||||
|
Exit;
|
||||||
|
|
||||||
// create external tool to run the compiler
|
// create external tool to run the compiler
|
||||||
//DebugLn('TLazPackageGraph.CompilePackage WorkingDir="',APackage.Directory,'"');
|
//DebugLn('TLazPackageGraph.CompilePackage WorkingDir="',APackage.Directory,'"');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user