mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 13:59:10 +02:00
IdeInspector: Jump to implementation
git-svn-id: trunk@28688 -
This commit is contained in:
parent
77a6748d93
commit
48dd5f62bb
@ -19,8 +19,10 @@ type
|
|||||||
public
|
public
|
||||||
Comp: TComponent;
|
Comp: TComponent;
|
||||||
Display: string;
|
Display: string;
|
||||||
|
IdentifierName: string;
|
||||||
TheUnitName: string;
|
TheUnitName: string;
|
||||||
FileName: string;
|
FileName: string;
|
||||||
|
Line: Integer;
|
||||||
procedure Assign(Other: THistoryEntry);
|
procedure Assign(Other: THistoryEntry);
|
||||||
procedure UpdateDisplayName;
|
procedure UpdateDisplayName;
|
||||||
end;
|
end;
|
||||||
@ -164,6 +166,8 @@ begin
|
|||||||
FBaseDisplay := Other.FBaseDisplay;
|
FBaseDisplay := Other.FBaseDisplay;
|
||||||
Display := Other.Display;
|
Display := Other.Display;
|
||||||
TheUnitName := Other.TheUnitName;
|
TheUnitName := Other.TheUnitName;
|
||||||
|
IdentifierName := Other.IdentifierName;
|
||||||
|
Line := Other.Line;
|
||||||
FileName := Other.FileName;
|
FileName := Other.FileName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -239,6 +243,7 @@ var
|
|||||||
Row: TOIPropertyGridRow;
|
Row: TOIPropertyGridRow;
|
||||||
Method: TMethod;
|
Method: TMethod;
|
||||||
s, s2, OName: string;
|
s, s2, OName: string;
|
||||||
|
MethName: String;
|
||||||
begin
|
begin
|
||||||
Row := FPropertiesGrid.GetActiveRow;
|
Row := FPropertiesGrid.GetActiveRow;
|
||||||
Method.Code := nil;;
|
Method.Code := nil;;
|
||||||
@ -255,12 +260,14 @@ begin
|
|||||||
else
|
else
|
||||||
OName := '';
|
OName := '';
|
||||||
|
|
||||||
s := TObject(Method.Data).MethodName(Method.Code);
|
MethName := TObject(Method.Data).MethodName(Method.Code);
|
||||||
|
s := MethName;;
|
||||||
if s = '' then
|
if s = '' then
|
||||||
s := IntToHex(QWord(PtrUint(Method.Code)), 2*SizeOf(Pointer));
|
s := IntToHex(QWord(PtrUint(Method.Code)), 2*SizeOf(Pointer));
|
||||||
|
|
||||||
s := TObject(Method.Data).ClassName + OName + '.' + s;
|
s := TObject(Method.Data).ClassName + OName + '.' + s;
|
||||||
|
|
||||||
|
FCurEntry.Line := -1;
|
||||||
try
|
try
|
||||||
s2 := Trim(OriginalBackTraceStrFunc(Method.Code));
|
s2 := Trim(OriginalBackTraceStrFunc(Method.Code));
|
||||||
i := pos(' ', s2);
|
i := pos(' ', s2);
|
||||||
@ -268,6 +275,13 @@ begin
|
|||||||
s2 := copy(s2, i, length(s));
|
s2 := copy(s2, i, length(s));
|
||||||
if s2<>'' then
|
if s2<>'' then
|
||||||
s := s + ' ' + s2;
|
s := s + ' ' + s2;
|
||||||
|
i := pos('line ', LowerCase(s));
|
||||||
|
if i > 0 then begin
|
||||||
|
s2 := Trim(copy(s, i+4, length(s2)));
|
||||||
|
i := pos(' ', s2)-1;
|
||||||
|
if i < 1 then i := length(s2);
|
||||||
|
FCurEntry.Line := StrToIntDef(copy(s2, 1, i), -1);
|
||||||
|
end;
|
||||||
except
|
except
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -276,9 +290,11 @@ begin
|
|||||||
FCurEntry.Comp := nil;
|
FCurEntry.Comp := nil;
|
||||||
FCurEntry.TheUnitName := TObject(Method.Data).ClassType.UnitName;
|
FCurEntry.TheUnitName := TObject(Method.Data).ClassType.UnitName;
|
||||||
FCurEntry.FileName := LazarusIDE.FindUnitFile(FCurEntry.TheUnitName, LazarusIDE);
|
FCurEntry.FileName := LazarusIDE.FindUnitFile(FCurEntry.TheUnitName, LazarusIDE);
|
||||||
|
if MethName <> '' then
|
||||||
|
FCurEntry.IdentifierName := TObject(Method.Data).ClassName + '.' + MethName
|
||||||
|
else
|
||||||
|
FCurEntry.IdentifierName := '';
|
||||||
|
|
||||||
//LazarusIDE.DoOpenFileAndJumpToIdentifier(AFile, copy(AName,1,i), -1, -1, [ofOnlyIfExists, ofRegularFile]);
|
|
||||||
//LazarusIDE.DoOpenFileAndJumpToPos(AFile, Point(1,i), Max(i-1,1), -1, -1, [ofOnlyIfExists, ofRegularFile]);
|
|
||||||
UpdateHistory;
|
UpdateHistory;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -324,7 +340,13 @@ end;
|
|||||||
|
|
||||||
procedure TIdeInspectForm.btnOpenFileClick(Sender: TObject);
|
procedure TIdeInspectForm.btnOpenFileClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
LazarusIDE.DoOpenEditorFile(EditFile.Text, -1, -1, [ofOnlyIfExists, ofRegularFile]);
|
if FCurEntry.Line > 0 then
|
||||||
|
LazarusIDE.DoOpenFileAndJumpToPos(EditFile.Text, Point(1,FCurEntry.Line), Max(FCurEntry.Line-1,1), -1, -1, [ofOnlyIfExists, ofRegularFile])
|
||||||
|
else
|
||||||
|
if FCurEntry.IdentifierName <> '' then
|
||||||
|
LazarusIDE.DoOpenFileAndJumpToIdentifier(EditFile.Text, FCurEntry.IdentifierName, -1, -1, [ofOnlyIfExists, ofRegularFile])
|
||||||
|
else
|
||||||
|
LazarusIDE.DoOpenEditorFile(EditFile.Text, -1, -1, [ofOnlyIfExists, ofRegularFile]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIdeInspectForm.btnSaveHistClick(Sender: TObject);
|
procedure TIdeInspectForm.btnSaveHistClick(Sender: TObject);
|
||||||
@ -491,10 +513,14 @@ begin
|
|||||||
if FSelected <> nil then begin
|
if FSelected <> nil then begin
|
||||||
FCurEntry.TheUnitName := FSelected.UnitName;
|
FCurEntry.TheUnitName := FSelected.UnitName;
|
||||||
FCurEntry.FileName := LazarusIDE.FindUnitFile(FCurEntry.TheUnitName, LazarusIDE);
|
FCurEntry.FileName := LazarusIDE.FindUnitFile(FCurEntry.TheUnitName, LazarusIDE);
|
||||||
|
FCurEntry.IdentifierName := FSelected.ClassName;
|
||||||
|
FCurEntry.Line := -1;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
FCurEntry.TheUnitName := '';
|
FCurEntry.TheUnitName := '';
|
||||||
FCurEntry.FileName := '';
|
FCurEntry.FileName := '';
|
||||||
|
FCurEntry.IdentifierName := '';
|
||||||
|
FCurEntry.Line := -1;
|
||||||
end;
|
end;
|
||||||
UpdateHistory;
|
UpdateHistory;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user