mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 06:09:15 +02:00
messages: quickfix items in src
git-svn-id: trunk@45289 -
This commit is contained in:
parent
c0772a50ef
commit
213a34d083
@ -35,11 +35,12 @@ interface
|
||||
|
||||
uses
|
||||
Math, strutils, Classes, SysUtils, UTF8Process, FileProcs, LazFileCache,
|
||||
LazUTF8Classes, LazFileUtils, LazUTF8, AvgLvlTree, SynEdit, LResources, Forms,
|
||||
Buttons, ExtCtrls, Controls, LMessages, LCLType, Graphics, LCLIntf, Themes,
|
||||
ImgList, GraphType, Menus, Clipbrd, Dialogs, StdCtrls, IDEExternToolIntf,
|
||||
IDEImagesIntf, MenuIntf, PackageIntf, IDECommands, etSrcEditMarks,
|
||||
etQuickFixes, LazarusIDEStrConsts, EnvironmentOpts, HelpFPCMessages;
|
||||
LazUTF8Classes, LazFileUtils, LazUTF8, AvgLvlTree, SynEdit, SynEditMarks,
|
||||
LResources, Forms, Buttons, ExtCtrls, Controls, LMessages, LCLType, Graphics,
|
||||
LCLIntf, Themes, ImgList, GraphType, Menus, Clipbrd, Dialogs, StdCtrls,
|
||||
IDEExternToolIntf, IDEImagesIntf, MenuIntf, PackageIntf, IDECommands,
|
||||
SrcEditorIntf, etSrcEditMarks, etQuickFixes, LazarusIDEStrConsts,
|
||||
EnvironmentOpts, HelpFPCMessages;
|
||||
|
||||
const
|
||||
CustomViewCaption = '------------------------------';
|
||||
@ -445,6 +446,7 @@ type
|
||||
DeleteOld: boolean);
|
||||
procedure ApplySrcChanges(Changes: TETSingleSrcChanges);
|
||||
procedure ApplyMultiSrcChanges(Changes: TETMultiSrcChanges);
|
||||
procedure SourceEditorPopup(aSrcEdit: TSourceEditorInterface);
|
||||
|
||||
// message lines
|
||||
procedure SelectMsgLine(Msg: TMessageLine; DoScroll: boolean);
|
||||
@ -3740,6 +3742,35 @@ begin
|
||||
ApplySrcChanges(TETSingleSrcChanges(Node.Data));
|
||||
end;
|
||||
|
||||
procedure TMessagesFrame.SourceEditorPopup(aSrcEdit: TSourceEditorInterface);
|
||||
var
|
||||
LineCol: TPoint;
|
||||
aSynEdit: TSynEdit;
|
||||
MarkLine: TSynEditMarkLine;
|
||||
i: Integer;
|
||||
Mark: TETMark;
|
||||
begin
|
||||
//debugln(['TMessagesFrame.SourceEditorPopup ']);
|
||||
// get all marks of the current source editor line
|
||||
aSynEdit:=TSynEdit(aSrcEdit.EditorControl);
|
||||
if not (aSynEdit is TSynEdit) then exit;
|
||||
LineCol:=aSrcEdit.CursorScreenXY;
|
||||
if LineCol.Y>aSynEdit.Lines.Count then exit;
|
||||
MarkLine:=aSynEdit.Marks.Line[LineCol.Y];
|
||||
if MarkLine=nil then exit;
|
||||
IDEQuickFixes.ClearLines;
|
||||
for i:=0 to MarkLine.Count-1 do begin
|
||||
Mark:=TETMark(MarkLine[i]);
|
||||
if not (Mark is TETMark) then continue;
|
||||
//debugln(['TMessagesFrame.SourceEditorPopup ',Mark.Line,',',Mark.Column,' ID=',Mark.MsgLine.MsgID,' Msg=',Mark.MsgLine.Msg]);
|
||||
IDEQuickFixes.AddMsgLine(Mark.MsgLine);
|
||||
end;
|
||||
// create items
|
||||
if IDEQuickFixes.Count>0 then begin
|
||||
IDEQuickFixes.OnPopupMenu(SrcEditMenuSectionFirstDynamic);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMessagesFrame.SelectMsgLine(Msg: TMessageLine; DoScroll: boolean);
|
||||
begin
|
||||
MessagesCtrl.Select(Msg,DoScroll);
|
||||
|
@ -33,8 +33,8 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, IDEMsgIntf, IDEImagesIntf, IDEExternToolIntf,
|
||||
LazIDEIntf, Forms, Controls, Graphics, Dialogs, LCLProc, etMessageFrame,
|
||||
etSrcEditMarks, etQuickFixes;
|
||||
LazIDEIntf, SrcEditorIntf, Forms, Controls, Graphics, Dialogs, LCLProc,
|
||||
etMessageFrame, etSrcEditMarks, etQuickFixes;
|
||||
|
||||
type
|
||||
|
||||
@ -53,24 +53,32 @@ type
|
||||
protected
|
||||
function GetViews(Index: integer): TExtToolView; override;
|
||||
public
|
||||
procedure ClearCustomMessages(const ViewCaption: string='');
|
||||
function AddCustomMessage(TheUrgency: TMessageLineUrgency; Msg: string;
|
||||
aSrcFilename: string=''; LineNumber: integer=0; Column: integer=0;
|
||||
const ViewCaption: string=''): TMessageLine; override;
|
||||
// views
|
||||
procedure Clear; override;
|
||||
procedure DeleteView(View: TExtToolView); override;
|
||||
function FindUnfinishedView: TExtToolView; override;
|
||||
function GetSelectedLine: TMessageLine; override;
|
||||
function GetView(aCaption: string; CreateIfNotExist: boolean
|
||||
): TExtToolView; override;
|
||||
function ViewCount: integer; override;
|
||||
function CreateView(aCaptionPrefix: string): TExtToolView; override;
|
||||
function IndexOfView(View: TExtToolView): integer; override;
|
||||
|
||||
// lines
|
||||
procedure SelectMsgLine(Msg: TMessageLine); override;
|
||||
function SelectFirstUrgentMessage(aMinUrgency: TMessageLineUrgency;
|
||||
WithSrcPos: boolean): boolean; override;
|
||||
function SelectNextUrgentMessage(aMinUrgency: TMessageLineUrgency;
|
||||
WithSrcPos, Downwards: boolean): boolean; override;
|
||||
function ViewCount: integer; override;
|
||||
procedure ClearCustomMessages(const ViewCaption: string='');
|
||||
function AddCustomMessage(TheUrgency: TMessageLineUrgency; Msg: string;
|
||||
aSrcFilename: string=''; LineNumber: integer=0; Column: integer=0;
|
||||
const ViewCaption: string=''): TMessageLine; override;
|
||||
|
||||
// misc
|
||||
procedure SourceEditorPopup(aSrcEdit: TSourceEditorInterface);
|
||||
|
||||
// options
|
||||
procedure ApplyIDEOptions;
|
||||
property DblClickJumps: boolean read GetDblClickJumps write SetDblClickJumps;
|
||||
property HideMessagesIcons: boolean read GetHideMessagesIcons write SetHideMessagesIcons;
|
||||
@ -148,6 +156,11 @@ begin
|
||||
LineNumber,Column,ViewCaption);
|
||||
end;
|
||||
|
||||
procedure TMessagesView.SourceEditorPopup(aSrcEdit: TSourceEditorInterface);
|
||||
begin
|
||||
MessagesFrame1.SourceEditorPopup(aSrcEdit);
|
||||
end;
|
||||
|
||||
procedure TMessagesView.Clear;
|
||||
begin
|
||||
MessagesFrame1.ClearViews;
|
||||
|
@ -1059,6 +1059,9 @@ begin
|
||||
end;
|
||||
|
||||
constructor TETMarks.Create(AOwner: TComponent);
|
||||
const
|
||||
DefMarkColorHint = TColor($00a5ff);
|
||||
DefMarkColorError = clRed;
|
||||
var
|
||||
u: TMessageLineUrgency;
|
||||
begin
|
||||
@ -1066,13 +1069,11 @@ begin
|
||||
if ExtToolsMarks=nil then
|
||||
ExtToolsMarks:=Self;
|
||||
for u:=low(TMessageLineUrgency) to high(TMessageLineUrgency) do
|
||||
fMarkStyles[u]:=TETMarkStyle.Create(u,clNone);
|
||||
fMarkStyles[mluHint].Color:=clGreen;
|
||||
fMarkStyles[mluNote].Color:=clGreen;
|
||||
fMarkStyles[mluWarning].Color:=clYellow;
|
||||
fMarkStyles[mluError].Color:=clRed;
|
||||
fMarkStyles[mluFatal].Color:=clRed;
|
||||
fMarkStyles[mluPanic].Color:=clRed;
|
||||
fMarkStyles[u]:=TETMarkStyle.Create(u,DefMarkColorHint);
|
||||
fMarkStyles[mluWarning].Color:=DefMarkColorError;
|
||||
fMarkStyles[mluError].Color:=DefMarkColorError;
|
||||
fMarkStyles[mluFatal].Color:=DefMarkColorError;
|
||||
fMarkStyles[mluPanic].Color:=DefMarkColorError;
|
||||
end;
|
||||
|
||||
destructor TETMarks.Destroy;
|
||||
|
@ -6408,6 +6408,10 @@ begin
|
||||
Marks[i].CreatePopupMenuItems(@AddUserDefinedPopupMenuItem);
|
||||
FreeMem(Marks);
|
||||
end;
|
||||
{$IFDEF EnableNewExtTools}
|
||||
if MessagesView<>nil then
|
||||
MessagesView.SourceEditorPopup(ASrcEdit);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
if Assigned(Manager.OnPopupMenu) then
|
||||
|
Loading…
Reference in New Issue
Block a user