mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-05 21:58:28 +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
|
uses
|
||||||
Classes, SysUtils, FileUtil, LazLogger, LazFileUtils, LazHelpIntf, HelpIntfs,
|
Classes, SysUtils, FileUtil, LazLogger, LazFileUtils, LazHelpIntf, HelpIntfs,
|
||||||
LazConfigStorage, PropEdits, LazIDEIntf, IDEDialogs,
|
LazConfigStorage, PropEdits, LazIDEIntf, IDEDialogs, IDEExternToolIntf,
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEExternToolIntf,
|
|
||||||
{$ENDIF}
|
|
||||||
LHelpControl, Controls, UTF8Process, ChmLangRef, ChmLcl, ChmProg;
|
LHelpControl, Controls, UTF8Process, ChmLangRef, ChmLcl, ChmProg;
|
||||||
|
|
||||||
resourcestring
|
resourcestring
|
||||||
@ -256,15 +253,7 @@ var
|
|||||||
LHelpProjectDir: String;
|
LHelpProjectDir: String;
|
||||||
WS: String;
|
WS: String;
|
||||||
PCP: String;
|
PCP: String;
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
Tool: TIDEExternalToolOptions;
|
Tool: TIDEExternalToolOptions;
|
||||||
{$ELSE}
|
|
||||||
Proc: TProcessUTF8;
|
|
||||||
Buffer: array[0..511] of char;
|
|
||||||
BufP: Integer;
|
|
||||||
BufC: Char;
|
|
||||||
LastWasEOL: Boolean;
|
|
||||||
{$ENDIF}
|
|
||||||
begin
|
begin
|
||||||
Result := mrCancel;
|
Result := mrCancel;
|
||||||
|
|
||||||
@ -294,7 +283,6 @@ begin
|
|||||||
//if Result <> mrYes then
|
//if Result <> mrYes then
|
||||||
// Exit;
|
// Exit;
|
||||||
|
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
Tool:=TIDEExternalToolOptions.Create;
|
Tool:=TIDEExternalToolOptions.Create;
|
||||||
try
|
try
|
||||||
Tool.Title:='- Building lhelp -';
|
Tool.Title:='- Building lhelp -';
|
||||||
@ -308,77 +296,6 @@ begin
|
|||||||
finally
|
finally
|
||||||
Tool.Free;
|
Tool.Free;
|
||||||
end;
|
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;
|
end;
|
||||||
|
|
||||||
function TChmHelpViewer.GetLazBuildEXE(out ALazBuild: String): Boolean;
|
function TChmHelpViewer.GetLazBuildEXE(out ALazBuild: String): Boolean;
|
||||||
|
@ -35,9 +35,6 @@ implementation
|
|||||||
uses
|
uses
|
||||||
{ lazarus }
|
{ lazarus }
|
||||||
LazIDEIntf, MenuIntf, IdeCommands,
|
LazIDEIntf, MenuIntf, IdeCommands,
|
||||||
{$IFDEF EnableOldExtTools}
|
|
||||||
IDEMsgIntf,
|
|
||||||
{$ENDIF}
|
|
||||||
{ local }
|
{ local }
|
||||||
LazCHMHelp, InterfaceBase;
|
LazCHMHelp, InterfaceBase;
|
||||||
|
|
||||||
|
@ -231,8 +231,6 @@ type
|
|||||||
function GetFilterType: TCodyIdentifierFilter;
|
function GetFilterType: TCodyIdentifierFilter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
|
|
||||||
{ TQuickFixIdentifierNotFoundShowDictionary }
|
{ TQuickFixIdentifierNotFoundShowDictionary }
|
||||||
|
|
||||||
TQuickFixIdentifierNotFoundShowDictionary = class(TMsgQuickFix)
|
TQuickFixIdentifierNotFoundShowDictionary = class(TMsgQuickFix)
|
||||||
@ -241,7 +239,6 @@ type
|
|||||||
procedure CreateMenuItems(Fixes: TMsgQuickFixes); override;
|
procedure CreateMenuItems(Fixes: TMsgQuickFixes); override;
|
||||||
procedure QuickFix({%H-}Fixes: TMsgQuickFixes; Msg: TMessageLine); override;
|
procedure QuickFix({%H-}Fixes: TMsgQuickFixes; Msg: TMessageLine); override;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
var
|
var
|
||||||
CodyUnitDictionary: TCodyUnitDictionary = nil;
|
CodyUnitDictionary: TCodyUnitDictionary = nil;
|
||||||
@ -280,9 +277,7 @@ end;
|
|||||||
procedure InitUnitDictionary;
|
procedure InitUnitDictionary;
|
||||||
begin
|
begin
|
||||||
CodyUnitDictionary:=TCodyUnitDictionary.Create;
|
CodyUnitDictionary:=TCodyUnitDictionary.Create;
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
RegisterIDEMsgQuickFix(TQuickFixIdentifierNotFoundShowDictionary.Create);
|
RegisterIDEMsgQuickFix(TQuickFixIdentifierNotFoundShowDictionary.Create);
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CompareCodyIdentifiersAlphaScopeUse(Item1, Item2: Pointer): integer;
|
function CompareCodyIdentifiersAlphaScopeUse(Item1, Item2: Pointer): integer;
|
||||||
@ -371,7 +366,6 @@ begin
|
|||||||
exit(0);
|
exit(0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
{ TQuickFixIdentifierNotFoundShowDictionary }
|
{ TQuickFixIdentifierNotFoundShowDictionary }
|
||||||
|
|
||||||
function TQuickFixIdentifierNotFoundShowDictionary.IsApplicable(
|
function TQuickFixIdentifierNotFoundShowDictionary.IsApplicable(
|
||||||
@ -407,7 +401,6 @@ begin
|
|||||||
Point(Msg.Column,Msg.Line),-1,-1,-1,[])<>mrOk then exit;
|
Point(Msg.Column,Msg.Line),-1,-1,-1,[])<>mrOk then exit;
|
||||||
ShowUnitDictionaryDialog(nil);
|
ShowUnitDictionaryDialog(nil);
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{ TCodyIdentifier }
|
{ TCodyIdentifier }
|
||||||
|
|
||||||
|
@ -57,9 +57,7 @@ implementation
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
inifiles, IDEMsgIntf,
|
inifiles, IDEMsgIntf,
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEExternToolIntf,
|
IDEExternToolIntf,
|
||||||
{$ENDIF}
|
|
||||||
BaseIDEIntf;
|
BaseIDEIntf;
|
||||||
|
|
||||||
Const
|
Const
|
||||||
@ -181,11 +179,7 @@ end;
|
|||||||
procedure TIDEDataDictionary.DDProgress(Sender : TObject; Const Msg : String);
|
procedure TIDEDataDictionary.DDProgress(Sender : TObject; Const Msg : String);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(mluImportant,SLoadingDataDict+Msg);
|
IDEMessagesWindow.AddCustomMessage(mluImportant,SLoadingDataDict+Msg);
|
||||||
{$ELSE}
|
|
||||||
IDEMessagesWindow.AddMsg(SLoadingDataDict+Msg,'',2);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEDataDictionary.SetFileName(const AValue: String);
|
procedure TIDEDataDictionary.SetFileName(const AValue: String);
|
||||||
@ -282,22 +276,9 @@ procedure TIDEDataDictionary.Load;
|
|||||||
begin
|
begin
|
||||||
If (FFileName<>'') and Active then
|
If (FFileName<>'') and Active then
|
||||||
begin
|
begin
|
||||||
{$IFNDEF EnableOldExtTools}
|
IDEMessagesWindow.AddCustomMessage(mluImportant,SLoadingDataDict+SFromfile+FFileName);
|
||||||
IDEMessagesWindow.AddCustomMessage(mluImportant,SLoadingDataDict+SFromfile+FFileName);
|
|
||||||
{$ELSE}
|
|
||||||
IDEMessagesWindow.BeginBlock(False);
|
|
||||||
Try
|
|
||||||
IDEMessagesWindow.AddMsg(SLoadingDataDict+SFromfile+FFileName,'',2);
|
|
||||||
{$ENDIF}
|
|
||||||
FDataDict.LoadFromFile(UTF8ToSys(FFileName));
|
FDataDict.LoadFromFile(UTF8ToSys(FFileName));
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
{$ELSE}
|
|
||||||
Finally
|
|
||||||
IDEMessagesWindow.EndBlock;
|
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,9 +75,7 @@ implementation
|
|||||||
|
|
||||||
uses forms, dialogs, controls,
|
uses forms, dialogs, controls,
|
||||||
IDEMsgIntf,
|
IDEMsgIntf,
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEExternToolIntf,
|
IDEExternToolIntf,
|
||||||
{$ENDIF}
|
|
||||||
ldd_consts;
|
ldd_consts;
|
||||||
|
|
||||||
|
|
||||||
@ -279,18 +277,11 @@ begin
|
|||||||
ASelection:=TPersistentSelectionList.Create;
|
ASelection:=TPersistentSelectionList.Create;
|
||||||
try
|
try
|
||||||
GlobalDesignHook.GetSelection(ASelection);
|
GlobalDesignHook.GetSelection(ASelection);
|
||||||
{$IFDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.BeginBlock(True);
|
|
||||||
{$ENDIF}
|
|
||||||
For I:=0 to ASelection.Count-1 do
|
For I:=0 to ASelection.Count-1 do
|
||||||
if (ASelection[i] is TDataset) then
|
if (ASelection[i] is TDataset) then
|
||||||
begin
|
begin
|
||||||
DS:=TDataset(ASelection[i]);
|
DS:=TDataset(ASelection[i]);
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(mluImportant,Format(SApplyingDDToDataset,[DS.Name]));
|
IDEMessagesWindow.AddCustomMessage(mluImportant,Format(SApplyingDDToDataset,[DS.Name]));
|
||||||
{$ELSE}
|
|
||||||
IDEMessagesWindow.AddMsg(Format(SApplyingDDToDataset,[DS.Name]),'',i+1);
|
|
||||||
{$ENDIF}
|
|
||||||
IDEDataDictionary.Dictionary.ApplyToDataset(DS,@ApplyDDToField);
|
IDEDataDictionary.Dictionary.ApplyToDataset(DS,@ApplyDDToField);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
@ -304,18 +295,10 @@ begin
|
|||||||
If (FD<>Nil) then
|
If (FD<>Nil) then
|
||||||
begin
|
begin
|
||||||
If VerboseApply then
|
If VerboseApply then
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(mluImportant,Format(SApplyingDDToField,[F.FieldName]));
|
IDEMessagesWindow.AddCustomMessage(mluImportant,Format(SApplyingDDToField,[F.FieldName]));
|
||||||
{$ELSE}
|
|
||||||
IDEMessagesWindow.AddMsg(Format(SApplyingDDToField,[F.FieldName]),'',-1)
|
|
||||||
{$ENDIF}
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(mluImportant,Format(SWarningNoDDForField,[F.FieldName]));
|
IDEMessagesWindow.AddCustomMessage(mluImportant,Format(SWarningNoDDForField,[F.FieldName]));
|
||||||
{$ELSE}
|
|
||||||
IDEMessagesWindow.AddMsg(Format(SWarningNoDDForField,[F.FieldName]),'',-1);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TIDEDataDictCommandHandler.DesignSQL(Sender : TObject);
|
Procedure TIDEDataDictCommandHandler.DesignSQL(Sender : TObject);
|
||||||
|
@ -23,9 +23,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, fpWeb, fpHTML, fpdatasetform,
|
Classes, SysUtils, fpWeb, fpHTML, fpdatasetform,
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEExternToolIntf,
|
IDEExternToolIntf,
|
||||||
{$ENDIF}
|
|
||||||
Controls, Dialogs, forms, LazIDEIntf, ProjectIntf, SrcEditorIntf, IDEMsgIntf,
|
Controls, Dialogs, forms, LazIDEIntf, ProjectIntf, SrcEditorIntf, IDEMsgIntf,
|
||||||
fpextjs,
|
fpextjs,
|
||||||
extjsjson, extjsxml,
|
extjsjson, extjsxml,
|
||||||
@ -1062,11 +1060,7 @@ end;
|
|||||||
|
|
||||||
procedure TJSSyntaxChecker.ShowMessage(const Msg: String);
|
procedure TJSSyntaxChecker.ShowMessage(const Msg: String);
|
||||||
begin
|
begin
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(mluImportant,Msg,SourceFileName);
|
IDEMessagesWindow.AddCustomMessage(mluImportant,Msg,SourceFileName);
|
||||||
{$ELSE}
|
|
||||||
IDEMessagesWindow.AddMsg(SourceFileName+' : '+Msg,'',0,Nil);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TJSSyntaxChecker.ShowMessage(const Fmt: String;
|
procedure TJSSyntaxChecker.ShowMessage(const Fmt: String;
|
||||||
@ -1113,38 +1107,29 @@ Var
|
|||||||
S : TStringStream;
|
S : TStringStream;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$IFDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.BeginBlock(False);
|
|
||||||
{$ENDIF}
|
|
||||||
try
|
try
|
||||||
try
|
Handled:=False;
|
||||||
Handled:=False;
|
result:=mrNone;
|
||||||
result:=mrNone;
|
AE:=SourceEditorManagerIntf.ActiveEditor;
|
||||||
AE:=SourceEditorManagerIntf.ActiveEditor;
|
If (AE<>Nil) then
|
||||||
If (AE<>Nil) then
|
begin
|
||||||
|
E:=ExtractFileExt(AE.FileName);
|
||||||
|
FSFN:=ExtractFileName(AE.FileName);
|
||||||
|
Handled:=CompareText(E,'.js')=0;
|
||||||
|
If Handled then
|
||||||
begin
|
begin
|
||||||
E:=ExtractFileExt(AE.FileName);
|
S:=TStringStream.Create(AE.SourceText);
|
||||||
FSFN:=ExtractFileName(AE.FileName);
|
try
|
||||||
Handled:=CompareText(E,'.js')=0;
|
CheckJavaScript(S);
|
||||||
If Handled then
|
Result:=mrOK;
|
||||||
begin
|
finally
|
||||||
S:=TStringStream.Create(AE.SourceText);
|
S.Free;
|
||||||
try
|
end;
|
||||||
CheckJavaScript(S);
|
|
||||||
Result:=mrOK;
|
|
||||||
finally
|
|
||||||
S.Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
except
|
|
||||||
On E : Exception do
|
|
||||||
ShowException('Error during syntax check',E);
|
|
||||||
end;
|
end;
|
||||||
finally
|
except
|
||||||
{$IFDEF EnableOldExtTools}
|
On E : Exception do
|
||||||
IDEMessagesWindow.EndBlock;
|
ShowException('Error during syntax check',E);
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -613,7 +613,6 @@ type
|
|||||||
property OutputDirectory: string read FOutputDirectory write SetOutputDirectory;
|
property OutputDirectory: string read FOutputDirectory write SetOutputDirectory;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
const
|
const
|
||||||
SubToolH2Pas = 'h2pas';
|
SubToolH2Pas = 'h2pas';
|
||||||
type
|
type
|
||||||
@ -625,7 +624,6 @@ type
|
|||||||
procedure ReadLine(Line: string; OutputIndex: integer; var Handled: boolean
|
procedure ReadLine(Line: string; OutputIndex: integer; var Handled: boolean
|
||||||
); override; // (worker thread)
|
); override; // (worker thread)
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{ TH2PasTool }
|
{ TH2PasTool }
|
||||||
|
|
||||||
@ -657,9 +655,6 @@ type
|
|||||||
procedure SetProjectHistory(const AValue: TStrings);
|
procedure SetProjectHistory(const AValue: TStrings);
|
||||||
procedure SetWindowBounds(const AValue: TRect);
|
procedure SetWindowBounds(const AValue: TRect);
|
||||||
procedure Seth2pasFilename(const AValue: string);
|
procedure Seth2pasFilename(const AValue: string);
|
||||||
{$IFDEF EnableOldExtTools}
|
|
||||||
procedure OnParseH2PasLine(Sender: TObject; Line: TIDEScanMessageLine);
|
|
||||||
{$ENDIF}
|
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -678,9 +673,6 @@ type
|
|||||||
function MergeIncludeFiles(AFile: TH2PasFile;
|
function MergeIncludeFiles(AFile: TH2PasFile;
|
||||||
TextConverter: TIDETextConverter): TModalResult;
|
TextConverter: TIDETextConverter): TModalResult;
|
||||||
function GetH2PasFilename: string;
|
function GetH2PasFilename: string;
|
||||||
{$IFDEF EnableOldExtTools}
|
|
||||||
function FindH2PasErrorMessage: integer;
|
|
||||||
{$ENDIF}
|
|
||||||
function FileIsRelated(const aFilename: string): Boolean;
|
function FileIsRelated(const aFilename: string): Boolean;
|
||||||
public
|
public
|
||||||
property Project: TH2PasProject read FProject write SetProject;
|
property Project: TH2PasProject read FProject write SetProject;
|
||||||
@ -712,7 +704,6 @@ const
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
{ TH2PasParser }
|
{ TH2PasParser }
|
||||||
|
|
||||||
class function TH2PasParser.DefaultSubTool: string;
|
class function TH2PasParser.DefaultSubTool: string;
|
||||||
@ -757,7 +748,6 @@ begin
|
|||||||
MsgLine.Urgency:=mluError;
|
MsgLine.Urgency:=mluError;
|
||||||
MsgLine.Msg:=Msg;
|
MsgLine.Msg:=Msg;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{ TH2PasFile }
|
{ TH2PasFile }
|
||||||
|
|
||||||
@ -1742,28 +1732,6 @@ end;
|
|||||||
|
|
||||||
{ TH2PasConverter }
|
{ 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;
|
function TH2PasConverter.GetCurrentProjectFilename: string;
|
||||||
begin
|
begin
|
||||||
if FProjectHistory.Count>0 then
|
if FProjectHistory.Count>0 then
|
||||||
@ -2036,13 +2004,8 @@ var
|
|||||||
end;
|
end;
|
||||||
ErrMsg:=ErrMsg+' Error: '+ErrorTool.ErrorMsg+' ('+ErrorTool.Caption+')';
|
ErrMsg:=ErrMsg+' Error: '+ErrorTool.ErrorMsg+' ('+ErrorTool.Caption+')';
|
||||||
DebugLn(['TH2PasConverter.ConvertFile Failed: ',ErrMsg]);
|
DebugLn(['TH2PasConverter.ConvertFile Failed: ',ErrMsg]);
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(mluError,ErrorTool.ErrorMsg,Filename,Line,Col,ErrorTool.Caption);
|
IDEMessagesWindow.AddCustomMessage(mluError,ErrorTool.ErrorMsg,Filename,Line,Col,ErrorTool.Caption);
|
||||||
LazarusIDE.DoJumpToCompilerMessage(true);
|
LazarusIDE.DoJumpToCompilerMessage(true);
|
||||||
{$ELSE}
|
|
||||||
IDEMessagesWindow.AddMsg(ErrMsg,BaseDir,-1);
|
|
||||||
LazarusIDE.DoJumpToCompilerMessage(true, IDEMessagesWindow.LinesCount-1);
|
|
||||||
{$ENDIF}
|
|
||||||
Result:=mrAbort;
|
Result:=mrAbort;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2106,20 +2069,11 @@ begin
|
|||||||
Tool.CmdLineParams:=AFile.GetH2PasParameters(Tool.TargetFilename);
|
Tool.CmdLineParams:=AFile.GetH2PasParameters(Tool.TargetFilename);
|
||||||
Tool.WorkingDirectory:=Project.BaseDir;
|
Tool.WorkingDirectory:=Project.BaseDir;
|
||||||
DebugLn(['TH2PasConverter.ConvertFile Tool.Filename="',Tool.Filename,'" Tool.CmdLineParams="',Tool.CmdLineParams,'"']);
|
DebugLn(['TH2PasConverter.ConvertFile Tool.Filename="',Tool.Filename,'" Tool.CmdLineParams="',Tool.CmdLineParams,'"']);
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
Tool.Scanners.Add(SubToolH2Pas);
|
Tool.Scanners.Add(SubToolH2Pas);
|
||||||
if not RunExternalTool(Tool) then
|
if not RunExternalTool(Tool) then
|
||||||
exit(mrAbort);
|
exit(mrAbort);
|
||||||
if IDEMessagesWindow.SelectFirstUrgentMessage(mluError,false) then
|
if IDEMessagesWindow.SelectFirstUrgentMessage(mluError,false) then
|
||||||
exit(mrAbort);
|
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
|
finally
|
||||||
Tool.Free;
|
Tool.Free;
|
||||||
end;
|
end;
|
||||||
@ -2315,23 +2269,6 @@ begin
|
|||||||
Result:=FindDefaultExecutablePath(h2pasFilename);
|
Result:=FindDefaultExecutablePath(h2pasFilename);
|
||||||
end;
|
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;
|
function TH2PasConverter.FileIsRelated(const aFilename: string): Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(CompareFilenames(AFilename,LastUsedFilename)=0)
|
Result:=(CompareFilenames(AFilename,LastUsedFilename)=0)
|
||||||
|
@ -27,9 +27,7 @@ uses
|
|||||||
SynHighlighterCPP, FileProcs, IDEMsgIntf, MenuIntf, IDECommands, BaseIDEIntf,
|
SynHighlighterCPP, FileProcs, IDEMsgIntf, MenuIntf, IDECommands, BaseIDEIntf,
|
||||||
IDEDialogs, LazIDEIntf, ProjectIntf, CodeToolManager, SrcEditorIntf,
|
IDEDialogs, LazIDEIntf, ProjectIntf, CodeToolManager, SrcEditorIntf,
|
||||||
IDETextConverter, H2PasStrConsts, H2PasConvert, IDETextConvListEdit,
|
IDETextConverter, H2PasStrConsts, H2PasConvert, IDETextConvListEdit,
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEExternToolIntf,
|
IDEExternToolIntf,
|
||||||
{$ENDIF}
|
|
||||||
CompOptsIntf;
|
CompOptsIntf;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -240,10 +238,8 @@ begin
|
|||||||
TextConverterToolClasses.RegisterClass(TFixForwardDefinitions);
|
TextConverterToolClasses.RegisterClass(TFixForwardDefinitions);
|
||||||
TextConverterToolClasses.RegisterClass(TAddToUsesSection);
|
TextConverterToolClasses.RegisterClass(TAddToUsesSection);
|
||||||
|
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
// register h2pas output parser
|
// register h2pas output parser
|
||||||
ExternalToolList.RegisterParser(TH2PasParser);
|
ExternalToolList.RegisterParser(TH2PasParser);
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TH2PasDialog }
|
{ TH2PasDialog }
|
||||||
|
@ -91,7 +91,6 @@ type
|
|||||||
coptParsedPlatformIndependent // all but platform macros resolved
|
coptParsedPlatformIndependent // all but platform macros resolved
|
||||||
);
|
);
|
||||||
|
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
TCompilerFlagValue = (
|
TCompilerFlagValue = (
|
||||||
cfvNone, // default, do not pass the flag
|
cfvNone, // default, do not pass the flag
|
||||||
cfvHide, // pass the flag, e.g. -vm5000
|
cfvHide, // pass the flag, e.g. -vm5000
|
||||||
@ -109,7 +108,6 @@ type
|
|||||||
property Values[MsgId: integer]: TCompilerFlagValue read GetValues write SetValues; default;
|
property Values[MsgId: integer]: TCompilerFlagValue read GetValues write SetValues; default;
|
||||||
property Modified: boolean read GetModified write SetModified;
|
property Modified: boolean read GetModified write SetModified;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
const
|
const
|
||||||
crAll = [crCompile, crBuild, crRun];
|
crAll = [crCompile, crBuild, crRun];
|
||||||
@ -148,9 +146,6 @@ type
|
|||||||
procedure SetPassLinkerOpt(const AValue: Boolean);
|
procedure SetPassLinkerOpt(const AValue: Boolean);
|
||||||
procedure SetRangeChecks(const AValue: Boolean);
|
procedure SetRangeChecks(const AValue: Boolean);
|
||||||
procedure SetShowAll(const AValue: Boolean);
|
procedure SetShowAll(const AValue: Boolean);
|
||||||
{$IFDEF EnableOldExtTools}
|
|
||||||
procedure SetShowAllProcsOnError(const AValue: Boolean);
|
|
||||||
{$ENDIF}
|
|
||||||
procedure SetShowCompProc(const AValue: Boolean);
|
procedure SetShowCompProc(const AValue: Boolean);
|
||||||
procedure SetShowCond(const AValue: Boolean);
|
procedure SetShowCond(const AValue: Boolean);
|
||||||
procedure SetShowDebugInfo(const AValue: Boolean);
|
procedure SetShowDebugInfo(const AValue: Boolean);
|
||||||
@ -162,9 +157,6 @@ type
|
|||||||
procedure SetShowHintsForUnusedUnitsInMainSrc(const AValue: Boolean);
|
procedure SetShowHintsForUnusedUnitsInMainSrc(const AValue: Boolean);
|
||||||
procedure SetShowLineNum(const AValue: Boolean);
|
procedure SetShowLineNum(const AValue: Boolean);
|
||||||
procedure SetShowNotes(const AValue: Boolean);
|
procedure SetShowNotes(const AValue: Boolean);
|
||||||
{$IFDEF EnableOldExtTools}
|
|
||||||
procedure SetShowNothing(const AValue: Boolean);
|
|
||||||
{$ENDIF}
|
|
||||||
procedure SetShowSummary(const AValue: Boolean);
|
procedure SetShowSummary(const AValue: Boolean);
|
||||||
procedure SetShowTriedFiles(const AValue: Boolean);
|
procedure SetShowTriedFiles(const AValue: Boolean);
|
||||||
procedure SetShowUsedFiles(const AValue: Boolean);
|
procedure SetShowUsedFiles(const AValue: Boolean);
|
||||||
@ -260,27 +252,19 @@ type
|
|||||||
fShowGenInfo: Boolean;
|
fShowGenInfo: Boolean;
|
||||||
fShowLineNum: Boolean;
|
fShowLineNum: Boolean;
|
||||||
fShowAll: Boolean;
|
fShowAll: Boolean;
|
||||||
{$IFDEF EnableOldExtTools}
|
|
||||||
fShowAllProcsOnError: Boolean;
|
|
||||||
{$ENDIF}
|
|
||||||
fShowDebugInfo: Boolean;
|
fShowDebugInfo: Boolean;
|
||||||
fShowUsedFiles: Boolean;
|
fShowUsedFiles: Boolean;
|
||||||
fShowTriedFiles: Boolean;
|
fShowTriedFiles: Boolean;
|
||||||
fShowCompProc: Boolean;
|
fShowCompProc: Boolean;
|
||||||
fShowCond: Boolean;
|
fShowCond: Boolean;
|
||||||
fShowExecInfo: Boolean;
|
fShowExecInfo: Boolean;
|
||||||
{$IFDEF EnableOldExtTools}
|
|
||||||
fShowNothing: Boolean;
|
|
||||||
{$ENDIF}
|
|
||||||
fShowSummary: Boolean;
|
fShowSummary: Boolean;
|
||||||
fShowHintsForUnusedUnitsInMainSrc: Boolean;
|
fShowHintsForUnusedUnitsInMainSrc: Boolean;
|
||||||
fShowHintsForSenderNotUsed: Boolean;
|
fShowHintsForSenderNotUsed: Boolean;
|
||||||
fWriteFPCLogo: Boolean;
|
fWriteFPCLogo: Boolean;
|
||||||
fStopAfterErrCount: integer;
|
fStopAfterErrCount: integer;
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
// Turn specific types of compiler messages on or off
|
// Turn specific types of compiler messages on or off
|
||||||
fMessageFlags: TAbstractCompilerMsgIDFlags;
|
fMessageFlags: TAbstractCompilerMsgIDFlags;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
// Other:
|
// Other:
|
||||||
fDontUseConfigFile: Boolean;
|
fDontUseConfigFile: Boolean;
|
||||||
@ -429,10 +413,6 @@ type
|
|||||||
property ShowHints: Boolean read fShowHints write SetShowHints; // -vh
|
property ShowHints: Boolean read fShowHints write SetShowHints; // -vh
|
||||||
property ShowGenInfo: Boolean read fShowGenInfo write SetShowGenInfo; // -vi
|
property ShowGenInfo: Boolean read fShowGenInfo write SetShowGenInfo; // -vi
|
||||||
property ShowLineNum: Boolean read fShowLineNum write SetShowLineNum; // -vl
|
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 ShowAll: Boolean read fShowAll write SetShowAll; // -va
|
||||||
property ShowDebugInfo: Boolean read fShowDebugInfo write SetShowDebugInfo; // -vd
|
property ShowDebugInfo: Boolean read fShowDebugInfo write SetShowDebugInfo; // -vd
|
||||||
property ShowUsedFiles: Boolean read fShowUsedFiles write SetShowUsedFiles; // -vu
|
property ShowUsedFiles: Boolean read fShowUsedFiles write SetShowUsedFiles; // -vu
|
||||||
@ -440,9 +420,6 @@ type
|
|||||||
property ShowCompProc: Boolean read fShowCompProc write SetShowCompProc; // -vp
|
property ShowCompProc: Boolean read fShowCompProc write SetShowCompProc; // -vp
|
||||||
property ShowCond: Boolean read fShowCond write SetShowCond; // -vc
|
property ShowCond: Boolean read fShowCond write SetShowCond; // -vc
|
||||||
property ShowExecInfo: Boolean read fShowExecInfo write SetShowExecInfo; // -vx
|
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 ShowSummary: Boolean read FShowSummary write SetShowSummary;
|
||||||
property ShowHintsForUnusedUnitsInMainSrc: Boolean
|
property ShowHintsForUnusedUnitsInMainSrc: Boolean
|
||||||
read fShowHintsForUnusedUnitsInMainSrc write SetShowHintsForUnusedUnitsInMainSrc;
|
read fShowHintsForUnusedUnitsInMainSrc write SetShowHintsForUnusedUnitsInMainSrc;
|
||||||
@ -450,9 +427,7 @@ type
|
|||||||
read fShowHintsForSenderNotUsed write SetShowHintsForSenderNotUsed;
|
read fShowHintsForSenderNotUsed write SetShowHintsForSenderNotUsed;
|
||||||
property WriteFPCLogo: Boolean read fWriteFPCLogo write SetWriteFPCLogo;
|
property WriteFPCLogo: Boolean read fWriteFPCLogo write SetWriteFPCLogo;
|
||||||
property StopAfterErrCount: integer read fStopAfterErrCount write SetStopAfterErrCount;
|
property StopAfterErrCount: integer read fStopAfterErrCount write SetStopAfterErrCount;
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
property MessageFlags: TAbstractCompilerMsgIDFlags read fMessageFlags;
|
property MessageFlags: TAbstractCompilerMsgIDFlags read fMessageFlags;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
// other
|
// other
|
||||||
property DontUseConfigFile: Boolean read fDontUseConfigFile write SetDontUseConfigFile;
|
property DontUseConfigFile: Boolean read fDontUseConfigFile write SetDontUseConfigFile;
|
||||||
@ -521,15 +496,6 @@ begin
|
|||||||
IncreaseChangeStamp;
|
IncreaseChangeStamp;
|
||||||
end;
|
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);
|
procedure TLazCompilerOptions.SetShowCompProc(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if fShowCompProc=AValue then exit;
|
if fShowCompProc=AValue then exit;
|
||||||
@ -608,15 +574,6 @@ begin
|
|||||||
IncreaseChangeStamp;
|
IncreaseChangeStamp;
|
||||||
end;
|
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);
|
procedure TLazCompilerOptions.SetShowSummary(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if FShowSummary=AValue then exit;
|
if FShowSummary=AValue then exit;
|
||||||
|
@ -11,7 +11,6 @@ unit IDEExternToolIntf;
|
|||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -2361,281 +2360,4 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
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;
|
function ShowHelpForSourcePosition(const Filename: string;
|
||||||
const CodePos: TPoint;
|
const CodePos: TPoint;
|
||||||
var ErrMsg: string): TShowHelpResult; virtual; abstract;
|
var ErrMsg: string): TShowHelpResult; virtual; abstract;
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
procedure ShowHelpForMessage; virtual; abstract;
|
procedure ShowHelpForMessage; virtual; abstract;
|
||||||
{$ELSE}
|
|
||||||
procedure ShowHelpForMessage(Line: integer); virtual; abstract;
|
|
||||||
{$ENDIF}
|
|
||||||
procedure ShowHelpForObjectInspector(Sender: TObject); virtual; abstract;
|
procedure ShowHelpForObjectInspector(Sender: TObject); virtual; abstract;
|
||||||
procedure ShowHelpForIDEControl(Sender: TControl); virtual; abstract;
|
procedure ShowHelpForIDEControl(Sender: TControl); virtual; abstract;
|
||||||
function CreateHint(aHintWindow: THintWindow; ScreenPos: TPoint;
|
function CreateHint(aHintWindow: THintWindow; ScreenPos: TPoint;
|
||||||
|
@ -15,8 +15,6 @@ unit IDEMsgIntf;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, contnrs, Forms, Menus,
|
Classes, SysUtils, contnrs, Forms, Menus,
|
||||||
IDECommands, IDEExternToolIntf, MenuIntf, LazFileUtils;
|
IDECommands, IDEExternToolIntf, MenuIntf, LazFileUtils;
|
||||||
@ -312,790 +310,5 @@ begin
|
|||||||
fItems.Remove(Fix);
|
fItems.Remove(Fix);
|
||||||
end;
|
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.
|
end.
|
||||||
|
|
||||||
|
@ -18,10 +18,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLProc, Forms, Controls, Dialogs, PropEdits, LazHelpHTML,
|
Classes, SysUtils, LCLProc, Forms, Controls, Dialogs, PropEdits, LazHelpHTML,
|
||||||
IDEOptionsIntf, CompOptsIntf, ProjectIntf,
|
IDEOptionsIntf, CompOptsIntf, ProjectIntf,
|
||||||
{$IFNDEF EnableOldExtTools}
|
IDEExternToolIntf, SrcEditorIntf;
|
||||||
IDEExternToolIntf,
|
|
||||||
{$ENDIF}
|
|
||||||
SrcEditorIntf;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
// open file flags
|
// open file flags
|
||||||
@ -287,11 +284,7 @@ type
|
|||||||
function ShowProgress(const SomeText: string;
|
function ShowProgress(const SomeText: string;
|
||||||
Step, MaxStep: integer): boolean; virtual; abstract; // False if canceled by user
|
Step, MaxStep: integer): boolean; virtual; abstract; // False if canceled by user
|
||||||
function DoJumpToCompilerMessage(FocusEditor: boolean;
|
function DoJumpToCompilerMessage(FocusEditor: boolean;
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
Msg: TMessageLine = nil // if nil then it jumps to first message
|
Msg: TMessageLine = nil // if nil then it jumps to first message
|
||||||
{$ELSE}
|
|
||||||
Index:integer = -1
|
|
||||||
{$ENDIF}
|
|
||||||
): boolean; virtual; abstract;
|
): boolean; virtual; abstract;
|
||||||
procedure DoJumpToNextError(DirectionDown: boolean); virtual; abstract;
|
procedure DoJumpToNextError(DirectionDown: boolean); virtual; abstract;
|
||||||
procedure DoShowMessagesView(BringToFront: boolean = true); virtual; abstract;
|
procedure DoShowMessagesView(BringToFront: boolean = true); virtual; abstract;
|
||||||
|
@ -250,9 +250,7 @@ procedure TJcfIdeMain.LogIDEMessage(const psFile, psMessage: string;
|
|||||||
const piY, piX: integer);
|
const piY, piX: integer);
|
||||||
var
|
var
|
||||||
lazMessages: TIDEMessagesWindowInterface;
|
lazMessages: TIDEMessagesWindowInterface;
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
Urgency: TMessageLineUrgency;
|
Urgency: TMessageLineUrgency;
|
||||||
{$ENDIF}
|
|
||||||
begin
|
begin
|
||||||
{ no empty lines in this log }
|
{ no empty lines in this log }
|
||||||
if psMessage = '' then
|
if psMessage = '' then
|
||||||
@ -262,7 +260,6 @@ begin
|
|||||||
if lazMessages = nil then
|
if lazMessages = nil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
case peMessageType of
|
case peMessageType of
|
||||||
mtException,mtInputError,mtParseError: Urgency:=mluError;
|
mtException,mtInputError,mtParseError: Urgency:=mluError;
|
||||||
mtCodeWarning: Urgency:=mluWarning;
|
mtCodeWarning: Urgency:=mluWarning;
|
||||||
@ -270,14 +267,6 @@ begin
|
|||||||
mtProgress: Urgency:=mluProgress;
|
mtProgress: Urgency:=mluProgress;
|
||||||
end;
|
end;
|
||||||
lazMessages.AddCustomMessage(Urgency,psMessage, psFile, piY, piX, 'JCF')
|
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;
|
end;
|
||||||
|
|
||||||
procedure TJcfIdeMain.MakeEditorConverter;
|
procedure TJcfIdeMain.MakeEditorConverter;
|
||||||
|
@ -6,9 +6,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, SrcEditorIntf, IDEMsgIntf, LazIDEIntf, IDEOptionsIntf,
|
Classes, SysUtils, SrcEditorIntf, IDEMsgIntf, LazIDEIntf, IDEOptionsIntf,
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEExternToolIntf,
|
IDEExternToolIntf,
|
||||||
{$ENDIF}
|
|
||||||
Controls, SynEdit, EMScriptClasses, EMSStrings, Laz2_XMLCfg, uPSRuntime,
|
Controls, SynEdit, EMScriptClasses, EMSStrings, Laz2_XMLCfg, uPSRuntime,
|
||||||
uPSUtils, LazLoggerBase, LazFileUtils;
|
uPSUtils, LazLoggerBase, LazFileUtils;
|
||||||
|
|
||||||
@ -300,11 +298,7 @@ begin
|
|||||||
Exec.RunScript;
|
Exec.RunScript;
|
||||||
except
|
except
|
||||||
on e: Exception do
|
on e: Exception do
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(mluError,Format('%s: %s', [e.ClassName, e.Message]));
|
IDEMessagesWindow.AddCustomMessage(mluError,Format('%s: %s', [e.ClassName, e.Message]));
|
||||||
{$ELSE}
|
|
||||||
IDEMessagesWindow.AddMsg(Format('%s: %s', [e.ClassName, e.Message]), '', -1);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
if Exec.ExceptionCode <> erNoError then begin
|
if Exec.ExceptionCode <> erNoError then begin
|
||||||
ExObj := Exec.ExceptionObject;
|
ExObj := Exec.ExceptionObject;
|
||||||
@ -318,11 +312,7 @@ begin
|
|||||||
y := 0;
|
y := 0;
|
||||||
Exec.TranslatePositionEx(Exec.ExceptionProcNo, Exec.ExceptionPos, i, x, y, s2);
|
Exec.TranslatePositionEx(Exec.ExceptionProcNo, Exec.ExceptionPos, i, x, y, s2);
|
||||||
if IDEMessagesWindow <> nil then
|
if IDEMessagesWindow <> nil then
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(mluError,Format('%s: "%s" at %d/%d', [s, Exec.ExceptionString, x,y]));
|
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;
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
|
@ -112,9 +112,7 @@ uses
|
|||||||
srceditorintf,
|
srceditorintf,
|
||||||
ProjectIntf,
|
ProjectIntf,
|
||||||
IDEMsgIntf,
|
IDEMsgIntf,
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEExternToolIntf,
|
IDEExternToolIntf,
|
||||||
{$ENDIF}
|
|
||||||
CodeCache,
|
CodeCache,
|
||||||
CodeToolManager;
|
CodeToolManager;
|
||||||
|
|
||||||
@ -424,11 +422,7 @@ end;
|
|||||||
|
|
||||||
procedure TSQLSyntaxChecker.ShowMessage(const Msg: String);
|
procedure TSQLSyntaxChecker.ShowMessage(const Msg: String);
|
||||||
begin
|
begin
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(mluImportant,Msg,SourceFileName);
|
IDEMessagesWindow.AddCustomMessage(mluImportant,Msg,SourceFileName);
|
||||||
{$ELSE}
|
|
||||||
IDEMessagesWindow.AddMsg(SourceFileName+' : '+Msg,'',0,Nil);
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSQLSyntaxChecker.ShowMessage(const Fmt: String; Args: array of const);
|
procedure TSQLSyntaxChecker.ShowMessage(const Fmt: String; Args: array of const);
|
||||||
@ -477,37 +471,28 @@ Var
|
|||||||
S : TStringStream;
|
S : TStringStream;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$IFDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.BeginBlock(False);
|
|
||||||
{$ENDIF}
|
|
||||||
try
|
try
|
||||||
try
|
Handled:=False;
|
||||||
Handled:=False;
|
result:=mrNone;
|
||||||
result:=mrNone;
|
AE:=SourceEditorManagerIntf.ActiveEditor;
|
||||||
AE:=SourceEditorManagerIntf.ActiveEditor;
|
If (AE<>Nil) then
|
||||||
If (AE<>Nil) then
|
begin
|
||||||
|
E:=ExtractFileExt(AE.FileName);
|
||||||
|
FSFN:=ExtractFileName(AE.FileName);
|
||||||
|
Handled:=CompareText(E,'.sql')=0;
|
||||||
|
If Handled then
|
||||||
begin
|
begin
|
||||||
E:=ExtractFileExt(AE.FileName);
|
S:=TStringStream.Create(AE.SourceText);
|
||||||
FSFN:=ExtractFileName(AE.FileName);
|
try
|
||||||
Handled:=CompareText(E,'.sql')=0;
|
Result:=CheckSQL(S);
|
||||||
If Handled then
|
finally
|
||||||
begin
|
S.Free;
|
||||||
S:=TStringStream.Create(AE.SourceText);
|
end;
|
||||||
try
|
|
||||||
Result:=CheckSQL(S);
|
|
||||||
finally
|
|
||||||
S.Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
except
|
|
||||||
On E : Exception do
|
|
||||||
ShowException('Error during syntax check',E);
|
|
||||||
end;
|
end;
|
||||||
finally
|
except
|
||||||
{$IFDEF EnableOldExtTools}
|
On E : Exception do
|
||||||
IDEMessagesWindow.EndBlock;
|
ShowException('Error during syntax check',E);
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ type
|
|||||||
function RenameFile(const SrcFilename, DestFilename: string): TModalResult;
|
function RenameFile(const SrcFilename, DestFilename: string): TModalResult;
|
||||||
function MaybeBackupFile(const AFilename: string): TModalResult;
|
function MaybeBackupFile(const AFilename: string): TModalResult;
|
||||||
procedure ClearLog;
|
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;
|
function SaveLog: Boolean;
|
||||||
public
|
public
|
||||||
property MainFilenames: TStringlist read fMainFilenames;
|
property MainFilenames: TStringlist read fMainFilenames;
|
||||||
@ -787,17 +787,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TConvertSettings.AddLogLine(
|
function TConvertSettings.AddLogLine(
|
||||||
const ALine: string
|
const ALine: string; Urgency: TMessageLineUrgency
|
||||||
{$IFNDEF EnableOldExtTools}; Urgency: TMessageLineUrgency{$ENDIF}
|
|
||||||
): integer;
|
): integer;
|
||||||
begin
|
begin
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(Urgency,aLine); // Show in message window
|
IDEMessagesWindow.AddCustomMessage(Urgency,aLine); // Show in message window
|
||||||
Result:=fLog.Add(MessageLineUrgencyNames[Urgency]+': '+ALine);// and store for log.
|
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;
|
end;
|
||||||
|
|
||||||
function TConvertSettings.SaveLog: Boolean;
|
function TConvertSettings.SaveLog: Boolean;
|
||||||
@ -810,11 +804,7 @@ begin
|
|||||||
Code.Assign(fLog);
|
Code.Assign(fLog);
|
||||||
Result:=SaveCodeBuffer(Code)=mrOk;
|
Result:=SaveCodeBuffer(Code)=mrOk;
|
||||||
if Result then
|
if Result then
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
IDEMessagesWindow.AddCustomMessage(mluHint,'This log was saved to '+aFilename); // Show in message window
|
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;
|
end;
|
||||||
|
|
||||||
function TConvertSettings.GetBackupPath: String;
|
function TConvertSettings.GetBackupPath: String;
|
||||||
|
@ -42,10 +42,6 @@ uses
|
|||||||
// IDE
|
// IDE
|
||||||
IDEDialogs, ComponentReg, PackageIntf, IDEWindowIntf, DialogProcs,
|
IDEDialogs, ComponentReg, PackageIntf, IDEWindowIntf, DialogProcs,
|
||||||
CustomFormEditor, LazarusIDEStrConsts, IDEProcs,
|
CustomFormEditor, LazarusIDEStrConsts, IDEProcs,
|
||||||
{$IFNDEF EnableOldExtTools}
|
|
||||||
{$ELSE}
|
|
||||||
OutputFilter,
|
|
||||||
{$ENDIF}
|
|
||||||
EditorOptions, CheckLFMDlg, IDEMsgIntf, Project, SourceMarks,
|
EditorOptions, CheckLFMDlg, IDEMsgIntf, Project, SourceMarks,
|
||||||
// Converter
|
// Converter
|
||||||
ConverterTypes, ConvertSettings, ReplaceNamesUnit,
|
ConverterTypes, ConvertSettings, ReplaceNamesUnit,
|
||||||
|
Loading…
Reference in New Issue
Block a user