MG: jump point is now added if method jumping not revertable

git-svn-id: trunk@3469 -
This commit is contained in:
lazarus 2002-10-05 14:17:53 +00:00
parent 199076ab2f
commit fac2a16ff2
2 changed files with 12 additions and 5 deletions

View File

@ -202,7 +202,8 @@ type
// method jumping // method jumping
function JumpToMethod(Code: TCodeBuffer; X,Y: integer; function JumpToMethod(Code: TCodeBuffer; X,Y: integer;
var NewCode: TCodeBuffer; var NewCode: TCodeBuffer;
var NewX, NewY, NewTopLine: integer): boolean; var NewX, NewY, NewTopLine: integer;
var RevertableJump: boolean): boolean;
// find declaration // find declaration
function FindDeclaration(Code: TCodeBuffer; X,Y: integer; function FindDeclaration(Code: TCodeBuffer; X,Y: integer;
@ -619,7 +620,8 @@ begin
end; end;
function TCodeToolManager.JumpToMethod(Code: TCodeBuffer; X,Y: integer; function TCodeToolManager.JumpToMethod(Code: TCodeBuffer; X,Y: integer;
var NewCode: TCodeBuffer; var NewX, NewY, NewTopLine: integer): boolean; var NewCode: TCodeBuffer; var NewX, NewY, NewTopLine: integer;
var RevertableJump: boolean): boolean;
var var
CursorPos: TCodeXYPosition; CursorPos: TCodeXYPosition;
NewPos: TCodeXYPosition; NewPos: TCodeXYPosition;
@ -636,7 +638,8 @@ begin
writeln('TCodeToolManager.JumpToMethod B ',FCurCodeTool.Scanner<>nil); writeln('TCodeToolManager.JumpToMethod B ',FCurCodeTool.Scanner<>nil);
{$ENDIF} {$ENDIF}
try try
Result:=FCurCodeTool.FindJumpPoint(CursorPos,NewPos,NewTopLine); Result:=FCurCodeTool.FindJumpPoint(CursorPos,NewPos,NewTopLine,
RevertableJump);
if Result then begin if Result then begin
NewX:=NewPos.X; NewX:=NewPos.X;
NewY:=NewPos.Y; NewY:=NewPos.Y;

View File

@ -56,7 +56,8 @@ type
const UpperProcName: string): TCodeTreeNode; const UpperProcName: string): TCodeTreeNode;
public public
function FindJumpPoint(CursorPos: TCodeXYPosition; function FindJumpPoint(CursorPos: TCodeXYPosition;
var NewPos: TCodeXYPosition; var NewTopLine: integer): boolean; var NewPos: TCodeXYPosition; var NewTopLine: integer;
var RevertableJump: boolean): boolean;
function FindJumpPointInProcNode(ProcNode: TCodeTreeNode; function FindJumpPointInProcNode(ProcNode: TCodeTreeNode;
var NewPos: TCodeXYPosition; var NewTopLine: integer): boolean; var NewPos: TCodeXYPosition; var NewTopLine: integer): boolean;
function GatherProcNodes(StartNode: TCodeTreeNode; function GatherProcNodes(StartNode: TCodeTreeNode;
@ -136,7 +137,8 @@ begin
end; end;
function TMethodJumpingCodeTool.FindJumpPoint(CursorPos: TCodeXYPosition; function TMethodJumpingCodeTool.FindJumpPoint(CursorPos: TCodeXYPosition;
var NewPos: TCodeXYPosition; var NewTopLine: integer): boolean; var NewPos: TCodeXYPosition; var NewTopLine: integer;
var RevertableJump: boolean): boolean;
const const
JumpToProcAttr = [phpInUpperCase,phpWithoutClassName,phpWithVarModifiers, JumpToProcAttr = [phpInUpperCase,phpWithoutClassName,phpWithVarModifiers,
@ -201,6 +203,7 @@ const
Result:=JumpToCleanPos(ToProcNode.FirstChild.StartPos, Result:=JumpToCleanPos(ToProcNode.FirstChild.StartPos,
ToProcNode.StartPos,NewPos,NewTopLine,false); ToProcNode.StartPos,NewPos,NewTopLine,false);
end; end;
RevertableJump:=true;
end; end;
end; end;
@ -260,6 +263,7 @@ var CursorNode, ClassNode, ProcNode, StartNode, TypeSectionNode,
BodyAVLNode, DefAVLNode: TAVLTreeNode; BodyAVLNode, DefAVLNode: TAVLTreeNode;
begin begin
Result:=false; Result:=false;
RevertableJump:=false;
NewPos:=CursorPos; NewPos:=CursorPos;
// build code tree // build code tree
{$IFDEF CTDEBUG} {$IFDEF CTDEBUG}