IDE: clean up old external tools

git-svn-id: trunk@45942 -
This commit is contained in:
mattias 2014-07-20 19:47:30 +00:00
parent 2a1a95199f
commit abaf3fb59c
12 changed files with 12 additions and 4059 deletions

3
.gitattributes vendored
View File

@ -5468,8 +5468,6 @@ ide/modematrixopts.pas svneol=native#text/plain
ide/mouseactiondialog.lfm svneol=native#text/plain
ide/mouseactiondialog.pas svneol=native#text/pascal
ide/msgquickfixes.pas svneol=native#text/plain
ide/msgview.lfm svneol=native#text/plain
ide/msgview.pp svneol=native#text/pascal
ide/msgvieweditor.lfm svneol=native#text/plain
ide/msgvieweditor.pas svneol=native#text/pascal
ide/multireplacedlg.lfm svneol=native#text/plain
@ -5479,7 +5477,6 @@ ide/newdialog.pas svneol=native#text/pascal
ide/newprojectdlg.lfm svneol=native#text/plain
ide/newprojectdlg.pp svneol=native#text/pascal
ide/objectlists.pas svneol=native#text/pascal
ide/outputfilter.pas svneol=native#text/pascal
ide/patheditordlg.lfm svneol=native#text/pascal
ide/patheditordlg.pas svneol=native#text/pascal
ide/procedurelist.lfm svneol=native#text/plain

View File

@ -50,10 +50,7 @@ uses
CodeToolManager,
// IDEIntf
LazIDEIntf, IDEMsgIntf, IDEHelpIntf, IDEImagesIntf, IDEWindowIntf, IDEDialogs,
PackageIntf,
{$IFNDEF EnableOldExtTools}
IDEExternToolIntf,
{$ENDIF}
PackageIntf, IDEExternToolIntf,
// IDE
LazarusIDEStrConsts, TransferMacros, LazConf, IDEProcs, DialogProcs,
MainBar, ExtToolEditDlg, EnvironmentOpts,
@ -190,9 +187,6 @@ type
// This is used by MakeLazarus and SaveIDEMakeOptions
function CreateIDEMakeOptions(Flags: TBuildLazarusFlags): TModalResult;
public
{$IFDEF EnableOldExtTools}
ExternalTools: TBaseExternalToolList;
{$ENDIF}
constructor Create;
function ShowConfigureBuildLazarusDlg(AProfiles: TBuildLazarusProfiles): TModalResult;
function MakeLazarus(Profile: TBuildLazarusProfile; Flags: TBuildLazarusFlags): TModalResult;
@ -373,11 +367,7 @@ end;
function TLazarusBuilder.MakeLazarus(Profile: TBuildLazarusProfile;
Flags: TBuildLazarusFlags): TModalResult;
var
{$IFNDEF EnableOldExtTools}
Tool: TAbstractExternalTool;
{$ELSE}
Tool: TExternalToolOptions;
{$ENDIF}
Executable, CmdLineParams, Cmd: String;
EnvironmentOverrides: TStringList;
@ -392,7 +382,6 @@ var
Params:=Cmd+' '+Params
else
Params:=Cmd;
{$IFNDEF EnableOldExtTools}
Tool:=ExternalToolList.Add(CurTitle);
Tool.Reference(Self,ClassName);
try
@ -411,18 +400,6 @@ var
finally
Tool.Release(Self);
end;
{$ELSE}
if Tool=nil then
Tool:=TExternalToolOptions.Create;
Tool.Title:=CurTitle;
Tool.Filename:=Executable;
Tool.WorkingDirectory:=fWorkingDir;
Tool.ScanOutputForFPCMessages:=true;
Tool.ScanOutputForMakeMessages:=true;
Tool.CmdLineParams:=Params;
Tool.EnvironmentOverrides.Assign(EnvironmentOverrides);
Result:=ExternalTools.Run(Tool,fMacros,false);
{$ENDIF}
end;
var
@ -523,9 +500,6 @@ begin
Result:=mrOk;
finally
EnvironmentOverrides.Free;
{$IFDEF EnableOldExtTools}
Tool.Free;
{$ENDIF}
if LazarusIDE<>nil then
LazarusIDE.MainBarSubTitle:='';
end;
@ -734,22 +708,14 @@ begin
if not (Result in [mrOk,mrIgnore]) then begin
debugln(['CreateAppleBundle CreateApplicationBundle failed']);
if IDEMessagesWindow<>nil then
{$IFNDEF EnableOldExtTools}
IDEMessagesWindow.AddCustomMessage(mluError,'to create application bundle '+BundleDir);
{$ELSE}
IDEMessagesWindow.AddMsg('Error: failed to create application bundle '+BundleDir,fTargetDir,-1);
{$ENDIF}
exit;
end;
Result:=CreateAppBundleSymbolicLink(fTargetFilename);
if not (Result in [mrOk,mrIgnore]) then begin
debugln(['CreateAppleBundle CreateAppBundleSymbolicLink failed']);
if IDEMessagesWindow<>nil then
{$IFNDEF EnableOldExtTools}
IDEMessagesWindow.AddCustomMessage(mluError,'failed to create application bundle symlink to '+fTargetFilename);
{$ELSE}
IDEMessagesWindow.AddMsg('Error: failed to create application bundle symlink to '+fTargetFilename,fTargetDir,-1);
{$ENDIF}
exit;
end;
end;

View File

@ -42,20 +42,13 @@ uses
ExprEval, BasicCodeTools, CodeToolManager, DefineTemplates, CodeCache,
FileProcs, CodeToolsCfgScript, CodeToolsStructs,
// IDEIntf
{$IFDEF EnableOldExtTools}
SrcEditorIntf,
{$ENDIF}
ProjectIntf, MacroIntf, IDEDialogs, IDEExternToolIntf,
CompOptsIntf, LazIDEIntf, MacroDefIntf, IDEMsgIntf,
// IDE
LazarusIDEStrConsts, DialogProcs, IDEProcs, CodeToolsOptions, InputHistory,
EditDefineTree, ProjectResources, MiscOptions, LazConf, EnvironmentOpts,
TransferMacros, CompilerOptions,
{$IFNDEF EnableOldExtTools}
ExtTools, etMakeMsgParser, etFPCMsgParser,
{$ELSE}
OutputFilter,
{$ENDIF}
Compiler, FPCSrcScan, PackageDefs, PackageSystem, Project, ProjectIcon,
ModeMatrixOpts, BaseBuildManager, ApplicationBundle;
@ -148,11 +141,6 @@ type
function CTMacroFuncProjectUnitPath(Data: Pointer): boolean;
function CTMacroFuncProjectIncPath(Data: Pointer): boolean;
function CTMacroFuncProjectSrcPath(Data: Pointer): boolean;
{$IFNDEF EnableOldExtTools}
{$ELSE}
function OnRunCompilerWithOptions(ExtTool: TIDEExternalToolOptions;
CompOptions: TBaseCompilerOptions): TModalResult;
{$ENDIF}
procedure OnProjectDestroy(Sender: TObject);
procedure SetUnitSetCache(const AValue: TFPCUnitSetCache);
protected
@ -177,9 +165,7 @@ type
destructor Destroy; override;
procedure SetupTransferMacros;
procedure TranslateMacros;
{$IFNDEF EnableOldExtTools}
procedure SetupExternalTools;
{$ENDIF}
procedure SetupCompilerInterface;
procedure SetupInputHistories;
@ -243,9 +229,6 @@ type
var
MainBuildBoss: TBuildManager = nil;
TheCompiler: TCompiler = nil;
{$IFDEF EnableOldExtTools}
TheOutputFilter: TOutputFilter = nil;
{$ENDIF}
implementation
@ -337,9 +320,6 @@ begin
FUnitSetChangeStamp:=TFPCUnitSetCache.GetInvalidChangeStamp;
OnBackupFileInteractive:=@BackupFile;
{$IFDEF EnableOldExtTools}
RunCompilerWithOptions:=@OnRunCompilerWithOptions;
{$ENDIF}
GetBuildMacroValues:=@OnGetBuildMacroValues;
OnAppendCustomOption:=@AppendMatrixCustomOption;
@ -348,11 +328,7 @@ end;
destructor TBuildManager.Destroy;
begin
{$IFNDEF EnableOldExtTools}
FreeAndNil(ExternalTools);
{$ELSE}
RunCompilerWithOptions:=nil;
{$ENDIF}
GetBuildMacroValues:=nil;
OnAppendCustomOption:=nil;
@ -508,7 +484,6 @@ begin
tr('MakeFile',lisTMFunctionChompPathDelimiter);
end;
{$IFNDEF EnableOldExtTools}
procedure TBuildManager.SetupExternalTools;
begin
// setup the external tool queue
@ -519,16 +494,10 @@ begin
FPCMsgFilePool:=TFPCMsgFilePool.Create(nil);
end;
{$ENDIF}
procedure TBuildManager.SetupCompilerInterface;
begin
TheCompiler := TCompiler.Create;
{$IFDEF EnableOldExtTools}
with TheCompiler do begin
OutputFilter:=TheOutputFilter;
end;
{$ENDIF}
end;
procedure TBuildManager.SetupInputHistories;
@ -1371,15 +1340,9 @@ function TBuildManager.CheckAmbiguousSources(const AFilename: string;
begin
Result:=mrOk;
if Compiling then begin
{$IFNDEF EnableOldExtTools}
IDEMessagesWindow.AddCustomMessage(mluError,
Format('ambiguous file found: "%s". Source file is: "%s"',
[AmbiguousFilename, AFilename]));
{$ELSE}
TheOutputFilter.ReadConstLine(
Format(lisWarningAmbiguousFileFoundSourceFileIs,
[AmbiguousFilename, AFilename]), true);
{$ENDIF}
end;
end;
@ -2275,20 +2238,6 @@ begin
end;
end;
{$IFNDEF EnableOldExtTools}
{$ELSE EnableOldExtTools}
function TBuildManager.OnRunCompilerWithOptions(
ExtTool: TIDEExternalToolOptions; CompOptions: TBaseCompilerOptions): TModalResult;
begin
if SourceEditorManagerIntf<>nil then
SourceEditorManagerIntf.ClearErrorLines;
Result:=EnvironmentOptions.ExternalTools.Run(ExtTool,GlobalMacroList,false,
CompOptions);
if LazarusIDE<>nil then
LazarusIDE.DoCheckFilesOnDisk;
end;
{$Endif EnableOldExtTools}
procedure TBuildManager.SetUnitSetCache(const AValue: TFPCUnitSetCache);
begin
if FUnitSetCache=AValue then exit;

View File

@ -41,9 +41,6 @@ uses
Dialogs, LazConfigStorage, Laz2_XMLCfg, LazUTF8,
// IDEIntf
ProjectIntf, ObjectInspector, IDEWindowIntf, IDEOptionsIntf,
{$IFDEF EnableOldExtTools}
CompOptsIntf,
{$ENDIF}
ComponentReg, IDEExternToolIntf, IDEDialogs, MacroDefIntf,
DbgIntfDebuggerBase,
// IDE
@ -222,7 +219,6 @@ const
);
{ External Tools - the user menu items in the Tools menu }
{$IFNDEF EnableOldExtTools}
type
TBaseExternalUserTools = class
public
@ -233,21 +229,6 @@ type
TExternalUserToolsClass = class of TBaseExternalUserTools;
var
ExternalUserToolsClass: TExternalUserToolsClass; // set by ExtToolEditDlg to TExternalUserTools
{$ELSE}
type
TBaseExternalToolList = class(TList)
public
function Load(Config: TConfigStorage; const Path: string): TModalResult; virtual; abstract;
function Save(Config: TConfigStorage; const Path: string): TModalResult; virtual; abstract;
function Run(ExtTool: TIDEExternalToolOptions;
Macros: TTransferMacroList;
ShowAbort: boolean;
CompilerOptions: TLazCompilerOptions = nil): TModalResult; virtual; abstract;
end;
TExternalToolListClass = class of TBaseExternalToolList;
var
ExternalToolListClass: TExternalToolListClass; // set by ExtToolDialog
{$ENDIF}
type
TEnvOptParseType = (
@ -362,9 +343,7 @@ type
fMsgViewColors: array[TMsgWndColor] of TColor;
FShowCompileDialog: Boolean; // show dialog during compile
FAutoCloseCompileDialog: Boolean; // auto close dialog after succesed compile
{$IFNDEF EnableOldExtTools}
FMsgViewFilters: TLMsgViewFilters;
{$ENDIF}
// compiler + debugger + lazarus files
FParseValues: array[TEnvOptParseType] of TParseString;
@ -417,12 +396,8 @@ type
FBackupInfoOtherFiles: TBackupInfo;
// external tools
{$IFNDEF EnableOldExtTools}
fExternalUserTools: TBaseExternalUserTools; // see ExtToolEditDlg.TExternalUserTools
{$ELSE}
fExternalTools: TBaseExternalToolList;
{$ENDIF}
// naming conventions
fPascalFileExtension: TPascalExtType;
fCharcaseFileAction : TCharCaseFileAction;
@ -712,12 +687,7 @@ type
write FBackupInfoOtherFiles;
// external tools
{$IFNDEF EnableOldExtTools}
property ExternalToolMenuItems: TBaseExternalUserTools read fExternalUserTools;
{$ELSE}
property ExternalTools: TBaseExternalToolList read fExternalTools
write fExternalTools;
{$ENDIF}
// naming conventions
property PascalFileExtension: TPascalExtType read fPascalFileExtension
@ -754,9 +724,7 @@ type
property MsgViewFilenameStyle: TMsgWndFileNameStyle read FMsgViewFilenameStyle
write FMsgViewFilenameStyle;
property MsgViewColors[c: TMsgWndColor]: TColor read GetMsgViewColors write SetMsgViewColors;
{$IFNDEF EnableOldExtTools}
property MsgViewFilters: TLMsgViewFilters read FMsgViewFilters write FMsgViewFilters;
{$ENDIF}
// glyphs
property ShowButtonGlyphs: TApplicationShowGlyphs read FShowButtonGlyphs write FShowButtonGlyphs;
@ -1007,9 +975,7 @@ begin
FMsgViewFilenameStyle:=mwfsShort;
for c:=low(TMsgWndColor) to high(TMsgWndColor) do
fMsgViewColors[c]:=MsgWndDefaultColors[c];
{$IFNDEF EnableOldExtTools}
FMsgViewFilters:=TLMsgViewFilters.Create(nil);
{$ENDIF}
// glyphs
FShowButtonGlyphs := sbgSystem;
@ -1058,12 +1024,8 @@ begin
end;
// external tools
{$IFNDEF EnableOldExtTools}
fExternalUserTools:=ExternalUserToolsClass.Create;
{$ELSE}
fExternalTools:=ExternalToolListClass.Create;
{$ENDIF}
// naming
fPascalFileExtension:=petPAS;
fCharcaseFileAction:=ccfaAutoRename;
@ -1084,12 +1046,8 @@ var
i: Integer;
begin
FreeAndNil(FBuildMatrixOptions);
{$IFNDEF EnableOldExtTools}
FreeAndNil(FMsgViewFilters);
FreeAndNil(fExternalUserTools);
{$ELSE}
FreeAndNil(fExternalTools);
{$ENDIF}
FreeAndNil(FRecentOpenFiles);
FreeAndNil(FRecentProjectFiles);
FreeAndNil(FRecentPackageFiles);
@ -1475,9 +1433,7 @@ begin
for mwc:=low(TMsgWndColor) to high(TMsgWndColor) do
fMsgViewColors[mwc]:=XMLConfig.GetValue(
Path+'MsgView/Colors/'+MsgWndColorNames[mwc],MsgWndDefaultColors[mwc]);
{$IFNDEF EnableOldExtTools}
MsgViewFilters.LoadFromXMLConfig(XMLConfig,'MsgView/Filters/');
{$ENDIF}
// glyphs
FShowButtonGlyphs := TApplicationShowGlyphs(XMLConfig.GetValue(Path+'ShowButtonGlyphs/Value',
@ -1512,11 +1468,7 @@ begin
end;
// external tools
{$IFNDEF EnableOldExtTools}
fExternalUserTools.Load(FConfigStore,Path+'ExternalTools/');
{$ELSE}
fExternalTools.Load(FConfigStore,Path+'ExternalTools/');
{$ENDIF}
// naming
LoadPascalFileExt(Path+'');
@ -1864,9 +1816,7 @@ begin
for mwc:=low(TMsgWndColor) to high(TMsgWndColor) do
XMLConfig.SetDeleteValue(Path+'MsgView/Colors/'+MsgWndColorNames[mwc],
fMsgViewColors[mwc],MsgWndDefaultColors[mwc]);
{$IFNDEF EnableOldExtTools}
MsgViewFilters.SaveToXMLConfig(XMLConfig,'MsgView/Filters/');
{$ENDIF}
// glyphs
XMLConfig.SetDeleteValue(Path+'ShowButtonGlyphs/Value',
@ -1891,11 +1841,7 @@ begin
XMLConfig.SetDeleteValue(Path+'Recent/AlreadyPopulated', FAlreadyPopulatedRecentFiles, false);
// external tools
{$IFNDEF EnableOldExtTools}
fExternalUserTools.Save(FConfigStore,Path+'ExternalTools/');
{$ELSE}
fExternalTools.Save(FConfigStore,Path+'ExternalTools/');
{$ENDIF}
// naming
XMLConfig.SetDeleteValue(Path+'Naming/PascalFileExtension',

View File

@ -27,8 +27,6 @@ unit etMessageFrame;
{$mode objfpc}{$H+}
{$IFDEF EnableOldExtTools}{$Error Wrong}{$ENDIF}
{$I ide.inc}
interface

View File

@ -42,73 +42,15 @@ uses
Buttons, StdCtrls, ComCtrls, Dialogs, ExtCtrls, ButtonPanel, Menus,
FileProcs,
IDEExternToolIntf, IDEImagesIntf, IDEDialogs, IDEHelpIntf, IDECommands,
{$IFDEF EnableOldExtTools}
LazConfigStorage, UTF8Process, CompOptsIntf,
{$ENDIF}
ProjectIntf,
EnvironmentOpts,
ExtToolEditDlg, KeyMapping, TransferMacros, IDEProcs, LazFileUtils,
CompilerOptions,
{$IFDEF EnableOldExtTools}
InfoBuild, OutputFilter,
{$ENDIF}
LazarusIDEStrConsts, IDEOptionDefs, EditorOptions;
const
MaxExtTools = ecExtToolLast-ecExtToolFirst+1;
{$IFNDEF EnableOldExtTools}
{$ELSE EnableOldExtTools}
type
TOnNeedsOutputFilter = procedure(var OutputFilter: TOutputFilter;
var Abort: boolean) of object;
TOnFreeOutputFilter = procedure(OutputFilter: TOutputFilter;
ErrorOccurred: boolean) of object;
{ TExternalToolList -
the storage object for all external tools }
TExternalToolList = class(TBaseExternalToolList)
private
fOnFreeOutputFilter: TOnFreeOutputFilter;
fOnNeedsOutputFilter: TOnNeedsOutputFilter;
fRunningTools: TList; // list of TProcess
fAllKeys: TKeyCommandRelationList;
function GetToolOpts(Index: integer): TExternalToolOptions;
procedure SetToolOpts(Index: integer; NewTool: TExternalToolOptions);
procedure AddRunningTool(TheProcess: TProcess; ExecuteProcess: boolean);
public
procedure Add(NewTool: TExternalToolOptions);
procedure Assign(Source: TExternalToolList);
procedure Clear; override;
constructor Create;
procedure Delete(Index: integer);
destructor Destroy; override;
procedure FreeStoppedProcesses;
procedure Insert(Index: integer; NewTool: TExternalToolOptions);
function Load(Config: TConfigStorage): TModalResult;
function Load(Config: TConfigStorage; const Path: string): TModalResult; override;
procedure LoadShortCuts(KeyCommandRelationList: TKeyCommandRelationList);
function Run(ExtTool: TIDEExternalToolOptions;
Macros: TTransferMacroList;
ShowAbort: boolean;
CompilerOptions: TLazCompilerOptions = nil): TModalResult; override;
function Run(Index: integer; Macros: TTransferMacroList;
ShowAbort: boolean): TModalResult;
function Save(Config: TConfigStorage): TModalResult;
function Save(Config: TConfigStorage; const Path: string): TModalResult; override;
procedure SaveShortCuts(KeyCommandRelationList: TKeyCommandRelationList);
property Items[Index: integer]: TExternalToolOptions
read GetToolOpts write SetToolOpts; default;
property OnFreeOutputFilter: TOnFreeOutputFilter
read fOnFreeOutputFilter write fOnFreeOutputFilter;
property OnNeedsOutputFilter: TOnNeedsOutputFilter
read fOnNeedsOutputFilter write fOnNeedsOutputFilter;
end;
{$Endif EnableOldExtTools}
type
{ TExternalToolDialog -
the dialog to edit all external tools }
@ -143,34 +85,29 @@ type
procedure MoveDownButtonClick(Sender: TObject);
procedure ListboxClick(Sender: TObject);
private
{$IFNDEF EnableOldExtTools}
fExtToolList: TExternalUserTools;
{$ELSE}
fExtToolList: TExternalToolList;
{$ENDIF}
fTransferMacros: TTransferMacroList;
procedure Load;
procedure SetExtToolList(NewExtToolList: {$IFNDEF EnableOldExtTools}TExternalUserTools{$ELSE}TExternalToolList{$ENDIF});
procedure SetExtToolList(NewExtToolList: TExternalUserTools);
procedure SetTransferMacros(NewMacros: TTransferMacroList);
function ToolDescription(Index: integer): string;
procedure EnableButtons;
public
constructor Create(AnOwner: TComponent); override;
destructor Destroy; override;
property ExtToolList: {$IFNDEF EnableOldExtTools}TExternalUserTools{$ELSE}TExternalToolList{$ENDIF}
read fExtToolList write SetExtToolList;
property ExtToolList: TExternalUserTools read fExtToolList write SetExtToolList;
property TransferMacros: TTransferMacroList
read fTransferMacros write SetTransferMacros;
end;
function ShowExtToolDialog(ExtToolList: {$IFNDEF EnableOldExtTools}TExternalUserTools{$ELSE}TExternalToolList{$ENDIF};
function ShowExtToolDialog(ExtToolList: TExternalUserTools;
TransferMacros: TTransferMacroList):TModalResult;
implementation
{$R *.lfm}
function ShowExtToolDialog(ExtToolList: {$IFNDEF EnableOldExtTools}TExternalUserTools{$ELSE}TExternalToolList{$ENDIF};
function ShowExtToolDialog(ExtToolList: TExternalUserTools;
TransferMacros: TTransferMacroList):TModalResult;
var
ExternalToolDialog: TExternalToolDialog;
@ -188,369 +125,6 @@ begin
end;
end;
{$IFNDEF EnableOldExtTools}
{$ELSE EnableOldExtTools}
{ TExternalToolList }
function TExternalToolList.GetToolOpts(Index: integer): TExternalToolOptions;
begin
Result:=TExternalToolOptions(inherited Items[Index]);
end;
procedure TExternalToolList.SetToolOpts(Index: integer;
NewTool: TExternalToolOptions);
begin
inherited Items[Index]:=NewTool;
end;
procedure TExternalToolList.Add(NewTool: TExternalToolOptions);
begin
inherited Add(NewTool);
end;
procedure TExternalToolList.Assign(Source: TExternalToolList);
var
i: integer;
begin
if Source=Self then exit;
Clear;
if Source=nil then exit;
Count:=Source.Count;
for i:=0 to Count-1 do begin
Items[i]:=TExternalToolOptions.Create;
Items[i].Assign(Source[i]);
end;
end;
constructor TExternalToolList.Create;
begin
inherited Create;
Clear;
end;
procedure TExternalToolList.Delete(Index: integer);
begin
Items[Index].Free;
inherited Delete(Index);
end;
destructor TExternalToolList.Destroy;
var
i: Integer;
begin
FreeStoppedProcesses;
if fRunningTools<>nil then begin
for i:=0 to fRunningTools.Count-1 do
TProcess(fRunningTools[i]).Free;
fRunningTools.Free;
end;
fAllKeys.Free;
inherited Destroy;
end;
procedure TExternalToolList.Clear;
var
i: integer;
begin
for i:=0 to Count-1 do
TExternalToolOptions(Items[i]).Free;
inherited Clear;
end;
procedure TExternalToolList.Insert(Index: integer; NewTool: TExternalToolOptions);
begin
inherited Insert(Index,NewTool);
end;
function TExternalToolList.Load(Config: TConfigStorage): TModalResult;
var
i: integer;
NewTool: TExternalToolOptions;
begin
Clear;
Count:=Config.GetValue('Count',0);
for i:=0 to Count-1 do begin
NewTool:=TExternalToolOptions.Create;
Items[i]:=NewTool;
Config.AppendBasePath('Tool'+IntToStr(i+1)+'/');
try
if NewTool.Load(Config)<>mrOk then exit;
finally
Config.UndoAppendBasePath;
end;
end;
Result:=mrOk;
end;
function TExternalToolList.Load(Config: TConfigStorage; const Path: string
): TModalResult;
begin
if Path<>'' then
Config.AppendBasePath(Path);
try
Result:=Load(Config);
finally
if Path<>'' then
Config.UndoAppendBasePath;
end;
end;
procedure TExternalToolList.LoadShortCuts(KeyCommandRelationList: TKeyCommandRelationList);
var
i: integer;
KeyCommandRelation: TKeyCommandRelation;
begin
if not assigned(fAllKeys) then
fAllKeys:=TKeyCommandRelationList.Create;
fAllKeys.Assign(KeyCommandRelationList);
for i:=0 to Count-1 do begin
KeyCommandRelation:=KeyCommandRelationList.FindByCommand(ecExtToolFirst+i);
if KeyCommandRelation<>nil then begin
Items[i].Key:=KeyCommandRelation.ShortcutA.Key1;
Items[i].Shift:=KeyCommandRelation.ShortcutA.Shift1;
end else begin
Items[i].Key:=VK_UNKNOWN;
Items[i].Shift:=[];
end;
end;
end;
function TExternalToolList.Run(Index: integer;
Macros: TTransferMacroList; ShowAbort: boolean): TModalResult;
begin
Result:=mrCancel;
if (Index<0) or (Index>=Count) then exit;
Result:=Run(Items[Index],Macros,ShowAbort);
end;
function TExternalToolList.Run(ExtTool: TIDEExternalToolOptions;
Macros: TTransferMacroList; ShowAbort: boolean;
CompilerOptions: TLazCompilerOptions): TModalResult;
var
WorkingDir, Filename, Params, CmdLine, Title: string;
TheProcess: TProcessUTF8;
Abort, ErrorOccurred: boolean;
NewFilename: String;
TheOutputFilter: TOutputFilter;
begin
Result:=mrCancel;
if ExtTool=nil then exit;
TheOutputFilter:=nil;
Filename:=ExtTool.Filename;
WorkingDir:=ExtTool.WorkingDirectory;
Params:=ExtTool.CmdLineParams;
Title:=ExtTool.Title;
if Title='' then Title:=Filename;
if (not Macros.SubstituteStr(Filename)) then exit;
if (not Macros.SubstituteStr(WorkingDir)) then exit;
if (not Macros.SubstituteStr(Params)) then exit;
// expand working directory
WorkingDir:=TrimAndExpandDirectory(WorkingDir);
if (WorkingDir<>'')
and (not DirPathExists(WorkingDir)) then begin
Result:=IDEMessageDialogAb(lisExtToolFailedToRunTool,
Format(lisExtToolUnableToRunTheTool, ['"', Title, '"', LineEnding,
Format(lisWorkingDirectoryNotFound, [WorkingDir])]),
mtError,[mbCancel],ShowAbort);
CompileProgress.Ready(lisExtToolUnableToRunTheTool, ['"', Title, '"', LineEnding,
Format(lisWorkingDirectoryNotFound, [WorkingDir])]);
exit;
end;
// expand file name
if not FilenameIsAbsolute(Filename) then begin
NewFilename:=FindProgram(Filename,GetCurrentDirUTF8,false);
if NewFilename='' then begin
Result:=IDEMessageDialogAb(lisExtToolFailedToRunTool,
Format(lisExtToolUnableToRunTheTool, ['"', Title, '"', LineEnding,
Format(lisProgramNotFound, [Filename])]),
mtError,[mbCancel],ShowAbort);
CompileProgress.Ready(lisExtToolUnableToRunTheTool, ['"', Title, '"', LineEnding,
Format(lisProgramNotFound, [Filename])]);
exit;
end;
Filename:=NewFilename;
end;
WorkingDir:=TrimFilename(WorkingDir);
Filename:=TrimFilename(Filename);
CmdLine:=Filename;
if Params<>'' then
CmdLine:=CmdLine+' '+Params;
DebugLn('[TExternalToolList.Run] CmdLine="',CmdLine,'" WorkDir="',WorkingDir,'"');
TheProcess:=nil;
try
try
CheckIfFileIsExecutable(Filename);
TheProcess := TOutputFilterProcess.Create(nil);
TheProcess.Executable := FileName;
SplitCmdLineParams(Params,TheProcess.Parameters);
TheProcess.Options:= [poUsePipes,poStdErrToOutPut];
if ExtTool.HideMainForm then
TheProcess.ShowWindow := swoHide
else
TheProcess.ShowWindow := swoShowNormal;
TheProcess.CurrentDirectory := WorkingDir;
if ExtTool.EnvironmentOverrides.Count>0 then
ExtTool.AssignEnvironmentTo(TheProcess.Environment);
if (ExtTool.NeedsOutputFilter) and (TheOutputFilter=nil)
and Assigned(OnNeedsOutputFilter) then begin
Abort:=false;
OnNeedsOutputFilter(TheOutputFilter,Abort);
if Abort then begin
CompileProgress.Ready(lisInfoBuildAbort);
Result:=mrAbort;
exit;
end;
end;
if TheOutputFilter<>nil then begin
ErrorOccurred:=false;
try
TheOutputFilter.CompilerOptions:=CompilerOptions as TBaseCompilerOptions;
TheOutputFilter.Options:=[ofoExceptionOnError,ofoMakeFilenamesAbsolute];
if ExtTool.ScanOutputForFPCMessages then
TheOutputFilter.Options:=TheOutputFilter.Options+[ofoSearchForFPCMessages];
if ExtTool.ScanOutputForMakeMessages then
TheOutputFilter.Options:=TheOutputFilter.Options+[ofoSearchForMakeMessages];
if ExtTool.ShowAllOutput then
TheOutputFilter.Options:=TheOutputFilter.Options+[ofoShowAll];
try
Result:=mrCancel;
try
if TheOutputFilter.Execute(TheProcess,Self,ExtTool) then begin
TheOutputFilter.ReadConstLine(Format(lisExtToolTitleCompleted,[Title]),true);
end;
if TheOutputFilter.ErrorExists then begin
ErrorOccurred:=true;
end;
finally
TheProcess.WaitOnExit;
FreeAndNil(TheProcess);
end;
if ErrorOccurred then
Result:=mrCancel
else if TheOutputFilter.Aborted then
Result:=mrAbort
else
Result:=mrOk;
except
on e: EOutputFilterError do begin
DebugLn('TExternalToolList.Run Exception: ',E.Message);
ErrorOccurred:=true;
end
else
raise
end;
finally
if Assigned(OnFreeOutputFilter) then
OnFreeOutputFilter(TheOutputFilter,ErrorOccurred);
end;
end else begin
AddRunningTool(TheProcess,true);
TheProcess:=nil;
Result:=mrOk;
end;
finally
FreeAndNil(TheProcess);
end;
except
on e: Exception do begin
DebugLn('TExternalToolList.Run ',lisExtToolFailedToRunTool, ' ', E.Message);
DumpExceptionBackTrace;
Result:=IDEMessageDialogAb(lisExtToolFailedToRunTool,
Format(lisExtToolUnableToRunTheTool, ['"', Title, '"', LineEnding, e.Message]),
mtError,[mbCancel],ShowAbort);
CompileProgress.Ready(lisExtToolUnableToRunTheTool,
['"', Title, '"', LineEnding, e.Message]);
end;
end;
end;
function TExternalToolList.Save(Config: TConfigStorage): TModalResult;
var
i: integer;
begin
Config.SetValue('Count',Count);
for i:=0 to Count-1 do begin
Config.AppendBasePath('Tool'+IntToStr(i+1)+'/');
try
if Items[i].Save(Config)<>mrOk then exit;
finally
Config.UndoAppendBasePath;
end;
end;
Result:=mrOk;
end;
function TExternalToolList.Save(Config: TConfigStorage; const Path: string): TModalResult;
begin
if Path<>'' then
Config.AppendBasePath(Path);
try
Result:=Save(Config);
finally
if Path<>'' then
Config.UndoAppendBasePath;
end;
end;
procedure TExternalToolList.SaveShortCuts(KeyCommandRelationList: TKeyCommandRelationList);
var
i: integer;
KeyCommandRelation: TKeyCommandRelation;
begin
KeyCommandRelationList.ExtToolCount:=Count;
for i:=0 to Count-1 do begin
KeyCommandRelation:=KeyCommandRelationList.FindByCommand(ecExtToolFirst+i);
if KeyCommandRelation<>nil then begin
KeyCommandRelation.ShortcutA:=IDEShortCut(Items[i].Key,Items[i].Shift,
VK_UNKNOWN,[]);
end else begin
DebugLn('[TExternalToolList.SaveShortCuts] Error: '
+'unable to save shortcut for external tool "',Items[i].Title,'"');
end;
end;
end;
procedure TExternalToolList.AddRunningTool(TheProcess: TProcess;
ExecuteProcess: boolean);
begin
if fRunningTools=nil then fRunningTools:=TList.Create;
fRunningTools.Add(TheProcess);
if ExecuteProcess then
TheProcess.Execute;
end;
procedure TExternalToolList.FreeStoppedProcesses;
var
i: integer;
TheProcess: TProcess;
begin
if fRunningTools=nil then exit;
i:=fRunningTools.Count-1;
while i>=0 do begin
try
TheProcess:=TProcess(fRunningTools[i]);
if not TheProcess.Running then begin
try
TheProcess.WaitOnExit;
TheProcess.Free;
finally
fRunningTools.Delete(i);
end;
end;
except
on E: Exception do begin
DebugLn('Error freeing stopped process: ',E.Message);
end;
end;
dec(i);
end;
end;
{$ENDIF}
{ TExternalToolDialog }
constructor TExternalToolDialog.Create(AnOwner: TComponent);
@ -581,11 +155,7 @@ begin
MoveUpButton.ImageIndex := IDEImages.LoadImage(16, 'arrow_up');
MoveDownButton.ImageIndex := IDEImages.LoadImage(16, 'arrow_down');
{$IFNDEF EnableOldExtTools}
fExtToolList:=TExternalUserTools.Create;
{$ELSE}
fExtToolList:=TExternalToolList.Create;
{$ENDIF}
end;
destructor TExternalToolDialog.Destroy;
@ -594,7 +164,7 @@ begin
inherited Destroy;
end;
procedure TExternalToolDialog.SetExtToolList(NewExtToolList: {$IFNDEF EnableOldExtTools}TExternalUserTools{$ELSE}TExternalToolList{$ENDIF});
procedure TExternalToolDialog.SetExtToolList(NewExtToolList: TExternalUserTools);
begin
if fExtToolList=NewExtToolList then exit;
fExtToolList.Assign(NewExtToolList);
@ -609,13 +179,7 @@ end;
function TExternalToolDialog.ToolDescription(Index: integer): string;
begin
{$IFNDEF EnableOldExtTools}
Result:=fExtToolList[Index].Title;
{$ELSE}
Result:=fExtToolList[Index].ShortDescription;
if Result='' then
Result:=fExtToolList[Index].Title;
{$ENDIF}
if Result='' then
Result:=ExtractFilename(fExtToolList[Index].Filename);
//DebugLn(['TExternalToolDialog.ToolDescription Index=',Index,' Result=',Result,' Cmd="',fExtToolList[Index].Filename,' ',fExtToolList[Index].CmdLineParams,'"']);
@ -636,11 +200,7 @@ end;
procedure TExternalToolDialog.AddButtonClick(Sender: TObject);
var
MsgResult: TModalResult;
{$IFNDEF EnableOldExtTools}
NewTool: TExternalUserTool;
{$ELSE}
NewTool: TExternalToolOptions;
{$ENDIF}
begin
if fExtToolList.Count>=MaxExtTools then begin
IDEMessageDialog(lisExtToolMaximumToolsReached,
@ -648,14 +208,8 @@ begin
mtInformation,[mbCancel]);
exit;
end;
{$IFNDEF EnableOldExtTools}
NewTool:=TExternalUserTool.Create(nil);
MsgResult:=ShowExtToolOptionDlg(fTransferMacros, NewTool, EditorOpts.KeyMap);
{$ELSE}
NewTool:=TExternalToolOptions.Create;
MsgResult:=ShowExtToolOptionDlg(fTransferMacros, NewTool,
TExternalToolList(EnvironmentOptions.ExternalTools).fAllKeys);
{$ENDIF}
if MsgResult=mrOk then
begin
fExtToolList.Add(NewTool);
@ -673,20 +227,12 @@ end;
procedure TExternalToolDialog.MenuItemCloneClick(Sender: TObject);
var
{$IFNDEF EnableOldExtTools}
NewTool, OldTool: TExternalUserTool;
{$ELSE}
NewTool, OldTool: TExternalToolOptions;
{$ENDIF}
begin
If Listbox.ItemIndex <> -1 Then Begin
OldTool := fExtToolList.Items[Listbox.ItemIndex];
If Assigned(OldTool) Then Begin
{$IFNDEF EnableOldExtTools}
NewTool:=TExternalUserTool.Create(nil);
{$ELSE}
NewTool:=TExternalToolOptions.Create;
{$ENDIF}
NewTool.Assign(OldTool);
fExtToolList.Add(NewTool);
Listbox.Items.Add(ToolDescription(fExtToolList.Count-1));
@ -716,18 +262,10 @@ end;
procedure TExternalToolDialog.MenuItemImportClick(Sender: TObject);
Var
FileConfig: TXMLOptionsStorage;
{$IFNDEF EnableOldExtTools}
NewToolList: TExternalUserTools;
{$ELSE}
NewToolList : TExternalToolList;
{$ENDIF}
begin
If OpenDialog1.Execute Then Begin
{$IFNDEF EnableOldExtTools}
NewToolList := TExternalUserTools.Create;
{$ELSE}
NewToolList := TExternalToolList.Create;
{$ENDIF}
FileConfig := TXMLOptionsStorage.Create(OpenDialog1.FileName, True);
NewToolList.Load(FileConfig);
SetExtToolList(NewToolList);
@ -750,14 +288,8 @@ var
begin
i:=Listbox.ItemIndex;
if i<0 then exit;
if ShowExtToolOptionDlg(fTransferMacros,fExtToolList[i],
{$IFNDEF EnableOldExtTools}
EditorOpts.KeyMap
{$ELSE}
TExternalToolList(EnvironmentOptions.ExternalTools).fAllKeys
{$ENDIF}
)=mrOk then
begin
if ShowExtToolOptionDlg(fTransferMacros,fExtToolList[i],EditorOpts.KeyMap)=mrOk
then begin
Listbox.Items[i]:=ToolDescription(i);
EnableButtons;
end;
@ -804,9 +336,4 @@ begin
EnableButtons;
end;
{$IFDEF EnableOldExtTools}
initialization
ExternalToolListClass:=TExternalToolList;
{$ENDIF}
end.

View File

@ -46,12 +46,7 @@ uses
IDEExternToolIntf,
// IDE
LazarusIDEStrConsts, TransferMacros, DialogProcs, IDEOptionDefs,
ObjInspExt, EnvironmentOpts, AboutFrm, Project, MainBar,
{$IFNDEF EnableOldExtTools}
etMessagesWnd,
{$ELSE}
OutputFilter, MsgView,
{$ENDIF}
ObjInspExt, EnvironmentOpts, AboutFrm, Project, MainBar, etMessagesWnd,
IDEFPDocFileSearch, PackageDefs, PackageSystem,
HelpOptions, MainIntf, LazConf, HelpFPCMessages, CodeHelp,
IDEContextHelpEdit, IDEWindowHelp, CodeBrowser;
@ -215,11 +210,7 @@ type
function ShowHelpForSourcePosition(const Filename: string;
const CodePos: TPoint;
var ErrMsg: string): TShowHelpResult; override;
{$IFNDEF EnableOldExtTools}
procedure ShowHelpForMessage; override;
{$ELSE}
procedure ShowHelpForMessage(Line: integer); override;
{$ENDIF}
procedure ShowHelpForObjectInspector(Sender: TObject); override;
procedure ShowHelpForIDEControl(Sender: TControl); override;
function CreateHint(aHintWindow: THintWindow; ScreenPos: TPoint;
@ -1597,7 +1588,6 @@ begin
CacheWasUsed,AnOwner);
end;
{$IFNDEF EnableOldExtTools}
procedure TIDEHelpManager.ShowHelpForMessage;
var
Line: TMessageLine;
@ -1610,33 +1600,6 @@ begin
Line.GetAttributes(Parts);
ShowHelpOrErrorForMessageLine(Line.Msg,Parts);
end;
{$ELSE EnableOldExtTools}
procedure TIDEHelpManager.ShowHelpForMessage(Line: integer);
function ParseMessage(MsgItem: TIDEMessageLine): TStringList;
begin
Result:=TStringList.Create;
Result.Values['Message']:=MsgItem.Msg;
if MsgItem.Parts<>nil then
Result.Assign(MsgItem.Parts);
end;
var
MsgItem: TIDEMessageLine;
MessageParts: TStringList;
begin
//debugln('TIDEHelpManager.ShowHelpForMessage A Line=',dbgs(Line));
if MessagesView=nil then exit;
if Line<0 then
Line:=MessagesView.SelectedMessageIndex;
//DebugLn('TIDEHelpManager.ShowHelpForMessage B Line=',dbgs(Line),' ',dbgs(MessagesView.VisibleItemCount));
if (Line<0) or (Line>=MessagesView.VisibleItemCount) then exit;
MsgItem:=MessagesView.VisibleItems[Line];
if MsgItem=nil then exit;
if MsgItem.Msg<>'' then begin
MessageParts:=ParseMessage(MsgItem);
ShowHelpOrErrorForMessageLine(MsgItem.Msg,MessageParts);
end;
end;
{$Endif EnableOldExtTools}
procedure TIDEHelpManager.ShowHelpForObjectInspector(Sender: TObject);
var

View File

@ -121,7 +121,6 @@ type
property Unit2Files: TICCFiles read FUnit2Files;
end;
{$IFNDEF EnableOldExtTools}
type
{ TQuickFixRecompilingChecksumChanged }
@ -131,17 +130,6 @@ type
procedure CreateMenuItems(Fixes: TMsgQuickFixes); override;
procedure QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine); override;
end;
{$ELSE}
type
{ TQuickFixRecompilingChecksumChanged }
TQuickFixRecompilingChecksumChanged = class(TIDEMsgQuickFixItem)
public
constructor Create;
function IsApplicable(Line: TIDEMessageLine): boolean; override;
procedure Execute(const Msg: TIDEMessageLine; Step: TIMQuickFixStep); override;
end;
{$ENDIF}
procedure InitInspectChecksumChangedQuickFixItems;
@ -414,7 +402,6 @@ begin
InfoTreeView.EndUpdate;
end;
{$IFNDEF EnableOldExtTools}
{ TQuickFixRecompilingChecksumChanged }
function TQuickFixRecompilingChecksumChanged.IsApplicable(Msg: TMessageLine;
@ -457,46 +444,6 @@ begin
Dlg.Free;
end;
end;
{$ELSE}
constructor TQuickFixRecompilingChecksumChanged.Create;
begin
Name:='Show dialog for message Recompiling Unit1, checksum changed for Unit1';
Caption:='Explore message "checksum changed"';
Steps:=[imqfoMenuItem];
end;
function TQuickFixRecompilingChecksumChanged.IsApplicable(Line: TIDEMessageLine
): boolean;
begin
Result:=false;
if not REMatches(Line.Msg,'Recompiling ([a-z_][a-z_0-9]*), checksum changed for ([a-z_][a-z_0-9]*)','i')
then exit;
Result:=true;
end;
procedure TQuickFixRecompilingChecksumChanged.Execute(
const Msg: TIDEMessageLine; Step: TIMQuickFixStep);
var
Dlg: TInspectChksumChgDialog;
Unit1, Unit2: string;
begin
if Step=imqfoMenuItem then begin
debugln(['TQuickFixRecompilingChecksumChanged.Execute ']);
if not REMatches(Msg.Msg,'Recompiling ([a-z_][a-z_0-9]*), checksum changed for ([a-z_][a-z_0-9]*)','i')
then exit;
Unit1:=REVar(1);
Unit2:=REVar(2);
debugln(['TQuickFixRecompilingChecksumChanged.Execute Unit1=',REVar(1),', checksum changed for Unit2=',REVar(2)]);
Dlg:=TInspectChksumChgDialog.Create(nil);
try
Dlg.InitWithMsg(Msg.Msg,Unit1,Unit2);
Dlg.ShowModal;
finally
Dlg.Free;
end;
end;
end;
{$ENDIF}
end.

View File

@ -1,41 +0,0 @@
inherited MessagesView: TMessagesView
Left = 284
Height = 79
Top = 640
Width = 722
ActiveControl = MessageTreeView
BorderStyle = bsSizeToolWin
Caption = 'MessagesView'
ClientHeight = 79
ClientWidth = 722
KeyPreview = True
OnDeactivate = FormDeactivate
OnKeyDown = MessagesViewKeyDown
object MessageTreeView: TTreeView[0]
Left = 0
Height = 79
Top = 0
Width = 722
Align = alClient
DefaultItemHeight = 15
MultiSelect = True
PopupMenu = MainPopupMenu
ReadOnly = True
ScrollBars = ssAutoBoth
ShowRoot = False
TabOrder = 0
OnExit = MessageViewExit
Options = [tvoAllowMultiselect, tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoToolTips, tvoThemedDraw]
end
object MainPopupMenu: TPopupMenu[1]
OnPopup = MainPopupMenuPopup
left = 48
top = 8
end
object IdleTimer1: TIdleTimer[2]
AutoEnabled = True
OnTimer = IdleTimer1Timer
left = 166
top = 8
end
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -37,10 +37,7 @@ interface
uses
Classes, SysUtils, FileUtil, Laz2_XMLCfg, Process, LCLProc, Controls,
Graphics, Forms, CodeToolManager, FileProcs, LazConf, LResources, ProjectIntf,
ProjectResourcesIntf, IDEMsgIntf, MacroIntf,
{$IFNDEF EnableOldExtTools}
IDEExternToolIntf,
{$ENDIF}
ProjectResourcesIntf, IDEMsgIntf, MacroIntf, IDEExternToolIntf,
LazarusIDEStrConsts, resource, bitmapresource, groupresource,
groupiconresource, groupcursorresource;
@ -189,11 +186,7 @@ begin
end;
end
else
{$IFNDEF EnableOldExtTools}
IDEMessagesWindow.AddCustomMessage(mluError,Format(lisFileNotFound2, [Filename]));
{$ELSE}
IDEMessagesWindow.AddMsg(Format(lisFileNotFound2, [Filename]), '', -1);
{$ENDIF}
end;
function TResourceItem.GetRealFileName(ProjectDirectory: String): String;