mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 18:58:04 +02:00
IDE: clean up old external tools
git-svn-id: trunk@45946 -
This commit is contained in:
parent
160cd91c5a
commit
e3e3c31ab3
@ -27,10 +27,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LazLogger, LazFileUtils, LazHelpIntf, HelpIntfs,
|
||||
LazConfigStorage, PropEdits, LazIDEIntf, IDEDialogs,
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEExternToolIntf,
|
||||
{$ENDIF}
|
||||
LazConfigStorage, PropEdits, LazIDEIntf, IDEDialogs, IDEExternToolIntf,
|
||||
LHelpControl, Controls, UTF8Process, ChmLangRef, ChmLcl, ChmProg;
|
||||
|
||||
resourcestring
|
||||
@ -256,15 +253,7 @@ var
|
||||
LHelpProjectDir: String;
|
||||
WS: String;
|
||||
PCP: String;
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
Tool: TIDEExternalToolOptions;
|
||||
{$ELSE}
|
||||
Proc: TProcessUTF8;
|
||||
Buffer: array[0..511] of char;
|
||||
BufP: Integer;
|
||||
BufC: Char;
|
||||
LastWasEOL: Boolean;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := mrCancel;
|
||||
|
||||
@ -294,7 +283,6 @@ begin
|
||||
//if Result <> mrYes then
|
||||
// Exit;
|
||||
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
Tool:=TIDEExternalToolOptions.Create;
|
||||
try
|
||||
Tool.Title:='- Building lhelp -';
|
||||
@ -308,77 +296,6 @@ begin
|
||||
finally
|
||||
Tool.Free;
|
||||
end;
|
||||
|
||||
{$ELSE}
|
||||
Proc := TProcessUTF8.Create(nil);
|
||||
{$if FPC_FULLVERSION<20604}
|
||||
Proc.InheritHandles := false;
|
||||
{$endif}
|
||||
{$if (fpc_version=2) and (fpc_release<5)}
|
||||
Proc.CommandLine := Lazbuild+' '+WS+' '+PCP+' '+LHelpProject;
|
||||
{$else}
|
||||
Proc.Executable := Lazbuild;
|
||||
Proc.Parameters.Add(WS);
|
||||
Proc.Parameters.Add(PCP);
|
||||
Proc.Parameters.Add(LHelpProject);
|
||||
{$endif}
|
||||
Proc.Options := [poUsePipes, poStderrToOutPut];
|
||||
debugln(['TChmHelpViewer.CheckBuildLHelp running "',Lazbuild,' ',WS,' ',PCP,' ',LHelpProject,'" ...']);
|
||||
Proc.Execute;
|
||||
|
||||
|
||||
BufP := 0;
|
||||
LastWasEOL:= False;
|
||||
|
||||
IDEMessagesWindow.BeginBlock;
|
||||
IDEMessagesWindow.AddMsg('- Building lhelp -','',0);
|
||||
|
||||
|
||||
while Proc.Running do begin
|
||||
while Proc.Output.NumBytesAvailable > 0 do
|
||||
begin
|
||||
BufC := Char(Proc.Output.ReadByte);
|
||||
if LastWasEOL then
|
||||
begin
|
||||
if not(BufC in [#13, #10]) then
|
||||
begin
|
||||
|
||||
IDEMessagesWindow.AddMsg(PChar(@Buffer[0]),LHelpProjectDir,1);
|
||||
Buffer[0] := BufC;
|
||||
BufP := 1;
|
||||
LastWasEOL:=False;
|
||||
end;
|
||||
Continue;
|
||||
end;
|
||||
|
||||
if BufC in [#13, #10] then
|
||||
begin
|
||||
LastWasEOL:=True;
|
||||
Buffer[BufP] := #0;
|
||||
Inc(BufP);
|
||||
end
|
||||
else
|
||||
begin
|
||||
Buffer[BufP] := BufC;
|
||||
Inc(BufP);
|
||||
end;
|
||||
end;
|
||||
Sleep(20);
|
||||
Application.ProcessMessages;
|
||||
end;
|
||||
|
||||
if BufP > 0 then
|
||||
IDEMessagesWindow.AddMsg(PChar(@Buffer[0]),LHelpProjectDir,0);
|
||||
|
||||
|
||||
if Proc.ExitStatus = 0 then
|
||||
Result := mrOK;
|
||||
Proc.Free;
|
||||
|
||||
IDEMessagesWindow.EndBlock;
|
||||
|
||||
if Result = mrOK then ;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TChmHelpViewer.GetLazBuildEXE(out ALazBuild: String): Boolean;
|
||||
|
@ -35,9 +35,6 @@ implementation
|
||||
uses
|
||||
{ lazarus }
|
||||
LazIDEIntf, MenuIntf, IdeCommands,
|
||||
{$IFDEF EnableOldExtTools}
|
||||
IDEMsgIntf,
|
||||
{$ENDIF}
|
||||
{ local }
|
||||
LazCHMHelp, InterfaceBase;
|
||||
|
||||
|
@ -231,8 +231,6 @@ type
|
||||
function GetFilterType: TCodyIdentifierFilter;
|
||||
end;
|
||||
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
|
||||
{ TQuickFixIdentifierNotFoundShowDictionary }
|
||||
|
||||
TQuickFixIdentifierNotFoundShowDictionary = class(TMsgQuickFix)
|
||||
@ -241,7 +239,6 @@ type
|
||||
procedure CreateMenuItems(Fixes: TMsgQuickFixes); override;
|
||||
procedure QuickFix({%H-}Fixes: TMsgQuickFixes; Msg: TMessageLine); override;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
var
|
||||
CodyUnitDictionary: TCodyUnitDictionary = nil;
|
||||
@ -280,9 +277,7 @@ end;
|
||||
procedure InitUnitDictionary;
|
||||
begin
|
||||
CodyUnitDictionary:=TCodyUnitDictionary.Create;
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
RegisterIDEMsgQuickFix(TQuickFixIdentifierNotFoundShowDictionary.Create);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function CompareCodyIdentifiersAlphaScopeUse(Item1, Item2: Pointer): integer;
|
||||
@ -371,7 +366,6 @@ begin
|
||||
exit(0);
|
||||
end;
|
||||
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
{ TQuickFixIdentifierNotFoundShowDictionary }
|
||||
|
||||
function TQuickFixIdentifierNotFoundShowDictionary.IsApplicable(
|
||||
@ -407,7 +401,6 @@ begin
|
||||
Point(Msg.Column,Msg.Line),-1,-1,-1,[])<>mrOk then exit;
|
||||
ShowUnitDictionaryDialog(nil);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{ TCodyIdentifier }
|
||||
|
||||
|
@ -57,9 +57,7 @@ implementation
|
||||
|
||||
uses
|
||||
inifiles, IDEMsgIntf,
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEExternToolIntf,
|
||||
{$ENDIF}
|
||||
BaseIDEIntf;
|
||||
|
||||
Const
|
||||
@ -181,11 +179,7 @@ end;
|
||||
procedure TIDEDataDictionary.DDProgress(Sender : TObject; Const Msg : String);
|
||||
|
||||
begin
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluImportant,SLoadingDataDict+Msg);
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg(SLoadingDataDict+Msg,'',2);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TIDEDataDictionary.SetFileName(const AValue: String);
|
||||
@ -282,22 +276,9 @@ procedure TIDEDataDictionary.Load;
|
||||
begin
|
||||
If (FFileName<>'') and Active then
|
||||
begin
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluImportant,SLoadingDataDict+SFromfile+FFileName);
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.BeginBlock(False);
|
||||
Try
|
||||
IDEMessagesWindow.AddMsg(SLoadingDataDict+SFromfile+FFileName,'',2);
|
||||
{$ENDIF}
|
||||
IDEMessagesWindow.AddCustomMessage(mluImportant,SLoadingDataDict+SFromfile+FFileName);
|
||||
FDataDict.LoadFromFile(UTF8ToSys(FFileName));
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
{$ELSE}
|
||||
Finally
|
||||
IDEMessagesWindow.EndBlock;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
|
@ -75,9 +75,7 @@ implementation
|
||||
|
||||
uses forms, dialogs, controls,
|
||||
IDEMsgIntf,
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEExternToolIntf,
|
||||
{$ENDIF}
|
||||
ldd_consts;
|
||||
|
||||
|
||||
@ -279,18 +277,11 @@ begin
|
||||
ASelection:=TPersistentSelectionList.Create;
|
||||
try
|
||||
GlobalDesignHook.GetSelection(ASelection);
|
||||
{$IFDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.BeginBlock(True);
|
||||
{$ENDIF}
|
||||
For I:=0 to ASelection.Count-1 do
|
||||
if (ASelection[i] is TDataset) then
|
||||
begin
|
||||
DS:=TDataset(ASelection[i]);
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluImportant,Format(SApplyingDDToDataset,[DS.Name]));
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg(Format(SApplyingDDToDataset,[DS.Name]),'',i+1);
|
||||
{$ENDIF}
|
||||
IDEDataDictionary.Dictionary.ApplyToDataset(DS,@ApplyDDToField);
|
||||
end;
|
||||
finally
|
||||
@ -304,18 +295,10 @@ begin
|
||||
If (FD<>Nil) then
|
||||
begin
|
||||
If VerboseApply then
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluImportant,Format(SApplyingDDToField,[F.FieldName]));
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg(Format(SApplyingDDToField,[F.FieldName]),'',-1)
|
||||
{$ENDIF}
|
||||
end
|
||||
else
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluImportant,Format(SWarningNoDDForField,[F.FieldName]));
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg(Format(SWarningNoDDForField,[F.FieldName]),'',-1);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
Procedure TIDEDataDictCommandHandler.DesignSQL(Sender : TObject);
|
||||
|
@ -23,9 +23,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, fpWeb, fpHTML, fpdatasetform,
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEExternToolIntf,
|
||||
{$ENDIF}
|
||||
Controls, Dialogs, forms, LazIDEIntf, ProjectIntf, SrcEditorIntf, IDEMsgIntf,
|
||||
fpextjs,
|
||||
extjsjson, extjsxml,
|
||||
@ -1062,11 +1060,7 @@ end;
|
||||
|
||||
procedure TJSSyntaxChecker.ShowMessage(const Msg: String);
|
||||
begin
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluImportant,Msg,SourceFileName);
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg(SourceFileName+' : '+Msg,'',0,Nil);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TJSSyntaxChecker.ShowMessage(const Fmt: String;
|
||||
@ -1113,38 +1107,29 @@ Var
|
||||
S : TStringStream;
|
||||
|
||||
begin
|
||||
{$IFDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.BeginBlock(False);
|
||||
{$ENDIF}
|
||||
try
|
||||
try
|
||||
Handled:=False;
|
||||
result:=mrNone;
|
||||
AE:=SourceEditorManagerIntf.ActiveEditor;
|
||||
If (AE<>Nil) then
|
||||
Handled:=False;
|
||||
result:=mrNone;
|
||||
AE:=SourceEditorManagerIntf.ActiveEditor;
|
||||
If (AE<>Nil) then
|
||||
begin
|
||||
E:=ExtractFileExt(AE.FileName);
|
||||
FSFN:=ExtractFileName(AE.FileName);
|
||||
Handled:=CompareText(E,'.js')=0;
|
||||
If Handled then
|
||||
begin
|
||||
E:=ExtractFileExt(AE.FileName);
|
||||
FSFN:=ExtractFileName(AE.FileName);
|
||||
Handled:=CompareText(E,'.js')=0;
|
||||
If Handled then
|
||||
begin
|
||||
S:=TStringStream.Create(AE.SourceText);
|
||||
try
|
||||
CheckJavaScript(S);
|
||||
Result:=mrOK;
|
||||
finally
|
||||
S.Free;
|
||||
end;
|
||||
end;
|
||||
S:=TStringStream.Create(AE.SourceText);
|
||||
try
|
||||
CheckJavaScript(S);
|
||||
Result:=mrOK;
|
||||
finally
|
||||
S.Free;
|
||||
end;
|
||||
end;
|
||||
except
|
||||
On E : Exception do
|
||||
ShowException('Error during syntax check',E);
|
||||
end;
|
||||
finally
|
||||
{$IFDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.EndBlock;
|
||||
{$ENDIF}
|
||||
except
|
||||
On E : Exception do
|
||||
ShowException('Error during syntax check',E);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -613,7 +613,6 @@ type
|
||||
property OutputDirectory: string read FOutputDirectory write SetOutputDirectory;
|
||||
end;
|
||||
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
const
|
||||
SubToolH2Pas = 'h2pas';
|
||||
type
|
||||
@ -625,7 +624,6 @@ type
|
||||
procedure ReadLine(Line: string; OutputIndex: integer; var Handled: boolean
|
||||
); override; // (worker thread)
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{ TH2PasTool }
|
||||
|
||||
@ -657,9 +655,6 @@ type
|
||||
procedure SetProjectHistory(const AValue: TStrings);
|
||||
procedure SetWindowBounds(const AValue: TRect);
|
||||
procedure Seth2pasFilename(const AValue: string);
|
||||
{$IFDEF EnableOldExtTools}
|
||||
procedure OnParseH2PasLine(Sender: TObject; Line: TIDEScanMessageLine);
|
||||
{$ENDIF}
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -678,9 +673,6 @@ type
|
||||
function MergeIncludeFiles(AFile: TH2PasFile;
|
||||
TextConverter: TIDETextConverter): TModalResult;
|
||||
function GetH2PasFilename: string;
|
||||
{$IFDEF EnableOldExtTools}
|
||||
function FindH2PasErrorMessage: integer;
|
||||
{$ENDIF}
|
||||
function FileIsRelated(const aFilename: string): Boolean;
|
||||
public
|
||||
property Project: TH2PasProject read FProject write SetProject;
|
||||
@ -712,7 +704,6 @@ const
|
||||
|
||||
implementation
|
||||
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
{ TH2PasParser }
|
||||
|
||||
class function TH2PasParser.DefaultSubTool: string;
|
||||
@ -757,7 +748,6 @@ begin
|
||||
MsgLine.Urgency:=mluError;
|
||||
MsgLine.Msg:=Msg;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{ TH2PasFile }
|
||||
|
||||
@ -1742,28 +1732,6 @@ end;
|
||||
|
||||
{ TH2PasConverter }
|
||||
|
||||
{$IFDEF EnableOldExtTools}
|
||||
procedure TH2PasConverter.OnParseH2PasLine(Sender: TObject;
|
||||
Line: TIDEScanMessageLine);
|
||||
var
|
||||
Tool: TH2PasTool;
|
||||
LineNumber: String;
|
||||
MsgType: String;
|
||||
Msg: String;
|
||||
begin
|
||||
if Line.Tool is TH2PasTool then begin
|
||||
Tool:=TH2PasTool(Line.Tool);
|
||||
if REMatches(Line.Line,'^at line ([0-9]+) (error) : (.*)$') then begin
|
||||
LineNumber:=REVar(1);
|
||||
MsgType:=REVar(2);
|
||||
Msg:=REVar(3);
|
||||
Line.Line:=Tool.TargetFilename+'('+LineNumber+') '+MsgType+': '+Msg;
|
||||
end;
|
||||
//DebugLn(['TH2PasConverter.OnParseH2PasLine ',Line.Line]);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TH2PasConverter.GetCurrentProjectFilename: string;
|
||||
begin
|
||||
if FProjectHistory.Count>0 then
|
||||
@ -2036,13 +2004,8 @@ var
|
||||
end;
|
||||
ErrMsg:=ErrMsg+' Error: '+ErrorTool.ErrorMsg+' ('+ErrorTool.Caption+')';
|
||||
DebugLn(['TH2PasConverter.ConvertFile Failed: ',ErrMsg]);
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluError,ErrorTool.ErrorMsg,Filename,Line,Col,ErrorTool.Caption);
|
||||
LazarusIDE.DoJumpToCompilerMessage(true);
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg(ErrMsg,BaseDir,-1);
|
||||
LazarusIDE.DoJumpToCompilerMessage(true, IDEMessagesWindow.LinesCount-1);
|
||||
{$ENDIF}
|
||||
Result:=mrAbort;
|
||||
end;
|
||||
|
||||
@ -2106,20 +2069,11 @@ begin
|
||||
Tool.CmdLineParams:=AFile.GetH2PasParameters(Tool.TargetFilename);
|
||||
Tool.WorkingDirectory:=Project.BaseDir;
|
||||
DebugLn(['TH2PasConverter.ConvertFile Tool.Filename="',Tool.Filename,'" Tool.CmdLineParams="',Tool.CmdLineParams,'"']);
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
Tool.Scanners.Add(SubToolH2Pas);
|
||||
if not RunExternalTool(Tool) then
|
||||
exit(mrAbort);
|
||||
if IDEMessagesWindow.SelectFirstUrgentMessage(mluError,false) then
|
||||
exit(mrAbort);
|
||||
{$ELSE}
|
||||
Tool.ScanOutput:=true;
|
||||
Tool.ShowAllOutput:=true;
|
||||
Tool.OnParseLine:=@OnParseH2PasLine;
|
||||
Result:=RunExternalTool(Tool);
|
||||
if Result<>mrOk then exit(mrAbort);
|
||||
if FindH2PasErrorMessage>=0 then exit(mrAbort);
|
||||
{$ENDIF}
|
||||
finally
|
||||
Tool.Free;
|
||||
end;
|
||||
@ -2315,23 +2269,6 @@ begin
|
||||
Result:=FindDefaultExecutablePath(h2pasFilename);
|
||||
end;
|
||||
|
||||
{$IFDEF EnableOldExtTools}
|
||||
function TH2PasConverter.FindH2PasErrorMessage: integer;
|
||||
var
|
||||
i: Integer;
|
||||
Line: TIDEMessageLine;
|
||||
begin
|
||||
for i:=0 to IDEMessagesWindow.LinesCount-1 do begin
|
||||
Line:=IDEMessagesWindow.Lines[i];
|
||||
if REMatches(Line.Msg,'^(.*)\([0-9]+\)') then begin
|
||||
Result:=i;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
Result:=-1;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TH2PasConverter.FileIsRelated(const aFilename: string): Boolean;
|
||||
begin
|
||||
Result:=(CompareFilenames(AFilename,LastUsedFilename)=0)
|
||||
|
@ -27,9 +27,7 @@ uses
|
||||
SynHighlighterCPP, FileProcs, IDEMsgIntf, MenuIntf, IDECommands, BaseIDEIntf,
|
||||
IDEDialogs, LazIDEIntf, ProjectIntf, CodeToolManager, SrcEditorIntf,
|
||||
IDETextConverter, H2PasStrConsts, H2PasConvert, IDETextConvListEdit,
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEExternToolIntf,
|
||||
{$ENDIF}
|
||||
CompOptsIntf;
|
||||
|
||||
type
|
||||
@ -240,10 +238,8 @@ begin
|
||||
TextConverterToolClasses.RegisterClass(TFixForwardDefinitions);
|
||||
TextConverterToolClasses.RegisterClass(TAddToUsesSection);
|
||||
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
// register h2pas output parser
|
||||
ExternalToolList.RegisterParser(TH2PasParser);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{ TH2PasDialog }
|
||||
|
@ -91,7 +91,6 @@ type
|
||||
coptParsedPlatformIndependent // all but platform macros resolved
|
||||
);
|
||||
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
TCompilerFlagValue = (
|
||||
cfvNone, // default, do not pass the flag
|
||||
cfvHide, // pass the flag, e.g. -vm5000
|
||||
@ -109,7 +108,6 @@ type
|
||||
property Values[MsgId: integer]: TCompilerFlagValue read GetValues write SetValues; default;
|
||||
property Modified: boolean read GetModified write SetModified;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
const
|
||||
crAll = [crCompile, crBuild, crRun];
|
||||
@ -148,9 +146,6 @@ type
|
||||
procedure SetPassLinkerOpt(const AValue: Boolean);
|
||||
procedure SetRangeChecks(const AValue: Boolean);
|
||||
procedure SetShowAll(const AValue: Boolean);
|
||||
{$IFDEF EnableOldExtTools}
|
||||
procedure SetShowAllProcsOnError(const AValue: Boolean);
|
||||
{$ENDIF}
|
||||
procedure SetShowCompProc(const AValue: Boolean);
|
||||
procedure SetShowCond(const AValue: Boolean);
|
||||
procedure SetShowDebugInfo(const AValue: Boolean);
|
||||
@ -162,9 +157,6 @@ type
|
||||
procedure SetShowHintsForUnusedUnitsInMainSrc(const AValue: Boolean);
|
||||
procedure SetShowLineNum(const AValue: Boolean);
|
||||
procedure SetShowNotes(const AValue: Boolean);
|
||||
{$IFDEF EnableOldExtTools}
|
||||
procedure SetShowNothing(const AValue: Boolean);
|
||||
{$ENDIF}
|
||||
procedure SetShowSummary(const AValue: Boolean);
|
||||
procedure SetShowTriedFiles(const AValue: Boolean);
|
||||
procedure SetShowUsedFiles(const AValue: Boolean);
|
||||
@ -260,27 +252,19 @@ type
|
||||
fShowGenInfo: Boolean;
|
||||
fShowLineNum: Boolean;
|
||||
fShowAll: Boolean;
|
||||
{$IFDEF EnableOldExtTools}
|
||||
fShowAllProcsOnError: Boolean;
|
||||
{$ENDIF}
|
||||
fShowDebugInfo: Boolean;
|
||||
fShowUsedFiles: Boolean;
|
||||
fShowTriedFiles: Boolean;
|
||||
fShowCompProc: Boolean;
|
||||
fShowCond: Boolean;
|
||||
fShowExecInfo: Boolean;
|
||||
{$IFDEF EnableOldExtTools}
|
||||
fShowNothing: Boolean;
|
||||
{$ENDIF}
|
||||
fShowSummary: Boolean;
|
||||
fShowHintsForUnusedUnitsInMainSrc: Boolean;
|
||||
fShowHintsForSenderNotUsed: Boolean;
|
||||
fWriteFPCLogo: Boolean;
|
||||
fStopAfterErrCount: integer;
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
// Turn specific types of compiler messages on or off
|
||||
fMessageFlags: TAbstractCompilerMsgIDFlags;
|
||||
{$ENDIF}
|
||||
|
||||
// Other:
|
||||
fDontUseConfigFile: Boolean;
|
||||
@ -429,10 +413,6 @@ type
|
||||
property ShowHints: Boolean read fShowHints write SetShowHints; // -vh
|
||||
property ShowGenInfo: Boolean read fShowGenInfo write SetShowGenInfo; // -vi
|
||||
property ShowLineNum: Boolean read fShowLineNum write SetShowLineNum; // -vl
|
||||
{$IFDEF EnableOldExtTools}
|
||||
property ShowAllProcsOnError: Boolean
|
||||
read fShowAllProcsOnError write SetShowAllProcsOnError; // -vb
|
||||
{$ENDIF}
|
||||
property ShowAll: Boolean read fShowAll write SetShowAll; // -va
|
||||
property ShowDebugInfo: Boolean read fShowDebugInfo write SetShowDebugInfo; // -vd
|
||||
property ShowUsedFiles: Boolean read fShowUsedFiles write SetShowUsedFiles; // -vu
|
||||
@ -440,9 +420,6 @@ type
|
||||
property ShowCompProc: Boolean read fShowCompProc write SetShowCompProc; // -vp
|
||||
property ShowCond: Boolean read fShowCond write SetShowCond; // -vc
|
||||
property ShowExecInfo: Boolean read fShowExecInfo write SetShowExecInfo; // -vx
|
||||
{$IFDEF EnableOldExtTools}
|
||||
property ShowNothing: Boolean read fShowNothing write SetShowNothing; // -v0
|
||||
{$ENDIF}
|
||||
property ShowSummary: Boolean read FShowSummary write SetShowSummary;
|
||||
property ShowHintsForUnusedUnitsInMainSrc: Boolean
|
||||
read fShowHintsForUnusedUnitsInMainSrc write SetShowHintsForUnusedUnitsInMainSrc;
|
||||
@ -450,9 +427,7 @@ type
|
||||
read fShowHintsForSenderNotUsed write SetShowHintsForSenderNotUsed;
|
||||
property WriteFPCLogo: Boolean read fWriteFPCLogo write SetWriteFPCLogo;
|
||||
property StopAfterErrCount: integer read fStopAfterErrCount write SetStopAfterErrCount;
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
property MessageFlags: TAbstractCompilerMsgIDFlags read fMessageFlags;
|
||||
{$ENDIF}
|
||||
|
||||
// other
|
||||
property DontUseConfigFile: Boolean read fDontUseConfigFile write SetDontUseConfigFile;
|
||||
@ -521,15 +496,6 @@ begin
|
||||
IncreaseChangeStamp;
|
||||
end;
|
||||
|
||||
{$IFDEF EnableOldExtTools}
|
||||
procedure TLazCompilerOptions.SetShowAllProcsOnError(const AValue: Boolean);
|
||||
begin
|
||||
if fShowAllProcsOnError=AValue then exit;
|
||||
fShowAllProcsOnError:=AValue;
|
||||
IncreaseChangeStamp;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TLazCompilerOptions.SetShowCompProc(const AValue: Boolean);
|
||||
begin
|
||||
if fShowCompProc=AValue then exit;
|
||||
@ -608,15 +574,6 @@ begin
|
||||
IncreaseChangeStamp;
|
||||
end;
|
||||
|
||||
{$IFDEF EnableOldExtTools}
|
||||
procedure TLazCompilerOptions.SetShowNothing(const AValue: Boolean);
|
||||
begin
|
||||
if fShowNothing=AValue then exit;
|
||||
fShowNothing:=AValue;
|
||||
IncreaseChangeStamp;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TLazCompilerOptions.SetShowSummary(const AValue: Boolean);
|
||||
begin
|
||||
if FShowSummary=AValue then exit;
|
||||
|
@ -11,7 +11,6 @@ unit IDEExternToolIntf;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
interface
|
||||
|
||||
uses
|
||||
@ -2361,281 +2360,4 @@ begin
|
||||
end;
|
||||
|
||||
end.
|
||||
{$ELSE EnableOldExtTools}
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLType, LazConfigStorage, Forms, Controls, BaseIDEIntf;
|
||||
|
||||
{ The xml format version:
|
||||
When the format changes (new values, changed formats) we can distinguish old
|
||||
files and are able to convert them.
|
||||
}
|
||||
const
|
||||
ExternalToolOptionsVersion = '2';
|
||||
|
||||
type
|
||||
TIDEExternalToolOptions = class;
|
||||
|
||||
{ TIDEScanMessageLine }
|
||||
|
||||
TIDEScanMessageLine = class(TPersistent)
|
||||
private
|
||||
FCaller: TObject;
|
||||
FLine: string;
|
||||
FLineNumber: integer;
|
||||
FTool: TIDEExternalToolOptions;
|
||||
FWorkingDirectory: string;
|
||||
procedure SetLine(const AValue: string);
|
||||
procedure SetWorkingDirectory(const AValue: string);
|
||||
protected
|
||||
procedure SetTool(const AValue: TIDEExternalToolOptions);
|
||||
procedure SetLineNumber(const NewLineNumber: integer);
|
||||
procedure LineChanged(const OldValue: string); virtual; abstract;
|
||||
procedure WorkingDirectoryChanged(const OldValue: string); virtual; abstract;
|
||||
public
|
||||
constructor Create(TheCaller: TObject = nil; TheTool: TIDEExternalToolOptions = nil);
|
||||
property Caller: TObject read FCaller;
|
||||
property Line: string read FLine write SetLine;
|
||||
property WorkingDirectory: string read FWorkingDirectory write SetWorkingDirectory;
|
||||
property LineNumber: integer read FLineNumber;
|
||||
property Tool: TIDEExternalToolOptions read FTool;
|
||||
end;
|
||||
|
||||
|
||||
TOnIDEExtToolParseLine = procedure(Sender: TObject;
|
||||
Line: TIDEScanMessageLine) of object;
|
||||
|
||||
{
|
||||
TIDEExternalToolOptions - the storage object for a single external tool
|
||||
}
|
||||
TIDEExternalToolOptions = class(TPersistent)
|
||||
private
|
||||
fCmdLineParams: string;
|
||||
FEnvironmentOverrides: TStringList;
|
||||
fFilename: string;
|
||||
FHideMainForm: boolean;
|
||||
FOnParseLine: TOnIDEExtToolParseLine;
|
||||
FScanners: TStrings;
|
||||
FScanOutput: boolean;
|
||||
fScanOutputForFPCMessages: boolean;
|
||||
fScanOutputForMakeMessages: boolean;
|
||||
FShowAllOutput: boolean;
|
||||
fTitle: string;
|
||||
fWorkingDirectory: string;
|
||||
procedure SetScanners(const AValue: TStrings);
|
||||
procedure SetScanOutput(const AValue: boolean);
|
||||
procedure SetShowAllOutput(const AValue: boolean);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Assign(Source: TPersistent); override;
|
||||
procedure Clear; virtual;
|
||||
function NeedsOutputFilter: boolean;
|
||||
function Load(Config: TConfigStorage): TModalResult; virtual;
|
||||
function Save(Config: TConfigStorage): TModalResult; virtual;
|
||||
function ShortDescription: string;
|
||||
procedure AssignEnvironmentTo(Strings: TStrings);
|
||||
procedure ParseLine(Sender: TObject; Line: TIDEScanMessageLine); virtual;
|
||||
|
||||
property CmdLineParams: string read fCmdLineParams write fCmdLineParams;
|
||||
property Filename: string read fFilename write fFilename;
|
||||
property Title: string read fTitle write fTitle;
|
||||
property WorkingDirectory: string
|
||||
read fWorkingDirectory write fWorkingDirectory;
|
||||
property EnvironmentOverrides: TStringList read FEnvironmentOverrides;
|
||||
property ScanOutputForFPCMessages: boolean
|
||||
read fScanOutputForFPCMessages write fScanOutputForFPCMessages;
|
||||
property ScanOutputForMakeMessages: boolean
|
||||
read fScanOutputForMakeMessages write fScanOutputForMakeMessages;
|
||||
property ScanOutput: boolean read FScanOutput write SetScanOutput;
|
||||
property ShowAllOutput: boolean read FShowAllOutput write SetShowAllOutput;
|
||||
property OnParseLine: TOnIDEExtToolParseLine read FOnParseLine write FOnParseLine;
|
||||
property Scanners: TStrings read FScanners write SetScanners;
|
||||
property HideMainForm: boolean read FHideMainForm write FHideMainForm default true;
|
||||
end;
|
||||
|
||||
type
|
||||
TRunExternalTool = function (Tool: TIDEExternalToolOptions): TModalResult of object;
|
||||
|
||||
var
|
||||
RunExternalTool: TRunExternalTool = nil;// set by the IDE
|
||||
|
||||
implementation
|
||||
|
||||
{ TIDEExternalToolOptions }
|
||||
|
||||
procedure TIDEExternalToolOptions.SetScanOutput(const AValue: boolean);
|
||||
begin
|
||||
if FScanOutput=AValue then exit;
|
||||
FScanOutput:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEExternalToolOptions.SetScanners(const AValue: TStrings);
|
||||
begin
|
||||
if FScanners=AValue then exit;
|
||||
FScanners.Assign(AValue);
|
||||
end;
|
||||
|
||||
procedure TIDEExternalToolOptions.SetShowAllOutput(const AValue: boolean);
|
||||
begin
|
||||
if FShowAllOutput=AValue then exit;
|
||||
FShowAllOutput:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEExternalToolOptions.Assign(Source: TPersistent);
|
||||
var
|
||||
Src: TIDEExternalToolOptions;
|
||||
begin
|
||||
if Source=Self then exit;
|
||||
if Source is TIDEExternalToolOptions then begin
|
||||
Src:=TIDEExternalToolOptions(Source);
|
||||
fTitle:=Src.fTitle;
|
||||
fFilename:=Src.fFilename;
|
||||
fCmdLineParams:=Src.fCmdLineParams;
|
||||
fWorkingDirectory:=Src.fWorkingDirectory;
|
||||
fScanOutputForFPCMessages:=Src.fScanOutputForFPCMessages;
|
||||
fScanOutputForMakeMessages:=Src.fScanOutputForMakeMessages;
|
||||
FScanOutput:=Src.FScanOutput;
|
||||
FShowAllOutput:=Src.FShowAllOutput;
|
||||
FScanners.Assign(Src.FScanners);
|
||||
FHideMainForm:=Src.HideMainForm;
|
||||
end else
|
||||
inherited Assign(Source);
|
||||
end;
|
||||
|
||||
constructor TIDEExternalToolOptions.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FEnvironmentOverrides:=TStringList.Create;
|
||||
FScanners:=TStringList.Create;
|
||||
FHideMainForm:=true;
|
||||
Clear;
|
||||
end;
|
||||
|
||||
destructor TIDEExternalToolOptions.Destroy;
|
||||
begin
|
||||
FreeAndNil(FEnvironmentOverrides);
|
||||
FreeAndNil(FScanners);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TIDEExternalToolOptions.Clear;
|
||||
begin
|
||||
fTitle:='';
|
||||
fFilename:='';
|
||||
fCmdLineParams:='';
|
||||
fWorkingDirectory:='';
|
||||
fScanOutputForFPCMessages:=false;
|
||||
fScanOutputForMakeMessages:=false;
|
||||
FScanOutput:=false;
|
||||
FShowAllOutput:=false;
|
||||
FHideMainForm:=true;
|
||||
FEnvironmentOverrides.Clear;
|
||||
FScanners.Clear;
|
||||
end;
|
||||
|
||||
function TIDEExternalToolOptions.Load(Config: TConfigStorage): TModalResult;
|
||||
begin
|
||||
Clear;
|
||||
fTitle:=Config.GetValue('Title/Value','');
|
||||
fFilename:=Config.GetValue('Filename/Value','');
|
||||
fCmdLineParams:=Config.GetValue('CmdLineParams/Value','');
|
||||
fWorkingDirectory:=Config.GetValue('WorkingDirectory/Value','');
|
||||
fScanOutputForFPCMessages:=Config.GetValue(
|
||||
'ScanOutputForFPCMessages/Value',false);
|
||||
fScanOutputForMakeMessages:=Config.GetValue(
|
||||
'ScanOutputForMakeMessages/Value',false);
|
||||
FShowAllOutput:=Config.GetValue('ShowAllOutput/Value',false);
|
||||
FHideMainForm:=Config.GetValue('HideMainForm/Value',true);
|
||||
Config.GetValue('EnvironmentOverrides/',FEnvironmentOverrides);
|
||||
Config.GetValue('Scanners/',FScanners);
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
function TIDEExternalToolOptions.Save(Config: TConfigStorage): TModalResult;
|
||||
begin
|
||||
Config.SetValue('Format/Version',ExternalToolOptionsVersion);
|
||||
Config.SetDeleteValue('Title/Value',fTitle,'');
|
||||
Config.SetDeleteValue('Filename/Value',fFilename,'');
|
||||
Config.SetDeleteValue('CmdLineParams/Value',fCmdLineParams,'');
|
||||
Config.SetDeleteValue('WorkingDirectory/Value',fWorkingDirectory,'');
|
||||
Config.SetDeleteValue(
|
||||
'ScanOutputForFPCMessages/Value',fScanOutputForFPCMessages,
|
||||
false);
|
||||
Config.SetDeleteValue(
|
||||
'ScanOutputForMakeMessages/Value',fScanOutputForMakeMessages,
|
||||
false);
|
||||
Config.SetDeleteValue('ShowAllOutput/Value',FShowAllOutput,false);
|
||||
Config.SetDeleteValue('HideMainForm/Value',FHideMainForm,true);
|
||||
Config.SetValue('EnvironmentOverrides/',FEnvironmentOverrides);
|
||||
Config.SetValue('Scanners/',FScanners);
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
function TIDEExternalToolOptions.ShortDescription: string;
|
||||
begin
|
||||
Result:=Title;
|
||||
end;
|
||||
|
||||
procedure TIDEExternalToolOptions.AssignEnvironmentTo(Strings: TStrings);
|
||||
begin
|
||||
BaseIDEIntf.AssignEnvironmentTo(Strings,EnvironmentOverrides);
|
||||
end;
|
||||
|
||||
procedure TIDEExternalToolOptions.ParseLine(Sender: TObject;
|
||||
Line: TIDEScanMessageLine);
|
||||
begin
|
||||
if Assigned(OnParseLine) then
|
||||
OnParseLine(Sender,Line);
|
||||
end;
|
||||
|
||||
function TIDEExternalToolOptions.NeedsOutputFilter: boolean;
|
||||
begin
|
||||
Result:=ScanOutput
|
||||
or ScanOutputForFPCMessages or ScanOutputForMakeMessages
|
||||
or ShowAllOutput
|
||||
or ((FScanners<>nil) and (FScanners.Count>0));
|
||||
end;
|
||||
|
||||
{ TIDEScanMessageLine }
|
||||
|
||||
procedure TIDEScanMessageLine.SetLine(const AValue: string);
|
||||
var
|
||||
OldLine: String;
|
||||
begin
|
||||
if FLine=AValue then exit;
|
||||
OldLine:=FLine;
|
||||
FLine:=AValue;
|
||||
LineChanged(OldLine);
|
||||
end;
|
||||
|
||||
procedure TIDEScanMessageLine.SetWorkingDirectory(const AValue: string);
|
||||
var
|
||||
OldDir: String;
|
||||
begin
|
||||
if FWorkingDirectory=AValue then exit;
|
||||
OldDir:=FWorkingDirectory;
|
||||
FWorkingDirectory:=AValue;
|
||||
WorkingDirectoryChanged(OldDir);
|
||||
end;
|
||||
|
||||
procedure TIDEScanMessageLine.SetTool(const AValue: TIDEExternalToolOptions);
|
||||
begin
|
||||
FTool:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEScanMessageLine.SetLineNumber(const NewLineNumber: integer);
|
||||
begin
|
||||
FLineNumber:=NewLineNumber;
|
||||
end;
|
||||
|
||||
constructor TIDEScanMessageLine.Create(TheCaller: TObject;
|
||||
TheTool: TIDEExternalToolOptions);
|
||||
begin
|
||||
FCaller:=TheCaller;
|
||||
FTool:=TheTool;
|
||||
end;
|
||||
|
||||
end.
|
||||
{$ENDIF}
|
||||
|
@ -59,11 +59,7 @@ type
|
||||
function ShowHelpForSourcePosition(const Filename: string;
|
||||
const CodePos: TPoint;
|
||||
var ErrMsg: string): TShowHelpResult; virtual; abstract;
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
procedure ShowHelpForMessage; virtual; abstract;
|
||||
{$ELSE}
|
||||
procedure ShowHelpForMessage(Line: integer); virtual; abstract;
|
||||
{$ENDIF}
|
||||
procedure ShowHelpForObjectInspector(Sender: TObject); virtual; abstract;
|
||||
procedure ShowHelpForIDEControl(Sender: TControl); virtual; abstract;
|
||||
function CreateHint(aHintWindow: THintWindow; ScreenPos: TPoint;
|
||||
|
@ -15,8 +15,6 @@ unit IDEMsgIntf;
|
||||
|
||||
interface
|
||||
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
|
||||
uses
|
||||
Classes, SysUtils, contnrs, Forms, Menus,
|
||||
IDECommands, IDEExternToolIntf, MenuIntf, LazFileUtils;
|
||||
@ -312,790 +310,5 @@ begin
|
||||
fItems.Remove(Fix);
|
||||
end;
|
||||
|
||||
{$ELSE EnableOldExtTools}
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, LCLProc,
|
||||
TextTools, IDECommands;
|
||||
|
||||
type
|
||||
|
||||
{ TIDEMessageLine
|
||||
|
||||
The IDE (TOutputFilter) parses each message line.
|
||||
If it sees FPC output, it fills the Parts property and set various
|
||||
Name=Value pairs.
|
||||
|
||||
Name | Value
|
||||
--------|-----------------------------------------------------------------
|
||||
Stage Indicates what part of the build process the message
|
||||
belongs to. Common values are 'FPC', 'Linker' or 'make'
|
||||
Type For FPC: 'Hint', 'Note', 'Warning', 'Error', 'Fatal', 'Panic',
|
||||
'Compiling', 'Assembling'
|
||||
For make: 'entering directory', 'leaving directory'
|
||||
For Linker:
|
||||
Line An integer for the linenumber as given by FPC in brackets.
|
||||
Column An integer for the column as given by FPC in brackets.
|
||||
Message The message text without other parsed items.
|
||||
|
||||
|
||||
Example:
|
||||
Message written by FPC:
|
||||
unit1.pas(21,3) Warning: unit buttons not used
|
||||
|
||||
Creates the following lines in Parts:
|
||||
Stage=FPC
|
||||
Type=Warning
|
||||
Filename=/path/unit1.pas
|
||||
Line=21
|
||||
Column=3
|
||||
Message=unit buttons not used
|
||||
|
||||
You can access them via:
|
||||
if ALine.Parts.Values['Stage']='FPC' then ...
|
||||
}
|
||||
|
||||
TIDEMessageLine = class
|
||||
private
|
||||
FDirectory: string;
|
||||
FMsg: string;
|
||||
FOriginalIndex: integer;
|
||||
FParts: TStrings;
|
||||
FPosition: integer;
|
||||
FVisible: boolean;
|
||||
FVisiblePosition: integer;
|
||||
procedure SetDirectory(const AValue: string);
|
||||
procedure SetMsg(const AValue: string);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure GetSourcePosition(out Filename: string;
|
||||
out LineNumber, Column: integer);
|
||||
procedure SetSourcePosition(const Filename: string;
|
||||
const LineNumber, Column: integer);
|
||||
property Msg: string read FMsg write SetMsg;
|
||||
property Directory: string read FDirectory write SetDirectory;
|
||||
property Position: integer read FPosition write FPosition; // position in all available messages
|
||||
property VisiblePosition: integer read FVisiblePosition write FVisiblePosition;// filtered position
|
||||
property OriginalIndex: integer read FOriginalIndex write FOriginalIndex;// unsorted, unfiltered position
|
||||
property Parts: TStrings read FParts write FParts;
|
||||
property Visible: boolean read FVisible write FVisible;
|
||||
end;
|
||||
|
||||
TOnFilterLine = procedure(MsgLine: TIDEMessageLine; var Show: boolean) of object;
|
||||
|
||||
{ TIDEMessageLineList }
|
||||
|
||||
TIDEMessageLineList = class
|
||||
private
|
||||
FItems: TFPList;
|
||||
function GetCount: integer;
|
||||
function GetItems(Index: integer): TIDEMessageLine;
|
||||
function GetParts(Index: integer): TStrings;
|
||||
procedure SetParts(Index: integer; const AValue: TStrings);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
function Add(const Msg: string): integer;
|
||||
function Add(Item: TIDEMessageLine): integer;
|
||||
procedure Delete(Index: Integer);
|
||||
public
|
||||
property Count: integer read GetCount;
|
||||
property Items[Index: integer]: TIDEMessageLine read GetItems; default;
|
||||
property Parts[Index: integer]: TStrings read GetParts write SetParts;
|
||||
end;
|
||||
|
||||
TIDEMsgScannerType = class;
|
||||
|
||||
{ TIDEMsgScanner }
|
||||
|
||||
TIDEMsgScanner = class(TPersistent)
|
||||
private
|
||||
FLines: TIDEMessageLineList;
|
||||
FScannerType: TIDEMsgScannerType;
|
||||
FWorkingDirectory: string;
|
||||
protected
|
||||
procedure SetWorkingDirectory(const AValue: string);
|
||||
public
|
||||
constructor Create(TheScannerType: TIDEMsgScannerType;
|
||||
TheLines: TIDEMessageLineList);
|
||||
function ParseLine(MsgLine: TIDEMessageLine; var Show: boolean): boolean; virtual; abstract;// true if line was handled
|
||||
procedure EndScan; virtual;
|
||||
property Lines: TIDEMessageLineList read FLines;
|
||||
property ScannerType: TIDEMsgScannerType read FScannerType;
|
||||
property WorkingDirectory: string read FWorkingDirectory write SetWorkingDirectory;
|
||||
end;
|
||||
|
||||
{ TIDEMsgScannerType }
|
||||
|
||||
TIDEMsgScannerType = class(TComponent)
|
||||
public
|
||||
function ShortDescription: string; virtual; abstract;
|
||||
function Description: string; virtual; abstract;
|
||||
function StartScan(Lines: TIDEMessageLineList): TIDEMsgScanner; virtual; abstract;
|
||||
end;
|
||||
|
||||
{ TIDEMsgScanners }
|
||||
|
||||
TIDEMsgScanners = class(TPersistent)
|
||||
private
|
||||
fScanners: TFPList;// current instances
|
||||
fTypes: TFPList;// registered scanner types
|
||||
function GetCount: integer;
|
||||
function GetItems(Index: integer): TIDEMsgScannerType;
|
||||
function GetScannerCount: integer;
|
||||
function GetScanners(Index: integer): TIDEMsgScanner;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure RegisterType(aType: TIDEMsgScannerType);
|
||||
procedure UnregisterType(aType: TIDEMsgScannerType);
|
||||
function CreateUniqueName(const aName: string): string;
|
||||
function IndexOfName(const aTypeName: string): integer;
|
||||
function TypeOfName(const aTypeName: string): TIDEMsgScannerType;
|
||||
function IndexOfShortDesc(const ShortDescription: string): integer;
|
||||
function TypeOfShortDesc(const ShortDescription: string): TIDEMsgScannerType;
|
||||
property Count: integer read GetCount;
|
||||
property Items[Index: integer]: TIDEMsgScannerType read GetItems; default;
|
||||
property ScannerCount: integer read GetScannerCount;
|
||||
property Scanners[Index: integer]: TIDEMsgScanner read GetScanners;
|
||||
end;
|
||||
|
||||
{ TIDEMsgQuickFixItem }
|
||||
|
||||
TIMQuickFixStep = (
|
||||
imqfoMenuItem, // Popup menu opens. Add now the menu item.
|
||||
imqfoImproveMessage,// Message can now be rewritten/beautified.
|
||||
imqfoJump // Override what happens, when user clicks on message.
|
||||
);
|
||||
TIMQuickFixSteps = set of TIMQuickFixStep;
|
||||
|
||||
TIMQFExecuteMethod = procedure(Sender: TObject; Step: TIMQuickFixStep;
|
||||
Msg: TIDEMessageLine) of object;
|
||||
TIMQFExecuteProc = procedure(Sender: TObject; Step: TIMQuickFixStep;
|
||||
Msg: TIDEMessageLine);
|
||||
|
||||
TIDEMsgQuickFixItem = class(TPersistent)
|
||||
private
|
||||
FCaption: string;
|
||||
FName: string;
|
||||
FOnExecuteMethod: TIMQFExecuteMethod;
|
||||
FOnExecuteProc: TIMQFExecuteProc;
|
||||
FRegExpression: string;
|
||||
FRegExprModifiers: string;
|
||||
FSteps: TIMQuickFixSteps;
|
||||
function GetCaption: string;
|
||||
procedure SetCaption(const AValue: string);
|
||||
procedure SetName(const AValue: string);
|
||||
procedure SetRegExpression(const AValue: string);
|
||||
procedure SetRegExprModifiers(const AValue: string);
|
||||
public
|
||||
constructor Create;
|
||||
procedure Execute(const Msg: TIDEMessageLine; Step: TIMQuickFixStep); virtual;
|
||||
function IsApplicable(Line: TIDEMessageLine): boolean; virtual;
|
||||
public
|
||||
property Name: string read FName write SetName;
|
||||
property Caption: string read GetCaption write SetCaption;
|
||||
property RegExpression: string read FRegExpression write SetRegExpression;
|
||||
property RegExprModifiers: string read FRegExprModifiers write SetRegExprModifiers;
|
||||
property OnExecuteMethod: TIMQFExecuteMethod read FOnExecuteMethod write FOnExecuteMethod;
|
||||
property OnExecuteProc: TIMQFExecuteProc read FOnExecuteProc write FOnExecuteProc;
|
||||
property Steps: TIMQuickFixSteps read FSteps write FSteps;
|
||||
end;
|
||||
|
||||
{ TIDEMsgQuickFixItems }
|
||||
|
||||
TIDEMsgQuickFixItems = class(TPersistent)
|
||||
private
|
||||
FItems: TFPList;
|
||||
function GetCount: integer;
|
||||
function GetItems(Index: integer): TIDEMsgQuickFixItem;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
function Add(Item: TIDEMsgQuickFixItem): integer;
|
||||
procedure Remove(Item: TIDEMsgQuickFixItem);
|
||||
function IndexOfName(const Name: string): integer;
|
||||
function FindByName(const Name: string): TIDEMsgQuickFixItem;
|
||||
function NewName(const StartValue: string): string;
|
||||
public
|
||||
property Count: integer read GetCount;
|
||||
property Items[Index: integer]: TIDEMsgQuickFixItem read GetItems; default;
|
||||
end;
|
||||
|
||||
{ TIDEMessagesWindowInterface }
|
||||
|
||||
TIDEMessagesWindowInterface = class(TForm)
|
||||
protected
|
||||
function GetLines(Index: integer): TIDEMessageLine; virtual; abstract;
|
||||
public
|
||||
procedure Clear; virtual; abstract;
|
||||
procedure AddMsg(const Msg, CurDir: string; OriginalIndex: integer; Parts: TStrings = nil); virtual; abstract;
|
||||
property Lines[Index: integer]: TIDEMessageLine read GetLines; default;
|
||||
function LinesCount: integer; virtual; abstract;
|
||||
procedure BeginBlock(ClearOldBlocks: Boolean = true); virtual; abstract;
|
||||
procedure EndBlock; virtual; abstract;
|
||||
function GetSelectedLine: TIDEMessageLine; virtual; abstract;
|
||||
end;
|
||||
|
||||
var
|
||||
IDEMsgQuickFixes: TIDEMsgQuickFixItems = nil; // initialized by the IDE
|
||||
IDEMessagesWindow: TIDEMessagesWindowInterface = nil;// initialized by the IDE
|
||||
IDEMsgScanners: TIDEMsgScanners = nil;// initialized by the IDE
|
||||
|
||||
procedure RegisterIDEMsgQuickFix(Item: TIDEMsgQuickFixItem);
|
||||
function RegisterIDEMsgQuickFix(const Name, Caption, RegExpr: string;
|
||||
Steps: TIMQuickFixSteps;
|
||||
const ExecuteMethod: TIMQFExecuteMethod;
|
||||
const ExecuteProc: TIMQFExecuteProc = nil): TIDEMsgQuickFixItem; overload;
|
||||
|
||||
procedure RegisterIDEMsgScanner(Item: TIDEMsgScannerType);
|
||||
|
||||
type
|
||||
TFPCErrorType = (etNone, etHint, etNote, etWarning, etError, etFatal, etPanic);
|
||||
|
||||
const
|
||||
FPCErrorTypeNames : array[TFPCErrorType] of string = (
|
||||
'None','Hint','Note','Warning','Error','Fatal','Panic'
|
||||
);
|
||||
|
||||
function FPCErrorTypeNameToType(const Name:string): TFPCErrorType;
|
||||
function ParseFPCMessage(const Line: string; out Filename:string;
|
||||
out CaretXY: TPoint; out MsgType: TFPCErrorType): boolean;
|
||||
|
||||
implementation
|
||||
|
||||
procedure RegisterIDEMsgQuickFix(Item: TIDEMsgQuickFixItem);
|
||||
begin
|
||||
IDEMsgQuickFixes.Add(Item);
|
||||
end;
|
||||
|
||||
function RegisterIDEMsgQuickFix(const Name, Caption, RegExpr: string;
|
||||
Steps: TIMQuickFixSteps;
|
||||
const ExecuteMethod: TIMQFExecuteMethod; const ExecuteProc: TIMQFExecuteProc
|
||||
): TIDEMsgQuickFixItem;
|
||||
begin
|
||||
Result:=TIDEMsgQuickFixItem.Create;
|
||||
Result.Name:=Name;
|
||||
Result.Caption:=Caption;
|
||||
Result.RegExpression:=RegExpr;
|
||||
Result.Steps:=Steps;
|
||||
Result.OnExecuteMethod:=ExecuteMethod;
|
||||
Result.OnExecuteProc:=ExecuteProc;
|
||||
IDEMsgQuickFixes.Add(Result);
|
||||
end;
|
||||
|
||||
procedure RegisterIDEMsgScanner(Item: TIDEMsgScannerType);
|
||||
begin
|
||||
IDEMsgScanners.RegisterType(Item);
|
||||
end;
|
||||
|
||||
function FPCErrorTypeNameToType(const Name: string): TFPCErrorType;
|
||||
begin
|
||||
for Result:=Succ(etNone) to High(TFPCErrorType) do
|
||||
if CompareText(FPCErrorTypeNames[Result],Name)=0 then exit;
|
||||
Result:=etNone;
|
||||
end;
|
||||
|
||||
function ParseFPCMessage(const Line: string; out Filename: string; out
|
||||
CaretXY: TPoint; out MsgType: TFPCErrorType): boolean;
|
||||
{ This assumes the line has one of the following formats
|
||||
<filename>(123,45) <ErrorType>: <some text>
|
||||
<filename>(123) <ErrorType>: <some text>
|
||||
<filename>(456) <ErrorType>: <some text> in line (123)
|
||||
Fatal: <some text>
|
||||
}
|
||||
var
|
||||
StartPos, EndPos: integer;
|
||||
begin
|
||||
Result:=false;
|
||||
StartPos:=1;
|
||||
|
||||
// skip time [0.000]
|
||||
if (Line<>'') and (Line[StartPos]='[') then begin
|
||||
inc(StartPos);
|
||||
while (StartPos<=length(Line)) and (Line[StartPos] in ['0'..'9','.']) do
|
||||
inc(StartPos);
|
||||
if (StartPos<=length(Line)) and (Line[StartPos]=']') then
|
||||
inc(StartPos);
|
||||
while (StartPos<=length(Line)) and (Line[StartPos] in [' ']) do
|
||||
inc(StartPos);
|
||||
end;
|
||||
|
||||
if copy(Line,StartPos,7)='Fatal: ' then begin
|
||||
Result:=true;
|
||||
Filename:='';
|
||||
MsgType:=etFatal;
|
||||
exit;
|
||||
end;
|
||||
if copy(Line,StartPos,7)='Panic: ' then begin
|
||||
Result:=true;
|
||||
Filename:='';
|
||||
MsgType:=etPanic;
|
||||
exit;
|
||||
end;
|
||||
|
||||
// find filename
|
||||
EndPos:=StartPos;
|
||||
while (EndPos<=length(Line)) and (Line[EndPos]<>'(') do inc(EndPos);
|
||||
if EndPos>length(Line) then exit;
|
||||
FileName:=copy(Line,StartPos,EndPos-StartPos);
|
||||
// read linenumber
|
||||
StartPos:=EndPos+1;
|
||||
EndPos:=StartPos;
|
||||
while (EndPos<=length(Line)) and (Line[EndPos] in ['0'..'9']) do inc(EndPos);
|
||||
if EndPos>length(Line) then exit;
|
||||
CaretXY.X:=1;
|
||||
CaretXY.Y:=StrToIntDef(copy(Line,StartPos,EndPos-StartPos),-1);
|
||||
if Line[EndPos]=',' then begin
|
||||
// format: <filename>(123,45) <ErrorType>: <some text>
|
||||
// read column
|
||||
StartPos:=EndPos+1;
|
||||
EndPos:=StartPos;
|
||||
while (EndPos<=length(Line)) and (Line[EndPos] in ['0'..'9']) do inc(EndPos);
|
||||
if EndPos>length(Line) then exit;
|
||||
CaretXY.X:=StrToIntDef(copy(Line,StartPos,EndPos-StartPos),-1);
|
||||
// read error type
|
||||
StartPos:=EndPos+2;
|
||||
while (EndPos<=length(Line)) and (Line[EndPos]<>':') do inc(EndPos);
|
||||
if EndPos>length(Line) then exit;
|
||||
MsgType:=FPCErrorTypeNameToType(copy(Line,StartPos,EndPos-StartPos));
|
||||
Result:=true;
|
||||
end else if Line[EndPos]=')' then begin
|
||||
// <filename>(123) <ErrorType>: <some text>
|
||||
// <filename>(456) <ErrorType>: <some text> in line (123)
|
||||
// read error type
|
||||
StartPos:=EndPos+2;
|
||||
while (EndPos<=length(Line)) and (Line[EndPos]<>':') do inc(EndPos);
|
||||
if EndPos>length(Line) then exit;
|
||||
MsgType:=FPCErrorTypeNameToType(copy(Line,StartPos,EndPos-StartPos));
|
||||
// read second linenumber (more useful)
|
||||
while (EndPos<=length(Line)) and (Line[EndPos]<>'(') do inc(EndPos);
|
||||
if EndPos>length(Line) then begin
|
||||
// format: <filename>(123) <ErrorType>: <some text>
|
||||
Result:=true;
|
||||
exit;
|
||||
end;
|
||||
StartPos:=EndPos+1;
|
||||
EndPos:=StartPos;
|
||||
while (EndPos<=length(Line)) and (Line[EndPos] in ['0'..'9']) do inc(EndPos);
|
||||
if EndPos>length(Line) then exit;
|
||||
CaretXY.Y:=StrToIntDef(copy(Line,StartPos,EndPos-StartPos),-1);
|
||||
Result:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TIDEMsgQuickFixItem }
|
||||
|
||||
function TIDEMsgQuickFixItem.GetCaption: string;
|
||||
begin
|
||||
if FCaption<>'' then
|
||||
Result:=FCaption
|
||||
else
|
||||
Result:=FName;
|
||||
end;
|
||||
|
||||
procedure TIDEMsgQuickFixItem.SetCaption(const AValue: string);
|
||||
begin
|
||||
if FCaption=AValue then exit;
|
||||
FCaption:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEMsgQuickFixItem.SetName(const AValue: string);
|
||||
begin
|
||||
if FName=AValue then exit;
|
||||
FName:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEMsgQuickFixItem.SetRegExpression(const AValue: string);
|
||||
begin
|
||||
if FRegExpression=AValue then exit;
|
||||
FRegExpression:=AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEMsgQuickFixItem.SetRegExprModifiers(const AValue: string);
|
||||
begin
|
||||
if FRegExprModifiers=AValue then exit;
|
||||
FRegExprModifiers:=AValue;
|
||||
end;
|
||||
|
||||
constructor TIDEMsgQuickFixItem.Create;
|
||||
begin
|
||||
FRegExprModifiers:='I';
|
||||
FSteps:=[imqfoMenuItem];
|
||||
end;
|
||||
|
||||
procedure TIDEMsgQuickFixItem.Execute(const Msg: TIDEMessageLine;
|
||||
Step: TIMQuickFixStep);
|
||||
begin
|
||||
if Assigned(OnExecuteMethod) then
|
||||
OnExecuteMethod(Self,Step,Msg);
|
||||
if Assigned(OnExecuteProc) then
|
||||
OnExecuteProc(Self,Step,Msg);
|
||||
end;
|
||||
|
||||
function TIDEMsgQuickFixItem.IsApplicable(Line: TIDEMessageLine): boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
if RegExpression='' then exit;
|
||||
//DebugLn('TIDEMsgQuickFixItem.IsApplicable Line.Msg="',Line.Msg,'" RegExpression="',RegExpression,'"');
|
||||
Result:=REMatches(Line.Msg,RegExpression,RegExprModifiers);
|
||||
end;
|
||||
|
||||
{ TIDEMsgQuickFixItems }
|
||||
|
||||
function TIDEMsgQuickFixItems.GetItems(Index: integer): TIDEMsgQuickFixItem;
|
||||
begin
|
||||
Result:=TIDEMsgQuickFixItem(FItems[Index]);
|
||||
end;
|
||||
|
||||
function TIDEMsgQuickFixItems.GetCount: integer;
|
||||
begin
|
||||
Result:=FItems.Count;
|
||||
end;
|
||||
|
||||
constructor TIDEMsgQuickFixItems.Create;
|
||||
begin
|
||||
FItems:=TFPList.Create;
|
||||
end;
|
||||
|
||||
destructor TIDEMsgQuickFixItems.Destroy;
|
||||
begin
|
||||
Clear;
|
||||
FreeAndNil(FItems);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TIDEMsgQuickFixItems.Clear;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=Count-1 downto 0 do Items[i].Free;
|
||||
end;
|
||||
|
||||
function TIDEMsgQuickFixItems.Add(Item: TIDEMsgQuickFixItem): integer;
|
||||
begin
|
||||
Item.Name:=NewName(Item.Name);
|
||||
Result:=FItems.Add(Item);
|
||||
end;
|
||||
|
||||
procedure TIDEMsgQuickFixItems.Remove(Item: TIDEMsgQuickFixItem);
|
||||
begin
|
||||
FItems.Remove(Item);
|
||||
end;
|
||||
|
||||
function TIDEMsgQuickFixItems.IndexOfName(const Name: string): integer;
|
||||
begin
|
||||
for Result:=0 to Count-1 do
|
||||
if CompareText(Items[Result].Name,Name)=0 then exit;
|
||||
Result:=-1;
|
||||
end;
|
||||
|
||||
function TIDEMsgQuickFixItems.FindByName(const Name: string
|
||||
): TIDEMsgQuickFixItem;
|
||||
var
|
||||
i: LongInt;
|
||||
begin
|
||||
i:=IndexOfName(Name);
|
||||
if i>=0 then
|
||||
Result:=Items[i]
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TIDEMsgQuickFixItems.NewName(const StartValue: string): string;
|
||||
begin
|
||||
Result:=StartValue;
|
||||
if IndexOfName(Result)<0 then exit;
|
||||
Result:=CreateFirstIdentifier(StartValue);
|
||||
//DebugLn('TIDEMsgQuickFixItems.NewName Result="',Result,'" StartValue="',StartValue,'"');
|
||||
while IndexOfName(Result)>=0 do
|
||||
Result:=CreateNextIdentifier(Result);
|
||||
end;
|
||||
|
||||
{ TIDEMessageLine }
|
||||
|
||||
procedure TIDEMessageLine.SetDirectory(const AValue: string);
|
||||
begin
|
||||
if FDirectory = AValue then
|
||||
exit;
|
||||
FDirectory := AValue;
|
||||
end;
|
||||
|
||||
procedure TIDEMessageLine.SetMsg(const AValue: string);
|
||||
begin
|
||||
if FMsg = AValue then
|
||||
exit;
|
||||
FMsg := AValue;
|
||||
end;
|
||||
|
||||
constructor TIDEMessageLine.Create;
|
||||
begin
|
||||
FPosition := -1;
|
||||
FVisiblePosition := -1;
|
||||
end;
|
||||
|
||||
destructor TIDEMessageLine.Destroy;
|
||||
begin
|
||||
FParts.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TIDEMessageLine.GetSourcePosition(out Filename: string; out
|
||||
LineNumber, Column: integer);
|
||||
begin
|
||||
if Parts<>nil then begin
|
||||
Filename:=Parts.Values['Filename'];
|
||||
LineNumber:=StrToIntDef(Parts.Values['Line'],0);
|
||||
Column:=StrToIntDef(Parts.Values['Column'],0);
|
||||
end else begin
|
||||
Filename:='';
|
||||
LineNumber:=0;
|
||||
Column:=0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TIDEMessageLine.SetSourcePosition(const Filename: string;
|
||||
const LineNumber, Column: integer);
|
||||
var
|
||||
BracketClosePos: LongInt;
|
||||
s: String;
|
||||
CommaPos: LongInt;
|
||||
BracketOpenPos: LongInt;
|
||||
begin
|
||||
if Parts<>nil then begin
|
||||
if Filename<>'' then
|
||||
Parts.Values['Filename']:=Filename;
|
||||
if LineNumber>0 then
|
||||
Parts.Values['Line']:=IntToStr(LineNumber);
|
||||
if Column>0 then
|
||||
Parts.Values['Column']:=IntToStr(Column);
|
||||
if ExtractFilePath(Filename)<>'' then
|
||||
Directory:=ExtractFilePath(Filename);
|
||||
end;
|
||||
BracketOpenPos:=System.Pos('(',Msg);
|
||||
if (BracketOpenPos>0) then begin
|
||||
if (Filename<>'') then begin
|
||||
Msg:=Filename+copy(Msg,BracketOpenPos,length(Msg));
|
||||
BracketOpenPos:=length(Filename)+1;
|
||||
end;
|
||||
CommaPos:=System.Pos(',',Msg);
|
||||
if LineNumber>0 then begin
|
||||
if CommaPos>0 then begin
|
||||
s:=IntToStr(LineNumber);
|
||||
Msg:=copy(Msg,1,BracketOpenPos)+s
|
||||
+copy(Msg,CommaPos,length(Msg));
|
||||
end else begin
|
||||
s:=IntToStr(LineNumber);
|
||||
Msg:=copy(Msg,1,BracketOpenPos)+s+',1'
|
||||
+copy(Msg,BracketOpenPos+1,length(Msg));
|
||||
end;
|
||||
CommaPos:=BracketOpenPos+length(s)+1;
|
||||
end;
|
||||
if CommaPos>0 then begin
|
||||
BracketClosePos:=System.Pos(')',Msg);
|
||||
if BracketClosePos>0 then begin
|
||||
if Column>0 then begin
|
||||
s:=IntToStr(Column);
|
||||
Msg:=copy(Msg,1,CommaPos)+s+copy(Msg,BracketClosePos,length(Msg));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end else begin
|
||||
Msg:=Filename+'('+IntToStr(LineNumber)+','+IntToStr(Column)+')'+Msg;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TIDEMessageLineList }
|
||||
|
||||
function TIDEMessageLineList.GetCount: integer;
|
||||
begin
|
||||
Result:=FItems.Count;
|
||||
end;
|
||||
|
||||
function TIDEMessageLineList.GetItems(Index: integer): TIDEMessageLine;
|
||||
begin
|
||||
Result:=TIDEMessageLine(FItems[Index]);
|
||||
end;
|
||||
|
||||
function TIDEMessageLineList.GetParts(Index: integer): TStrings;
|
||||
begin
|
||||
Result:=Items[Index].Parts;
|
||||
end;
|
||||
|
||||
procedure TIDEMessageLineList.SetParts(Index: integer; const AValue: TStrings);
|
||||
begin
|
||||
Items[Index].Parts:=AValue;
|
||||
end;
|
||||
|
||||
constructor TIDEMessageLineList.Create;
|
||||
begin
|
||||
FItems:=TFPList.Create;
|
||||
end;
|
||||
|
||||
destructor TIDEMessageLineList.Destroy;
|
||||
begin
|
||||
Clear;
|
||||
FreeAndNil(FItems);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TIDEMessageLineList.Clear;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to FItems.Count-1 do TObject(FItems[i]).Free;
|
||||
FItems.Clear;
|
||||
end;
|
||||
|
||||
function TIDEMessageLineList.Add(const Msg: string): integer;
|
||||
var
|
||||
Item: TIDEMessageLine;
|
||||
begin
|
||||
Item:=TIDEMessageLine.Create;
|
||||
Item.Msg:=Msg;
|
||||
Result:=Add(Item);
|
||||
end;
|
||||
|
||||
function TIDEMessageLineList.Add(Item: TIDEMessageLine): integer;
|
||||
begin
|
||||
Result:=FItems.Add(Item);
|
||||
Item.OriginalIndex:=Result;
|
||||
end;
|
||||
|
||||
procedure TIDEMessageLineList.Delete(Index: Integer);
|
||||
begin
|
||||
TObject(FItems[Index]).Free;
|
||||
FItems.Delete(Index);
|
||||
end;
|
||||
|
||||
{ TIDEMsgScanner }
|
||||
|
||||
procedure TIDEMsgScanner.SetWorkingDirectory(const AValue: string);
|
||||
begin
|
||||
if FWorkingDirectory=AValue then exit;
|
||||
FWorkingDirectory:=AValue;
|
||||
end;
|
||||
|
||||
constructor TIDEMsgScanner.Create(TheScannerType: TIDEMsgScannerType;
|
||||
TheLines: TIDEMessageLineList);
|
||||
begin
|
||||
FScannerType:=TheScannerType;
|
||||
FLines:=TheLines;
|
||||
end;
|
||||
|
||||
procedure TIDEMsgScanner.EndScan;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{ TIDEMsgScanners }
|
||||
|
||||
function TIDEMsgScanners.GetCount: integer;
|
||||
begin
|
||||
Result:=fTypes.Count;
|
||||
end;
|
||||
|
||||
function TIDEMsgScanners.GetItems(Index: integer): TIDEMsgScannerType;
|
||||
begin
|
||||
Result:=TIDEMsgScannerType(fTypes[Index]);
|
||||
end;
|
||||
|
||||
function TIDEMsgScanners.GetScannerCount: integer;
|
||||
begin
|
||||
Result:=fScanners.Count;
|
||||
end;
|
||||
|
||||
function TIDEMsgScanners.GetScanners(Index: integer): TIDEMsgScanner;
|
||||
begin
|
||||
Result:=TIDEMsgScanner(fScanners[Index]);
|
||||
end;
|
||||
|
||||
constructor TIDEMsgScanners.Create;
|
||||
begin
|
||||
fTypes:=TFPList.Create;
|
||||
fScanners:=TFPList.Create;
|
||||
end;
|
||||
|
||||
destructor TIDEMsgScanners.Destroy;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to fTypes.Count-1 do TObject(fTypes[i]).Free;
|
||||
FreeAndNil(fTypes);
|
||||
for i:=0 to fScanners.Count-1 do TObject(fScanners[i]).Free;
|
||||
FreeAndNil(fScanners);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TIDEMsgScanners.RegisterType(aType: TIDEMsgScannerType);
|
||||
begin
|
||||
if (aType.Name='') or (not IsValidIdent(aType.Name)) then
|
||||
raise Exception.Create('TIDEMsgScanners.RegisterType invalid name "'+dbgstr(aType.Name)+'"');
|
||||
aType.Name:=CreateUniqueName(aType.Name);
|
||||
fTypes.Add(aType);
|
||||
end;
|
||||
|
||||
procedure TIDEMsgScanners.UnregisterType(aType: TIDEMsgScannerType);
|
||||
begin
|
||||
fTypes.Remove(aType);
|
||||
end;
|
||||
|
||||
function TIDEMsgScanners.CreateUniqueName(const aName: string): string;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=aName;
|
||||
if IndexOfName(Result)<0 then exit;
|
||||
i:=1;
|
||||
repeat
|
||||
Result:=aName+'_'+IntToStr(i);
|
||||
until IndexOfName(Result)<0;
|
||||
end;
|
||||
|
||||
function TIDEMsgScanners.IndexOfName(const aTypeName: string): integer;
|
||||
begin
|
||||
Result:=fTypes.Count-1;
|
||||
while (Result>=0)
|
||||
and (SysUtils.CompareText(Items[Result].Name,aTypeName)<>0) do
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
function TIDEMsgScanners.TypeOfName(const aTypeName: string
|
||||
): TIDEMsgScannerType;
|
||||
var
|
||||
i: LongInt;
|
||||
begin
|
||||
i:=IndexOfName(aTypeName);
|
||||
if i>=0 then
|
||||
Result:=Items[i]
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TIDEMsgScanners.IndexOfShortDesc(const ShortDescription: string
|
||||
): integer;
|
||||
begin
|
||||
Result:=fTypes.Count-1;
|
||||
while (Result>=0)
|
||||
and (SysUtils.CompareText(Items[Result].ShortDescription,ShortDescription)<>0) do
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
function TIDEMsgScanners.TypeOfShortDesc(const ShortDescription: string
|
||||
): TIDEMsgScannerType;
|
||||
var
|
||||
i: LongInt;
|
||||
begin
|
||||
i:=IndexOfShortDesc(ShortDescription);
|
||||
if i>=0 then
|
||||
Result:=Items[i]
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
{$Endif EnableOldExtTools}
|
||||
end.
|
||||
|
||||
|
@ -18,10 +18,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, Dialogs, PropEdits, LazHelpHTML,
|
||||
IDEOptionsIntf, CompOptsIntf, ProjectIntf,
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEExternToolIntf,
|
||||
{$ENDIF}
|
||||
SrcEditorIntf;
|
||||
IDEExternToolIntf, SrcEditorIntf;
|
||||
|
||||
type
|
||||
// open file flags
|
||||
@ -287,11 +284,7 @@ type
|
||||
function ShowProgress(const SomeText: string;
|
||||
Step, MaxStep: integer): boolean; virtual; abstract; // False if canceled by user
|
||||
function DoJumpToCompilerMessage(FocusEditor: boolean;
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
Msg: TMessageLine = nil // if nil then it jumps to first message
|
||||
{$ELSE}
|
||||
Index:integer = -1
|
||||
{$ENDIF}
|
||||
): boolean; virtual; abstract;
|
||||
procedure DoJumpToNextError(DirectionDown: boolean); virtual; abstract;
|
||||
procedure DoShowMessagesView(BringToFront: boolean = true); virtual; abstract;
|
||||
|
@ -250,9 +250,7 @@ procedure TJcfIdeMain.LogIDEMessage(const psFile, psMessage: string;
|
||||
const piY, piX: integer);
|
||||
var
|
||||
lazMessages: TIDEMessagesWindowInterface;
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
Urgency: TMessageLineUrgency;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{ no empty lines in this log }
|
||||
if psMessage = '' then
|
||||
@ -262,7 +260,6 @@ begin
|
||||
if lazMessages = nil then
|
||||
exit;
|
||||
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
case peMessageType of
|
||||
mtException,mtInputError,mtParseError: Urgency:=mluError;
|
||||
mtCodeWarning: Urgency:=mluWarning;
|
||||
@ -270,14 +267,6 @@ begin
|
||||
mtProgress: Urgency:=mluProgress;
|
||||
end;
|
||||
lazMessages.AddCustomMessage(Urgency,psMessage, psFile, piY, piX, 'JCF')
|
||||
{$ELSE}
|
||||
if (piY >= 0) and (piX >= 0) then
|
||||
lazMessages.AddMsg('JCF: ' + psMessage, psFile, 0)
|
||||
//lazMessages.AddToolMessage(psFile, psMessage, 'JCF', piY, piX)
|
||||
else
|
||||
lazMessages.AddMsg('JCF: ' + psFile + ' ' + psMessage, '', 0);
|
||||
//lazMessages.AddTitleMessage('JCF: ' + psFile + ' ' + psMessage);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TJcfIdeMain.MakeEditorConverter;
|
||||
|
@ -6,9 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, SrcEditorIntf, IDEMsgIntf, LazIDEIntf, IDEOptionsIntf,
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEExternToolIntf,
|
||||
{$ENDIF}
|
||||
Controls, SynEdit, EMScriptClasses, EMSStrings, Laz2_XMLCfg, uPSRuntime,
|
||||
uPSUtils, LazLoggerBase, LazFileUtils;
|
||||
|
||||
@ -300,11 +298,7 @@ begin
|
||||
Exec.RunScript;
|
||||
except
|
||||
on e: Exception do
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluError,Format('%s: %s', [e.ClassName, e.Message]));
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg(Format('%s: %s', [e.ClassName, e.Message]), '', -1);
|
||||
{$ENDIF}
|
||||
end;
|
||||
if Exec.ExceptionCode <> erNoError then begin
|
||||
ExObj := Exec.ExceptionObject;
|
||||
@ -318,11 +312,7 @@ begin
|
||||
y := 0;
|
||||
Exec.TranslatePositionEx(Exec.ExceptionProcNo, Exec.ExceptionPos, i, x, y, s2);
|
||||
if IDEMessagesWindow <> nil then
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluError,Format('%s: "%s" at %d/%d', [s, Exec.ExceptionString, x,y]));
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg(Format('%s: "%s" at %d/%d', [s, Exec.ExceptionString, x,y]), '', -1);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
finally
|
||||
|
@ -112,9 +112,7 @@ uses
|
||||
srceditorintf,
|
||||
ProjectIntf,
|
||||
IDEMsgIntf,
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEExternToolIntf,
|
||||
{$ENDIF}
|
||||
CodeCache,
|
||||
CodeToolManager;
|
||||
|
||||
@ -424,11 +422,7 @@ end;
|
||||
|
||||
procedure TSQLSyntaxChecker.ShowMessage(const Msg: String);
|
||||
begin
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluImportant,Msg,SourceFileName);
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg(SourceFileName+' : '+Msg,'',0,Nil);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TSQLSyntaxChecker.ShowMessage(const Fmt: String; Args: array of const);
|
||||
@ -477,37 +471,28 @@ Var
|
||||
S : TStringStream;
|
||||
|
||||
begin
|
||||
{$IFDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.BeginBlock(False);
|
||||
{$ENDIF}
|
||||
try
|
||||
try
|
||||
Handled:=False;
|
||||
result:=mrNone;
|
||||
AE:=SourceEditorManagerIntf.ActiveEditor;
|
||||
If (AE<>Nil) then
|
||||
Handled:=False;
|
||||
result:=mrNone;
|
||||
AE:=SourceEditorManagerIntf.ActiveEditor;
|
||||
If (AE<>Nil) then
|
||||
begin
|
||||
E:=ExtractFileExt(AE.FileName);
|
||||
FSFN:=ExtractFileName(AE.FileName);
|
||||
Handled:=CompareText(E,'.sql')=0;
|
||||
If Handled then
|
||||
begin
|
||||
E:=ExtractFileExt(AE.FileName);
|
||||
FSFN:=ExtractFileName(AE.FileName);
|
||||
Handled:=CompareText(E,'.sql')=0;
|
||||
If Handled then
|
||||
begin
|
||||
S:=TStringStream.Create(AE.SourceText);
|
||||
try
|
||||
Result:=CheckSQL(S);
|
||||
finally
|
||||
S.Free;
|
||||
end;
|
||||
end;
|
||||
S:=TStringStream.Create(AE.SourceText);
|
||||
try
|
||||
Result:=CheckSQL(S);
|
||||
finally
|
||||
S.Free;
|
||||
end;
|
||||
end;
|
||||
except
|
||||
On E : Exception do
|
||||
ShowException('Error during syntax check',E);
|
||||
end;
|
||||
finally
|
||||
{$IFDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.EndBlock;
|
||||
{$ENDIF}
|
||||
except
|
||||
On E : Exception do
|
||||
ShowException('Error during syntax check',E);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -105,7 +105,7 @@ type
|
||||
function RenameFile(const SrcFilename, DestFilename: string): TModalResult;
|
||||
function MaybeBackupFile(const AFilename: string): TModalResult;
|
||||
procedure ClearLog;
|
||||
function AddLogLine(const ALine: string {$IFNDEF EnableOldExtTools}; Urgency: TMessageLineUrgency = mluHint{$ENDIF}): integer;
|
||||
function AddLogLine(const ALine: string; Urgency: TMessageLineUrgency = mluHint): integer;
|
||||
function SaveLog: Boolean;
|
||||
public
|
||||
property MainFilenames: TStringlist read fMainFilenames;
|
||||
@ -787,17 +787,11 @@ begin
|
||||
end;
|
||||
|
||||
function TConvertSettings.AddLogLine(
|
||||
const ALine: string
|
||||
{$IFNDEF EnableOldExtTools}; Urgency: TMessageLineUrgency{$ENDIF}
|
||||
const ALine: string; Urgency: TMessageLineUrgency
|
||||
): integer;
|
||||
begin
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(Urgency,aLine); // Show in message window
|
||||
Result:=fLog.Add(MessageLineUrgencyNames[Urgency]+': '+ALine);// and store for log.
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg(ALine, '', -1); // Show in message window
|
||||
Result:=fLog.Add(ALine); // and store for log.
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TConvertSettings.SaveLog: Boolean;
|
||||
@ -810,11 +804,7 @@ begin
|
||||
Code.Assign(fLog);
|
||||
Result:=SaveCodeBuffer(Code)=mrOk;
|
||||
if Result then
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluHint,'This log was saved to '+aFilename); // Show in message window
|
||||
{$ELSE}
|
||||
IDEMessagesWindow.AddMsg('This log was saved to '+aFilename, '', -1);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TConvertSettings.GetBackupPath: String;
|
||||
|
@ -42,10 +42,6 @@ uses
|
||||
// IDE
|
||||
IDEDialogs, ComponentReg, PackageIntf, IDEWindowIntf, DialogProcs,
|
||||
CustomFormEditor, LazarusIDEStrConsts, IDEProcs,
|
||||
{$IFNDEF EnableOldExtTools}
|
||||
{$ELSE}
|
||||
OutputFilter,
|
||||
{$ENDIF}
|
||||
EditorOptions, CheckLFMDlg, IDEMsgIntf, Project, SourceMarks,
|
||||
// Converter
|
||||
ConverterTypes, ConvertSettings, ReplaceNamesUnit,
|
||||
|
Loading…
Reference in New Issue
Block a user