mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-06 11:40:35 +01:00
IDE: migrate compiler message types
git-svn-id: trunk@42234 -
This commit is contained in:
parent
f36557e1c9
commit
057762a149
@ -35,18 +35,18 @@ type
|
||||
|
||||
TMessageLineUrgency = (
|
||||
mluNone,
|
||||
mluProgress, // time and statistics about the run
|
||||
mluDebug, // extreme verbosity, only useful for tool authors
|
||||
mluVerbose3, // all infos
|
||||
mluVerbose2, // almost all infos
|
||||
mluVerbose, // extra infos
|
||||
mluHint, // tool found something unusual
|
||||
mluNote, // maybe wrong or unnecessary
|
||||
mluWarn, // probably something is wrong
|
||||
mluProgress, // time and statistics about the run
|
||||
mluDebug, // extreme verbosity, only useful for tool authors
|
||||
mluVerbose3, // all infos
|
||||
mluVerbose2, // almost all infos
|
||||
mluVerbose, // extra infos
|
||||
mluHint, // tool found something unusual
|
||||
mluNote, // maybe wrong or unnecessary
|
||||
mluWarning, // probably something is wrong
|
||||
mluImportant, // message has no urgency level, but should be shown
|
||||
mluError, // tool could not finish, some tools can still continue
|
||||
mluFatal, // critical error in input, tool had to abort
|
||||
mluPanic // bug in tool
|
||||
mluError, // tool could not finish, some tools can still continue
|
||||
mluFatal, // critical error in input, tool had to abort
|
||||
mluPanic // bug in tool
|
||||
);
|
||||
TMessageLineUrgencies = set of TMessageLineUrgency;
|
||||
const
|
||||
@ -59,7 +59,7 @@ const
|
||||
'Verbose',
|
||||
'Hint',
|
||||
'Note',
|
||||
'Warn',
|
||||
'Warning',
|
||||
'Misc',
|
||||
'Error',
|
||||
'Fatal',
|
||||
@ -519,45 +519,6 @@ type
|
||||
var
|
||||
ExternalToolList: TIDEExternalTools = nil; // will be set by the IDE
|
||||
|
||||
type
|
||||
TMsgQuickFixes = class;
|
||||
|
||||
{ TMsgQuickFix }
|
||||
|
||||
TMsgQuickFix = class(TComponent)
|
||||
protected
|
||||
public
|
||||
procedure CreateMenuItems(Fixes: TMsgQuickFixes); virtual;
|
||||
procedure JumpTo({%H-}Msg: TMessageLine; var {%H-}Handled: boolean); virtual;
|
||||
procedure QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine); virtual;
|
||||
end;
|
||||
TMsgQuickFixClass = class of TMsgQuickFix;
|
||||
|
||||
{ TMsgQuickFixes }
|
||||
|
||||
TMsgQuickFixes = class(TComponent)
|
||||
private
|
||||
function GetLines(Index: integer): TMessageLine; inline;
|
||||
function GetQuickFixes(Index: integer): TMsgQuickFix; inline;
|
||||
protected
|
||||
fMsg: TFPList; // list of TMessageLine
|
||||
fItems: TObjectList; // list of TMsgQuickFix
|
||||
public
|
||||
constructor Create(aOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure RegisterQuickFix(Fix: TMsgQuickFix);
|
||||
procedure UnregisterQuickFix(Fix: TMsgQuickFix);
|
||||
function Count: integer; inline;
|
||||
property Items[Index: integer]: TMsgQuickFix read GetQuickFixes; default;
|
||||
function LineCount: integer; inline;
|
||||
property Lines[Index: integer]: TMessageLine read GetLines;
|
||||
function AddMenuItem(Fix: TMsgQuickFix; Msg: TMessageLine; aCaption: string;
|
||||
aTag: PtrInt = 0): TMenuItem; virtual; abstract;
|
||||
end;
|
||||
|
||||
var
|
||||
MsgQuickFixes: TMsgQuickFixes = nil; // set by IDE
|
||||
|
||||
function CompareMsgLinesSrcPos(MsgLine1, MsgLine2: Pointer): integer;
|
||||
|
||||
function dbgs(u: TMessageLineUrgency): string; overload;
|
||||
@ -1930,117 +1891,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TMsgQuickFix }
|
||||
|
||||
procedure TMsgQuickFix.QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
// this is purely an example
|
||||
|
||||
if Msg<>nil then begin
|
||||
if Msg.MsgID=-11111 then begin
|
||||
// fix the cause for the message
|
||||
// ...
|
||||
// mark message as handled
|
||||
Msg.MarkFixed;
|
||||
end;
|
||||
end else begin
|
||||
// example for fixing multiple messages at once
|
||||
for i:=0 to Fixes.LineCount-1 do begin
|
||||
Msg:=Fixes.Lines[i];
|
||||
if Msg.MsgID=-11111 then begin
|
||||
// fix the cause for the message
|
||||
// ...
|
||||
// mark message as handled
|
||||
Msg.MarkFixed;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMsgQuickFix.CreateMenuItems(Fixes: TMsgQuickFixes);
|
||||
var
|
||||
i: Integer;
|
||||
Msg: TMessageLine;
|
||||
begin
|
||||
// this is an example how to check the selected messages
|
||||
for i:=0 to Fixes.LineCount-1 do begin
|
||||
Msg:=Fixes.Lines[i];
|
||||
// here are some examples how to test if a message fits
|
||||
if (Msg.Urgency<mluWarn)
|
||||
and (Msg.MsgID=-11111)
|
||||
and (Msg.Line>0)
|
||||
and (Msg.Column>0)
|
||||
and (Msg.SubTool=SubToolFPC)
|
||||
and (Msg.GetFullFilename<>'')
|
||||
and (Pos('LazarusExample',Msg.Msg)>0)
|
||||
then
|
||||
// this message can be quick fixed => add a menu item
|
||||
Fixes.AddMenuItem(Self,Msg,'Change this or that to fix this item');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMsgQuickFix.JumpTo(Msg: TMessageLine; var Handled: boolean);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{ TMsgQuickFixes }
|
||||
|
||||
// inline
|
||||
function TMsgQuickFixes.GetLines(Index: integer): TMessageLine;
|
||||
begin
|
||||
Result:=TMessageLine(fMsg[index]);
|
||||
end;
|
||||
|
||||
// inline
|
||||
function TMsgQuickFixes.GetQuickFixes(Index: integer): TMsgQuickFix;
|
||||
begin
|
||||
Result:=TMsgQuickFix(fItems[Index]);
|
||||
end;
|
||||
|
||||
// inline
|
||||
function TMsgQuickFixes.Count: integer;
|
||||
begin
|
||||
Result:=fItems.Count;
|
||||
end;
|
||||
|
||||
// inline
|
||||
function TMsgQuickFixes.LineCount: integer;
|
||||
begin
|
||||
Result:=fMsg.Count;
|
||||
end;
|
||||
|
||||
constructor TMsgQuickFixes.Create(aOwner: TComponent);
|
||||
begin
|
||||
inherited Create(aOwner);
|
||||
fItems:=TObjectList.create(true);
|
||||
fMsg:=TFPList.Create;
|
||||
end;
|
||||
|
||||
destructor TMsgQuickFixes.Destroy;
|
||||
begin
|
||||
FreeAndNil(fMsg);
|
||||
FreeAndNil(fItems);
|
||||
inherited Destroy;
|
||||
if MsgQuickFixes=Self then
|
||||
MsgQuickFixes:=nil;
|
||||
end;
|
||||
|
||||
procedure TMsgQuickFixes.RegisterQuickFix(Fix: TMsgQuickFix);
|
||||
begin
|
||||
if fItems.IndexOf(Fix)>=0 then
|
||||
raise Exception.Create('quick fix already registered');
|
||||
fItems.Add(Fix);
|
||||
end;
|
||||
|
||||
procedure TMsgQuickFixes.UnregisterQuickFix(Fix: TMsgQuickFix);
|
||||
begin
|
||||
fItems.Remove(Fix);
|
||||
end;
|
||||
|
||||
end.
|
||||
{$ELSE}
|
||||
interface
|
||||
|
||||
@ -15,6 +15,165 @@ unit IDEMsgIntf;
|
||||
|
||||
interface
|
||||
|
||||
{$IFDEF EnableNewExtTools}
|
||||
|
||||
uses
|
||||
Classes, SysUtils, contnrs, Forms, Menus,
|
||||
TextTools, IDECommands, IDEExternToolIntf;
|
||||
|
||||
type
|
||||
TMsgQuickFixes = class;
|
||||
|
||||
{ TMsgQuickFix }
|
||||
|
||||
TMsgQuickFix = class(TComponent)
|
||||
protected
|
||||
public
|
||||
procedure CreateMenuItems(Fixes: TMsgQuickFixes); virtual;
|
||||
procedure JumpTo({%H-}Msg: TMessageLine; var {%H-}Handled: boolean); virtual;
|
||||
procedure QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine); virtual;
|
||||
end;
|
||||
TMsgQuickFixClass = class of TMsgQuickFix;
|
||||
|
||||
{ TMsgQuickFixes }
|
||||
|
||||
TMsgQuickFixes = class(TComponent)
|
||||
private
|
||||
function GetLines(Index: integer): TMessageLine; inline;
|
||||
function GetQuickFixes(Index: integer): TMsgQuickFix; inline;
|
||||
protected
|
||||
fMsg: TFPList; // list of TMessageLine
|
||||
fItems: TObjectList; // list of TMsgQuickFix
|
||||
public
|
||||
constructor Create(aOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure RegisterQuickFix(Fix: TMsgQuickFix);
|
||||
procedure UnregisterQuickFix(Fix: TMsgQuickFix);
|
||||
function Count: integer; inline;
|
||||
property Items[Index: integer]: TMsgQuickFix read GetQuickFixes; default;
|
||||
function LineCount: integer; inline;
|
||||
property Lines[Index: integer]: TMessageLine read GetLines;
|
||||
function AddMenuItem(Fix: TMsgQuickFix; Msg: TMessageLine; aCaption: string;
|
||||
aTag: PtrInt = 0): TMenuItem; virtual; abstract;
|
||||
end;
|
||||
|
||||
var
|
||||
MsgQuickFixes: TMsgQuickFixes = nil; // set by IDE
|
||||
|
||||
implementation
|
||||
|
||||
{ TMsgQuickFix }
|
||||
|
||||
procedure TMsgQuickFix.QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
// this is purely an example
|
||||
|
||||
if Msg<>nil then begin
|
||||
if Msg.MsgID=-11111 then begin
|
||||
// fix the cause for the message
|
||||
// ...
|
||||
// mark message as handled
|
||||
Msg.MarkFixed;
|
||||
end;
|
||||
end else begin
|
||||
// example for fixing multiple messages at once
|
||||
for i:=0 to Fixes.LineCount-1 do begin
|
||||
Msg:=Fixes.Lines[i];
|
||||
if Msg.MsgID=-11111 then begin
|
||||
// fix the cause for the message
|
||||
// ...
|
||||
// mark message as handled
|
||||
Msg.MarkFixed;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMsgQuickFix.CreateMenuItems(Fixes: TMsgQuickFixes);
|
||||
var
|
||||
i: Integer;
|
||||
Msg: TMessageLine;
|
||||
begin
|
||||
// this is an example how to check the selected messages
|
||||
for i:=0 to Fixes.LineCount-1 do begin
|
||||
Msg:=Fixes.Lines[i];
|
||||
// here are some examples how to test if a message fits
|
||||
if (Msg.Urgency<mluWarning)
|
||||
and (Msg.MsgID=-11111)
|
||||
and (Msg.Line>0)
|
||||
and (Msg.Column>0)
|
||||
and (Msg.SubTool=SubToolFPC)
|
||||
and (Msg.GetFullFilename<>'')
|
||||
and (Pos('LazarusExample',Msg.Msg)>0)
|
||||
then
|
||||
// this message can be quick fixed => add a menu item
|
||||
Fixes.AddMenuItem(Self,Msg,'Change this or that to fix this item');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMsgQuickFix.JumpTo(Msg: TMessageLine; var Handled: boolean);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{ TMsgQuickFixes }
|
||||
|
||||
// inline
|
||||
function TMsgQuickFixes.GetLines(Index: integer): TMessageLine;
|
||||
begin
|
||||
Result:=TMessageLine(fMsg[index]);
|
||||
end;
|
||||
|
||||
// inline
|
||||
function TMsgQuickFixes.GetQuickFixes(Index: integer): TMsgQuickFix;
|
||||
begin
|
||||
Result:=TMsgQuickFix(fItems[Index]);
|
||||
end;
|
||||
|
||||
// inline
|
||||
function TMsgQuickFixes.Count: integer;
|
||||
begin
|
||||
Result:=fItems.Count;
|
||||
end;
|
||||
|
||||
// inline
|
||||
function TMsgQuickFixes.LineCount: integer;
|
||||
begin
|
||||
Result:=fMsg.Count;
|
||||
end;
|
||||
|
||||
constructor TMsgQuickFixes.Create(aOwner: TComponent);
|
||||
begin
|
||||
inherited Create(aOwner);
|
||||
fItems:=TObjectList.create(true);
|
||||
fMsg:=TFPList.Create;
|
||||
end;
|
||||
|
||||
destructor TMsgQuickFixes.Destroy;
|
||||
begin
|
||||
FreeAndNil(fMsg);
|
||||
FreeAndNil(fItems);
|
||||
inherited Destroy;
|
||||
if MsgQuickFixes=Self then
|
||||
MsgQuickFixes:=nil;
|
||||
end;
|
||||
|
||||
procedure TMsgQuickFixes.RegisterQuickFix(Fix: TMsgQuickFix);
|
||||
begin
|
||||
if fItems.IndexOf(Fix)>=0 then
|
||||
raise Exception.Create('quick fix already registered');
|
||||
fItems.Add(Fix);
|
||||
end;
|
||||
|
||||
procedure TMsgQuickFixes.UnregisterQuickFix(Fix: TMsgQuickFix);
|
||||
begin
|
||||
fItems.Remove(Fix);
|
||||
end;
|
||||
|
||||
{$ELSE EnableNewExtTools}
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, LCLProc,
|
||||
TextTools, IDECommands, IDEExternToolIntf;
|
||||
@ -797,5 +956,6 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
{$ENDIF EnableNewExtTools}
|
||||
end.
|
||||
|
||||
|
||||
@ -45,7 +45,13 @@ uses
|
||||
// IDE
|
||||
LazarusIDEStrConsts, DialogProcs, IDEProcs, CodeToolsOptions, InputHistory,
|
||||
EditDefineTree, ProjectResources, MiscOptions, LazConf, EnvironmentOpts,
|
||||
TransferMacros, CompilerOptions, OutputFilter, Compiler, FPCSrcScan,
|
||||
TransferMacros, CompilerOptions,
|
||||
{$IFDEF EnableNewExtTools}
|
||||
ExtTools,
|
||||
{$ELSE}
|
||||
OutputFilter,
|
||||
{$ENDIF}
|
||||
Compiler, FPCSrcScan,
|
||||
PackageDefs, PackageSystem, Project, ProjectIcon,
|
||||
ModeMatrixOpts, BaseBuildManager, ApplicationBundle;
|
||||
|
||||
@ -159,6 +165,9 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure SetupTransferMacros;
|
||||
procedure TranslateMacros;
|
||||
{$IFDEF EnableNewExtTools}
|
||||
procedure SetupExternalTools;
|
||||
{$ENDIF}
|
||||
procedure SetupCompilerInterface;
|
||||
procedure SetupInputHistories;
|
||||
|
||||
@ -312,6 +321,10 @@ end;
|
||||
|
||||
destructor TBuildManager.Destroy;
|
||||
begin
|
||||
{$IFDEF EnableNewExtTools}
|
||||
FreeAndNil(ExternalTools);
|
||||
{$ENDIF}
|
||||
|
||||
GetBuildMacroValues:=nil;
|
||||
OnAppendCustomOption:=nil;
|
||||
OnBackupFileInteractive:=nil;
|
||||
@ -462,6 +475,20 @@ begin
|
||||
tr('MakeFile',lisTMFunctionChompPathDelimiter);
|
||||
end;
|
||||
|
||||
{$IFDEF EnableNewExtTools}
|
||||
procedure TBuildManager.SetupExternalTools;
|
||||
begin
|
||||
// setup the external tool queue
|
||||
ExternalTools:=TExternalTools.Create(Self);
|
||||
RegisterFPCParser;
|
||||
RegisterMakeParser;
|
||||
ExternalToolList.RegisterParser(TDefaultParser);
|
||||
|
||||
FPCMsgFilePool:=TFPCMsgFilePool.Create(nil);
|
||||
FPCMsgFilePool.OnLoadFile:=@FPCMsgFilePoolLoadFile;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TBuildManager.SetupCompilerInterface;
|
||||
begin
|
||||
TheCompiler := TCompiler.Create;
|
||||
|
||||
@ -39,7 +39,12 @@ uses
|
||||
SynEditMiscClasses, LFMTrees,
|
||||
// IDE
|
||||
PropEdits, IDEDialogs, ComponentReg, PackageIntf, IDEWindowIntf,
|
||||
CustomFormEditor, LazarusIDEStrConsts, OutputFilter, IDEProcs, IDEOptionDefs,
|
||||
CustomFormEditor, LazarusIDEStrConsts,
|
||||
{$IFDEF EnableNewExtTools}
|
||||
{$ELSE}
|
||||
OutputFilter,
|
||||
{$ENDIF}
|
||||
IDEProcs, IDEOptionDefs,
|
||||
EditorOptions, ExtCtrls, JITForms, PropEditUtils;
|
||||
|
||||
type
|
||||
|
||||
@ -39,7 +39,12 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Process, LCLProc, Forms, Controls, contnrs, strutils, FileUtil,
|
||||
LazarusIDEStrConsts, CompilerOptions, Project, OutputFilter, UTF8Process,
|
||||
LazarusIDEStrConsts, CompilerOptions, Project,
|
||||
{$IFDEF EnableNewExtTools}
|
||||
{$ELSE}
|
||||
OutputFilter,
|
||||
{$ENDIF}
|
||||
UTF8Process,
|
||||
InfoBuild, IDEMsgIntf, LazIDEIntf, ProjectIntf, CompOptsIntf;
|
||||
|
||||
type
|
||||
|
||||
@ -374,7 +374,7 @@ type
|
||||
MsgText : String; // message text
|
||||
DefIgnored : Boolean; // is message ignored by default (based on the message file)
|
||||
State : TCompilerMessageState; // user state of the message
|
||||
MsgType : TFPCErrorType; // type of message (error, warning, etc)
|
||||
MsgType : {$IFDEF EnableNewExtTools}TMessageLineUrgency{$ELSE}TFPCErrorType{$ENDIF}; // type of message (error, warning, etc)
|
||||
constructor Create(AOwner: TCompilerMessagesList);
|
||||
// function GetUserText: string; overload;
|
||||
// function GetUserText(const ReplaceParams: array of string): string; overload;
|
||||
@ -391,7 +391,7 @@ type
|
||||
protected
|
||||
fUsedMsgFile: string;
|
||||
fUpdating : Integer;
|
||||
FErrorNames : array [TFPCErrorType] of string;
|
||||
FErrorNames : array [{$IFDEF EnableNewExtTools}TMessageLineUrgency{$ELSE}TFPCErrorType{$ENDIF}] of string;
|
||||
|
||||
procedure ClearHash;
|
||||
procedure AddHash(Msg: TCompilerMessageConfig);
|
||||
@ -403,7 +403,7 @@ type
|
||||
procedure GetStateArray(var b: array of TCompilerMessageState); // array must be large enough
|
||||
procedure SetStateArray(const b: array of TCompilerMessageState); // to store b[MaxMsgIndex], or function fail
|
||||
function GetCount: Integer;
|
||||
function GetErrorNames(errtype: TFPCErrorType): string;
|
||||
function GetErrorNames(errtype: {$IFDEF EnableNewExtTools}TMessageLineUrgency{$ELSE}TFPCErrorType{$ENDIF}): string;
|
||||
procedure IncreaseChangeStamp;
|
||||
property ChangeStamp: int64 read FChangeStamp;
|
||||
property OnChanged: TNotifyEvent read FOnChanged write FOnChanged;
|
||||
@ -415,7 +415,7 @@ type
|
||||
procedure BeginUpdate;
|
||||
procedure EndUpdate;
|
||||
function LoadMsgFile(const FileName: string): Boolean;
|
||||
function Add(AMsgIndex: Integer; AMsgType: TFPCErrorType; const AMsgText: string;
|
||||
function Add(AMsgIndex: Integer; AMsgType: {$IFDEF EnableNewExtTools}TMessageLineUrgency{$ELSE}TFPCErrorType{$ENDIF}; const AMsgText: string;
|
||||
DefIgnored: Boolean = false; AState: TCompilerMessageState = msDefault): TCompilerMessageConfig;
|
||||
procedure SetDefault(KeepState: Boolean=true);
|
||||
// function GetParams(MsgIndex: Integer; var prms: array of string; out PrmCount: Integer): Integer;
|
||||
@ -426,7 +426,7 @@ type
|
||||
property MsgState[i: Integer]: TCompilerMessageState read GetMsgState write SetMsgState;
|
||||
property Count: Integer read GetCount;
|
||||
property UsedMsgFile : string read fUsedMsgFile;
|
||||
property ErrorNames[errtype: TFPCErrorType]: string read GetErrorNames;
|
||||
property ErrorNames[errtype: {$IFDEF EnableNewExtTools}TMessageLineUrgency{$ELSE}TFPCErrorType{$ENDIF}]: string read GetErrorNames;
|
||||
end;
|
||||
|
||||
const
|
||||
@ -1407,6 +1407,19 @@ var
|
||||
LinkSmart := aXMLConfig.GetValue(p+'LinkSmart/Value', false);
|
||||
end;
|
||||
|
||||
procedure ReadMsgErrorName(t: {$IFDEF EnableNewExtTools}TMessageLineUrgency{$ELSE}TFPCErrorType{$ENDIF};
|
||||
const aPath, SubPath: string);
|
||||
begin
|
||||
fCompilerMessages.fErrorNames[t]:=
|
||||
aXMLConfig.GetValue(aPath+'CompilerMessages/ErrorNames/'+SubPath,
|
||||
{$IFDEF EnableNewExtTools}
|
||||
MessageLineUrgencyNames[t]
|
||||
{$ELSE}
|
||||
FPCErrorTypeNames[t]
|
||||
{$ENDIF}
|
||||
);
|
||||
end;
|
||||
|
||||
begin
|
||||
{ Load the compiler options from the XML file }
|
||||
p:=Path;
|
||||
@ -1573,16 +1586,15 @@ begin
|
||||
State := msOn;
|
||||
end;
|
||||
|
||||
if UseMsgFile then
|
||||
with aXMLConfig do begin
|
||||
// ErrorNames should be stored, because the Message file is not read (or parsed)
|
||||
// on project opening. So errors needs to be initialized properly from the CompilerOptions.xml
|
||||
fCompilerMessages.fErrorNames[etHint] :=GetValue(p+'CompilerMessages/ErrorNames/Hint', FPCErrorTypeNames[etHint]);
|
||||
fCompilerMessages.fErrorNames[etNote] :=GetValue(p+'CompilerMessages/ErrorNames/Note', FPCErrorTypeNames[etNote]);
|
||||
fCompilerMessages.fErrorNames[etWarning]:=GetValue(p+'CompilerMessages/ErrorNames/Warning', FPCErrorTypeNames[etWarning]);
|
||||
fCompilerMessages.fErrorNames[etError] :=GetValue(p+'CompilerMessages/ErrorNames/Error', FPCErrorTypeNames[etError]);
|
||||
fCompilerMessages.fErrorNames[etFatal] :=GetValue(p+'CompilerMessages/ErrorNames/Fatal', FPCErrorTypeNames[etFatal]);
|
||||
end;
|
||||
if UseMsgFile then begin
|
||||
// ErrorNames should be stored, because the Message file is not read (or parsed)
|
||||
// on project opening. So errors needs to be initialized properly from the CompilerOptions.xml
|
||||
ReadMsgErrorName({$IFDEF EnableNewExtTools}mluHint{$ELSE}etHint{$ENDIF},p,'Hint');
|
||||
ReadMsgErrorName({$IFDEF EnableNewExtTools}mluNote{$ELSE}etNote{$ENDIF},p,'Note');
|
||||
ReadMsgErrorName({$IFDEF EnableNewExtTools}mluWarning{$ELSE}etWarning{$ENDIF},p,'Earning');
|
||||
ReadMsgErrorName({$IFDEF EnableNewExtTools}mluError{$ELSE}etError{$ENDIF},p,'Error');
|
||||
ReadMsgErrorName({$IFDEF EnableNewExtTools}mluFatal{$ELSE}etFatal{$ENDIF},p,'Fatal');
|
||||
end;
|
||||
|
||||
{ Other }
|
||||
p:=Path+'Other/';
|
||||
@ -1639,6 +1651,19 @@ var
|
||||
Result:=SwitchPathDelims(AFilename,UsePathDelim);
|
||||
end;
|
||||
|
||||
procedure WriteMsgErrorName(t: {$IFDEF EnableNewExtTools}TMessageLineUrgency{$ELSE}TFPCErrorType{$ENDIF};
|
||||
const aPath, SubPath: string);
|
||||
begin
|
||||
aXMLConfig.SetDeleteValue(aPath+'CompilerMessages/ErrorNames/'+SubPath,
|
||||
CompilerMessages.ErrorNames[t],
|
||||
{$IFDEF EnableNewExtTools}
|
||||
MessageLineUrgencyNames[t]
|
||||
{$ELSE}
|
||||
FPCErrorTypeNames[t]
|
||||
{$ENDIF}
|
||||
);
|
||||
end;
|
||||
|
||||
var
|
||||
P, s: string;
|
||||
i: Integer;
|
||||
@ -1765,11 +1790,11 @@ begin
|
||||
aXMLConfig.SetDeleteValue(p+'CompilerMessages/UseMsgFile/Value', UseMsgFile, False);
|
||||
aXMLConfig.SetDeleteValue(p+'CompilerMessages/MsgFileName/Value', MsgFileName, '$(FPCMsgFile)');
|
||||
|
||||
aXMLConfig.SetDeleteValue(p+'CompilerMessages/ErrorNames/Hint', CompilerMessages.ErrorNames[etHint], FPCErrorTypeNames[etHint]);
|
||||
aXMLConfig.SetDeleteValue(p+'CompilerMessages/ErrorNames/Note', CompilerMessages.ErrorNames[etNote], FPCErrorTypeNames[etNote]);
|
||||
aXMLConfig.SetDeleteValue(p+'CompilerMessages/ErrorNames/Warning', CompilerMessages.ErrorNames[etWarning], FPCErrorTypeNames[etWarning]);
|
||||
aXMLConfig.SetDeleteValue(p+'CompilerMessages/ErrorNames/Error', CompilerMessages.ErrorNames[etError], FPCErrorTypeNames[etError]);
|
||||
aXMLConfig.SetDeleteValue(p+'CompilerMessages/ErrorNames/Fatal', CompilerMessages.ErrorNames[etFatal], FPCErrorTypeNames[etFatal]);
|
||||
WriteMsgErrorName({$IFDEF EnableNewExtTools}mluHint{$ELSE}etHint{$ENDIF},p,'Hint');
|
||||
WriteMsgErrorName({$IFDEF EnableNewExtTools}mluNote{$ELSE}etNote{$ENDIF},p,'Note');
|
||||
WriteMsgErrorName({$IFDEF EnableNewExtTools}mluWarning{$ELSE}etWarning{$ENDIF},p,'Earning');
|
||||
WriteMsgErrorName({$IFDEF EnableNewExtTools}mluError{$ELSE}etError{$ENDIF},p,'Error');
|
||||
WriteMsgErrorName({$IFDEF EnableNewExtTools}mluFatal{$ELSE}etFatal{$ENDIF},p,'Fatal');
|
||||
|
||||
{ Other }
|
||||
p:=Path+'Other/';
|
||||
|
||||
@ -46,7 +46,12 @@ uses
|
||||
CompOptsIntf, ProjectIntf,
|
||||
EnvironmentOpts,
|
||||
ExtToolEditDlg, KeyMapping, TransferMacros, IDEProcs, LazFileUtils,
|
||||
InfoBuild, CompilerOptions, OutputFilter, LazarusIDEStrConsts, IDEOptionDefs;
|
||||
InfoBuild, CompilerOptions,
|
||||
{$IFDEF EnableNewExtTools}
|
||||
{$ELSE}
|
||||
OutputFilter,
|
||||
{$ENDIF}
|
||||
LazarusIDEStrConsts, IDEOptionDefs;
|
||||
|
||||
const
|
||||
MaxExtTools = ecExtToolLast-ecExtToolFirst+1;
|
||||
|
||||
@ -45,7 +45,11 @@ uses
|
||||
IDEMsgIntf, PackageIntf, LazIDEIntf, HelpIntfs, IDEHelpIntf,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, TransferMacros, DialogProcs, IDEOptionDefs,
|
||||
ObjInspExt, EnvironmentOpts, AboutFrm, MsgView, Project, MainBar, OutputFilter,
|
||||
ObjInspExt, EnvironmentOpts, AboutFrm, MsgView, Project, MainBar,
|
||||
{$IFDEF EnableNewExtTools}
|
||||
{$ELSE}
|
||||
OutputFilter,
|
||||
{$ENDIF}
|
||||
IDEFPDocFileSearch, PackageDefs, PackageSystem,
|
||||
HelpOptions, MainIntf, LazConf, HelpFPCMessages, CodeHelp,
|
||||
IDEContextHelpEdit, IDEWindowHelp;
|
||||
|
||||
23
ide/main.pp
23
ide/main.pp
@ -109,7 +109,7 @@ uses
|
||||
{$IFDEF EnableNewExtTools}
|
||||
etQuickFixes,
|
||||
{$ELSE}
|
||||
MsgQuickFixes,
|
||||
OutputFilter, MsgQuickFixes,
|
||||
{$ENDIF}
|
||||
// converter
|
||||
ChgEncodingDlg, ConvertDelphi, ConvCodeTool, MissingPropertiesDlg, LazXMLForms,
|
||||
@ -147,7 +147,7 @@ uses
|
||||
CodeTemplatesDlg, CodeBrowser, FindUnitDlg, InspectChksumChangedDlg,
|
||||
IdeOptionsDlg, EditDefineTree, PublishModule, EnvironmentOpts, TransferMacros,
|
||||
KeyMapping, IDETranslations, IDEProcs, ExtToolDialog, ExtToolEditDlg,
|
||||
OutputFilter, JumpHistoryView, ExampleManager,
|
||||
JumpHistoryView, ExampleManager,
|
||||
BuildLazDialog, BuildProfileManager, BuildManager, CheckCompOptsForNewUnitDlg,
|
||||
MiscOptions, InputHistory, UnitDependencies, ClipBoardHistory,
|
||||
IDEFPCInfo, IDEInfoDlg, IDEInfoNeedBuild, ProcessList, InitialSetupDlgs,
|
||||
@ -697,9 +697,6 @@ type
|
||||
procedure SetupFormEditor;
|
||||
procedure SetupSourceNotebook;
|
||||
procedure SetupCodeMacros;
|
||||
{$IFDEF EnableNewExtTools}
|
||||
procedure SetupExternalTools;
|
||||
{$ENDIF}
|
||||
procedure SetupControlSelection;
|
||||
procedure SetupIDECommands;
|
||||
procedure SetupIDEMsgQuickFixItems;
|
||||
@ -1368,7 +1365,7 @@ begin
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create CODETOOLS');{$ENDIF}
|
||||
|
||||
{$IFDEF EnableNewExtTools}
|
||||
SetupExternalTools;
|
||||
MainBuildBoss.SetupExternalTools;
|
||||
{$ENDIF}
|
||||
|
||||
// build and position the MainIDE form
|
||||
@ -2120,20 +2117,6 @@ begin
|
||||
CreateStandardCodeMacros;
|
||||
end;
|
||||
|
||||
{$IFDEF EnableNewExtTools}
|
||||
procedure TMainIDE.SetupExternalTools;
|
||||
begin
|
||||
// setup the external tool queue
|
||||
ExternalTools:=TExternalTools.Create(Self);
|
||||
RegisterFPCParser;
|
||||
RegisterMakeParser;
|
||||
ExternalToolList.RegisterParser(TDefaultParser);
|
||||
|
||||
FPCMsgFilePool:=TFPCMsgFilePool.Create(nil);
|
||||
FPCMsgFilePool.OnLoadFile:=@FPCMsgFilePoolLoadFile;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TMainIDE.SetupControlSelection;
|
||||
begin
|
||||
TheControlSelection:=TControlSelection.Create;
|
||||
|
||||
@ -63,7 +63,11 @@ uses
|
||||
IDECommands, IDEMsgIntf, IDEWindowIntf,
|
||||
// IDE
|
||||
LazConf, LazarusIDEStrConsts, ProjectDefs, Project, PublishModule,
|
||||
BuildLazDialog, Compiler, ComponentReg, OutputFilter,
|
||||
BuildLazDialog, Compiler, ComponentReg,
|
||||
{$IFDEF EnableNewExtTools}
|
||||
{$ELSE}
|
||||
OutputFilter,
|
||||
{$ENDIF}
|
||||
TransferMacros, ObjectInspector, PropEdits, IDEDefs, MsgView,
|
||||
EnvironmentOpts, EditorOptions, CompilerOptions, KeyMapping, IDEProcs,
|
||||
Debugger, IDEOptionDefs, CodeToolsDefines, Splash, Designer,
|
||||
|
||||
@ -14,6 +14,10 @@
|
||||
}
|
||||
unit OutputFilter;
|
||||
|
||||
{$IFDEF EnableNewExtTools}
|
||||
{$ERROR deprecated}
|
||||
{$ENDIF}
|
||||
|
||||
{$mode objfpc}
|
||||
{$H+}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user