implemented searching debugging files in inherited unit paths

git-svn-id: trunk@4177 -
This commit is contained in:
mattias 2003-05-23 18:50:07 +00:00
parent 692d003027
commit 00a3d4a023
3 changed files with 66 additions and 64 deletions

View File

@ -206,6 +206,7 @@ type
function GetNestedCommentsFlagForFile(const Filename: string): boolean; function GetNestedCommentsFlagForFile(const Filename: string): boolean;
function GetPascalCompilerForDirectory(const Directory: string): TPascalCompiler; function GetPascalCompilerForDirectory(const Directory: string): TPascalCompiler;
function GetCompilerModeForDirectory(const Directory: string): TCompilerMode; function GetCompilerModeForDirectory(const Directory: string): TCompilerMode;
function GetCompiledSrcExtForDirectory(const Directory: string): string;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -687,6 +688,18 @@ begin
Result:=cm; Result:=cm;
end; end;
function TCodeToolManager.GetCompiledSrcExtForDirectory(const Directory: string
): string;
var
Evaluator: TExpressionEvaluator;
begin
Result:='.ppu';
Evaluator:=DefineTree.GetDefinesForDirectory(Directory,true);
if Evaluator=nil then exit;
if Evaluator.IsDefined('WIN32') then
Result:='.ppw';
end;
function TCodeToolManager.InitCurCodeTool(Code: TCodeBuffer): boolean; function TCodeToolManager.InitCurCodeTool(Code: TCodeBuffer): boolean;
var MainCode: TCodeBuffer; var MainCode: TCodeBuffer;
begin begin

View File

@ -40,12 +40,12 @@ uses
MemCheck, MemCheck,
{$ENDIF} {$ENDIF}
Classes, SysUtils, Forms, Controls, Dialogs, Menus, FileCtrl, Laz_XMLCfg, Classes, SysUtils, Forms, Controls, Dialogs, Menus, FileCtrl, Laz_XMLCfg,
SynEdit, SynEdit, CodeCache, CodeToolManager,
CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, UnitEditor, CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, UnitEditor,
Project, IDEProcs, Debugger, RunParamsOpts, ExtToolDialog, IDEOptionDefs, Project, IDEProcs, InputHistory, Debugger, RunParamsOpts, ExtToolDialog,
LazarusIDEStrConsts, ProjectDefs, BaseDebugManager, MainBar, DebuggerDlg, IDEOptionDefs, LazarusIDEStrConsts, ProjectDefs, BaseDebugManager, MainBar,
Watchesdlg, BreakPointsdlg, LocalsDlg, DBGOutputForm, GDBMIDebugger, DebuggerDlg, Watchesdlg, BreakPointsdlg, LocalsDlg, DBGOutputForm,
CallStackDlg; GDBMIDebugger, CallStackDlg;
type type
@ -288,11 +288,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
ActiveSrcEdit: TSourceEditor; SrcFile: String;
SearchFile, UnitFile: String;
OpenDialog: TOpenDialog; OpenDialog: TOpenDialog;
UnitInfo: TUnitInfo; NewSource: TCodeBuffer;
n: Integer;
begin begin
if (Sender<>FDebugger) or (Sender=nil) then exit; if (Sender<>FDebugger) or (Sender=nil) then exit;
@ -307,64 +305,48 @@ begin
Exit; Exit;
end; end;
UnitFile := MainIDE.FindUnitFile(ALocation.SrcFile); SrcFile := MainIDE.FindSourceFile(ALocation.SrcFile);
if UnitFile = '' if SrcFile = '' then SrcFile := ALocation.SrcFile;
then UnitFile := ALocation.SrcFile;
if MainIDE.DoOpenEditorFile(UnitFile,-1,[ofOnlyIfExists, ofQuiet]) <> mrOk if (not FilenameIsAbsolute(SrcFile)) or (not FileExists(SrcFile)) then begin
then begin if MessageDlg(lisFileNotFound,
// Try to find it ourself in the project files Format(lisTheFileWasNotFoundDoYouWantToLocateItYourself, ['"',
SearchFile := ExtractFilenameOnly(ALocation.SrcFile); SrcFile, '"', #13, #13, #13])
UnitFile := ''; ,mtConfirmation, [mbYes, mbNo], 0) <> mrYes
for n := Project1.UnitCount - 1 downto 0 do then Exit;
begin
UnitInfo := Project1.Units[n]; repeat
if CompareFileNames(SearchFile, ExtractFilenameOnly(UnitInfo.FileName)) = 0 OpenDialog:=TOpenDialog.Create(Application);
then begin try
UnitFile := UnitInfo.FileName; InputHistories.ApplyFileDialogSettings(OpenDialog);
Break; OpenDialog.Title:=lisOpenFile+' '+SrcFile;
OpenDialog.Options:=OpenDialog.Options+[ofFileMustExist];
if not OpenDialog.Execute then
exit;
SrcFile:=CleanAndExpandFilename(OpenDialog.FileName);
InputHistories.StoreFileDialogSettings(OpenDialog);
finally
OpenDialog.Free;
end; end;
end; until FilenameIsAbsolute(SrcFile) and FileExists(SrcFile);
if (UnitFile = '')
or (MainIDE.DoOpenEditorFile(UnitFile,-1,[ofOnlyIfExists, ofQuiet]) <> mrOk)
then begin
UnitFile := ALocation.SrcFile;
repeat
if MessageDlg(lisFileNotFound,
Format(lisTheFileWasNotFoundDoYouWantToLocateItYourself, ['"',
UnitFile, '"', #13, #13, #13])
,mtConfirmation, [mbYes, mbNo], 0) <> mrYes
then Exit;
OpenDialog := TOpenDialog.Create(Application);
try
OpenDialog.Title := lisOpenFile;
OpenDialog.FileName := ALocation.SrcFile;
if not OpenDialog.Execute
then Exit;
UnitFile := OpenDialog.FileName;
finally
OpenDialog.Free;
end;
until MainIDE.DoOpenEditorFile(UnitFile,-1,[ofOnlyIfExists, ofQuiet]) = mrOk;
end;
end; end;
ActiveSrcEdit := SourceNoteBook.GetActiveSE; NewSource:=CodeToolBoss.LoadFile(SrcFile,true,false);
if ActiveSrcEdit=nil then exit; if NewSource=nil then begin
exit;
with ActiveSrcEdit.EditorComponent do
begin
CaretXY:=Point(1, ALocation.SrcLine);
BlockBegin:=CaretXY;
BlockEnd:=CaretXY;
TopLine:=ALocation.SrcLine-(LinesInWindow div 2);
end; end;
SourceNotebook.ClearExecutionLines;
SourceNotebook.ClearErrorLines; // clear old error and execution lines
ActiveSrcEdit.ExecutionLine:=ALocation.SrcLine; if SourceNotebook<>nil then begin
// ActiveSrcEdit.ErrorLine:=ALocation.SrcLine; SourceNotebook.ClearExecutionLines;
SourceNotebook.ClearErrorLines;
end;
// jump editor to execution line
if MainIDE.DoJumpToCodePos(nil,nil,NewSource,1,ALocation.SrcLine,-1,true)
<>mrOk then exit;
// mark execution line
SourceNotebook.GetActiveSE.ExecutionLine:=ALocation.SrcLine;
end; end;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -912,6 +894,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.21 2003/05/23 18:50:07 mattias
implemented searching debugging files in inherited unit paths
Revision 1.20 2003/05/23 16:46:13 mattias Revision 1.20 2003/05/23 16:46:13 mattias
added message, that debugger is readonly while running added message, that debugger is readonly while running

View File

@ -417,6 +417,10 @@ 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 DoJumpToCodePos(
ActiveSrcEdit: TSourceEditor; ActiveUnitInfo: TUnitInfo;
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
AddJumpPoint: boolean): TModalResult; virtual; abstract;
procedure DoJumpToCodeToolBossError; virtual; abstract; procedure DoJumpToCodeToolBossError; virtual; abstract;
procedure SaveSourceEditorChangesToCodeCache(PageIndex: integer); virtual; abstract; procedure SaveSourceEditorChangesToCodeCache(PageIndex: integer); virtual; abstract;
end; end;