From: Erik B. <eb...@us...> - 2006-09-06 07:51:32
|
Update of /cvsroot/gexperts/gexperts/unstable/Src/Utils In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv31344/Src/Utils Modified Files: GX_OtaUtils.pas Log Message: Add TBaseDebuggerNotifier class and related debugger services routines Index: GX_OtaUtils.pas =================================================================== RCS file: /cvsroot/gexperts/gexperts/unstable/Src/Utils/GX_OtaUtils.pas,v retrieving revision 1.194 retrieving revision 1.195 diff -u -d -r1.194 -r1.195 --- GX_OtaUtils.pas 1 Sep 2006 20:58:56 -0000 1.194 +++ GX_OtaUtils.pas 6 Sep 2006 07:49:52 -0000 1.195 @@ -239,8 +239,9 @@ // Ses if the IDE is curently debugging an application function GxOtaCurrentlyDebugging: Boolean; -// Get the IDE services interface. Succeeds or raises an exception. +// Get an IDE services interface. Succeeds or raises an exception. function GxOtaGetIDEServices: IOTAServices; +function GxOtaGetDebuggerServices: IOTADebuggerServices; // Determine if we are currently editing a VCL/CLX/NFM function GxOtaGetActiveDesignerType: string; @@ -564,6 +565,20 @@ destructor Destroy; override; end; + TBaseDebuggerNotifier = class(TNotifierObject, IOTADebuggerNotifier) + private + FNotifierIndex: Integer; + public + function AddNotifierToIDE: Boolean; + function RemoveNotifierFromIDE: Boolean; + destructor Destroy; override; + // IOTADebuggerNotifier + procedure BreakpointAdded({$IFDEF GX_VER170_up} const {$ENDIF} Breakpoint: IOTABreakpoint); virtual; + procedure BreakpointDeleted({$IFDEF GX_VER170_up} const {$ENDIF} Breakpoint: IOTABreakpoint); virtual; + procedure ProcessCreated({$IFDEF GX_VER170_up} const {$ENDIF} Process: IOTAProcess); virtual; + procedure ProcessDestroyed({$IFDEF GX_VER170_up} const {$ENDIF} Process: IOTAProcess); virtual; + end; + EStandAloneUsage = class(Exception); const @@ -858,6 +873,13 @@ raise Exception.Create('IOTAServices not implemented'); end; +function GxOtaGetDebuggerServices: IOTADebuggerServices; +begin + Result := BorlandIDEServices as IOTADebuggerServices; + if not Assigned(Result) then + raise Exception.Create('IOTADebuggerServices not implemented'); +end; + function GxOtaGetActiveDesignerType: string; begin if RunningLinux then @@ -4050,6 +4072,53 @@ inherited Destroy; end; +{ TBaseDebuggerNotifier } + +function TBaseDebuggerNotifier.AddNotifierToIDE: Boolean; +begin + FNotifierIndex := GxOtaGetDebuggerServices.AddNotifier(Self); + Result := (FNotifierIndex <> InvalidNotifierIndex); +end; + +function TBaseDebuggerNotifier.RemoveNotifierFromIDE: Boolean; +var + SavedIndex: Integer; +begin + Result := False; + if FNotifierIndex = InvalidNotifierIndex then + Exit; + SavedIndex := FNotifierIndex; + FNotifierIndex := InvalidNotifierIndex; + GxOtaGetDebuggerServices.RemoveNotifier(SavedIndex); + Result := True; +end; + +destructor TBaseDebuggerNotifier.Destroy; +begin + RemoveNotifierFromIDE; + inherited; +end; + +procedure TBaseDebuggerNotifier.BreakpointAdded({$IFDEF GX_VER170_up} const {$ENDIF} Breakpoint: IOTABreakpoint); +begin + // Nothing +end; + +procedure TBaseDebuggerNotifier.BreakpointDeleted({$IFDEF GX_VER170_up} const {$ENDIF} Breakpoint: IOTABreakpoint); +begin + // Nothing +end; + +procedure TBaseDebuggerNotifier.ProcessCreated({$IFDEF GX_VER170_up} const {$ENDIF} Process: IOTAProcess); +begin + // Nothing +end; + +procedure TBaseDebuggerNotifier.ProcessDestroyed({$IFDEF GX_VER170_up} const {$ENDIF} Process: IOTAProcess); +begin + // Nothing +end; + initialization finalization |