mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 21:41:35 +02:00
IDE: refactor, clean-up JumpToCodde/Source
git-svn-id: trunk@32347 -
This commit is contained in:
parent
ea6ce866f8
commit
a23438a510
@ -1084,7 +1084,7 @@ var
|
|||||||
SrcLine: Integer;
|
SrcLine: Integer;
|
||||||
i, TId: Integer;
|
i, TId: Integer;
|
||||||
StackEntry: TCallStackEntry;
|
StackEntry: TCallStackEntry;
|
||||||
FocusEditor: Boolean;
|
Flags: TJumpToCodePosFlags;
|
||||||
CurrentSourceUnitInfo: TDebuggerUnitInfo;
|
CurrentSourceUnitInfo: TDebuggerUnitInfo;
|
||||||
begin
|
begin
|
||||||
if (Sender<>FDebugger) or (Sender=nil) then exit;
|
if (Sender<>FDebugger) or (Sender=nil) then exit;
|
||||||
@ -1166,11 +1166,13 @@ begin
|
|||||||
then Editor := SourceEditorManager.SourceEditorIntfWithFilename(NewSource.Filename);
|
then Editor := SourceEditorManager.SourceEditorIntfWithFilename(NewSource.Filename);
|
||||||
|
|
||||||
// jump editor to execution line
|
// jump editor to execution line
|
||||||
FocusEditor := (FCurrentBreakPoint = nil) or (FCurrentBreakPoint.AutoContinueTime = 0);
|
Flags := [jfAddJumpPoint];
|
||||||
|
if (FCurrentBreakPoint = nil) or (FCurrentBreakPoint.AutoContinueTime = 0)
|
||||||
|
then include(Flags, jfFocusEditor);
|
||||||
i := SrcLine;
|
i := SrcLine;
|
||||||
if (Editor <> nil) then
|
if (Editor <> nil) then
|
||||||
i := Editor.DebugToSourceLine(i);
|
i := Editor.DebugToSourceLine(i);
|
||||||
if MainIDE.DoJumpToCodePos(nil,nil,NewSource,1,i,-1,true, FocusEditor)<>mrOk
|
if MainIDE.DoJumpToCodePosition(nil,nil,NewSource,1,i,-1, Flags)<>mrOk
|
||||||
then exit;
|
then exit;
|
||||||
|
|
||||||
// mark execution line
|
// mark execution line
|
||||||
|
105
ide/main.pp
105
ide/main.pp
@ -999,12 +999,12 @@ type
|
|||||||
Flags: TCodeToolsFlags): boolean;
|
Flags: TCodeToolsFlags): boolean;
|
||||||
function DoJumpToSourcePosition(const Filename: string;
|
function DoJumpToSourcePosition(const Filename: string;
|
||||||
NewX, NewY, NewTopLine: integer;
|
NewX, NewY, NewTopLine: integer;
|
||||||
AddJumpPoint: boolean; MarkLine: Boolean = False): TModalResult; override;
|
Flags: TJumpToCodePosFlags = [jfFocusEditor]): TModalResult; override;
|
||||||
function DoJumpToCodePos(
|
function DoJumpToCodePosition(
|
||||||
ActiveSrcEdit: TSourceEditor;
|
ActiveSrcEdit: TSourceEditorInterface;
|
||||||
ActiveUnitInfo: TUnitInfo;
|
ActiveUnitInfo: TUnitInfo;
|
||||||
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
||||||
AddJumpPoint: boolean; FocusEditor: Boolean = True; MarkLine: Boolean = False): TModalResult; override;
|
Flags: TJumpToCodePosFlags = [jfFocusEditor]): TModalResult; override;
|
||||||
procedure DoJumpToCodeToolBossError; override;
|
procedure DoJumpToCodeToolBossError; override;
|
||||||
procedure UpdateSourceNames;
|
procedure UpdateSourceNames;
|
||||||
function NeedSaveSourceEditorChangesToCodeCache(PageIndex: integer): boolean; override;
|
function NeedSaveSourceEditorChangesToCodeCache(PageIndex: integer): boolean; override;
|
||||||
@ -10392,8 +10392,8 @@ begin
|
|||||||
if CodeToolBoss.FindDeclarationInInterface(ActiveUnitInfo.Source,
|
if CodeToolBoss.FindDeclarationInInterface(ActiveUnitInfo.Source,
|
||||||
AnIdentifier,NewSource, NewX, NewY, NewTopLine)
|
AnIdentifier,NewSource, NewX, NewY, NewTopLine)
|
||||||
then begin
|
then begin
|
||||||
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, true);
|
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor]);
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
end else
|
end else
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
@ -10419,9 +10419,9 @@ begin
|
|||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
GetCurrentUnit(ActiveSrcEdit,ActiveUnitInfo);
|
GetCurrentUnit(ActiveSrcEdit,ActiveUnitInfo);
|
||||||
if ActiveUnitInfo<>nil then begin
|
if ActiveUnitInfo<>nil then begin
|
||||||
DoJumpToCodePos(OldActiveSrcEdit, OldActiveUnitInfo,
|
DoJumpToCodePosition(OldActiveSrcEdit, OldActiveUnitInfo,
|
||||||
ActiveUnitInfo.Source,
|
ActiveUnitInfo.Source,
|
||||||
CursorPosition.X, CursorPosition.Y, TopLine, true);
|
CursorPosition.X, CursorPosition.Y, TopLine, [jfAddJumpPoint, jfFocusEditor]);
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
end else begin
|
end else begin
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
@ -14412,7 +14412,7 @@ end;
|
|||||||
procedure TMainIDE.OnCodeExplorerJumpToCode(Sender: TObject;
|
procedure TMainIDE.OnCodeExplorerJumpToCode(Sender: TObject;
|
||||||
const Filename: string; const Caret: TPoint; TopLine: integer);
|
const Filename: string; const Caret: TPoint; TopLine: integer);
|
||||||
begin
|
begin
|
||||||
DoJumpToSourcePosition(Filename,Caret.X,Caret.Y,TopLine,true);
|
DoJumpToSourcePosition(Filename,Caret.X,Caret.Y,TopLine,[jfAddJumpPoint, jfFocusEditor]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OnCodeExplorerShowOptions(Sender: TObject);
|
procedure TMainIDE.OnCodeExplorerShowOptions(Sender: TObject);
|
||||||
@ -14964,41 +14964,45 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoJumpToSourcePosition(const Filename: string; NewX, NewY,
|
function TMainIDE.DoJumpToSourcePosition(const Filename: string; NewX, NewY,
|
||||||
NewTopLine: integer; AddJumpPoint: boolean; MarkLine: Boolean): TModalResult;
|
NewTopLine: integer; Flags: TJumpToCodePosFlags = [jfFocusEditor]): TModalResult;
|
||||||
var
|
var
|
||||||
CodeBuffer: TCodeBuffer;
|
CodeBuffer: TCodeBuffer;
|
||||||
begin
|
begin
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
CodeBuffer:=CodeToolBoss.LoadFile(TrimAndExpandFilename(Filename),true,false);
|
CodeBuffer:=CodeToolBoss.LoadFile(TrimAndExpandFilename(Filename),true,false);
|
||||||
if CodeBuffer=nil then exit;
|
if CodeBuffer=nil then exit;
|
||||||
Result:=DoJumpToCodePos(nil,nil,CodeBuffer,NewX,NewY,NewTopLine,AddJumpPoint, True, MarkLine);
|
Result:=DoJumpToCodePosition(nil,nil,CodeBuffer,NewX,NewY,NewTopLine, Flags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoJumpToCodePos(ActiveSrcEdit: TSourceEditor;
|
function TMainIDE.DoJumpToCodePosition(ActiveSrcEdit: TSourceEditorInterface;
|
||||||
ActiveUnitInfo: TUnitInfo; NewSource: TCodeBuffer; NewX, NewY,
|
ActiveUnitInfo: TUnitInfo; NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
||||||
NewTopLine: integer; AddJumpPoint: boolean; FocusEditor: Boolean;
|
Flags: TJumpToCodePosFlags): TModalResult;
|
||||||
MarkLine: Boolean): TModalResult;
|
|
||||||
var
|
var
|
||||||
NewSrcEdit: TSourceEditor;
|
SrcEdit, NewSrcEdit: TSourceEditor;
|
||||||
AnEditorInfo: TUnitEditorInfo;
|
AnEditorInfo: TUnitEditorInfo;
|
||||||
begin
|
begin
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if NewSource=nil then begin
|
if NewSource=nil then begin
|
||||||
DebugLn(['TMainIDE.DoJumpToCodePos ERROR: missing NewSource']);
|
DebugLn(['TMainIDE.DoJumpToCodePosition ERROR: missing NewSource']);
|
||||||
DumpStack;
|
DumpStack;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if ActiveSrcEdit = nil then
|
||||||
|
SrcEdit := nil
|
||||||
|
else
|
||||||
|
SrcEdit := ActiveSrcEdit as TSourceEditor;
|
||||||
|
|
||||||
SourceEditorManager.BeginAutoFocusLock;
|
SourceEditorManager.BeginAutoFocusLock;
|
||||||
try
|
try
|
||||||
if (ActiveSrcEdit=nil) or (ActiveUnitInfo=nil) then
|
if (SrcEdit=nil) or (ActiveUnitInfo=nil) then
|
||||||
GetCurrentUnit(ActiveSrcEdit,ActiveUnitInfo);
|
GetCurrentUnit(SrcEdit,ActiveUnitInfo);
|
||||||
|
|
||||||
if AddJumpPoint and (ActiveUnitInfo <> nil) and (ActiveSrcEdit <> nil)
|
if (jfAddJumpPoint in Flags) and (ActiveUnitInfo <> nil) and (SrcEdit <> nil)
|
||||||
then begin
|
then begin
|
||||||
if (NewSource<>ActiveUnitInfo.Source)
|
if (NewSource<>ActiveUnitInfo.Source)
|
||||||
or (ActiveSrcEdit.EditorComponent.CaretX<>NewX)
|
or (SrcEdit.EditorComponent.CaretX<>NewX)
|
||||||
or (ActiveSrcEdit.EditorComponent.CaretY<>NewY) then
|
or (SrcEdit.EditorComponent.CaretY<>NewY) then
|
||||||
SourceEditorManager.AddJumpPointClicked(Self);
|
SourceEditorManager.AddJumpPointClicked(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -15029,11 +15033,11 @@ begin
|
|||||||
SourceEditorManager.ActiveEditor := NewSrcEdit;
|
SourceEditorManager.ActiveEditor := NewSrcEdit;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
NewSrcEdit:=ActiveSrcEdit;
|
NewSrcEdit:=SrcEdit;
|
||||||
end;
|
end;
|
||||||
if NewX<1 then NewX:=1;
|
if NewX<1 then NewX:=1;
|
||||||
if NewY<1 then NewY:=1;
|
if NewY<1 then NewY:=1;
|
||||||
//debugln(['[TMainIDE.DoJumpToCodePos] ',NewX,',',NewY,',',NewTopLine]);
|
//debugln(['[TMainIDE.DoJumpToCodePosition] ',NewX,',',NewY,',',NewTopLine]);
|
||||||
try
|
try
|
||||||
NewSrcEdit.BeginUpdate;
|
NewSrcEdit.BeginUpdate;
|
||||||
NewSrcEdit.EditorComponent.MoveLogicalCaretIgnoreEOL(Point(NewX,NewY));
|
NewSrcEdit.EditorComponent.MoveLogicalCaretIgnoreEOL(Point(NewX,NewY));
|
||||||
@ -15043,15 +15047,15 @@ begin
|
|||||||
else
|
else
|
||||||
NewSrcEdit.TopLine:=NewTopLine;
|
NewSrcEdit.TopLine:=NewTopLine;
|
||||||
end;
|
end;
|
||||||
//DebugLn('TMainIDE.DoJumpToCodePos NewY=',dbgs(NewY),' ',dbgs(TopLine),' ',dbgs(NewTopLine));
|
//DebugLn('TMainIDE.DoJumpToCodePosition NewY=',dbgs(NewY),' ',dbgs(TopLine),' ',dbgs(NewTopLine));
|
||||||
NewSrcEdit.CenterCursorHoriz(hcmSoftKeepEOL);
|
NewSrcEdit.CenterCursorHoriz(hcmSoftKeepEOL);
|
||||||
finally
|
finally
|
||||||
NewSrcEdit.EndUpdate;
|
NewSrcEdit.EndUpdate;
|
||||||
end;
|
end;
|
||||||
if MarkLine then
|
if jfMarkLine in Flags then
|
||||||
NewSrcEdit.ErrorLine := NewY;
|
NewSrcEdit.ErrorLine := NewY;
|
||||||
|
|
||||||
if FocusEditor then
|
if jfFocusEditor in Flags then
|
||||||
SourceEditorManager.ShowActiveWindowOnTop(True);
|
SourceEditorManager.ShowActiveWindowOnTop(True);
|
||||||
UpdateSourceNames;
|
UpdateSourceNames;
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
@ -15137,6 +15141,7 @@ var ActiveSrcEdit: TSourceEditor;
|
|||||||
NewX, NewY, NewTopLine: integer;
|
NewX, NewY, NewTopLine: integer;
|
||||||
RevertableJump: boolean;
|
RevertableJump: boolean;
|
||||||
LogCaret: TPoint;
|
LogCaret: TPoint;
|
||||||
|
Flags: TJumpToCodePosFlags;
|
||||||
begin
|
begin
|
||||||
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[]) then exit;
|
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[]) then exit;
|
||||||
{$IFDEF IDE_DEBUG}
|
{$IFDEF IDE_DEBUG}
|
||||||
@ -15148,8 +15153,10 @@ begin
|
|||||||
LogCaret.X,LogCaret.Y,
|
LogCaret.X,LogCaret.Y,
|
||||||
NewSource,NewX,NewY,NewTopLine,RevertableJump) then
|
NewSource,NewX,NewY,NewTopLine,RevertableJump) then
|
||||||
begin
|
begin
|
||||||
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
Flags := [jfAddJumpPoint];
|
||||||
NewSource, NewX, NewY, NewTopLine, not RevertableJump);
|
if not RevertableJump then include(Flags, jfFocusEditor);
|
||||||
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
|
NewSource, NewX, NewY, NewTopLine, Flags);
|
||||||
end else begin
|
end else begin
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
end;
|
end;
|
||||||
@ -15257,8 +15264,8 @@ begin
|
|||||||
)
|
)
|
||||||
then begin
|
then begin
|
||||||
//debugln(['TMainIDE.DoFindDeclarationAtCaret ',NewSource.Filename,' NewX=',Newx,',y=',NewY,' ',NewTopLine]);
|
//debugln(['TMainIDE.DoFindDeclarationAtCaret ',NewSource.Filename,' NewX=',Newx,',y=',NewY,' ',NewTopLine]);
|
||||||
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, true);
|
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor]);
|
||||||
end else begin
|
end else begin
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
end;
|
end;
|
||||||
@ -15337,8 +15344,8 @@ begin
|
|||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
DoJumpToCodePos(TargetSrcEdit, TargetUnitInfo,
|
DoJumpToCodePosition(TargetSrcEdit, TargetUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, true);
|
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor]);
|
||||||
CodeToolBoss.GetIdentifierAt(NewSource,NewX,NewY,Identifier);
|
CodeToolBoss.GetIdentifierAt(NewSource,NewX,NewY,Identifier);
|
||||||
CurUnitname:=ExtractFileNameOnly(NewSource.Filename);
|
CurUnitname:=ExtractFileNameOnly(NewSource.Filename);
|
||||||
|
|
||||||
@ -15549,8 +15556,8 @@ begin
|
|||||||
ActiveSrcEdit.EditorComponent.CaretY,
|
ActiveSrcEdit.EditorComponent.CaretY,
|
||||||
NewSource,NewX,NewY,NewTopLine) then
|
NewSource,NewX,NewY,NewTopLine) then
|
||||||
begin
|
begin
|
||||||
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, false);
|
NewSource, NewX, NewY, NewTopLine, [jfFocusEditor]);
|
||||||
end else
|
end else
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
end;
|
end;
|
||||||
@ -15571,8 +15578,8 @@ begin
|
|||||||
ActiveSrcEdit.EditorComponent.CaretY,
|
ActiveSrcEdit.EditorComponent.CaretY,
|
||||||
NewSource,NewX,NewY,NewTopLine) then
|
NewSource,NewX,NewY,NewTopLine) then
|
||||||
begin
|
begin
|
||||||
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, false);
|
NewSource, NewX, NewY, NewTopLine, [jfFocusEditor]);
|
||||||
end else
|
end else
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
end;
|
end;
|
||||||
@ -15598,8 +15605,8 @@ begin
|
|||||||
if CodeToolBoss.GuessUnclosedBlock(ActiveUnitInfo.Source,
|
if CodeToolBoss.GuessUnclosedBlock(ActiveUnitInfo.Source,
|
||||||
StartX,StartY,NewSource,NewX,NewY,NewTopLine) then
|
StartX,StartY,NewSource,NewX,NewY,NewTopLine) then
|
||||||
begin
|
begin
|
||||||
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, true);
|
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor]);
|
||||||
end else begin
|
end else begin
|
||||||
if CodeToolBoss.ErrorMessage='' then begin
|
if CodeToolBoss.ErrorMessage='' then begin
|
||||||
MessageDlg(lisSuccess, lisAllBlocksLooksOk, mtInformation, [mbOk], 0);
|
MessageDlg(lisSuccess, lisAllBlocksLooksOk, mtInformation, [mbOk], 0);
|
||||||
@ -15629,8 +15636,8 @@ begin
|
|||||||
if CodeToolBoss.GuessMisplacedIfdefEndif(ActiveUnitInfo.Source,
|
if CodeToolBoss.GuessMisplacedIfdefEndif(ActiveUnitInfo.Source,
|
||||||
StartX,StartY,NewSource,NewX,NewY,NewTopLine) then
|
StartX,StartY,NewSource,NewX,NewY,NewTopLine) then
|
||||||
begin
|
begin
|
||||||
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, true);
|
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor]);
|
||||||
end else
|
end else
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
end;
|
end;
|
||||||
@ -15651,8 +15658,8 @@ begin
|
|||||||
ActiveSrcEdit.EditorComponent.CaretY,
|
ActiveSrcEdit.EditorComponent.CaretY,
|
||||||
NewSource,NewX,NewY,NewTopLine) then
|
NewSource,NewX,NewY,NewTopLine) then
|
||||||
begin
|
begin
|
||||||
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, false);
|
NewSource, NewX, NewY, NewTopLine, [jfFocusEditor]);
|
||||||
end else
|
end else
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
end;
|
end;
|
||||||
@ -15853,8 +15860,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
ApplyCodeToolChanges;
|
ApplyCodeToolChanges;
|
||||||
if NewSource<>nil then
|
if NewSource<>nil then
|
||||||
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, true);
|
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor]);
|
||||||
end else begin
|
end else begin
|
||||||
// error: probably a syntax error or just not in a procedure head/body
|
// error: probably a syntax error or just not in a procedure head/body
|
||||||
// or not in a class
|
// or not in a class
|
||||||
@ -15895,8 +15902,8 @@ begin
|
|||||||
if CodeToolBoss.ErrorMessage<>'' then begin
|
if CodeToolBoss.ErrorMessage<>'' then begin
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
end else if CTResult then begin
|
end else if CTResult then begin
|
||||||
DoJumpToCodePos(ActiveSrcEdit,ActiveUnitInfo,
|
DoJumpToCodePosition(ActiveSrcEdit,ActiveUnitInfo,
|
||||||
NewSource,NewX,NewY,NewTopLine,true);
|
NewSource,NewX,NewY,NewTopLine,[jfAddJumpPoint, jfFocusEditor]);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
OpenEditorsOnCodeToolChange:=OldChange;
|
OpenEditorsOnCodeToolChange:=OldChange;
|
||||||
@ -17747,8 +17754,8 @@ begin
|
|||||||
AClassName,CurMethodName,
|
AClassName,CurMethodName,
|
||||||
NewSource,NewX,NewY,NewTopLine) then
|
NewSource,NewX,NewY,NewTopLine) then
|
||||||
begin
|
begin
|
||||||
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, true);
|
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor]);
|
||||||
end else begin
|
end else begin
|
||||||
DebugLn(['TMainIDE.OnPropHookShowMethod failed finding the method in code']);
|
DebugLn(['TMainIDE.OnPropHookShowMethod failed finding the method in code']);
|
||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
|
@ -163,19 +163,13 @@ type
|
|||||||
OnClickEvent: TNotifyEvent); override;
|
OnClickEvent: TNotifyEvent); override;
|
||||||
procedure UpdateHighlighters(Immediately: boolean = false); override;
|
procedure UpdateHighlighters(Immediately: boolean = false); override;
|
||||||
|
|
||||||
function DoJumpToCodePosition(
|
//function DoJumpToCodePos(
|
||||||
ActiveSrcEdit: TSourceEditorInterface;
|
// ActiveSrcEdit: TSourceEditor;
|
||||||
ActiveUnitInfo: TUnitInfo;
|
// ActiveUnitInfo: TUnitInfo;
|
||||||
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
// NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
||||||
AddJumpPoint: boolean;
|
// AddJumpPoint: boolean;
|
||||||
MarkLine: Boolean = False): TModalResult; override;
|
// FocusEditor: Boolean = True;
|
||||||
function DoJumpToCodePos(
|
// MarkLine: Boolean = False): TModalResult; virtual;
|
||||||
ActiveSrcEdit: TSourceEditor;
|
|
||||||
ActiveUnitInfo: TUnitInfo;
|
|
||||||
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
|
||||||
AddJumpPoint: boolean;
|
|
||||||
FocusEditor: Boolean = True;
|
|
||||||
MarkLine: Boolean = False): TModalResult; virtual; abstract;
|
|
||||||
|
|
||||||
procedure FindInFilesPerDialog(AProject: TProject); override;
|
procedure FindInFilesPerDialog(AProject: TProject); override;
|
||||||
procedure FindInFiles(AProject: TProject; const FindText: string); override;
|
procedure FindInFiles(AProject: TProject; const FindText: string); override;
|
||||||
@ -1178,20 +1172,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDEBase.DoJumpToCodePosition(
|
//function TMainIDEBase.DoJumpToCodePos(ActiveSrcEdit: TSourceEditor; ActiveUnitInfo: TUnitInfo;
|
||||||
ActiveSrcEdit: TSourceEditorInterface; ActiveUnitInfo: TUnitInfo;
|
// NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer; AddJumpPoint: boolean;
|
||||||
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer; AddJumpPoint: boolean;
|
// FocusEditor: Boolean; MarkLine: Boolean): TModalResult;
|
||||||
MarkLine: Boolean): TModalResult;
|
//var
|
||||||
var
|
// Flags: TJumpToCodePosFlags;
|
||||||
SrcEdit: TSourceEditor;
|
//begin
|
||||||
begin
|
// Flags := [];
|
||||||
if ActiveSrcEdit = nil then
|
// if FocusEditor then Include(Flags, jfFocusEditor);
|
||||||
SrcEdit := nil
|
// if AddJumpPoint then Include(Flags, jfAddJumpPoint);
|
||||||
else
|
// if MarkLine then Include(Flags, jfMarkLine);
|
||||||
SrcEdit := ActiveSrcEdit as TSourceEditor;
|
// DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo, NewSource, NewX, NewY, NewTopLine,
|
||||||
Result := DoJumpToCodePos(SrcEdit as TSourceEditor, ActiveUnitInfo,
|
// Flags)
|
||||||
NewSource, NewX, NewY, NewTopLine, AddJumpPoint, True, MarkLine);
|
//end;
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TMainIDEBase.FindInFilesPerDialog(AProject: TProject);
|
procedure TMainIDEBase.FindInFilesPerDialog(AProject: TProject);
|
||||||
begin
|
begin
|
||||||
|
@ -118,6 +118,8 @@ type
|
|||||||
ieorExport
|
ieorExport
|
||||||
);
|
);
|
||||||
|
|
||||||
|
TJumpToCodePosFlag = (jfAddJumpPoint, jfFocusEditor, jfMarkLine);
|
||||||
|
TJumpToCodePosFlags = set of TJumpToCodePosFlag;
|
||||||
|
|
||||||
{ TMainIDEInterface }
|
{ TMainIDEInterface }
|
||||||
|
|
||||||
@ -180,13 +182,21 @@ type
|
|||||||
function DoJumpToSourcePosition(const Filename: string;
|
function DoJumpToSourcePosition(const Filename: string;
|
||||||
NewX, NewY, NewTopLine: integer;
|
NewX, NewY, NewTopLine: integer;
|
||||||
AddJumpPoint: boolean;
|
AddJumpPoint: boolean;
|
||||||
MarkLine: Boolean = False): TModalResult; virtual; abstract;
|
MarkLine: Boolean = False): TModalResult;
|
||||||
|
function DoJumpToSourcePosition(const Filename: string;
|
||||||
|
NewX, NewY, NewTopLine: integer;
|
||||||
|
Flags: TJumpToCodePosFlags = [jfFocusEditor]): TModalResult; virtual; abstract;
|
||||||
function DoJumpToCodePosition(
|
function DoJumpToCodePosition(
|
||||||
ActiveSrcEdit: TSourceEditorInterface;
|
ActiveSrcEdit: TSourceEditorInterface;
|
||||||
ActiveUnitInfo: TUnitInfo;
|
ActiveUnitInfo: TUnitInfo;
|
||||||
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
||||||
AddJumpPoint: boolean;
|
AddJumpPoint: boolean;
|
||||||
MarkLine: Boolean = False): TModalResult; virtual; abstract;
|
MarkLine: Boolean = False): TModalResult;
|
||||||
|
function DoJumpToCodePosition(
|
||||||
|
ActiveSrcEdit: TSourceEditorInterface;
|
||||||
|
ActiveUnitInfo: TUnitInfo;
|
||||||
|
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
||||||
|
Flags: TJumpToCodePosFlags = [jfFocusEditor]): TModalResult; virtual; abstract;
|
||||||
|
|
||||||
procedure FindInFilesPerDialog(AProject: TProject); virtual; abstract;
|
procedure FindInFilesPerDialog(AProject: TProject); virtual; abstract;
|
||||||
procedure FindInFiles(AProject: TProject; const FindText: string); virtual; abstract;
|
procedure FindInFiles(AProject: TProject; const FindText: string); virtual; abstract;
|
||||||
@ -430,6 +440,30 @@ begin
|
|||||||
UpdateCaption;
|
UpdateCaption;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMainIDEInterface.DoJumpToSourcePosition(const Filename: string; NewX, NewY,
|
||||||
|
NewTopLine: integer; AddJumpPoint: boolean; MarkLine: Boolean): TModalResult;
|
||||||
|
var
|
||||||
|
Flags: TJumpToCodePosFlags;
|
||||||
|
begin
|
||||||
|
Flags := [jfFocusEditor];
|
||||||
|
if AddJumpPoint then Include(Flags, jfAddJumpPoint);
|
||||||
|
if MarkLine then Include(Flags, jfMarkLine);
|
||||||
|
DoJumpToSourcePosition(Filename, NewX, NewY, NewTopLine, Flags)
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMainIDEInterface.DoJumpToCodePosition(ActiveSrcEdit: TSourceEditorInterface;
|
||||||
|
ActiveUnitInfo: TUnitInfo; NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer;
|
||||||
|
AddJumpPoint: boolean; MarkLine: Boolean): TModalResult;
|
||||||
|
var
|
||||||
|
Flags: TJumpToCodePosFlags;
|
||||||
|
begin
|
||||||
|
Flags := [jfFocusEditor];
|
||||||
|
if AddJumpPoint then Include(Flags, jfAddJumpPoint);
|
||||||
|
if MarkLine then Include(Flags, jfMarkLine);
|
||||||
|
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo, NewSource, NewX, NewY, NewTopLine,
|
||||||
|
Flags)
|
||||||
|
end;
|
||||||
|
|
||||||
class function TMainIDEInterface.GetPrimaryConfigPath: String;
|
class function TMainIDEInterface.GetPrimaryConfigPath: String;
|
||||||
begin
|
begin
|
||||||
Result:=LazConf.GetPrimaryConfigPath;
|
Result:=LazConf.GetPrimaryConfigPath;
|
||||||
|
Loading…
Reference in New Issue
Block a user