mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 05:18:00 +02:00
IDE: further migration external tools
git-svn-id: trunk@42295 -
This commit is contained in:
parent
d814f77dcf
commit
cf4f0b577b
@ -35,7 +35,7 @@ uses
|
||||
Classes, SysUtils, FileProcs, Forms, Controls, DialogProcs, Dialogs,
|
||||
contnrs, strutils,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, LazIDEIntf, FormEditor, IDEMsgIntf,
|
||||
LazarusIDEStrConsts, LazIDEIntf, FormEditor, IDEMsgIntf, IDEExternToolIntf,
|
||||
// codetools
|
||||
CodeToolManager, StdCodeTools, CodeTree, CodeAtom,
|
||||
FindDeclarationTool, PascalReaderTool, PascalParserTool, LFMTrees,
|
||||
@ -520,8 +520,7 @@ begin
|
||||
fCTLink.ResetMainScanner;
|
||||
if not fCTLink.SrcCache.Replace(gtNone, gtNone,
|
||||
FuncInfo.StartPos, FuncInfo.EndPos, NewFunc) then exit;
|
||||
fCTLink.fSettings.AddLogLine('Replaced call '+s);
|
||||
fCTLink.fSettings.AddLogLine(' with '+NewFunc);
|
||||
fCTLink.fSettings.AddLogLine('Replaced call '+s+' with '+NewFunc);
|
||||
// Add the required unit name to uses section if needed.
|
||||
if Assigned(AddUnitEvent) and (FuncInfo.UnitName<>'') then
|
||||
AddUnitEvent(FuncInfo.UnitName);
|
||||
|
@ -33,8 +33,8 @@ uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, IDEProcs,
|
||||
StdCtrls, EditBtn, Buttons, ExtCtrls, DialogProcs, ButtonPanel, ComCtrls,
|
||||
LazarusIDEStrConsts, CodeToolsStructs, CodeToolManager, CodeCache,
|
||||
DividerBevel, BaseIDEIntf, IDEMsgIntf, AVL_Tree, LazConfigStorage,
|
||||
ConverterTypes, ReplaceNamesUnit, ReplaceFuncsUnit;
|
||||
DividerBevel, BaseIDEIntf, IDEMsgIntf, IDEExternToolIntf, AVL_Tree,
|
||||
LazConfigStorage, ConverterTypes, ReplaceNamesUnit, ReplaceFuncsUnit;
|
||||
|
||||
type
|
||||
|
||||
@ -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): integer;
|
||||
function AddLogLine(const ALine: string {$IFDEF EnableNewExtTools}; Urgency: TMessageLineUrgency = mluHint{$ENDIF}): integer;
|
||||
function SaveLog: Boolean;
|
||||
public
|
||||
property MainFilenames: TStringlist read fMainFilenames;
|
||||
@ -785,10 +785,18 @@ begin
|
||||
fLog.Clear;
|
||||
end;
|
||||
|
||||
function TConvertSettings.AddLogLine(const ALine: string): integer;
|
||||
function TConvertSettings.AddLogLine(
|
||||
const ALine: string
|
||||
{$IFDEF EnableNewExtTools}; Urgency: TMessageLineUrgency{$ENDIF}
|
||||
): integer;
|
||||
begin
|
||||
{$IFDEF EnableNewExtTools}
|
||||
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;
|
||||
@ -801,7 +809,11 @@ begin
|
||||
Code.Assign(fLog);
|
||||
Result:=SaveCodeBuffer(Code)=mrOk;
|
||||
if Result then
|
||||
{$IFDEF EnableNewExtTools}
|
||||
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;
|
||||
|
@ -41,7 +41,11 @@ uses
|
||||
BasicCodeTools, CodeCache, CodeToolManager, CodeToolsStructs, CodeCompletionTool,
|
||||
// IDE
|
||||
IDEDialogs, ComponentReg, PackageIntf, IDEWindowIntf, DialogProcs,
|
||||
CustomFormEditor, LazarusIDEStrConsts, IDEProcs, OutputFilter,
|
||||
CustomFormEditor, LazarusIDEStrConsts, IDEProcs,
|
||||
{$IFDEF EnableNewExtTools}
|
||||
{$ELSE}
|
||||
OutputFilter,
|
||||
{$ENDIF}
|
||||
EditorOptions, CheckLFMDlg, IDEMsgIntf, Project,
|
||||
// Converter
|
||||
ConverterTypes, ConvertSettings, ReplaceNamesUnit,
|
||||
|
@ -33,7 +33,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Dialogs,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, IDEMsgIntf,
|
||||
LazarusIDEStrConsts, IDEMsgIntf, IDEExternToolIntf,
|
||||
// codetools
|
||||
CodeToolManager, StdCodeTools, CodeTree, CodeCache, CodeToolsStructs, AVL_Tree,
|
||||
LinkScanner, KeywordFuncLists, SourceChanger, CodeAtom, CodeToolsStrConsts,
|
||||
|
@ -35,24 +35,23 @@ uses
|
||||
Classes, SysUtils, AVL_Tree,
|
||||
// LCL
|
||||
LConvEncoding, InterfaceBase, LCLProc, Dialogs, FileUtil, Laz2_XMLCfg,
|
||||
LazUTF8, Forms, Controls,
|
||||
LazUTF8, LazUTF8Classes, Forms, Controls,
|
||||
// codetools
|
||||
ExprEval, BasicCodeTools, CodeToolManager, DefineTemplates, CodeCache,
|
||||
FileProcs, CodeToolsCfgScript, CodeToolsStructs,
|
||||
// IDEIntf
|
||||
SrcEditorIntf, ProjectIntf, MacroIntf, IDEDialogs, IDEExternToolIntf,
|
||||
CompOptsIntf, LazIDEIntf, MacroDefIntf,
|
||||
CompOptsIntf, LazIDEIntf, MacroDefIntf, IDEMsgIntf,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, DialogProcs, IDEProcs, CodeToolsOptions, InputHistory,
|
||||
EditDefineTree, ProjectResources, MiscOptions, LazConf, EnvironmentOpts,
|
||||
TransferMacros, CompilerOptions,
|
||||
{$IFDEF EnableNewExtTools}
|
||||
ExtTools,
|
||||
ExtTools, etMakeMsgParser, etFPCMsgParser,
|
||||
{$ELSE}
|
||||
OutputFilter,
|
||||
{$ENDIF}
|
||||
Compiler, FPCSrcScan,
|
||||
PackageDefs, PackageSystem, Project, ProjectIcon,
|
||||
Compiler, FPCSrcScan, PackageDefs, PackageSystem, Project, ProjectIcon,
|
||||
ModeMatrixOpts, BaseBuildManager, ApplicationBundle;
|
||||
|
||||
type
|
||||
@ -129,8 +128,12 @@ type
|
||||
function CTMacroFuncProjectUnitPath(Data: Pointer): boolean;
|
||||
function CTMacroFuncProjectIncPath(Data: Pointer): boolean;
|
||||
function CTMacroFuncProjectSrcPath(Data: Pointer): boolean;
|
||||
{$IFDEF EnableNewExtTools}
|
||||
procedure FPCMsgFilePoolLoadFile(aFilename: string; out s: string);
|
||||
{$ELSE}
|
||||
function OnRunCompilerWithOptions(ExtTool: TIDEExternalToolOptions;
|
||||
CompOptions: TBaseCompilerOptions): TModalResult;
|
||||
{$ENDIF}
|
||||
procedure SetUnitSetCache(const AValue: TFPCUnitSetCache);
|
||||
protected
|
||||
fTargetOS: string;
|
||||
@ -227,7 +230,9 @@ type
|
||||
var
|
||||
MainBuildBoss: TBuildManager = nil;
|
||||
TheCompiler: TCompiler = nil;
|
||||
{$IFNDEF EnableNewExtTools}
|
||||
TheOutputFilter: TOutputFilter = nil;
|
||||
{$ENDIF}
|
||||
|
||||
implementation
|
||||
|
||||
@ -311,7 +316,9 @@ begin
|
||||
FUnitSetChangeStamp:=TFPCUnitSetCache.GetInvalidChangeStamp;
|
||||
|
||||
OnBackupFileInteractive:=@BackupFile;
|
||||
{$IFNDEF EnableNewExtTools}
|
||||
RunCompilerWithOptions:=@OnRunCompilerWithOptions;
|
||||
{$ENDIF}
|
||||
|
||||
GetBuildMacroValues:=@OnGetBuildMacroValues;
|
||||
OnAppendCustomOption:=@AppendMatrixCustomOption;
|
||||
@ -322,12 +329,13 @@ destructor TBuildManager.Destroy;
|
||||
begin
|
||||
{$IFDEF EnableNewExtTools}
|
||||
FreeAndNil(ExternalTools);
|
||||
{$ELSE}
|
||||
RunCompilerWithOptions:=nil;
|
||||
{$ENDIF}
|
||||
|
||||
GetBuildMacroValues:=nil;
|
||||
OnAppendCustomOption:=nil;
|
||||
OnBackupFileInteractive:=nil;
|
||||
RunCompilerWithOptions:=nil;
|
||||
|
||||
FreeAndNil(FFPCSrcScans);
|
||||
|
||||
@ -1205,9 +1213,15 @@ function TBuildManager.CheckAmbiguousSources(const AFilename: string;
|
||||
begin
|
||||
Result:=mrOk;
|
||||
if Compiling then begin
|
||||
{$IFDEF EnableNewExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluError,
|
||||
Format('ambiguous file found: %s%s%s. Source file is: %s%s%s',
|
||||
['"', AmbiguousFilename, '"', '"', AFilename, '"']));
|
||||
{$ELSE}
|
||||
TheOutputFilter.ReadConstLine(
|
||||
Format(lisWarningAmbiguousFileFoundSourceFileIs,
|
||||
['"', AmbiguousFilename, '"', '"', AFilename, '"']), true);
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2100,6 +2114,27 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF EnableNewExtTools}
|
||||
procedure TBuildManager.FPCMsgFilePoolLoadFile(aFilename: string; out s: string
|
||||
);
|
||||
// Note: called by any thread
|
||||
var
|
||||
fs: TFileStreamUTF8;
|
||||
Encoding: String;
|
||||
begin
|
||||
s:='';
|
||||
fs := TFileStreamUTF8.Create(aFilename, fmOpenRead or fmShareDenyNone);
|
||||
try
|
||||
SetLength(s,fs.Size);
|
||||
if s<>'' then
|
||||
fs.Read(s[1],length(s));
|
||||
Encoding:=GuessEncoding(s);
|
||||
s:=ConvertEncoding(s,Encoding,EncodingUTF8);
|
||||
finally
|
||||
fs.Free;
|
||||
end;
|
||||
end;
|
||||
{$ELSE EnableNewExtTools}
|
||||
function TBuildManager.OnRunCompilerWithOptions(
|
||||
ExtTool: TIDEExternalToolOptions; CompOptions: TBaseCompilerOptions): TModalResult;
|
||||
begin
|
||||
@ -2110,6 +2145,7 @@ begin
|
||||
if LazarusIDE<>nil then
|
||||
LazarusIDE.DoCheckFilesOnDisk;
|
||||
end;
|
||||
{$ENDIF EnableNewExtTools}
|
||||
|
||||
procedure TBuildManager.SetUnitSetCache(const AValue: TFPCUnitSetCache);
|
||||
begin
|
||||
|
@ -136,7 +136,9 @@ type
|
||||
procedure mnuCenterWindowItemClick(Sender: TObject); virtual;
|
||||
procedure mnuWindowSourceItemClick(Sender: TObject); virtual;
|
||||
|
||||
{$IFNDEF EnableNewExtTools}
|
||||
procedure ConnectOutputFilter;
|
||||
{$ENDIF}
|
||||
procedure UpdateWindowMenu;
|
||||
|
||||
public
|
||||
@ -297,6 +299,7 @@ begin
|
||||
SourceEditorManager.ShowActiveWindowOnTop(True);
|
||||
end;
|
||||
|
||||
{$IFNDEF EnableNewExtTools}
|
||||
procedure TMainIDEBase.ConnectOutputFilter;
|
||||
begin
|
||||
TheOutputFilter.OnAddFilteredLine:=@MessagesView.AddMsg;
|
||||
@ -305,6 +308,7 @@ begin
|
||||
TheOutputFilter.OnBeginUpdate:=@MessagesView.BeginUpdateNotification;
|
||||
TheOutputFilter.OnEndUpdate:=@MessagesView.EndUpdateNotification;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TMainIDEBase.SetToolStatus(const AValue: TIDEToolStatus);
|
||||
begin
|
||||
|
@ -47,9 +47,9 @@ uses
|
||||
{$ELSE}
|
||||
MsgView,
|
||||
{$ENDIF}
|
||||
InputHistory, CheckLFMDlg, LCLMemManager,
|
||||
CodeToolManager, CodeToolsStructs, ConvCodeTool, CodeCache, CodeTree,
|
||||
FindDeclarationTool, BasicCodeTools, SynEdit, UnitResources;
|
||||
InputHistory, CheckLFMDlg, LCLMemManager, CodeToolManager, CodeToolsStructs,
|
||||
ConvCodeTool, CodeCache, CodeTree, FindDeclarationTool, BasicCodeTools,
|
||||
SynEdit, UnitResources, IDEExternToolIntf;
|
||||
|
||||
|
||||
type
|
||||
@ -974,7 +974,11 @@ begin
|
||||
if EMacro <> nil then begin
|
||||
EMacro.SetFromSource(AEditor.SourceText);
|
||||
if EMacro.IsInvalid and (EMacro.ErrorMsg <> '') then
|
||||
{$IFDEF EnableNewExtTools}
|
||||
IDEMessagesWindow.AddCustomMessage(mluError,EMacro.ErrorMsg);
|
||||
{$ELSE}
|
||||
MessagesView.AddMsg(EMacro.ErrorMsg, '', -1);
|
||||
{$ENDIF}
|
||||
end;
|
||||
MacroListViewer.UpdateDisplay;
|
||||
AnUnitInfo.ClearModifieds;
|
||||
|
Loading…
Reference in New Issue
Block a user