mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 09:29:10 +02:00
MG: added search function: Goto Include Directive
git-svn-id: trunk@1558 -
This commit is contained in:
parent
9be09b9fed
commit
ca4680a3cc
@ -190,6 +190,11 @@ type
|
|||||||
function FindDeclaration(Code: TCodeBuffer; X,Y: integer;
|
function FindDeclaration(Code: TCodeBuffer; X,Y: integer;
|
||||||
var NewCode: TCodeBuffer;
|
var NewCode: TCodeBuffer;
|
||||||
var NewX, NewY, NewTopLine: integer): boolean;
|
var NewX, NewY, NewTopLine: integer): boolean;
|
||||||
|
|
||||||
|
// find include directive
|
||||||
|
function FindEnclosingIncludeDirective(Code: TCodeBuffer; X,Y: integer;
|
||||||
|
var NewCode: TCodeBuffer;
|
||||||
|
var NewX, NewY, NewTopLine: integer): boolean;
|
||||||
|
|
||||||
// functions for events in the object inspector
|
// functions for events in the object inspector
|
||||||
function GetCompatiblePublishedMethods(Code: TCodeBuffer;
|
function GetCompatiblePublishedMethods(Code: TCodeBuffer;
|
||||||
@ -647,6 +652,34 @@ writeln('TCodeToolManager.FindDeclaration END ');
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCodeToolManager.FindEnclosingIncludeDirective(Code: TCodeBuffer; X,
|
||||||
|
Y: integer; var NewCode: TCodeBuffer; var NewX, NewY, NewTopLine: integer
|
||||||
|
): boolean;
|
||||||
|
var
|
||||||
|
CursorPos: TCodeXYPosition;
|
||||||
|
NewPos: TCodeXYPosition;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
{$IFDEF CTDEBUG}
|
||||||
|
writeln('TCodeToolManager.FindEnclosingIncludeDirective A ',Code.Filename,' x=',x,' y=',y);
|
||||||
|
{$ENDIF}
|
||||||
|
if not InitCurCodeTool(Code) then exit;
|
||||||
|
CursorPos.X:=X;
|
||||||
|
CursorPos.Y:=Y;
|
||||||
|
CursorPos.Code:=Code;
|
||||||
|
try
|
||||||
|
Result:=FCurCodeTool.FindEnclosingIncludeDirective(CursorPos,
|
||||||
|
NewPos,NewTopLine);
|
||||||
|
if Result then begin
|
||||||
|
NewX:=NewPos.X;
|
||||||
|
NewY:=NewPos.Y;
|
||||||
|
NewCode:=NewPos.Code;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e: Exception do Result:=HandleException(e);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCodeToolManager.FindBlockCounterPart(Code: TCodeBuffer;
|
function TCodeToolManager.FindBlockCounterPart(Code: TCodeBuffer;
|
||||||
X, Y: integer; var NewCode: TCodeBuffer; var NewX, NewY, NewTopLine: integer
|
X, Y: integer; var NewCode: TCodeBuffer; var NewX, NewY, NewTopLine: integer
|
||||||
): boolean;
|
): boolean;
|
||||||
|
@ -199,6 +199,9 @@ type
|
|||||||
function LinkCount: integer;
|
function LinkCount: integer;
|
||||||
function LinkIndexAtCleanPos(ACleanPos: integer): integer;
|
function LinkIndexAtCleanPos(ACleanPos: integer): integer;
|
||||||
function LinkSize(Index: integer): integer;
|
function LinkSize(Index: integer): integer;
|
||||||
|
function FindFirstSiblingLink(LinkIndex: integer): integer;
|
||||||
|
function FindParentLink(LinkIndex: integer): integer;
|
||||||
|
|
||||||
function CleanedSrc: string;
|
function CleanedSrc: string;
|
||||||
function CursorToCleanPos(ACursorPos: integer; ACode: pointer;
|
function CursorToCleanPos(ACursorPos: integer; ACode: pointer;
|
||||||
var ACleanPos: integer): integer; // 0=valid CleanPos
|
var ACleanPos: integer): integer; // 0=valid CleanPos
|
||||||
@ -206,10 +209,12 @@ type
|
|||||||
// 1=CursorPos beyond scanned code
|
// 1=CursorPos beyond scanned code
|
||||||
function CleanedPosToCursor(ACleanedPos: integer; var ACursorPos: integer;
|
function CleanedPosToCursor(ACleanedPos: integer; var ACursorPos: integer;
|
||||||
var ACode: Pointer): boolean;
|
var ACode: Pointer): boolean;
|
||||||
|
|
||||||
function WholeRangeIsWritable(CleanStartPos, CleanEndPos: integer): boolean;
|
function WholeRangeIsWritable(CleanStartPos, CleanEndPos: integer): boolean;
|
||||||
procedure FindCodeInRange(CleanStartPos, CleanEndPos: integer;
|
procedure FindCodeInRange(CleanStartPos, CleanEndPos: integer;
|
||||||
UniqueSortedCodeList: TList);
|
UniqueSortedCodeList: TList);
|
||||||
procedure DeleteRange(CleanStartPos,CleanEndPos: integer);
|
procedure DeleteRange(CleanStartPos,CleanEndPos: integer);
|
||||||
|
|
||||||
property OnGetSource: TOnGetSource read FOnGetSource write FOnGetSource;
|
property OnGetSource: TOnGetSource read FOnGetSource write FOnGetSource;
|
||||||
property OnLoadSource: TOnLoadSource read FOnLoadSource write FOnLoadSource;
|
property OnLoadSource: TOnLoadSource read FOnLoadSource write FOnLoadSource;
|
||||||
property OnDeleteSource: TOnDeleteSource
|
property OnDeleteSource: TOnDeleteSource
|
||||||
@ -469,6 +474,47 @@ begin
|
|||||||
Result:=CleanedLen-Links[Index].CleanedPos;
|
Result:=CleanedLen-Links[Index].CleanedPos;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TLinkScanner.FindFirstSiblingLink(LinkIndex: integer): integer;
|
||||||
|
{ find link of the start of the code
|
||||||
|
e.g. The resulting link SrcPos is always 1
|
||||||
|
if LinkIndex is in the main code, the result will be 0
|
||||||
|
if LinkIndex is in an include file, the result will be the first link of
|
||||||
|
the include file. If the include file is included multiple times, it is
|
||||||
|
treated as if they are different files.
|
||||||
|
|
||||||
|
ToDo: if include file include itself, directly or indirectly
|
||||||
|
}
|
||||||
|
var
|
||||||
|
LastIndex: integer;
|
||||||
|
begin
|
||||||
|
Result:=LinkIndex;
|
||||||
|
if LinkIndex>=0 then begin
|
||||||
|
LastIndex:=LinkIndex;
|
||||||
|
while (Result>=0) do begin
|
||||||
|
if Links[Result].Code=Links[LinkIndex].Code then begin
|
||||||
|
if Links[Result].SrcPos>Links[LastIndex].SrcPos then begin
|
||||||
|
// the include file was (in-)directly included by itself
|
||||||
|
// -> skip
|
||||||
|
Result:=FindParentLink(Result);
|
||||||
|
end else if Links[Result].SrcPos=1 then begin
|
||||||
|
// start found
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
LastIndex:=Result;
|
||||||
|
end else
|
||||||
|
dec(Result);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TLinkScanner.FindParentLink(LinkIndex: integer): integer;
|
||||||
|
// a parent link is the link of the include directive
|
||||||
|
// or in other words: the link in front of the first sibling link
|
||||||
|
begin
|
||||||
|
Result:=FindFirstSiblingLink(LinkIndex);
|
||||||
|
if Result>=0 then dec(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
function TLinkScanner.LinkIndexAtCleanPos(ACleanPos: integer): integer;
|
function TLinkScanner.LinkIndexAtCleanPos(ACleanPos: integer): integer;
|
||||||
var l,r,m: integer;
|
var l,r,m: integer;
|
||||||
begin
|
begin
|
||||||
|
@ -62,7 +62,7 @@ type
|
|||||||
function GetSourceName: string;
|
function GetSourceName: string;
|
||||||
function RenameSource(const NewName: string;
|
function RenameSource(const NewName: string;
|
||||||
SourceChangeCache: TSourceChangeCache): boolean;
|
SourceChangeCache: TSourceChangeCache): boolean;
|
||||||
|
|
||||||
// uses sections
|
// uses sections
|
||||||
function FindUnitInUsesSection(UsesNode: TCodeTreeNode;
|
function FindUnitInUsesSection(UsesNode: TCodeTreeNode;
|
||||||
const UpperUnitName: string;
|
const UpperUnitName: string;
|
||||||
@ -128,6 +128,10 @@ type
|
|||||||
var NewPos: TCodeXYPosition; var NewTopLine: integer): boolean;
|
var NewPos: TCodeXYPosition; var NewTopLine: integer): boolean;
|
||||||
function GuessUnclosedBlock(CursorPos: TCodeXYPosition;
|
function GuessUnclosedBlock(CursorPos: TCodeXYPosition;
|
||||||
var NewPos: TCodeXYPosition; var NewTopLine: integer): boolean;
|
var NewPos: TCodeXYPosition; var NewTopLine: integer): boolean;
|
||||||
|
|
||||||
|
// include directives
|
||||||
|
function FindEnclosingIncludeDirective(CursorPos: TCodeXYPosition;
|
||||||
|
var NewPos: TCodeXYPosition; var NewTopLine: integer): boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1151,7 +1155,26 @@ writeln('TStandardCodeTool.GuessUnclosedBlock A CursorPos=',CursorPos.X,',',Curs
|
|||||||
BuildBlockKeyWordFuncList;
|
BuildBlockKeyWordFuncList;
|
||||||
if ReadTilGuessedUnclosedBlock(CleanCursorPos,false) then
|
if ReadTilGuessedUnclosedBlock(CleanCursorPos,false) then
|
||||||
Result:=CleanPosToCaretAndTopLine(CurPos.StartPos,NewPos,NewTopLine);
|
Result:=CleanPosToCaretAndTopLine(CurPos.StartPos,NewPos,NewTopLine);
|
||||||
WriteDebugTreeReport;
|
//WriteDebugTreeReport;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TStandardCodeTool.FindEnclosingIncludeDirective(
|
||||||
|
CursorPos: TCodeXYPosition; var NewPos: TCodeXYPosition;
|
||||||
|
var NewTopLine: integer): boolean;
|
||||||
|
var
|
||||||
|
CleanCursorPos, LinkIndex, NewCleanPos: integer;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
BuildTreeAndGetCleanPos(false,CursorPos,CleanCursorPos);
|
||||||
|
LinkIndex:=Scanner.LinkIndexAtCleanPos(CleanCursorPos);
|
||||||
|
LinkIndex:=Scanner.FindParentLink(LinkIndex);
|
||||||
|
if LinkIndex<0 then
|
||||||
|
// this is no include file
|
||||||
|
exit;
|
||||||
|
NewPos.Code:=TCodeBuffer(Scanner.Links[LinkIndex].Code);
|
||||||
|
// calculate the directive end bracket
|
||||||
|
NewCleanPos:=Scanner.Links[LinkIndex].CleanedPos+Scanner.LinkSize(LinkIndex)-1;
|
||||||
|
Result:=CleanPosToCaretAndTopLine(NewCleanPos,NewPos,NewTopLine);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TStandardCodeTool.ReadTilGuessedUnclosedBlock(
|
function TStandardCodeTool.ReadTilGuessedUnclosedBlock(
|
||||||
|
@ -34,104 +34,105 @@ const
|
|||||||
These values can change from version to version, so DO NOT save them to file!
|
These values can change from version to version, so DO NOT save them to file!
|
||||||
|
|
||||||
}
|
}
|
||||||
ecFind = ecUserFirst + 1;
|
ecFind = ecUserFirst + 1;
|
||||||
ecFindAgain = ecUserFirst + 2;
|
ecFindAgain = ecUserFirst + 2;
|
||||||
ecFindNext = ecFindAgain;
|
ecFindNext = ecFindAgain;
|
||||||
ecReplace = ecUserFirst + 3;
|
ecReplace = ecUserFirst + 3;
|
||||||
ecFindProcedureDefinition = ecUserFirst + 4;
|
ecFindProcedureDefinition = ecUserFirst + 4;
|
||||||
ecFindProcedureMethod = ecUserFirst + 5;
|
ecFindProcedureMethod = ecUserFirst + 5;
|
||||||
ecGotoLineNumber = ecUserFirst + 6;
|
ecGotoLineNumber = ecUserFirst + 6;
|
||||||
|
|
||||||
ecNextEditor = ecUserFirst + 7;
|
ecNextEditor = ecUserFirst + 7;
|
||||||
ecPrevEditor = ecUserFirst + 8;
|
ecPrevEditor = ecUserFirst + 8;
|
||||||
|
|
||||||
ecPeriod = ecUserFirst + 9;
|
ecPeriod = ecUserFirst + 9;
|
||||||
|
|
||||||
ecFindPrevious = ecUserFirst + 10;
|
ecFindPrevious = ecUserFirst + 10;
|
||||||
ecFindInFiles = ecUserFirst + 11;
|
ecFindInFiles = ecUserFirst + 11;
|
||||||
ecJumpBack = ecUserFirst + 12;
|
ecJumpBack = ecUserFirst + 12;
|
||||||
ecJumpForward = ecUserFirst + 13;
|
ecJumpForward = ecUserFirst + 13;
|
||||||
ecAddJumpPoint = ecUserFirst + 14;
|
ecAddJumpPoint = ecUserFirst + 14;
|
||||||
ecViewJumpHistory = ecUserFirst + 15;
|
ecViewJumpHistory = ecUserFirst + 15;
|
||||||
|
|
||||||
ecFindDeclaration = ecUserFirst + 20;
|
ecFindDeclaration = ecUserFirst + 20;
|
||||||
ecFindBlockOtherEnd = ecUserFirst + 21;
|
ecFindBlockOtherEnd = ecUserFirst + 21;
|
||||||
ecFindBlockStart = ecUserFirst + 22;
|
ecFindBlockStart = ecUserFirst + 22;
|
||||||
ecOpenFileAtCursor = ecUserFirst + 23;
|
ecOpenFileAtCursor = ecUserFirst + 23;
|
||||||
|
ecGotoIncludeDirective = ecUserFirst + 24;
|
||||||
|
|
||||||
ecWordCompletion = ecUserFirst + 100;
|
ecWordCompletion = ecUserFirst + 100;
|
||||||
ecCompleteCode = ecUserFirst + 101;
|
ecCompleteCode = ecUserFirst + 101;
|
||||||
ecIdentCompletion = ecUserFirst + 102;
|
ecIdentCompletion = ecUserFirst + 102;
|
||||||
ecSyntaxCheck = ecUserFirst + 103;
|
ecSyntaxCheck = ecUserFirst + 103;
|
||||||
ecGuessUnclosedBlock = ecUserFirst + 104;
|
ecGuessUnclosedBlock = ecUserFirst + 104;
|
||||||
|
|
||||||
ecNew = ecUserFirst + 201;
|
ecNew = ecUserFirst + 201;
|
||||||
ecNewUnit = ecUserFirst + 202;
|
ecNewUnit = ecUserFirst + 202;
|
||||||
ecNewForm = ecUserFirst + 203;
|
ecNewForm = ecUserFirst + 203;
|
||||||
ecOpen = ecUserFirst + 204;
|
ecOpen = ecUserFirst + 204;
|
||||||
ecSave = ecUserFirst + 205;
|
ecSave = ecUserFirst + 205;
|
||||||
ecSaveAs = ecUserFirst + 206;
|
ecSaveAs = ecUserFirst + 206;
|
||||||
ecSaveAll = ecUserFirst + 207;
|
ecSaveAll = ecUserFirst + 207;
|
||||||
ecClose = ecUserFirst + 208;
|
ecClose = ecUserFirst + 208;
|
||||||
ecCloseAll = ecUserFirst + 209;
|
ecCloseAll = ecUserFirst + 209;
|
||||||
ecQuit = ecUserFirst + 210;
|
ecQuit = ecUserFirst + 210;
|
||||||
|
|
||||||
ecJumpToEditor = ecUserFirst + 300;
|
ecJumpToEditor = ecUserFirst + 300;
|
||||||
ecToggleFormUnit = ecUserFirst + 301;
|
ecToggleFormUnit = ecUserFirst + 301;
|
||||||
ecToggleObjectInsp = ecUserFirst + 302;
|
ecToggleObjectInsp = ecUserFirst + 302;
|
||||||
ecToggleProjectExpl = ecUserFirst + 303;
|
ecToggleProjectExpl = ecUserFirst + 303;
|
||||||
ecToggleCodeExpl = ecUserFirst + 304;
|
ecToggleCodeExpl = ecUserFirst + 304;
|
||||||
ecToggleMessages = ecUserFirst + 305;
|
ecToggleMessages = ecUserFirst + 305;
|
||||||
ecToggleWatches = ecUserFirst + 306;
|
ecToggleWatches = ecUserFirst + 306;
|
||||||
ecToggleBreakPoints = ecUserFirst + 307;
|
ecToggleBreakPoints = ecUserFirst + 307;
|
||||||
ecToggleDebuggerOut = ecUserFirst + 308;
|
ecToggleDebuggerOut = ecUserFirst + 308;
|
||||||
ecViewUnits = ecUserFirst + 309;
|
ecViewUnits = ecUserFirst + 309;
|
||||||
ecViewForms = ecUserFirst + 310;
|
ecViewForms = ecUserFirst + 310;
|
||||||
ecToggleLocals = ecUserFirst + 311;
|
ecToggleLocals = ecUserFirst + 311;
|
||||||
|
|
||||||
ecBuild = ecUserFirst + 400;
|
ecBuild = ecUserFirst + 400;
|
||||||
ecRun = ecUserFirst + 401;
|
ecRun = ecUserFirst + 401;
|
||||||
ecPause = ecUserFirst + 402;
|
ecPause = ecUserFirst + 402;
|
||||||
ecStepInto = ecUserFirst + 403;
|
ecStepInto = ecUserFirst + 403;
|
||||||
ecStepOver = ecUserFirst + 404;
|
ecStepOver = ecUserFirst + 404;
|
||||||
ecRunToCursor = ecUserFirst + 405;
|
ecRunToCursor = ecUserFirst + 405;
|
||||||
ecStopProgram = ecUserFirst + 406;
|
ecStopProgram = ecUserFirst + 406;
|
||||||
ecBuildAll = ecUserFirst + 407;
|
ecBuildAll = ecUserFirst + 407;
|
||||||
ecBuildLazarus = ecUserFirst + 408;
|
ecBuildLazarus = ecUserFirst + 408;
|
||||||
|
|
||||||
ecExtToolFirst = ecUserFirst + 500;
|
ecExtToolFirst = ecUserFirst + 500;
|
||||||
ecExtToolLast = ecUserFirst + 599;
|
ecExtToolLast = ecUserFirst + 599;
|
||||||
|
|
||||||
ecNewProject = ecUserFirst + 700;
|
ecNewProject = ecUserFirst + 700;
|
||||||
ecOpenProject = ecUserFirst + 701;
|
ecOpenProject = ecUserFirst + 701;
|
||||||
ecSaveProject = ecUserFirst + 702;
|
ecSaveProject = ecUserFirst + 702;
|
||||||
ecSaveProjectAs = ecUserFirst + 703;
|
ecSaveProjectAs = ecUserFirst + 703;
|
||||||
ecAddCurUnitToProj = ecUserFirst + 704;
|
ecAddCurUnitToProj = ecUserFirst + 704;
|
||||||
ecRemoveFromProj = ecUserFirst + 705;
|
ecRemoveFromProj = ecUserFirst + 705;
|
||||||
ecViewProjectSource = ecUserFirst + 706;
|
ecViewProjectSource = ecUserFirst + 706;
|
||||||
ecProjectOptions = ecUserFirst + 707;
|
ecProjectOptions = ecUserFirst + 707;
|
||||||
|
|
||||||
ecRunParameters = ecUserFirst + 800;
|
ecRunParameters = ecUserFirst + 800;
|
||||||
ecCompilerOptions = ecUserFirst + 801;
|
ecCompilerOptions = ecUserFirst + 801;
|
||||||
ecExtToolSettings = ecUserFirst + 802;
|
ecExtToolSettings = ecUserFirst + 802;
|
||||||
ecConfigBuildLazarus = ecUserFirst + 803;
|
ecConfigBuildLazarus = ecUserFirst + 803;
|
||||||
ecEnvironmentOptions = ecUserFirst + 804;
|
ecEnvironmentOptions = ecUserFirst + 804;
|
||||||
ecEditorOptions = ecUserFirst + 805;
|
ecEditorOptions = ecUserFirst + 805;
|
||||||
ecCodeToolsOptions = ecUserFirst + 806;
|
ecCodeToolsOptions = ecUserFirst + 806;
|
||||||
ecCodeToolsDefinesEd = ecUserFirst + 807;
|
ecCodeToolsDefinesEd = ecUserFirst + 807;
|
||||||
|
|
||||||
ecAboutLazarus = ecUserFirst + 900;
|
ecAboutLazarus = ecUserFirst + 900;
|
||||||
|
|
||||||
ecGotoEditor1 = ecUserFirst + 2000;
|
ecGotoEditor1 = ecUserFirst + 2000;
|
||||||
ecGotoEditor2 = ecGotoEditor1 + 1;
|
ecGotoEditor2 = ecGotoEditor1 + 1;
|
||||||
ecGotoEditor3 = ecGotoEditor2 + 1;
|
ecGotoEditor3 = ecGotoEditor2 + 1;
|
||||||
ecGotoEditor4 = ecGotoEditor3 + 1;
|
ecGotoEditor4 = ecGotoEditor3 + 1;
|
||||||
ecGotoEditor5 = ecGotoEditor4 + 1;
|
ecGotoEditor5 = ecGotoEditor4 + 1;
|
||||||
ecGotoEditor6 = ecGotoEditor5 + 1;
|
ecGotoEditor6 = ecGotoEditor5 + 1;
|
||||||
ecGotoEditor7 = ecGotoEditor6 + 1;
|
ecGotoEditor7 = ecGotoEditor6 + 1;
|
||||||
ecGotoEditor8 = ecGotoEditor7 + 1;
|
ecGotoEditor8 = ecGotoEditor7 + 1;
|
||||||
ecGotoEditor9 = ecGotoEditor8 + 1;
|
ecGotoEditor9 = ecGotoEditor8 + 1;
|
||||||
ecGotoEditor0 = ecGotoEditor9 + 1;
|
ecGotoEditor0 = ecGotoEditor9 + 1;
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -452,7 +453,8 @@ begin
|
|||||||
ecAddJumpPoint: Result:='add jump point';
|
ecAddJumpPoint: Result:='add jump point';
|
||||||
ecViewJumpHistory: Result:='view jump history';
|
ecViewJumpHistory: Result:='view jump history';
|
||||||
ecOpenFileAtCursor: Result:='open file at cursor';
|
ecOpenFileAtCursor: Result:='open file at cursor';
|
||||||
|
ecGotoIncludeDirective: Result:='goto to include directive of current include file';
|
||||||
|
|
||||||
// view menu
|
// view menu
|
||||||
ecToggleFormUnit: Result:= 'switch between form and source';
|
ecToggleFormUnit: Result:= 'switch between form and source';
|
||||||
ecToggleObjectInsp: Result:= 'view object inspector';
|
ecToggleObjectInsp: Result:= 'view object inspector';
|
||||||
@ -1041,6 +1043,16 @@ begin
|
|||||||
|
|
||||||
// selection
|
// selection
|
||||||
C:=Categories[AddCategory('CursorMoving','Cursor moving commands')];
|
C:=Categories[AddCategory('CursorMoving','Cursor moving commands')];
|
||||||
|
Add(C,'Move cursor word left',ecWordLeft, VK_LEFT, [ssCtrl],VK_UNKNOWN,[]);
|
||||||
|
Add(C,'Move cursor word right',ecWordRight, VK_RIGHT, [ssCtrl],VK_UNKNOWN,[]);
|
||||||
|
Add(C,'Move cursor to line start',ecLineStart, VK_HOME, [],VK_UNKNOWN,[]);
|
||||||
|
Add(C,'Move cursor to line end',ecLineEnd, VK_END, [],VK_UNKNOWN,[]);
|
||||||
|
Add(C,'Move cursor up one page',ecPageUp, VK_PRIOR, [],VK_UNKNOWN,[]);
|
||||||
|
Add(C,'Move cursor down one page',ecPageDown, VK_NEXT, [],VK_UNKNOWN,[]);
|
||||||
|
Add(C,'Move cursor left one page',ecPageLeft,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||||
|
Add(C,'Move cursor right one page',ecPageRight,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||||
|
Add(C,'Move cursor to top of page',ecPageTop, VK_PRIOR, [ssCtrl],VK_UNKNOWN,[]);
|
||||||
|
Add(C,'Move cursor to bottom of page',ecPageBottom, VK_NEXT, [ssCtrl],VK_UNKNOWN,[]);
|
||||||
Add(C,'Move cursor to absolute beginning',ecEditorTop,VK_HOME,[ssCtrl],VK_UNKNOWN,[]);
|
Add(C,'Move cursor to absolute beginning',ecEditorTop,VK_HOME,[ssCtrl],VK_UNKNOWN,[]);
|
||||||
Add(C,'Move cursor to absolute end',ecEditorBottom,VK_END,[ssCtrl],VK_UNKNOWN,[]);
|
Add(C,'Move cursor to absolute end',ecEditorBottom,VK_END,[ssCtrl],VK_UNKNOWN,[]);
|
||||||
|
|
||||||
@ -1125,6 +1137,7 @@ begin
|
|||||||
Add(C,'Find declaration',ecFindDeclaration,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
Add(C,'Find declaration',ecFindDeclaration,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||||
Add(C,'Find block other end',ecFindBlockOtherEnd,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
Add(C,'Find block other end',ecFindBlockOtherEnd,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||||
Add(C,'Find block start',ecFindBlockStart,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
Add(C,'Find block start',ecFindBlockStart,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||||
|
Add(C,'Goto include directive',ecGotoIncludeDirective,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||||
|
|
||||||
// source notebook
|
// source notebook
|
||||||
C:=Categories[AddCategory('SourceNotebook','Source Notebook commands')];
|
C:=Categories[AddCategory('SourceNotebook','Source Notebook commands')];
|
||||||
@ -1175,8 +1188,8 @@ begin
|
|||||||
Add(C,'Open project',ecOpenProject,VK_F11,[ssCtrl],VK_UNKNOWN,[]);
|
Add(C,'Open project',ecOpenProject,VK_F11,[ssCtrl],VK_UNKNOWN,[]);
|
||||||
Add(C,'Save project',ecSaveProject,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
Add(C,'Save project',ecSaveProject,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||||
Add(C,'Save project as',ecSaveProjectAs,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
Add(C,'Save project as',ecSaveProjectAs,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||||
Add(C,'add active unit to project',ecAddCurUnitToProj,VK_F11,[ssShift],VK_UNKNOWN,[]);
|
Add(C,'Add active unit to project',ecAddCurUnitToProj,VK_F11,[ssShift],VK_UNKNOWN,[]);
|
||||||
Add(C,'remove active unit from project',ecRemoveFromProj,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
Add(C,'Remove active unit from project',ecRemoveFromProj,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||||
Add(C,'View project source',ecViewProjectSource,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
Add(C,'View project source',ecViewProjectSource,VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||||
Add(C,'View project options',ecProjectOptions,VK_F11,[ssShift,ssCtrl],VK_UNKNOWN,[]);
|
Add(C,'View project options',ecProjectOptions,VK_F11,[ssShift,ssCtrl],VK_UNKNOWN,[]);
|
||||||
|
|
||||||
|
57
ide/main.pp
57
ide/main.pp
@ -61,7 +61,6 @@ type
|
|||||||
procedure mnuNewUnitClicked(Sender : TObject);
|
procedure mnuNewUnitClicked(Sender : TObject);
|
||||||
procedure mnuNewFormClicked(Sender : TObject);
|
procedure mnuNewFormClicked(Sender : TObject);
|
||||||
procedure mnuOpenClicked(Sender : TObject);
|
procedure mnuOpenClicked(Sender : TObject);
|
||||||
procedure mnuOpenFileAtCursorClicked(Sender : TObject);
|
|
||||||
procedure mnuSaveClicked(Sender : TObject);
|
procedure mnuSaveClicked(Sender : TObject);
|
||||||
procedure mnuSaveAsClicked(Sender : TObject);
|
procedure mnuSaveAsClicked(Sender : TObject);
|
||||||
procedure mnuSaveAllClicked(Sender : TObject);
|
procedure mnuSaveAllClicked(Sender : TObject);
|
||||||
@ -74,6 +73,9 @@ type
|
|||||||
procedure mnuSearchFindBlockStart(Sender: TObject);
|
procedure mnuSearchFindBlockStart(Sender: TObject);
|
||||||
procedure mnuSearchFindDeclaration(Sender: TObject);
|
procedure mnuSearchFindDeclaration(Sender: TObject);
|
||||||
procedure mnuSearchOpenFileAtCursor(Sender: TObject);
|
procedure mnuSearchOpenFileAtCursor(Sender: TObject);
|
||||||
|
procedure mnuFindDeclarationClicked(Sender : TObject);
|
||||||
|
procedure mnuOpenFileAtCursorClicked(Sender : TObject);
|
||||||
|
procedure mnuGotoIncludeDirectiveClicked(Sender : TObject);
|
||||||
|
|
||||||
// edit menu
|
// edit menu
|
||||||
procedure mnuEditUndoClicked(Sender: TObject);
|
procedure mnuEditUndoClicked(Sender: TObject);
|
||||||
@ -134,8 +136,7 @@ type
|
|||||||
|
|
||||||
procedure OpenFileDownArrowClicked(Sender : TObject);
|
procedure OpenFileDownArrowClicked(Sender : TObject);
|
||||||
procedure ControlClick(Sender : TObject);
|
procedure ControlClick(Sender : TObject);
|
||||||
procedure mnuFindDeclarationClicked(Sender : TObject);
|
|
||||||
|
|
||||||
// SourceNotebook events
|
// SourceNotebook events
|
||||||
Procedure OnSrcNoteBookActivated(Sender : TObject);
|
Procedure OnSrcNoteBookActivated(Sender : TObject);
|
||||||
Procedure OnSrcNoteBookAddJumpPoint(ACaretXY: TPoint; ATopLine: integer;
|
Procedure OnSrcNoteBookAddJumpPoint(ACaretXY: TPoint; ATopLine: integer;
|
||||||
@ -268,7 +269,7 @@ type
|
|||||||
function DoOpenUnknownFile(const AFileName:string;
|
function DoOpenUnknownFile(const AFileName:string;
|
||||||
Flags: TOpenFlags; var NewUnitInfo: TUnitInfo): TModalResult;
|
Flags: TOpenFlags; var NewUnitInfo: TUnitInfo): TModalResult;
|
||||||
procedure DoRestoreBookMarks(AnUnitInfo: TUnitInfo; ASrcEdit:TSourceEditor);
|
procedure DoRestoreBookMarks(AnUnitInfo: TUnitInfo; ASrcEdit:TSourceEditor);
|
||||||
function DoOpenFileInSourceNoteBook(AnUnitInfo: TUnitInfo;
|
function DoOpenFileInSourceNotebook(AnUnitInfo: TUnitInfo;
|
||||||
Flags: TOpenFlags): TModalResult;
|
Flags: TOpenFlags): TModalResult;
|
||||||
function DoLoadLFM(AnUnitInfo: TUnitInfo; Flags: TOpenFlags): TModalResult;
|
function DoLoadLFM(AnUnitInfo: TUnitInfo; Flags: TOpenFlags): TModalResult;
|
||||||
|
|
||||||
@ -294,7 +295,7 @@ type
|
|||||||
SaveFirst: boolean):TModalResult;
|
SaveFirst: boolean):TModalResult;
|
||||||
function DoOpenEditorFile(const AFileName:string;
|
function DoOpenEditorFile(const AFileName:string;
|
||||||
Flags: TOpenFlags): TModalResult; override;
|
Flags: TOpenFlags): TModalResult; override;
|
||||||
function DoOpenFileAtCursor(Sender: TObject):TModalResult;
|
function DoOpenFileAtCursor(Sender: TObject): TModalResult;
|
||||||
function DoSaveAll: TModalResult;
|
function DoSaveAll: TModalResult;
|
||||||
function DoOpenMainUnit(ProjectLoading: boolean): TModalResult;
|
function DoOpenMainUnit(ProjectLoading: boolean): TModalResult;
|
||||||
function DoViewUnitsAndForms(OnlyForms: boolean): TModalResult;
|
function DoViewUnitsAndForms(OnlyForms: boolean): TModalResult;
|
||||||
@ -360,6 +361,7 @@ type
|
|||||||
procedure DoGoToPascalBlockOtherEnd;
|
procedure DoGoToPascalBlockOtherEnd;
|
||||||
procedure DoGoToPascalBlockStart;
|
procedure DoGoToPascalBlockStart;
|
||||||
procedure DoJumpToGuessedUnclosedBlock(FindNext: boolean);
|
procedure DoJumpToGuessedUnclosedBlock(FindNext: boolean);
|
||||||
|
procedure DoGotoIncludeDirective;
|
||||||
procedure SaveIncludeLinks;
|
procedure SaveIncludeLinks;
|
||||||
|
|
||||||
// methods for debugging, compiling and external tools
|
// methods for debugging, compiling and external tools
|
||||||
@ -1320,6 +1322,12 @@ begin
|
|||||||
itmOpenFileAtCursor.Name:='itmOpenFileAtCursor';
|
itmOpenFileAtCursor.Name:='itmOpenFileAtCursor';
|
||||||
itmOpenFileAtCursor.Caption := 'Open filename at cursor';
|
itmOpenFileAtCursor.Caption := 'Open filename at cursor';
|
||||||
mnuSearch.add(itmOpenFileAtCursor);
|
mnuSearch.add(itmOpenFileAtCursor);
|
||||||
|
|
||||||
|
itmGotoIncludeDirective := TMenuItem.Create(nil);
|
||||||
|
itmGotoIncludeDirective.Name:='itmGotoIncludeDirective';
|
||||||
|
itmGotoIncludeDirective.Caption := 'Goto include directive';
|
||||||
|
itmGotoIncludeDirective.OnClick:=@mnuGotoIncludeDirectiveClicked;
|
||||||
|
mnuSearch.add(itmGotoIncludeDirective);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.SetupViewMenu;
|
procedure TMainIDE.SetupViewMenu;
|
||||||
@ -1714,6 +1722,11 @@ begin
|
|||||||
DoOpenFileAtCursor(Sender);
|
DoOpenFileAtCursor(Sender);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.mnuGotoIncludeDirectiveClicked(Sender : TObject);
|
||||||
|
begin
|
||||||
|
DoGotoIncludeDirective;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuSaveClicked(Sender : TObject);
|
procedure TMainIDE.mnuSaveClicked(Sender : TObject);
|
||||||
begin
|
begin
|
||||||
if SourceNoteBook.NoteBook=nil then exit;
|
if SourceNoteBook.NoteBook=nil then exit;
|
||||||
@ -1728,8 +1741,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainIDE.mnuSaveAllClicked(Sender : TObject);
|
procedure TMainIDE.mnuSaveAllClicked(Sender : TObject);
|
||||||
begin
|
begin
|
||||||
if SourceNoteBook.NoteBook=nil then exit;
|
DoSaveAll;
|
||||||
DoSaveAll;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuCloseClicked(Sender : TObject);
|
procedure TMainIDE.mnuCloseClicked(Sender : TObject);
|
||||||
@ -1818,6 +1830,9 @@ begin
|
|||||||
|
|
||||||
ecFindBlockStart:
|
ecFindBlockStart:
|
||||||
DoGoToPascalBlockStart;
|
DoGoToPascalBlockStart;
|
||||||
|
|
||||||
|
ecGotoIncludeDirective:
|
||||||
|
DoGotoIncludeDirective;
|
||||||
|
|
||||||
ecCompleteCode:
|
ecCompleteCode:
|
||||||
DoCompleteCodeAtCursor;
|
DoCompleteCodeAtCursor;
|
||||||
@ -3188,7 +3203,7 @@ begin
|
|||||||
Project1.ProjectInfoFile);
|
Project1.ProjectInfoFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoOpenFileInSourceNoteBook(AnUnitInfo: TUnitInfo;
|
function TMainIDE.DoOpenFileInSourceNotebook(AnUnitInfo: TUnitInfo;
|
||||||
Flags: TOpenFlags): TModalResult;
|
Flags: TOpenFlags): TModalResult;
|
||||||
var NewSrcEdit: TSourceEditor;
|
var NewSrcEdit: TSourceEditor;
|
||||||
NewPageName, AFilename: string;
|
NewPageName, AFilename: string;
|
||||||
@ -5548,6 +5563,28 @@ writeln('[TMainIDE.DoGoToPascalBlockEnd] ************');
|
|||||||
DoJumpToCodeToolBossError;
|
DoJumpToCodeToolBossError;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.DoGotoIncludeDirective;
|
||||||
|
var ActiveSrcEdit: TSourceEditor;
|
||||||
|
ActiveUnitInfo: TUnitInfo;
|
||||||
|
NewSource: TCodeBuffer;
|
||||||
|
NewX, NewY, NewTopLine: integer;
|
||||||
|
begin
|
||||||
|
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,false) then exit;
|
||||||
|
{ $IFDEF IDE_DEBUG}
|
||||||
|
writeln('');
|
||||||
|
writeln('[TMainIDE.DoGotoIncludeDirective] ************');
|
||||||
|
{ $ENDIF}
|
||||||
|
if CodeToolBoss.FindEnclosingIncludeDirective(ActiveUnitInfo.Source,
|
||||||
|
ActiveSrcEdit.EditorComponent.CaretX,
|
||||||
|
ActiveSrcEdit.EditorComponent.CaretY,
|
||||||
|
NewSource,NewX,NewY,NewTopLine) then
|
||||||
|
begin
|
||||||
|
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
|
||||||
|
NewSource, NewX, NewY, NewTopLine, false);
|
||||||
|
end else
|
||||||
|
DoJumpToCodeToolBossError;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.SaveIncludeLinks;
|
procedure TMainIDE.SaveIncludeLinks;
|
||||||
var AFilename: string;
|
var AFilename: string;
|
||||||
begin
|
begin
|
||||||
@ -6095,6 +6132,7 @@ begin
|
|||||||
itmFindBlockStart.ShortCut:=CommandToShortCut(ecFindBlockStart);
|
itmFindBlockStart.ShortCut:=CommandToShortCut(ecFindBlockStart);
|
||||||
itmFindDeclaration.ShortCut:=CommandToShortCut(ecFindDeclaration);
|
itmFindDeclaration.ShortCut:=CommandToShortCut(ecFindDeclaration);
|
||||||
itmOpenFileAtCursor.ShortCut:=CommandToShortCut(ecOpenFileAtCursor);
|
itmOpenFileAtCursor.ShortCut:=CommandToShortCut(ecOpenFileAtCursor);
|
||||||
|
itmGotoIncludeDirective.ShortCut:=CommandToShortCut(ecGotoIncludeDirective);
|
||||||
|
|
||||||
itmViewInspector.ShortCut:=CommandToShortCut(ecToggleObjectInsp);
|
itmViewInspector.ShortCut:=CommandToShortCut(ecToggleObjectInsp);
|
||||||
itmViewProject.ShortCut:=CommandToShortCut(ecToggleProjectExpl);
|
itmViewProject.ShortCut:=CommandToShortCut(ecToggleProjectExpl);
|
||||||
@ -6174,6 +6212,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.263 2002/03/28 11:49:48 lazarus
|
||||||
|
MG: added search function: Goto Include Directive
|
||||||
|
|
||||||
Revision 1.262 2002/03/28 09:34:06 lazarus
|
Revision 1.262 2002/03/28 09:34:06 lazarus
|
||||||
MG: show objectinspector only if needed
|
MG: show objectinspector only if needed
|
||||||
|
|
||||||
|
@ -64,8 +64,9 @@ type
|
|||||||
TLoadBufferFlags = set of TLoadBufferFlag;
|
TLoadBufferFlags = set of TLoadBufferFlag;
|
||||||
|
|
||||||
TMainIDEBar = class(TForm)
|
TMainIDEBar = class(TForm)
|
||||||
|
|
||||||
|
// the speedbuttons panel for frequently used IDE functions
|
||||||
pnlSpeedButtons : TPanel;
|
pnlSpeedButtons : TPanel;
|
||||||
|
|
||||||
ViewUnitsSpeedBtn : TSpeedButton;
|
ViewUnitsSpeedBtn : TSpeedButton;
|
||||||
ViewFormsSpeedBtn : TSpeedButton;
|
ViewFormsSpeedBtn : TSpeedButton;
|
||||||
NewUnitSpeedBtn : TSpeedButton;
|
NewUnitSpeedBtn : TSpeedButton;
|
||||||
@ -80,8 +81,8 @@ type
|
|||||||
StepIntoSpeedButton : TSpeedButton;
|
StepIntoSpeedButton : TSpeedButton;
|
||||||
StepOverSpeedButton : TSpeedButton;
|
StepOverSpeedButton : TSpeedButton;
|
||||||
OpenFilePopUpMenu : TPopupMenu;
|
OpenFilePopUpMenu : TPopupMenu;
|
||||||
GlobalMouseSpeedButton: TSpeedButton;
|
|
||||||
|
|
||||||
|
// MainMenu
|
||||||
mnuMain: TMainMenu;
|
mnuMain: TMainMenu;
|
||||||
|
|
||||||
mnuFile: TMenuItem;
|
mnuFile: TMenuItem;
|
||||||
@ -130,6 +131,7 @@ type
|
|||||||
itmFindBlockStart: TMenuItem;
|
itmFindBlockStart: TMenuItem;
|
||||||
itmFindDeclaration: TMenuItem;
|
itmFindDeclaration: TMenuItem;
|
||||||
itmOpenFileAtCursor: TMenuItem;
|
itmOpenFileAtCursor: TMenuItem;
|
||||||
|
itmGotoIncludeDirective: TMenuItem;
|
||||||
|
|
||||||
itmViewInspector: TMenuItem;
|
itmViewInspector: TMenuItem;
|
||||||
itmViewProject: TMenuItem;
|
itmViewProject: TMenuItem;
|
||||||
@ -177,8 +179,11 @@ type
|
|||||||
|
|
||||||
itmHelpAboutLazarus: TMenuItem;
|
itmHelpAboutLazarus: TMenuItem;
|
||||||
|
|
||||||
|
// component palette
|
||||||
ComponentNotebook : TNotebook;
|
ComponentNotebook : TNotebook;
|
||||||
|
GlobalMouseSpeedButton: TSpeedButton;
|
||||||
|
|
||||||
|
// hints. Note/ToDo: hints should be controlled by the lcl, this is a workaround
|
||||||
HintTimer1 : TTimer;
|
HintTimer1 : TTimer;
|
||||||
HintWindow1 : THintWindow;
|
HintWindow1 : THintWindow;
|
||||||
public
|
public
|
||||||
|
Loading…
Reference in New Issue
Block a user