- Removed some unneeded indirections

git-svn-id: trunk@17527 -
This commit is contained in:
marc 2008-11-22 18:43:49 +00:00
parent b586b94542
commit 435a07ac28
5 changed files with 19 additions and 65 deletions

View File

@ -39,7 +39,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LResources, StdCtrls,
Buttons, Menus, ComCtrls, IDEProcs, Debugger, DebuggerDlg, lclType;
Buttons, Menus, ComCtrls, IDEProcs, Debugger, DebuggerDlg, lclType, MainBase;
type
TBreakPointsDlgState = (
@ -629,7 +629,8 @@ begin
CurItem:=lvBreakPoints.Selected;
if CurItem=nil then exit;
CurBreakPoint:=TIDEBreakPoint(CurItem.Data);
DoJumpToCodePos(CurBreakPoint.Source,CurBreakPoint.Line,0);
MainIDE.DoJumpToSourcePosition(CurBreakPoint.Source, 0, CurBreakPoint.Line, 0, True);
end;
procedure TBreakPointsDlg.ShowProperties;

View File

@ -38,7 +38,7 @@ interface
uses
LResources, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, Debugger, DebuggerDlg, Menus, ClipBrd, ExtCtrls, StdCtrls, Spin,
ActnList;
ActnList, MainBase;
type
@ -264,9 +264,8 @@ begin
if Entry = nil then Exit;
Filename := Entry.Source;
if DoGetFullDebugFilename(Filename, true) <> mrOk then exit;
DoJumpToCodePos(Filename, Entry.Line, 0);
if DebugBoss.GetFullFilename(Filename, true)
then MainIDE.DoJumpToSourcePosition(Filename, 0, Entry.Line, 0, True);
end;
procedure TCallStackDlg.CopyToClipBoard;

View File

@ -40,20 +40,10 @@ uses
Classes, Forms, Controls, IDEProcs, Debugger, EnvironmentOpts;
type
TDebuggerDlg = class;
TJumpToCodePosEvent = function(Sender: TDebuggerDlg;
const Filename: string; Line, Column: integer
): TModalresult of object;
TGetFullDebugFilenameEvent =
function(Sender: TDebuggerDlg; var Filename: string;
AskUserIfNotFound: boolean): TModalresult of object;
TDebuggerDlgClass = class of TDebuggerDlg;
TDebuggerDlg = class(TForm)
private
FOnGetFullDebugFilename: TGetFullDebugFilenameEvent;
FOnJumpToCodePos: TJumpToCodePosEvent;
FUpdateCount: integer;
protected
procedure DoClose(var CloseAction: TCloseAction); override;
@ -63,14 +53,6 @@ type
procedure BeginUpdate;
procedure EndUpdate;
function UpdateCount: integer;
function DoJumpToCodePos(const Filename: string; Line, Column: integer
): TModalresult;
function DoGetFullDebugFilename(var Filename: string; AskUser: boolean
): TModalresult;
property OnJumpToCodePos: TJumpToCodePosEvent read FOnJumpToCodePos
write FOnJumpToCodePos;
property OnGetFullDebugFilename: TGetFullDebugFilenameEvent
read FOnGetFullDebugFilename write FOnGetFullDebugFilename;
end;
implementation
@ -95,24 +77,6 @@ begin
Result := FUpdateCount;
end;
function TDebuggerDlg.DoJumpToCodePos(const Filename: string; Line,
Column: integer): TModalresult;
begin
if Assigned(OnJumpToCodePos) then
Result:=OnJumpToCodePos(Self,Filename,Line,Column)
else
Result:=mrCancel;
end;
function TDebuggerDlg.DoGetFullDebugFilename(var Filename: string;
AskUser: boolean): TModalresult;
begin
if Assigned(OnGetFullDebugFilename) then
Result:=OnGetFullDebugFilename(Self,Filename,AskUser)
else
Result:=mrCancel;
end;
(*
procedure TDebuggerDlg.SetDebugger(const ADebugger: TDebugger);
begin

View File

@ -99,6 +99,8 @@ type
function Evaluate(const AExpression: String; var AResult: String
): Boolean; virtual; abstract; // Evaluates the given expression, returns true if valid
function GetFullFilename(var Filename: string; AskUserIfNotFound: Boolean): Boolean; virtual; abstract;
function DoCreateBreakPoint(const AFilename: string; ALine: integer;
WarnIfNoDebugger: boolean): TModalResult; virtual; abstract;
function DoDeleteBreakPoint(const AFilename: string; ALine: integer
@ -119,6 +121,7 @@ type
property Exceptions: TIDEExceptions read FExceptions; // A list of exceptions we should ignore
property CallStack: TIDECallStack read FCallStack;
property Locals: TIDELocals read FLocals;
property Registers: TIDERegisters read FRegisters;
property Signals: TIDESignals read FSignals; // A list of actions for signals we know of
property Watches: TIDEWatches read FWatches;
end;

View File

@ -52,7 +52,7 @@ uses
MainBar, MainIntf, MainBase, BaseBuildManager,
SourceMarks,
DebuggerDlg, Watchesdlg, BreakPointsdlg, LocalsDlg, WatchPropertyDlg,
CallStackDlg, EvaluateDlg, RegistersDlg, DBGOutputForm,
CallStackDlg, EvaluateDlg, RegistersDlg, {AssemblerDlg,} DBGOutputForm,
GDBMIDebugger, SSHGDBMIDebugger, ProcessDebugger,
BaseDebugManager;
@ -87,12 +87,8 @@ type
procedure OnDebuggerException(Sender: TObject; const AExceptionClass: String;
const AExceptionText: String);
// debugger dialog events
function DebuggerDlgJumpToCodePos(Sender: TDebuggerDlg;
const Filename: string; Line, Column: integer): TModalresult;
// Dialog events
procedure DebugDialogDestroy(Sender: TObject);
function DebuggerDlgGetFullFilename(Sender: TDebuggerDlg;
var Filename: string; AskUserIfNotFound: boolean): TModalresult;
private
FDebugger: TDebugger;
FBreakPointGroups: TIDEBreakPointGroups;
@ -160,6 +156,8 @@ type
function Evaluate(const AExpression: String;
var AResult: String): Boolean; override;
function GetFullFilename(var Filename: string; AskUserIfNotFound: Boolean): Boolean; override;
function DoCreateBreakPoint(const AFilename: string; ALine: integer;
WarnIfNoDebugger: boolean): TModalResult; override;
@ -1048,17 +1046,7 @@ end;
// Menu events
//-----------------------------------------------------------------------------
function TDebugManager.DebuggerDlgJumpToCodePos(Sender: TDebuggerDlg;
const Filename: string; Line, Column: integer): TModalresult;
begin
if not Destroying then
Result:=MainIDE.DoJumpToSourcePosition(Filename,Column,Line,0,true)
else
Result:=mrCancel;
end;
function TDebugManager.DebuggerDlgGetFullFilename(Sender: TDebuggerDlg;
var Filename: string; AskUserIfNotFound: boolean): TModalresult;
function TDebugManager.GetFullFilename(var Filename: string; AskUserIfNotFound: Boolean): Boolean;
var
SrcFile: String;
n: Integer;
@ -1066,7 +1054,7 @@ var
OpenDialog: TOpenDialog;
AnUnitInfo: TLazProjectFile;
begin
Result:=mrCancel;
Result:=False;
if Destroying then exit;
SrcFile := Filename;
@ -1131,9 +1119,10 @@ begin
FUserSourceFiles.Insert(0, SrcFile);
end;
if SrcFile<>'' then begin
if SrcFile<>''
then begin
Filename:=SrcFile;
Result:=mrOk;
Result:=True;
end;
end;
@ -1356,7 +1345,7 @@ begin
Exit;
end;
if DebuggerDlgGetFullFilename(nil,SrcFile,true)<>mrOk then exit;
if not GetFullFilename(SrcFile, true) then exit;
NewSource:=CodeToolBoss.LoadFile(SrcFile,true,false);
if NewSource=nil then begin
@ -1428,8 +1417,6 @@ begin
CurDialog.Name:=NonModalIDEWindowNames[DebugDlgIDEWindow[ADialogType]];
CurDialog.Tag := Integer(ADialogType);
CurDialog.OnDestroy := @DebugDialogDestroy;
CurDialog.OnJumpToCodePos:=@DebuggerDlgJumpToCodePos;
CurDialog.OnGetFullDebugFilename:=@DebuggerDlgGetFullFilename;
EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name);
case ADialogType of
ddtOutput: InitDebugOutputDlg;