mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-12 21:20:31 +01:00
IDEIntf: added handlers: lihtRunDebug, lihtRunWithoutDebugBuilding, lihtRunWithoutDebugInit
git-svn-id: trunk@56793 -
This commit is contained in:
parent
5e9de6d214
commit
f92c4017da
@ -247,6 +247,9 @@ type
|
|||||||
lihtShowDesignerFormOfSource, // called after showing a designer form for code editor (AEditor can be nil!)
|
lihtShowDesignerFormOfSource, // called after showing a designer form for code editor (AEditor can be nil!)
|
||||||
lihtShowSourceOfActiveDesignerForm, // called after showing a code of designer form
|
lihtShowSourceOfActiveDesignerForm, // called after showing a code of designer form
|
||||||
lihtChangeToolStatus, //called when IDEToolStatus has changed (e.g. itNone->itBuilder etc.)
|
lihtChangeToolStatus, //called when IDEToolStatus has changed (e.g. itNone->itBuilder etc.)
|
||||||
|
lihtRunDebug, // called when Run was clicked, after building, before starting the debugger
|
||||||
|
lihtRunWithoutDebugBuilding, // called when Run a project without debugger was clicked, before building
|
||||||
|
lihtRunWithoutDebugInit, // called when Run a project without debugger was clicked, after building
|
||||||
lihtRunFinished //called when ran program finishes
|
lihtRunFinished //called when ran program finishes
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -378,6 +381,9 @@ 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 DoCallRunDebug(var Handled: boolean): TModalResult;
|
||||||
|
function DoCallRunWithoutDebugBuilding(var Handled: boolean): TModalResult;
|
||||||
|
function DoCallRunWithoutDebugInit(var Handled: boolean): TModalResult;
|
||||||
procedure DoCallRunFinishedHandler;
|
procedure DoCallRunFinishedHandler;
|
||||||
function DoAddUnitToProject(AEditor: TSourceEditorInterface): TModalResult; virtual; abstract;
|
function DoAddUnitToProject(AEditor: TSourceEditorInterface): TModalResult; virtual; abstract;
|
||||||
|
|
||||||
@ -531,6 +537,15 @@ type
|
|||||||
AsLast: boolean = false);
|
AsLast: boolean = false);
|
||||||
procedure RemoveHandlerOnChangeToolStatus(
|
procedure RemoveHandlerOnChangeToolStatus(
|
||||||
const OnChangeToolStatus: TLazToolStatusChangeEvent);
|
const OnChangeToolStatus: TLazToolStatusChangeEvent);
|
||||||
|
procedure AddHandlerOnRunDebug(const Event: TModalHandledFunction;
|
||||||
|
AsLast: boolean = false);
|
||||||
|
procedure RemoveHandlerOnRunDebug(const Event: TModalHandledFunction);
|
||||||
|
procedure AddHandlerOnRunWithoutDebugBuilding(const Event: TModalHandledFunction;
|
||||||
|
AsLast: boolean = false);
|
||||||
|
procedure RemoveHandlerOnRunWithoutDebugBuilding(const Event: TModalHandledFunction);
|
||||||
|
procedure AddHandlerOnRunWithoutDebugInit(const Event: TModalHandledFunction;
|
||||||
|
AsLast: boolean = false);
|
||||||
|
procedure RemoveHandlerOnRunWithoutDebugInit(const Event: TModalHandledFunction);
|
||||||
procedure AddHandlerOnRunFinished(const OnRunFinishedEvent: TNotifyEvent;
|
procedure AddHandlerOnRunFinished(const OnRunFinishedEvent: TNotifyEvent;
|
||||||
AsLast: boolean = false);
|
AsLast: boolean = false);
|
||||||
procedure RemoveHandlerOnRunFinished(const OnRunFinishedEvent: TNotifyEvent);
|
procedure RemoveHandlerOnRunFinished(const OnRunFinishedEvent: TNotifyEvent);
|
||||||
@ -769,6 +784,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TLazIDEInterface.DoCallRunDebug(var Handled: boolean): TModalResult;
|
||||||
|
begin
|
||||||
|
Result:=DoCallModalHandledHandler(lihtRunDebug,Handled);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TLazIDEInterface.DoCallRunWithoutDebugBuilding(var Handled: boolean
|
||||||
|
): TModalResult;
|
||||||
|
begin
|
||||||
|
Result:=DoCallModalHandledHandler(lihtRunWithoutDebugBuilding,Handled);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TLazIDEInterface.DoCallRunWithoutDebugInit(var Handled: boolean
|
||||||
|
): TModalResult;
|
||||||
|
begin
|
||||||
|
Result:=DoCallModalHandledHandler(lihtRunWithoutDebugInit,Handled);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazIDEInterface.DoCallRunFinishedHandler;
|
procedure TLazIDEInterface.DoCallRunFinishedHandler;
|
||||||
begin
|
begin
|
||||||
DoCallNotifyHandler(lihtRunFinished);
|
DoCallNotifyHandler(lihtRunFinished);
|
||||||
@ -1004,6 +1036,42 @@ begin
|
|||||||
RemoveHandler(lihtChangeToolStatus,TMethod(OnChangeToolStatus));
|
RemoveHandler(lihtChangeToolStatus,TMethod(OnChangeToolStatus));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLazIDEInterface.AddHandlerOnRunDebug(
|
||||||
|
const Event: TModalHandledFunction; AsLast: boolean);
|
||||||
|
begin
|
||||||
|
AddHandler(lihtRunDebug,TMethod(Event),AsLast);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazIDEInterface.RemoveHandlerOnRunDebug(
|
||||||
|
const Event: TModalHandledFunction);
|
||||||
|
begin
|
||||||
|
RemoveHandler(lihtRunDebug,TMethod(Event));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazIDEInterface.AddHandlerOnRunWithoutDebugBuilding(
|
||||||
|
const Event: TModalHandledFunction; AsLast: boolean);
|
||||||
|
begin
|
||||||
|
AddHandler(lihtRunWithoutDebugBuilding,TMethod(Event),AsLast);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazIDEInterface.RemoveHandlerOnRunWithoutDebugBuilding(
|
||||||
|
const Event: TModalHandledFunction);
|
||||||
|
begin
|
||||||
|
RemoveHandler(lihtRunWithoutDebugBuilding,TMethod(Event));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazIDEInterface.AddHandlerOnRunWithoutDebugInit(
|
||||||
|
const Event: TModalHandledFunction; AsLast: boolean);
|
||||||
|
begin
|
||||||
|
AddHandler(lihtRunWithoutDebugInit,TMethod(Event),AsLast);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLazIDEInterface.RemoveHandlerOnRunWithoutDebugInit(
|
||||||
|
const Event: TModalHandledFunction);
|
||||||
|
begin
|
||||||
|
RemoveHandler(lihtRunWithoutDebugInit,TMethod(Event));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazIDEInterface.AddHandlerOnRunFinished(
|
procedure TLazIDEInterface.AddHandlerOnRunFinished(
|
||||||
const OnRunFinishedEvent: TNotifyEvent; AsLast: boolean);
|
const OnRunFinishedEvent: TNotifyEvent; AsLast: boolean);
|
||||||
begin
|
begin
|
||||||
|
|||||||
20
ide/main.pp
20
ide/main.pp
@ -7018,6 +7018,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoRunProject: TModalResult;
|
function TMainIDE.DoRunProject: TModalResult;
|
||||||
|
var
|
||||||
|
Handled: Boolean;
|
||||||
begin
|
begin
|
||||||
DebugLn('Hint: (lazarus) [TMainIDE.DoRunProject] INIT');
|
DebugLn('Hint: (lazarus) [TMainIDE.DoRunProject] INIT');
|
||||||
|
|
||||||
@ -7029,7 +7031,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
debugln('Hint: (lazarus) [TMainIDE.DoRunProject] Debugger=',EnvironmentOptions.DebuggerConfig.DebuggerClass);
|
debugln('Hint: (lazarus) [TMainIDE.DoRunProject] Debugger=',EnvironmentOptions.DebuggerConfig.DebuggerClass);
|
||||||
|
|
||||||
Result := mrCancel;
|
Handled:=false;
|
||||||
|
Result:=DoCallRunDebug(Handled);
|
||||||
|
if Handled then exit;
|
||||||
|
|
||||||
Result := DebugBoss.StartDebugging;
|
Result := DebugBoss.StartDebugging;
|
||||||
|
|
||||||
@ -7040,19 +7044,26 @@ function TMainIDE.DoRunProjectWithoutDebug: TModalResult;
|
|||||||
var
|
var
|
||||||
Process: TProcessUTF8;
|
Process: TProcessUTF8;
|
||||||
ExeCmdLine, ExeWorkingDirectory, ExeFile, Params: string;
|
ExeCmdLine, ExeWorkingDirectory, ExeFile, Params: string;
|
||||||
RunAppBundle: Boolean;
|
RunAppBundle, Handled: Boolean;
|
||||||
ARunMode: TRunParamsOptionsMode;
|
ARunMode: TRunParamsOptionsMode;
|
||||||
begin
|
begin
|
||||||
debugln(['TMainIDE.DoRunProjectWithoutDebug START']);
|
debugln(['Hint: (lazarus) [TMainIDE.DoRunProjectWithoutDebug] START']);
|
||||||
if Project1=nil then
|
if Project1=nil then
|
||||||
Exit(mrNone);
|
Exit(mrNone);
|
||||||
|
|
||||||
|
Handled:=false;
|
||||||
|
Result:=DoCallRunWithoutDebugBuilding(Handled);
|
||||||
|
if Handled then exit;
|
||||||
|
|
||||||
Result := DoBuildProject(crRun,[]);
|
Result := DoBuildProject(crRun,[]);
|
||||||
if Result <> mrOK then
|
if Result <> mrOK then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
|
Result:=DoCallRunWithoutDebugInit(Handled);
|
||||||
|
if Handled then exit;
|
||||||
|
|
||||||
ExeCmdLine := MainBuildBoss.GetRunCommandLine;
|
ExeCmdLine := MainBuildBoss.GetRunCommandLine;
|
||||||
debugln(['TMainIDE.DoRunProjectWithoutDebug ExeCmdLine="',ExeCmdLine,'"']);
|
debugln(['Hint: (lazarus) [TMainIDE.DoRunProjectWithoutDebug] ExeCmdLine="',ExeCmdLine,'"']);
|
||||||
if ExeCmdLine='' then
|
if ExeCmdLine='' then
|
||||||
begin
|
begin
|
||||||
IDEMessageDialog(lisUnableToRun, lisLaunchingApplicationInvalid,
|
IDEMessageDialog(lisUnableToRun, lisLaunchingApplicationInvalid,
|
||||||
@ -7066,7 +7077,6 @@ begin
|
|||||||
RunAppBundle:=RunAppBundle and Project1.UseAppBundle;
|
RunAppBundle:=RunAppBundle and Project1.UseAppBundle;
|
||||||
|
|
||||||
SplitCmdLine(ExeCmdLine,ExeFile,Params);
|
SplitCmdLine(ExeCmdLine,ExeFile,Params);
|
||||||
|
|
||||||
Process.Executable := ExeFile;
|
Process.Executable := ExeFile;
|
||||||
Process.Parameters.Text := Params;
|
Process.Parameters.Text := Params;
|
||||||
ARunMode := Project1.RunParameterOptions.GetActiveMode;
|
ARunMode := Project1.RunParameterOptions.GetActiveMode;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user