mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 05:40:24 +02:00
implemented go to next/previous error
git-svn-id: trunk@5525 -
This commit is contained in:
parent
41b6708b41
commit
d79589f135
@ -69,6 +69,8 @@ const
|
||||
ecJumpForward = ecUserFirst + 11;
|
||||
ecAddJumpPoint = ecUserFirst + 12;
|
||||
ecViewJumpHistory = ecUserFirst + 13;
|
||||
ecJumpToNextError = ecUserFirst + 14;
|
||||
ecJumpToPrevError = ecUserFirst + 15;
|
||||
|
||||
// search code
|
||||
ecFindDeclaration = ecUserFirst + 20;
|
||||
@ -525,6 +527,8 @@ begin
|
||||
ecJumpForward: SetResult(VK_H,[ssCtrl,ssShift],VK_UNKNOWN,[]);
|
||||
ecAddJumpPoint: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||
ecViewJumpHistory: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||
ecJumpToPrevError: SetResult(VK_F7,[ssCtrl],VK_UNKNOWN,[]);
|
||||
ecJumpToNextError: SetResult(VK_F8,[ssCtrl],VK_UNKNOWN,[]);
|
||||
ecOpenFileAtCursor: SetResult(VK_RETURN,[ssCtrl],VK_UNKNOWN,[]);
|
||||
|
||||
// marker
|
||||
@ -1119,8 +1123,10 @@ begin
|
||||
ecJumpForward : Result:= lismenujumpforward;
|
||||
ecAddJumpPoint : Result:= srkmecAddJumpPoint;
|
||||
ecViewJumpHistory : Result:= lismenuviewjumphistory;
|
||||
ecOpenFileAtCursor : Result:= srkmecOpenFileAtCursor;
|
||||
ecJumpToNextError : Result:= lisMenuJumpToNextError;
|
||||
ecJumpToPrevError : Result:= lisMenuJumpToPrevError;
|
||||
ecGotoIncludeDirective : Result:= srkmecGotoIncludeDirective;
|
||||
ecOpenFileAtCursor : Result:= srkmecOpenFileAtCursor;
|
||||
|
||||
// view menu
|
||||
ecToggleFormUnit : Result:= srkmecToggleFormUnit;
|
||||
@ -1890,6 +1896,8 @@ begin
|
||||
AddDefault(C,'Jump forward',ecJumpForward);
|
||||
AddDefault(C,'Add jump point',ecAddJumpPoint);
|
||||
AddDefault(C,'View jump history',ecViewJumpHistory);
|
||||
AddDefault(C,'Jump to next error',ecJumpToNextError);
|
||||
AddDefault(C,'Jump to previous error',ecJumpToPrevError);
|
||||
AddDefault(C,'Open file at cursor',ecOpenFileAtCursor);
|
||||
|
||||
// marker
|
||||
|
@ -167,7 +167,9 @@ resourcestring
|
||||
lisMenuFindDeclarationAtCursor = 'Find Declaration at cursor';
|
||||
lisMenuOpenFilenameAtCursor = 'Open filename at cursor';
|
||||
lisMenuGotoIncludeDirective = 'Goto include directive';
|
||||
|
||||
lisMenuJumpToNextError = 'Jump to next error';
|
||||
lisMenuJumpToPrevError = 'Jump to previous error';
|
||||
|
||||
lisMenuViewObjectInspector = 'Object Inspector';
|
||||
lisMenuViewSourceEditor = 'Source Editor';
|
||||
lisMenuViewCodeExplorer = 'Code Explorer';
|
||||
|
72
ide/main.pp
72
ide/main.pp
@ -647,17 +647,14 @@ type
|
||||
function DoDiff: TModalResult;
|
||||
function DoFindInFiles: TModalResult;
|
||||
|
||||
// methods for debugging, compiling and external tools
|
||||
// message view
|
||||
function DoJumpToCompilerMessage(Index:integer;
|
||||
FocusEditor: boolean): boolean;
|
||||
|
||||
function DoJumpToSearchResult(FocusEditor: boolean): boolean;
|
||||
|
||||
|
||||
procedure DoJumpToNextError(DirectionDown: boolean);
|
||||
procedure DoShowMessagesView;
|
||||
procedure DoShowSearchResultsView;
|
||||
|
||||
procedure DoArrangeSourceEditorAndMessageView(PutOnTop: boolean);
|
||||
|
||||
// methods for debugging, compiling and external tools
|
||||
function GetTestBuildDir: string; override;
|
||||
function GetProjectTargetFilename: string;
|
||||
function GetTargetOS: string;
|
||||
@ -677,6 +674,10 @@ type
|
||||
procedure GetIDEFileState(Sender: TObject; const AFilename: string;
|
||||
NeededFlags: TIDEFileStateFlags; var ResultFlags: TIDEFileStateFlags); override;
|
||||
|
||||
// search results
|
||||
function DoJumpToSearchResult(FocusEditor: boolean): boolean;
|
||||
procedure DoShowSearchResultsView;
|
||||
|
||||
// form editor and designer
|
||||
procedure DoBringToFrontFormOrUnit;
|
||||
procedure DoBringToFrontFormOrInspector;
|
||||
@ -1877,7 +1878,7 @@ var
|
||||
AnUnitInfo: TUnitInfo;
|
||||
begin
|
||||
Handled:=true;
|
||||
|
||||
|
||||
case Command of
|
||||
ecSave:
|
||||
if Sender is TDesigner then begin
|
||||
@ -1923,6 +1924,11 @@ begin
|
||||
ecStopProgram: DebugBoss.DoStopProject;
|
||||
ecToggleCallStack: DebugBoss.DoToggleCallStack;
|
||||
|
||||
ecJumpToPrevError:
|
||||
DoJumpToNextError(true);
|
||||
|
||||
ecJumpToNextError:
|
||||
DoJumpToNextError(false);
|
||||
|
||||
ecFindProcedureDefinition,
|
||||
ecFindProcedureMethod:
|
||||
@ -1936,7 +1942,7 @@ begin
|
||||
|
||||
ecFindBlockStart:
|
||||
DoGoToPascalBlockStart;
|
||||
|
||||
|
||||
ecGotoIncludeDirective:
|
||||
DoGotoIncludeDirective;
|
||||
|
||||
@ -7521,6 +7527,51 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoJumpToNextError(DirectionDown: boolean);
|
||||
var
|
||||
Index: integer;
|
||||
MaxMessages: integer;
|
||||
CurMsg: String;
|
||||
Filename: string;
|
||||
CaretXY: TPoint;
|
||||
MsgType: TErrorType;
|
||||
OldIndex: integer;
|
||||
RoundCount: Integer;
|
||||
begin
|
||||
// search relevant message (next error, fatal or panic)
|
||||
MaxMessages:=MessagesView.VisibleItemCount;
|
||||
OldIndex:=MessagesView.SelectedMessageIndex;
|
||||
Index:=OldIndex;
|
||||
RoundCount:=0;
|
||||
while (Index>=0) and (Index<MaxMessages) do begin
|
||||
// goto to next message
|
||||
if DirectionDown then begin
|
||||
inc(Index);
|
||||
if Index>=MaxMessages then begin
|
||||
inc(RoundCount);
|
||||
Index:=0;
|
||||
end;
|
||||
end else begin
|
||||
dec(Index);
|
||||
if Index<0 then begin
|
||||
inc(RoundCount);
|
||||
Index:=MaxMessages-1;
|
||||
end;
|
||||
end;
|
||||
if(Index=OldIndex) or (RoundCount>1) then exit;
|
||||
|
||||
// check if it is an error
|
||||
CurMsg:=MessagesView.VisibleItems[Index].Msg;
|
||||
if (TheOutputFilter.GetSourcePosition(
|
||||
CurMsg,Filename,CaretXY,MsgType)) then
|
||||
begin
|
||||
if MsgType in [etError,etFatal,etPanic] then break;
|
||||
end;
|
||||
end;
|
||||
MessagesView.SelectedMessageIndex:=Index;
|
||||
DoJumpToCompilerMessage(Index,true);
|
||||
end;
|
||||
|
||||
function TMainIDE.DoJumpToSearchResult(FocusEditor: boolean): boolean;
|
||||
var
|
||||
AFileName: string;
|
||||
@ -10294,6 +10345,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.726 2004/05/29 14:52:18 mattias
|
||||
implemented go to next/previous error
|
||||
|
||||
Revision 1.725 2004/05/29 13:55:28 mattias
|
||||
added MaxHeight:=100 for mainbar
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user