mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-04 04:18:22 +01:00
ideintf: added HandlerOnRunDebugInit
git-svn-id: trunk@63445 -
This commit is contained in:
parent
08a8aa9d47
commit
ff48695ac0
@ -251,7 +251,8 @@ type
|
||||
lihtShowDesignerFormOfSource, // called after showing a designer form for code editor (AEditor can be nil!)
|
||||
lihtShowSourceOfActiveDesignerForm, // called after showing a code of designer form
|
||||
lihtChangeToolStatus, //called when IDEToolStatus has changed (e.g. itNone->itBuilder etc.)
|
||||
lihtRunDebug, // called when Run was clicked, after building, before starting the debugger
|
||||
lihtRunDebugInit, // called when Run was clicked, after building, before debugger class is initialized
|
||||
lihtRunDebug, // called when Run was clicked, after building, after debugger class was initialized, 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
|
||||
@ -383,6 +384,7 @@ type
|
||||
function GetProjectFileForProjectEditor(AEditor: TSourceEditorInterface): TLazProjectFile; virtual; abstract;
|
||||
function DoCallProjectChangedHandler(HandlerType: TLazarusIDEHandlerType;
|
||||
AProject: TLazProject): TModalResult;
|
||||
function DoCallRunDebugInit(var Handled: boolean): TModalResult;
|
||||
function DoCallRunDebug(var Handled: boolean): TModalResult;
|
||||
function DoCallRunWithoutDebugBuilding(var Handled: boolean): TModalResult;
|
||||
function DoCallRunWithoutDebugInit(var Handled: boolean): TModalResult;
|
||||
@ -545,6 +547,9 @@ type
|
||||
AsLast: boolean = false);
|
||||
procedure RemoveHandlerOnChangeToolStatus(
|
||||
const OnChangeToolStatus: TLazToolStatusChangeEvent);
|
||||
procedure AddHandlerOnRunDebugInit(const Event: TModalHandledFunction;
|
||||
AsLast: boolean = false);
|
||||
procedure RemoveHandlerOnRunDebugInit(const Event: TModalHandledFunction);
|
||||
procedure AddHandlerOnRunDebug(const Event: TModalHandledFunction;
|
||||
AsLast: boolean = false);
|
||||
procedure RemoveHandlerOnRunDebug(const Event: TModalHandledFunction);
|
||||
@ -792,6 +797,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLazIDEInterface.DoCallRunDebugInit(var Handled: boolean
|
||||
): TModalResult;
|
||||
begin
|
||||
Result:=DoCallModalHandledHandler(lihtRunDebugInit,Handled);
|
||||
end;
|
||||
|
||||
function TLazIDEInterface.DoCallRunDebug(var Handled: boolean): TModalResult;
|
||||
begin
|
||||
Result:=DoCallModalHandledHandler(lihtRunDebug,Handled);
|
||||
@ -1056,6 +1067,18 @@ begin
|
||||
RemoveHandler(lihtChangeToolStatus,TMethod(OnChangeToolStatus));
|
||||
end;
|
||||
|
||||
procedure TLazIDEInterface.AddHandlerOnRunDebugInit(
|
||||
const Event: TModalHandledFunction; AsLast: boolean);
|
||||
begin
|
||||
AddHandler(lihtRunDebugInit,TMethod(Event),AsLast);
|
||||
end;
|
||||
|
||||
procedure TLazIDEInterface.RemoveHandlerOnRunDebugInit(
|
||||
const Event: TModalHandledFunction);
|
||||
begin
|
||||
RemoveHandler(lihtRunDebugInit,TMethod(Event));
|
||||
end;
|
||||
|
||||
procedure TLazIDEInterface.AddHandlerOnRunDebug(
|
||||
const Event: TModalHandledFunction; AsLast: boolean);
|
||||
begin
|
||||
|
||||
@ -3559,12 +3559,15 @@ begin
|
||||
end;
|
||||
|
||||
function TEnvironmentOptions.CurrentDebuggerClass(TheProject: TLazProject): TDebuggerClass;
|
||||
var
|
||||
Cfg: TDebuggerPropertiesConfig;
|
||||
begin
|
||||
LoadDebuggerProperties;
|
||||
|
||||
Result := nil;
|
||||
if CurrentDebuggerPropertiesConfigEx(TheProject) <> nil then
|
||||
Result := CurrentDebuggerPropertiesConfigEx(TheProject).DebuggerClass;
|
||||
Cfg := CurrentDebuggerPropertiesConfigEx(TheProject);
|
||||
if Cfg<> nil then
|
||||
Result := Cfg.DebuggerClass;
|
||||
end;
|
||||
|
||||
function TEnvironmentOptions.GetCurrentDebuggerPropertiesConfig: TDebuggerPropertiesConfig;
|
||||
|
||||
12
ide/main.pp
12
ide/main.pp
@ -7236,6 +7236,7 @@ var
|
||||
DebugClass: TDebuggerClass;
|
||||
ARunMode: TRunParamsOptionsMode;
|
||||
ReqOpts: TDebugCompilerRequirements;
|
||||
Handled: Boolean;
|
||||
begin
|
||||
if ToolStatus <> itNone
|
||||
then begin
|
||||
@ -7249,6 +7250,13 @@ begin
|
||||
// Check if this project is runnable
|
||||
if Project1=nil then exit(mrCancel);
|
||||
|
||||
// call handler
|
||||
Handled:=false;
|
||||
Result := DoCallRunDebugInit(Handled);
|
||||
if Handled or (Result<>mrOk) then
|
||||
exit;
|
||||
|
||||
// check if project is runnable
|
||||
ARunMode := Project1.RunParameterOptions.GetActiveMode;
|
||||
if not ( ((Project1.CompilerOptions.ExecutableType=cetProgram) or
|
||||
((ARunMode<>nil) and (ARunMode.HostApplicationFilename<>'')))
|
||||
@ -7366,14 +7374,12 @@ begin
|
||||
Result:=mrCancel;
|
||||
Handled:=false;
|
||||
Result := DoCallRunDebug(Handled);
|
||||
if Handled then
|
||||
if Handled or (Result<>mrOk) then
|
||||
exit;
|
||||
finally
|
||||
if Result<>mrOk then
|
||||
ToolStatus:=itNone;
|
||||
end;
|
||||
if Result<>mrOk then
|
||||
exit;
|
||||
|
||||
Result := DebugBoss.StartDebugging;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user