IDE: registering debug dialogs

git-svn-id: trunk@25601 -
This commit is contained in:
mattias 2010-05-24 12:00:04 +00:00
parent ddb29579bd
commit 04cd712c29
2 changed files with 52 additions and 18 deletions

View File

@ -146,7 +146,7 @@ type
function ShowWatchProperties(const AWatch: TIDEWatch; AWatchExpression: String = ''): TModalresult; virtual; abstract; function ShowWatchProperties(const AWatch: TIDEWatch; AWatchExpression: String = ''): TModalresult; virtual; abstract;
procedure ViewDebugDialog(const ADialogType: TDebugDialogType; procedure ViewDebugDialog(const ADialogType: TDebugDialogType;
BringToFront: Boolean = True); virtual; abstract; BringToFront: Boolean = True; Sow: Boolean = true); virtual; abstract;
public public
property Commands: TDBGCommands read GetCommands; // All current available commands of the debugger property Commands: TDBGCommands read GetCommands; // All current available commands of the debugger
property Debuggers[const AIndex: Integer]: TDebuggerClass read GetDebuggerClass; property Debuggers[const AIndex: Integer]: TDebuggerClass read GetDebuggerClass;

View File

@ -37,19 +37,21 @@ interface
{off $define VerboseDebugger} {off $define VerboseDebugger}
uses uses
{$IFDEF IDE_MEM_CHECK} {$IFDEF IDE_MEM_CHECK}
MemCheck, MemCheck,
{$ENDIF} {$ENDIF}
// LCL
Classes, SysUtils, Forms, Controls, Dialogs, Menus, ExtCtrls, FileUtil, LCLProc, Classes, SysUtils, Forms, Controls, Dialogs, Menus, ExtCtrls, FileUtil, LCLProc,
Laz_XMLCfg,
{ for Get/SetForegroundWindow }
LCLType, LCLIntf, LCLType, LCLIntf,
SynEdit, CodeCache, CodeToolManager, // SynEdit, codetools
SrcEditorIntf, MenuIntf, IDECommands, LazIDEIntf, ProjectIntf, IDEDialogs, Laz_XMLCfg, SynEdit, CodeCache, CodeToolManager,
LazConf, // IDEIntf
CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, SourceEditor, IDEWindowIntf, SrcEditorIntf, MenuIntf, IDECommands, LazIDEIntf, ProjectIntf,
ProjectDefs, Project, IDEProcs, InputHistory, Debugger, CmdLineDebugger, IDEDialogs,
IDEOptionDefs, LazarusIDEStrConsts, // IDE
LazConf, CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping,
SourceEditor, ProjectDefs, Project, IDEProcs, InputHistory, Debugger,
CmdLineDebugger, IDEOptionDefs, LazarusIDEStrConsts,
MainBar, MainIntf, MainBase, BaseBuildManager, MainBar, MainIntf, MainBase, BaseBuildManager,
SourceMarks, SourceMarks,
DebuggerDlg, Watchesdlg, BreakPointsdlg, BreakPropertyDlg, LocalsDlg, WatchPropertyDlg, DebuggerDlg, Watchesdlg, BreakPointsdlg, BreakPropertyDlg, LocalsDlg, WatchPropertyDlg,
@ -113,6 +115,8 @@ type
var ASrcEdit: TSourceEditor); var ASrcEdit: TSourceEditor);
// Dialog routines // Dialog routines
procedure CreateDebugDialog(Sender: TObject; aFormName: string;
var AForm: TCustomForm);
procedure DestroyDebugDialog(const ADialogType: TDebugDialogType); procedure DestroyDebugDialog(const ADialogType: TDebugDialogType);
procedure InitDebugOutputDlg; procedure InitDebugOutputDlg;
procedure InitDebugEventsDlg; procedure InitDebugEventsDlg;
@ -183,7 +187,7 @@ type
function ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult; override; function ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult; override;
function ShowWatchProperties(const AWatch: TIDEWatch; AWatchExpression: String = ''): TModalresult; override; function ShowWatchProperties(const AWatch: TIDEWatch; AWatchExpression: String = ''): TModalresult; override;
procedure ViewDebugDialog(const ADialogType: TDebugDialogType; BringToFront: Boolean = true); override; procedure ViewDebugDialog(const ADialogType: TDebugDialogType; BringToFront: Boolean = true; Show: Boolean = true); override;
end; end;
@ -1737,7 +1741,7 @@ begin
end; end;
procedure TDebugManager.ViewDebugDialog(const ADialogType: TDebugDialogType; procedure TDebugManager.ViewDebugDialog(const ADialogType: TDebugDialogType;
BringToFront: Boolean); BringToFront: Boolean; Show: Boolean);
const const
DEBUGDIALOGCLASS: array[TDebugDialogType] of TDebuggerDlgClass = ( DEBUGDIALOGCLASS: array[TDebugDialogType] of TDebuggerDlgClass = (
TDbgOutputForm, TDbgEventsForm, TBreakPointsDlg, TWatchesDlg, TLocalsDlg, TDbgOutputForm, TDbgEventsForm, TBreakPointsDlg, TWatchesDlg, TLocalsDlg,
@ -1754,7 +1758,6 @@ begin
CurDialog.Name:=NonModalIDEWindowNames[DebugDlgIDEWindow[ADialogType]]; CurDialog.Name:=NonModalIDEWindowNames[DebugDlgIDEWindow[ADialogType]];
CurDialog.Tag := Integer(ADialogType); CurDialog.Tag := Integer(ADialogType);
CurDialog.OnDestroy := @DebugDialogDestroy; CurDialog.OnDestroy := @DebugDialogDestroy;
EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name);
case ADialogType of case ADialogType of
ddtOutput: InitDebugOutputDlg; ddtOutput: InitDebugOutputDlg;
ddtEvents: InitDebugEventsDlg; ddtEvents: InitDebugEventsDlg;
@ -1776,10 +1779,14 @@ begin
TBreakPointsDlg(CurDialog).BaseDirectory:=Project1.ProjectDirectory; TBreakPointsDlg(CurDialog).BaseDirectory:=Project1.ProjectDirectory;
end; end;
end; end;
if BringToFront then if Show then
FDialogs[ADialogType].ShowOnTop begin
else EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name);
FDialogs[ADialogType].Show; if BringToFront then
FDialogs[ADialogType].ShowOnTop
else
FDialogs[ADialogType].Show;
end;
end; end;
procedure TDebugManager.DestroyDebugDialog(const ADialogType: TDebugDialogType); procedure TDebugManager.DestroyDebugDialog(const ADialogType: TDebugDialogType);
@ -1956,6 +1963,8 @@ begin
end; end;
procedure TDebugManager.ConnectMainBarEvents; procedure TDebugManager.ConnectMainBarEvents;
var
DlgType: TDebugDialogType;
begin begin
with MainIDEBar do begin with MainIDEBar do begin
itmViewWatches.OnClick := @mnuViewDebugDialogClick; itmViewWatches.OnClick := @mnuViewDebugDialogClick;
@ -1986,6 +1995,10 @@ begin
itmRunMenuAddWatch.OnClick := @mnuAddWatchClicked; itmRunMenuAddWatch.OnClick := @mnuAddWatchClicked;
// itmRunMenuAddBpSource.OnClick := @; // itmRunMenuAddBpSource.OnClick := @;
end; end;
for DlgType:=Low(TDebugDialogType) to High(TDebugDialogType) do
IDEWindowCreators.Add(NonModalIDEWindowNames[DebugDlgIDEWindow[DlgType]],
@CreateDebugDialog,'','','','');
end; end;
procedure TDebugManager.ConnectSourceNotebookEvents; procedure TDebugManager.ConnectSourceNotebookEvents;
@ -2182,6 +2195,27 @@ begin
ASrcEdit:=nil; ASrcEdit:=nil;
end; end;
procedure TDebugManager.CreateDebugDialog(Sender: TObject; aFormName: string;
var AForm: TCustomForm);
function ItIs(Prefix: string): boolean;
begin
Result:=SysUtils.CompareText(copy(aFormName,1,length(Prefix)),Prefix)=0;
end;
var
DlgType: TDebugDialogType;
begin
for DlgType:=Low(TDebugDialogType) to High(TDebugDialogType) do
if ItIs(NonModalIDEWindowNames[DebugDlgIDEWindow[DlgType]]) then
begin
ViewDebugDialog(DlgType,false,false);
AForm:=FDialogs[DlgType];
exit;
end;
raise Exception.Create('TDebugManager.CreateDebugDialog invalid FormName "'+aFormName+'"');
end;
procedure TDebugManager.ClearDebugOutputLog; procedure TDebugManager.ClearDebugOutputLog;
begin begin
if FDialogs[ddtOutput] <> nil then if FDialogs[ddtOutput] <> nil then