implemented jump to code on double click for breakpoints and callstack dlg

git-svn-id: trunk@4214 -
This commit is contained in:
mattias 2003-05-29 23:14:17 +00:00
parent 4bff933ab0
commit c67f949ee8
9 changed files with 297 additions and 180 deletions

View File

@ -1,104 +1,106 @@
object BreakpointsDlg: TBreakpointsDlg object BreakpointsDlg: TBreakpointsDlg
Caption = 'Breakpoint list' CAPTION = 'Breakpoint list'
ClientHeight = 205 CLIENTHEIGHT = 205
ClientWidth = 629 CLIENTWIDTH = 629
Visible = True VISIBLE = True
HorzScrollBar.Page = 630 HORZSCROLLBAR.PAGE = 630
VertScrollBar.Page = 206 VERTSCROLLBAR.PAGE = 206
Left = 340 LEFT = 340
Height = 205 HEIGHT = 205
Top = 117 TOP = 117
Width = 629 WIDTH = 629
HelpType = htkeyword HELPTYPE = htkeyword
object lvBreakPoints: TListView object lvBreakPoints: TLISTVIEW
Align = alclient ALIGN = alclient
Columns = < ANCHORS = [aktop, akleft]
COLUMNS = <
item item
Caption = 'State' CAPTION = 'State'
Visible = True VISIBLE = True
Width = 50 WIDTH = 50
end end
item item
Caption = 'Filename/Address' CAPTION = 'Filename/Address'
Visible = True VISIBLE = True
Width = 150 WIDTH = 150
end end
item item
Caption = 'Line/Length' CAPTION = 'Line/Length'
Visible = True VISIBLE = True
Width = 100 WIDTH = 100
end end
item item
Caption = 'Condition' CAPTION = 'Condition'
Visible = True VISIBLE = True
Width = 75 WIDTH = 75
end end
item item
Caption = 'Action' CAPTION = 'Action'
Visible = True VISIBLE = True
Width = 50 WIDTH = 50
end end
item item
Caption = 'Pass Count' CAPTION = 'Pass Count'
Visible = True VISIBLE = True
Width = 100 WIDTH = 100
end end
item item
Caption = 'Group' CAPTION = 'Group'
Visible = True VISIBLE = True
Width = 50 WIDTH = 50
end> end>
MultiSelect = True MULTISELECT = True
PopupMenu = mnuPopup POPUPMENU = mnuPopup
ViewStyle = vsreport VIEWSTYLE = vsreport
OnClick = lvBreakPointsClick ONCLICK = lvBreakPointsClick
OnSelectItem = lvBreakPointsSelectItem ONDBLCLICK = lvBreakPointsDBLCLICK
Height = 205 ONSELECTITEM = lvBreakPointsSelectItem
Width = 629 HEIGHT = 205
HelpType = htkeyword WIDTH = 629
HELPTYPE = htkeyword
end end
object mnuPopup: TPopupMenu object mnuPopup: TPOPUPMENU
OnPopup = mnuPopupPopup ONPOPUP = mnuPopupPopup
left = 100 left = 100
top = 96 top = 96
object popAdd: TMenuItem object popAdd: TMENUITEM
Caption = 'Add...' CAPTION = 'Add...'
object popAddSourceBP: TMenuItem object popAddSourceBP: TMENUITEM
Caption = '&Source breakpoint' CAPTION = '&Source breakpoint'
Enabled = False ENABLED = False
OnClick = popAddSourceBPClick ONCLICK = popAddSourceBPClick
end end
end end
object N1: TMenuItem object N1: TMENUITEM
Caption = '-' CAPTION = '-'
end end
object popProperties: TMenuItem object popProperties: TMENUITEM
Caption = '&Properties' CAPTION = '&Properties'
OnClick = popPropertiesClick ONCLICK = popPropertiesClick
end end
object popEnabled: TMenuItem object popEnabled: TMENUITEM
Caption = '&Enabled' CAPTION = '&Enabled'
ShowAlwaysCheckable = True SHOWALWAYSCHECKABLE = True
OnClick = popEnabledClick ONCLICK = popEnabledClick
end end
object popDelete: TMenuItem object popDelete: TMENUITEM
Caption = '&Delete' CAPTION = '&Delete'
OnClick = popDeleteClick ONCLICK = popDeleteClick
end end
object N2: TMenuItem object N2: TMENUITEM
Caption = '-' CAPTION = '-'
end end
object popDisableAll: TMenuItem object popDisableAll: TMENUITEM
Caption = 'D&isable All' CAPTION = 'D&isable All'
OnClick = popDisableAllClick ONCLICK = popDisableAllClick
end end
object popEnableAll: TMenuItem object popEnableAll: TMENUITEM
Caption = '&Enable All' CAPTION = '&Enable All'
OnClick = popEnableAllClick ONCLICK = popEnableAllClick
end end
object popDeleteAll: TMenuItem object popDeleteAll: TMENUITEM
Caption = '&Delete All' CAPTION = '&Delete All'
OnClick = popDeleteAllClick ONCLICK = popDeleteAllClick
end end
end end
end end

View File

@ -1,30 +1,31 @@
{ This is an automatically generated lazarus resource file } { This is an automatically generated lazarus resource file }
LazarusResources.Add('TBreakpointsDlg','FORMDATA',[ LazarusResources.Add('TBreakpointsDlg','FORMDATA',[
'TPF0'#15'TBreakpointsDlg'#14'BreakpointsDlg'#7'Caption'#6#15'Breakpoint list' 'TPF0'#15'TBreakpointsDlg'#14'BreakpointsDlg'#7'CAPTION'#6#15'Breakpoint list'
+#12'ClientHeight'#3#205#0#11'ClientWidth'#3'u'#2#7'Visible'#9#18'HorzScrollB' +#12'CLIENTHEIGHT'#3#205#0#11'CLIENTWIDTH'#3'u'#2#7'VISIBLE'#9#18'HORZSCROLLB'
+'ar.Page'#3'v'#2#18'VertScrollBar.Page'#3#206#0#4'Left'#3'T'#1#6'Height'#3 +'AR.PAGE'#3'v'#2#18'VERTSCROLLBAR.PAGE'#3#206#0#4'LEFT'#3'T'#1#6'HEIGHT'#3
+#205#0#3'Top'#2'u'#5'Width'#3'u'#2#8'HelpType'#7#9'htkeyword'#0#9'TListView' +#205#0#3'TOP'#2'u'#5'WIDTH'#3'u'#2#8'HELPTYPE'#7#9'htkeyword'#0#9'TLISTVIEW'
+#13'lvBreakPoints'#5'Align'#7#8'alclient'#7'Columns'#14#1#7'Caption'#6#5'Sta' +#13'lvBreakPoints'#5'ALIGN'#7#8'alclient'#7'ANCHORS'#11#5'aktop'#6'akleft'#0
+'te'#7'Visible'#9#5'Width'#2'2'#0#1#7'Caption'#6#16'Filename/Address'#7'Visi' +#7'COLUMNS'#14#1#7'CAPTION'#6#5'State'#7'VISIBLE'#9#5'WIDTH'#2'2'#0#1#7'CAPT'
+'ble'#9#5'Width'#3#150#0#0#1#7'Caption'#6#11'Line/Length'#7'Visible'#9#5'Wid' +'ION'#6#16'Filename/Address'#7'VISIBLE'#9#5'WIDTH'#3#150#0#0#1#7'CAPTION'#6
+'th'#2'd'#0#1#7'Caption'#6#9'Condition'#7'Visible'#9#5'Width'#2'K'#0#1#7'Cap' +#11'Line/Length'#7'VISIBLE'#9#5'WIDTH'#2'd'#0#1#7'CAPTION'#6#9'Condition'#7
+'tion'#6#6'Action'#7'Visible'#9#5'Width'#2'2'#0#1#7'Caption'#6#10'Pass Count' +'VISIBLE'#9#5'WIDTH'#2'K'#0#1#7'CAPTION'#6#6'Action'#7'VISIBLE'#9#5'WIDTH'#2
+#7'Visible'#9#5'Width'#2'd'#0#1#7'Caption'#6#5'Group'#7'Visible'#9#5'Width'#2 +'2'#0#1#7'CAPTION'#6#10'Pass Count'#7'VISIBLE'#9#5'WIDTH'#2'd'#0#1#7'CAPTION'
+'2'#0#0#11'MultiSelect'#9#9'PopupMenu'#7#8'mnuPopup'#9'ViewStyle'#7#8'vsrepo' +#6#5'Group'#7'VISIBLE'#9#5'WIDTH'#2'2'#0#0#11'MULTISELECT'#9#9'POPUPMENU'#7#8
+'rt'#7'OnClick'#7#18'lvBreakPointsClick'#12'OnSelectItem'#7#23'lvBreakPoints' +'mnuPopup'#9'VIEWSTYLE'#7#8'vsreport'#7'ONCLICK'#7#18'lvBreakPointsClick'#10
+'SelectItem'#6'Height'#3#205#0#5'Width'#3'u'#2#8'HelpType'#7#9'htkeyword'#0#0 +'ONDBLCLICK'#7#21'lvBreakPointsDBLCLICK'#12'ONSELECTITEM'#7#23'lvBreakPoints'
+#10'TPopupMenu'#8'mnuPopup'#7'OnPopup'#7#13'mnuPopupPopup'#4'left'#2'd'#3'to' +'SelectItem'#6'HEIGHT'#3#205#0#5'WIDTH'#3'u'#2#8'HELPTYPE'#7#9'htkeyword'#0#0
+'p'#2'`'#0#9'TMenuItem'#6'popAdd'#7'Caption'#6#6'Add...'#0#9'TMenuItem'#14'p' +#10'TPOPUPMENU'#8'mnuPopup'#7'ONPOPUP'#7#13'mnuPopupPopup'#4'left'#2'd'#3'to'
+'opAddSourceBP'#7'Caption'#6#18'&Source breakpoint'#7'Enabled'#8#7'OnClick'#7 +'p'#2'`'#0#9'TMENUITEM'#6'popAdd'#7'CAPTION'#6#6'Add...'#0#9'TMENUITEM'#14'p'
+#19'popAddSourceBPClick'#0#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TM' +'opAddSourceBP'#7'CAPTION'#6#18'&Source breakpoint'#7'ENABLED'#8#7'ONCLICK'#7
+'enuItem'#13'popProperties'#7'Caption'#6#11'&Properties'#7'OnClick'#7#18'pop' +#19'popAddSourceBPClick'#0#0#0#9'TMENUITEM'#2'N1'#7'CAPTION'#6#1'-'#0#0#9'TM'
+'PropertiesClick'#0#0#9'TMenuItem'#10'popEnabled'#7'Caption'#6#8'&Enabled'#19 +'ENUITEM'#13'popProperties'#7'CAPTION'#6#11'&Properties'#7'ONCLICK'#7#18'pop'
+'ShowAlwaysCheckable'#9#7'OnClick'#7#15'popEnabledClick'#0#0#9'TMenuItem'#9 +'PropertiesClick'#0#0#9'TMENUITEM'#10'popEnabled'#7'CAPTION'#6#8'&Enabled'#19
+'popDelete'#7'Caption'#6#7'&Delete'#7'OnClick'#7#14'popDeleteClick'#0#0#9'TM' +'SHOWALWAYSCHECKABLE'#9#7'ONCLICK'#7#15'popEnabledClick'#0#0#9'TMENUITEM'#9
+'enuItem'#2'N2'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'popDisableAll'#7'Capti' +'popDelete'#7'CAPTION'#6#7'&Delete'#7'ONCLICK'#7#14'popDeleteClick'#0#0#9'TM'
+'on'#6#12'D&isable All'#7'OnClick'#7#18'popDisableAllClick'#0#0#9'TMenuItem' +'ENUITEM'#2'N2'#7'CAPTION'#6#1'-'#0#0#9'TMENUITEM'#13'popDisableAll'#7'CAPTI'
+#12'popEnableAll'#7'Caption'#6#11'&Enable All'#7'OnClick'#7#17'popEnableAllC' +'ON'#6#12'D&isable All'#7'ONCLICK'#7#18'popDisableAllClick'#0#0#9'TMENUITEM'
+'lick'#0#0#9'TMenuItem'#12'popDeleteAll'#7'Caption'#6#11'&Delete All'#7'OnCl' +#12'popEnableAll'#7'CAPTION'#6#11'&Enable All'#7'ONCLICK'#7#17'popEnableAllC'
+'ick'#7#17'popDeleteAllClick'#0#0#0#0 +'lick'#0#0#9'TMENUITEM'#12'popDeleteAll'#7'CAPTION'#6#11'&Delete All'#7'ONCL'
+'ICK'#7#17'popDeleteAllClick'#0#0#0#0
]); ]);

View File

@ -61,6 +61,7 @@ type
popEnableAll: TMenuItem; popEnableAll: TMenuItem;
popDeleteAll: TMenuItem; popDeleteAll: TMenuItem;
procedure lvBreakPointsClick(Sender: TObject); procedure lvBreakPointsClick(Sender: TObject);
procedure lvBreakPointsDBLCLICK(Sender: TObject);
procedure lvBreakPointsSelectItem(Sender: TObject; AItem: TListItem; procedure lvBreakPointsSelectItem(Sender: TObject; AItem: TListItem;
Selected: Boolean); Selected: Boolean);
procedure mnuPopupPopup(Sender: TObject); procedure mnuPopupPopup(Sender: TObject);
@ -91,6 +92,7 @@ type
protected protected
procedure DoEndUpdate; override; procedure DoEndUpdate; override;
procedure BreakPointsUpdate; virtual; procedure BreakPointsUpdate; virtual;
procedure DoJumpToCurrentBreakPoint; virtual;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -195,10 +197,26 @@ begin
BreakPointUpdate(FBreakPoints,FBreakPoints.Items[i]); BreakPointUpdate(FBreakPoints,FBreakPoints.Items[i]);
end; end;
procedure TBreakPointsDlg.DoJumpToCurrentBreakPoint;
var
CurItem: TListItem;
CurBreakPoint: TDBGBreakPoint;
begin
CurItem:=lvBreakPoints.Selected;
if CurItem=nil then exit;
CurBreakPoint:=TDBGBreakPoint(CurItem.Data);
DoJumpToCodePos(CurBreakPoint.Source,CurBreakPoint.Line,0);
end;
procedure TBreakPointsDlg.lvBreakPointsClick(Sender: TObject); procedure TBreakPointsDlg.lvBreakPointsClick(Sender: TObject);
begin begin
end; end;
procedure TBreakPointsDlg.lvBreakPointsDBLCLICK(Sender: TObject);
begin
DoJumpToCurrentBreakPoint;
end;
procedure TBreakPointsDlg.lvBreakPointsSelectItem(Sender: TObject; procedure TBreakPointsDlg.lvBreakPointsSelectItem(Sender: TObject;
AItem: TListItem; Selected: Boolean); AItem: TListItem; Selected: Boolean);
begin begin
@ -384,6 +402,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.16 2003/05/29 23:14:17 mattias
implemented jump to code on double click for breakpoints and callstack dlg
Revision 1.15 2003/05/28 15:56:19 mattias Revision 1.15 2003/05/28 15:56:19 mattias
implemented sourcemarks implemented sourcemarks

View File

@ -1,29 +1,36 @@
object CallStackDlg: TCallStackDlg object CallStackDlg: TCallStackDlg
Left = 359 CAPTION = 'CallStack'
Top = 126 CLIENTHEIGHT = 200
Width = 500 CLIENTWIDTH = 500
Height = 200 VISIBLE = True
Caption = 'CallStack' HORZSCROLLBAR.PAGE = 501
object lvCallStack: TListView VERTSCROLLBAR.PAGE = 201
Left = 0 LEFT = 359
Top = 0 HEIGHT = 200
Width = 484 TOP = 126
Height = 200 WIDTH = 500
Align = alClient object lvCallStack: TLISTVIEW
Columns = < ALIGN = alclient
ANCHORS = [aktop, akleft]
COLUMNS = <
item item
Caption = 'Source' CAPTION = 'Source'
Width = 150 VISIBLE = True
WIDTH = 150
end end
item item
Caption = 'Line' CAPTION = 'Line'
Width = 50 VISIBLE = True
WIDTH = 50
end end
item item
Caption = 'Function' CAPTION = 'Function'
Width = 300 VISIBLE = True
WIDTH = 300
end> end>
MultiSelect = False VIEWSTYLE = vsreport
ViewStyle = vsReport ONDBLCLICK = lvCallStackDBLCLICK
HEIGHT = 200
WIDTH = 500
end end
end end

View File

@ -37,14 +37,24 @@ unit DebuggerDlg;
interface interface
uses uses
Classes, Forms, IDEProcs, Debugger, EnvironmentOpts; Classes, Forms, Controls, IDEProcs, Debugger, EnvironmentOpts;
type 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; TDebuggerDlgClass = class of TDebuggerDlg;
TDebuggerDlg = class(TForm) TDebuggerDlg = class(TForm)
private private
FDebugger: TDebugger; FDebugger: TDebugger;
FOnGetFullDebugFilename: TGetFullDebugFilenameEvent;
FOnJumpToCodePos: TJumpToCodePosEvent;
FUpdateCount: integer; FUpdateCount: integer;
protected protected
procedure SetDebugger(const ADebugger: TDebugger); virtual; procedure SetDebugger(const ADebugger: TDebugger); virtual;
@ -56,7 +66,15 @@ type
procedure BeginUpdate; procedure BeginUpdate;
procedure EndUpdate; procedure EndUpdate;
function UpdateCount: integer; function UpdateCount: integer;
function DoJumpToCodePos(const Filename: string; Line, Column: integer
): TModalresult;
function DoGetFullDebugFilename(var Filename: string; AskUser: boolean
): TModalresult;
property Debugger: TDebugger read FDebugger write SetDebugger; property Debugger: TDebugger read FDebugger write SetDebugger;
property OnJumpToCodePos: TJumpToCodePosEvent read FOnJumpToCodePos
write FOnJumpToCodePos;
property OnGetFullDebugFilename: TGetFullDebugFilenameEvent
read FOnGetFullDebugFilename write FOnGetFullDebugFilename;
end; end;
implementation implementation
@ -86,6 +104,24 @@ begin
Result:=FUpdateCount; Result:=FUpdateCount;
end; 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); procedure TDebuggerDlg.SetDebugger(const ADebugger: TDebugger);
begin begin
FDebugger := ADebugger; FDebugger := ADebugger;
@ -109,6 +145,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.6 2003/05/29 23:14:17 mattias
implemented jump to code on double click for breakpoints and callstack dlg
Revision 1.5 2003/05/28 08:46:24 mattias Revision 1.5 2003/05/28 08:46:24 mattias
break;points dialog now gets the items without debugger break;points dialog now gets the items without debugger

View File

@ -73,6 +73,13 @@ type
procedure OnDebuggerOutput(Sender: TObject; const AText: String); procedure OnDebuggerOutput(Sender: TObject; const AText: String);
procedure OnDebuggerException(Sender: TObject; const AExceptionClass: String; procedure OnDebuggerException(Sender: TObject; const AExceptionClass: String;
const AExceptionText: String); const AExceptionText: String);
// debugger dialog events
function DebuggerDlgJumpToCodePos(Sender: TDebuggerDlg;
const Filename: string; Line, Column: integer): TModalresult;
procedure DebugDialogDestroy(Sender: TObject);
function DebuggerDlgGetFullFilename(Sender: TDebuggerDlg;
var Filename: string; AskUserIfNotFound: boolean): TModalresult;
private private
FDebugger: TDebugger; FDebugger: TDebugger;
FDebuggerUpdateLock: integer; FDebuggerUpdateLock: integer;
@ -101,7 +108,6 @@ type
var ASrcEdit: TSourceEditor); var ASrcEdit: TSourceEditor);
// Dialog routines // Dialog routines
procedure DebugDialogDestroy(Sender: TObject);
procedure ViewDebugDialog(const ADialogType: TDebugDialogType); procedure ViewDebugDialog(const ADialogType: TDebugDialogType);
procedure DestroyDebugDialog(const ADialogType: TDebugDialogType); procedure DestroyDebugDialog(const ADialogType: TDebugDialogType);
procedure InitDebugOutputDlg; procedure InitDebugOutputDlg;
@ -412,6 +418,86 @@ end;
// Menu events // Menu events
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
function TDebugManager.DebuggerDlgJumpToCodePos(Sender: TDebuggerDlg;
const Filename: string; Line, Column: integer): TModalresult;
begin
if not Destroying then
Result:=MainIDE.DoJumpToSourcePos(Filename,Column,Line,0,true)
else
Result:=mrCancel;
end;
function TDebugManager.DebuggerDlgGetFullFilename(Sender: TDebuggerDlg;
var Filename: string; AskUserIfNotFound: boolean): TModalresult;
var
SrcFile: String;
n: Integer;
UserFilename: string;
OpenDialog: TOpenDialog;
begin
Result:=mrCancel;
if Destroying then exit;
SrcFile := Filename;
SrcFile := MainIDE.FindSourceFile(SrcFile,Project1.ProjectDirectory,
[fsfSearchForProject,fsfUseIncludePaths,fsfUseDebugPath]);
if SrcFile = '' then SrcFile := Filename;
if not FilenameIsAbsolute(SrcFile)
then begin
// first attempt to get a longer name
// short file, look in the user list
for n := 0 to FUserSourceFiles.Count - 1 do
begin
UserFilename := FUserSourceFiles[n];
if CompareFileNames(ExtractFilenameOnly(SrcFile),
ExtractFilenameOnly(UserFilename)) = 0
then begin
if FileExists(UserFilename)
then begin
FUserSourceFiles.Move(n, 0); // move most recent first
SrcFile := UserFilename;
Break;
end;
end;
end;
end;
if ((not FilenameIsAbsolute(SrcFile)) or (not FileExists(SrcFile)))
and AskUserIfNotFound
then begin
if MessageDlg(lisFileNotFound,
Format(lisTheFileWasNotFoundDoYouWantToLocateItYourself, ['"',
SrcFile, '"', #13, #13, #13])
,mtConfirmation, [mbYes, mbNo], 0) <> mrYes
then Exit;
repeat
OpenDialog:=TOpenDialog.Create(Application);
try
InputHistories.ApplyFileDialogSettings(OpenDialog);
OpenDialog.Title:=lisOpenFile+' '+SrcFile;
OpenDialog.Options:=OpenDialog.Options+[ofFileMustExist];
OpenDialog.FileName := SrcFile;
if not OpenDialog.Execute then
exit;
SrcFile:=CleanAndExpandFilename(OpenDialog.FileName);
InputHistories.StoreFileDialogSettings(OpenDialog);
finally
OpenDialog.Free;
end;
until FilenameIsAbsolute(SrcFile) and FileExists(SrcFile);
FUserSourceFiles.Insert(0, SrcFile);
end;
if SrcFile<>'' then begin
Filename:=SrcFile;
Result:=mrOk;
end;
end;
procedure TDebugManager.mnuViewDebugDialogClick(Sender: TObject); procedure TDebugManager.mnuViewDebugDialogClick(Sender: TObject);
begin begin
ViewDebugDialog(TDebugDialogType(TMenuItem(Sender).Tag)); ViewDebugDialog(TDebugDialogType(TMenuItem(Sender).Tag));
@ -563,11 +649,9 @@ procedure TDebugManager.OnDebuggerCurrentLine(Sender: TObject;
// -> show the current execution line in editor // -> show the current execution line in editor
// if SrcLine = -1 then no source is available // if SrcLine = -1 then no source is available
var var
S, SrcFile: String; SrcFile: String;
OpenDialog: TOpenDialog;
NewSource: TCodeBuffer; NewSource: TCodeBuffer;
Editor: TSourceEditor; Editor: TSourceEditor;
n: Integer;
begin begin
if (Sender<>FDebugger) or (Sender=nil) then exit; if (Sender<>FDebugger) or (Sender=nil) then exit;
if Destroying then exit; if Destroying then exit;
@ -583,59 +667,14 @@ begin
Exit; Exit;
end; end;
SrcFile := MainIDE.FindSourceFile(ALocation.SrcFile,Project1.ProjectDirectory, SrcFile:=ALocation.SrcFile;
[fsfSearchForProject,fsfUseIncludePaths,fsfUseDebugPath]); if DebuggerDlgGetFullFilename(nil,SrcFile,true)<>mrOk then exit;
if SrcFile = '' then SrcFile := ALocation.SrcFile;
if not FilenameIsAbsolute(SrcFile)
then begin
// first attempt to get a longer name
// short file, look in the user list
for n := 0 to FUserSourceFiles.Count - 1 do
begin
S := FUserSourceFiles[n];
if CompareFileNames(ExtractFilenameOnly(SrcFile), ExtractFilenameOnly(S)) = 0
then begin
if FileExists(S)
then begin
FUserSourceFiles.Move(n, 0); // move most recent first
SrcFile := S;
Break;
end;
end;
end;
end;
if (not FilenameIsAbsolute(SrcFile)) or (not FileExists(SrcFile))
then begin
if MessageDlg(lisFileNotFound,
Format(lisTheFileWasNotFoundDoYouWantToLocateItYourself, ['"',
SrcFile, '"', #13, #13, #13])
,mtConfirmation, [mbYes, mbNo], 0) <> mrYes
then Exit;
repeat
OpenDialog:=TOpenDialog.Create(Application);
try
InputHistories.ApplyFileDialogSettings(OpenDialog);
OpenDialog.Title:=lisOpenFile+' '+SrcFile;
OpenDialog.Options:=OpenDialog.Options+[ofFileMustExist];
OpenDialog.FileName := SrcFile;
if not OpenDialog.Execute then
exit;
SrcFile:=CleanAndExpandFilename(OpenDialog.FileName);
InputHistories.StoreFileDialogSettings(OpenDialog);
finally
OpenDialog.Free;
end;
until FilenameIsAbsolute(SrcFile) and FileExists(SrcFile);
FUserSourceFiles.Insert(0, SrcFile);
end;
NewSource:=CodeToolBoss.LoadFile(SrcFile,true,false); NewSource:=CodeToolBoss.LoadFile(SrcFile,true,false);
if NewSource=nil then begin if NewSource=nil then begin
MessageDlg(lisDebugUnableToLoadFile,
Format(lisDebugUnableToLoadFile2, ['"', SrcFile, '"']),
mtError,[mbCancel],0);
exit; exit;
end; end;
@ -687,6 +726,8 @@ 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;
CurDialog.OnJumpToCodePos:=@DebuggerDlgJumpToCodePos;
CurDialog.OnGetFullDebugFilename:=@DebuggerDlgGetFullFilename;
EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name); EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name);
case ADialogType of case ADialogType of
ddtOutput: InitDebugOutputDlg; ddtOutput: InitDebugOutputDlg;
@ -1348,6 +1389,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.39 2003/05/29 23:14:17 mattias
implemented jump to code on double click for breakpoints and callstack dlg
Revision 1.38 2003/05/29 18:47:27 mattias Revision 1.38 2003/05/29 18:47:27 mattias
fixed reposition sourcemark fixed reposition sourcemark

View File

@ -422,6 +422,8 @@ resourcestring
// file dialogs // file dialogs
lisOpenFile = 'Open file'; lisOpenFile = 'Open file';
lisDebugUnableToLoadFile = 'Unable to load file';
lisDebugUnableToLoadFile2 = 'Unable to load file %s%s%s.';
lisOpenProjectFile = 'Open Project File'; lisOpenProjectFile = 'Open Project File';
lisOpenPackageFile = 'Open Package File'; lisOpenPackageFile = 'Open Package File';
lisSaveSpace = 'Save '; lisSaveSpace = 'Save ';

View File

@ -434,6 +434,9 @@ type
procedure SaveEnvironment; virtual; abstract; procedure SaveEnvironment; virtual; abstract;
procedure SetRecentSubMenu(ParentMenuItem: TMenuItem; FileList: TStringList; procedure SetRecentSubMenu(ParentMenuItem: TMenuItem; FileList: TStringList;
OnClickEvent: TNotifyEvent); virtual; OnClickEvent: TNotifyEvent); virtual;
function DoJumpToSourcePos(const Filename: string;
NewX, NewY, NewTopLine: integer;
AddJumpPoint: boolean): TModalResult; virtual; abstract;
function DoJumpToCodePos( function DoJumpToCodePos(
ActiveSrcEdit: TSourceEditor; ActiveUnitInfo: TUnitInfo; ActiveSrcEdit: TSourceEditor; ActiveUnitInfo: TUnitInfo;
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer; NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;

View File

@ -573,8 +573,6 @@ begin
EditorAndLine.Line:=ALine; EditorAndLine.Line:=ALine;
AVLNode:=fSortedItems.FindLeftMostKey(@EditorAndLine, AVLNode:=fSortedItems.FindLeftMostKey(@EditorAndLine,
@CompareEditorAndLineWithMark); @CompareEditorAndLineWithMark);
if ALine=50 then
writeln('TSourceMarks.GetMarksForLine ',Aline,' ',AVLNode<>nil);
while (AVLNode<>nil) do begin while (AVLNode<>nil) do begin
CurMark:=TSourceMark(AVLNode.Data); CurMark:=TSourceMark(AVLNode.Data);
if CompareEditorAndLineWithMark(@EditorAndLine,CurMark)<>0 then break; if CompareEditorAndLineWithMark(@EditorAndLine,CurMark)<>0 then break;