IDE: clean up old external tools

git-svn-id: trunk@45944 -
This commit is contained in:
mattias 2014-07-20 19:52:20 +00:00
parent d95954ac0b
commit a826bc11f6
5 changed files with 1 additions and 423 deletions

2
.gitattributes vendored
View File

@ -5215,8 +5215,6 @@ ide/diffpatch.pas svneol=native#text/pascal
ide/diskdiffsdialog.lfm svneol=native#text/plain
ide/diskdiffsdialog.pas svneol=native#text/pascal
ide/editdefinetree.pas svneol=native#text/pascal
ide/editmsgscannersdlg.lfm svneol=native#text/plain
ide/editmsgscannersdlg.pas svneol=native#text/plain
ide/editorfilemanager.lfm svneol=native#text/plain
ide/editorfilemanager.pas svneol=native#text/plain
ide/editormacrolistviewer.lfm svneol=native#text/pascal

View File

@ -39,13 +39,8 @@ interface
uses
Classes, SysUtils, Process, LCLProc, Forms, Controls, contnrs, strutils, FileUtil,
IDEExternToolIntf, IDEMsgIntf, CompOptsIntf, LazIDEIntf,
LazarusIDEStrConsts, CompilerOptions, Project,
{$IFNDEF EnableOldExtTools}
IDEExternToolIntf,
{$ELSE}
UTF8Process, OutputFilter, InfoBuild,
{$ENDIF}
IDEMsgIntf, CompOptsIntf, LazIDEIntf,
DefineTemplates, TransferMacros, EnvironmentOpts, LazFileUtils;
type
@ -56,10 +51,6 @@ type
TCompiler = class(TObject)
private
FOnCmdLineCreate : TOnCmdLineCreate;
{$IFDEF EnableOldExtTools}
FOutputFilter: TOutputFilter;
FTheProcess: TProcessUTF8;
{$ENDIF}
public
constructor Create;
destructor Destroy; override;
@ -69,10 +60,6 @@ type
const aCompileHint: string
): TModalResult;
procedure WriteError(const Msg: string);
{$IFDEF EnableOldExtTools}
property OutputFilter: TOutputFilter read FOutputFilter write FOutputFilter;
property TheProcess: TProcessUTF8 read FTheProcess;
{$ENDIF}
end;
// Following classes are for compiler options parsed from "fpc -h" and "fpc -i".
@ -271,9 +258,6 @@ end;
------------------------------------------------------------------------------}
destructor TCompiler.Destroy;
begin
{$IFDEF EnableOldExtTools}
FreeAndNil(FTheProcess);
{$ENDIF}
inherited Destroy;
end;
@ -286,20 +270,13 @@ function TCompiler.Compile(AProject: TProject; const WorkingDir,
var
CmdLine : String;
Abort : Boolean;
{$IFNDEF EnableOldExtTools}
Tool: TAbstractExternalTool;
FPCParser: TFPCParser;
{$ENDIF}
begin
Result:=mrCancel;
if ConsoleVerbosity>=0 then
DebugLn('TCompiler.Compile WorkingDir="',WorkingDir,'" CompilerFilename="',CompilerFilename,'" CompilerParams="',CompilerParams,'"');
// if we want to show the compile progress, it's now time to show the dialog
{$IFDEF EnableOldExtTools}
CompileProgress.Show;
{$ENDIF}
try
CheckIfFileIsExecutable(CompilerFilename);
except
@ -332,7 +309,6 @@ begin
if ConsoleVerbosity>=0 then
DebugLn('[TCompiler.Compile] CmdLine="',CompilerFilename+CmdLine,'"');
{$IFNDEF EnableOldExtTools}
Tool:=ExternalToolList.Add('Compile Project');
Tool.Reference(Self,ClassName);
try
@ -356,55 +332,6 @@ begin
finally
Tool.Release(Self);
end;
{$ELSE}
try
if TheProcess=nil then
FTheProcess := TOutputFilterProcess.Create(nil);
TheProcess.CommandLine := CompilerFilename+CmdLine;
TheProcess.Options:= [poUsePipes, poStdErrToOutput];
TheProcess.ShowWindow := swoHide;
Result:=mrOk;
try
TheProcess.CurrentDirectory:=WorkingDir;
if OutputFilter<>nil then begin
if BuildAll and Assigned(IDEMessagesWindow) then
IDEMessagesWindow.AddMsg(lisOptionsChangedRecompilingCleanWithB,
WorkingDir, -1);
OutputFilter.Options:=[ofoSearchForFPCMessages,ofoExceptionOnError];
OutputFilter.CompilerOptions:=AProject.CompilerOptions;
if not OutputFilter.Execute(TheProcess,Self) then
if OutputFilter.Aborted then
Result := mrAbort
else
Result := mrCancel;
end else begin
TheProcess.Execute;
end;
finally
if TheProcess.Running
then begin
TheProcess.WaitOnExit;
if not (TheProcess.ExitStatus in [0,1]) then begin
WriteError(Format(listCompilerInternalError,[TheProcess.ExitStatus]));
Result:=mrCancel;
end;
end;
end;
except
on e: EOutputFilterError do begin
Result:=mrCancel;
exit;
end;
on e: Exception do begin
if ConsoleVerbosity>=-1 then
DebugLn('[TCompiler.Compile] exception "',E.Message,'"');
WriteError(E.Message);
Result:=mrCancel;
exit;
end;
end;
{$ENDIF}
if ConsoleVerbosity>=0 then
DebugLn('[TCompiler.Compile] end');
end;
@ -412,13 +339,8 @@ end;
procedure TCompiler.WriteError(const Msg: string);
begin
DebugLn('TCompiler.WriteError ',Msg);
{$IFNDEF EnableOldExtTools}
if IDEMessagesWindow<>nil then
IDEMessagesWindow.AddCustomMessage(mluError,Msg);
{$ELSE}
if OutputFilter <> nil then
OutputFilter.ReadConstLine(Msg, True);
{$ENDIF}
end;
// Compiler options parsed from "fpc -h" and "fpc -i".

View File

@ -1,107 +0,0 @@
object EditMsgScannersDialog: TEditMsgScannersDialog
Left = 301
Height = 354
Top = 196
Width = 486
ActiveControl = ScannersListBox
Caption = 'EditMsgScannersDialog'
ClientHeight = 354
ClientWidth = 486
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '0.9.27'
object ButtonPanel: TButtonPanel
Left = 6
Height = 26
Top = 322
Width = 474
TabOrder = 0
ShowButtons = [pbOK, pbCancel, pbHelp]
ShowBevel = False
end
object AvailableGroupBox: TGroupBox
Left = 271
Height = 310
Top = 6
Width = 209
Align = alRight
BorderSpacing.Around = 6
Caption = 'AvailableGroupBox'
ClientHeight = 292
ClientWidth = 205
TabOrder = 1
object AvailableListBox: TListBox
Left = 6
Height = 280
Top = 6
Width = 193
Align = alClient
BorderSpacing.Around = 6
ItemHeight = 0
TabOrder = 0
end
end
object ScannersGroupBox: TGroupBox
Left = 6
Height = 310
Top = 6
Width = 209
Align = alClient
BorderSpacing.Around = 6
Caption = 'ScannersGroupBox'
ClientHeight = 292
ClientWidth = 205
TabOrder = 2
object ScannersListBox: TListBox
Left = 6
Height = 280
Top = 6
Width = 193
Align = alClient
BorderSpacing.Around = 6
ItemHeight = 0
TabOrder = 0
end
end
object MoveBtnPanel: TPanel
Left = 221
Height = 316
Top = 0
Width = 39
Align = alRight
BevelOuter = bvNone
ClientHeight = 316
ClientWidth = 39
TabOrder = 3
object AddSpeedButton: TSpeedButton
Left = 8
Height = 22
Top = 84
Width = 23
Color = clBtnFace
NumGlyphs = 0
OnClick = AddSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
object RemoveSpeedButton: TSpeedButton
Left = 8
Height = 22
Top = 152
Width = 23
Color = clBtnFace
NumGlyphs = 0
OnClick = RemoveSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
end
object Splitter1: TSplitter
Left = 260
Height = 316
Top = 0
Width = 5
Align = alRight
ResizeAnchor = akRight
end
end

View File

@ -1,217 +0,0 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Mattias Gaertner
}
unit EditMsgScannersDlg;
{$IFNDEF EnableOldExtTools}
{$Error}
{$ENDIF}
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs,
ButtonPanel, StdCtrls, ExtCtrls, Buttons, LazarusIDEStrConsts,
IDEMsgIntf;
type
{ TEditMsgScannersDialog }
TEditMsgScannersDialog = class(TForm)
ButtonPanel: TButtonPanel;
AvailableGroupBox: TGroupBox;
AvailableListBox: TListBox;
ScannersListBox: TListBox;
MoveBtnPanel: TPanel;
ScannersGroupBox: TGroupBox;
AddSpeedButton: TSpeedButton;
RemoveSpeedButton: TSpeedButton;
Splitter1: TSplitter;
procedure AddSpeedButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure RemoveSpeedButtonClick(Sender: TObject);
private
FScanners: TStrings;
procedure SetScanners(const AValue: TStrings);
procedure UpdateButtons;
public
procedure FillAvailableListbox;
procedure FillScannersListbox;
function IndexOfUsedScanner(const ScannerName: string): integer;
property Scanners: TStrings read FScanners write SetScanners;
end;
function ShowEditMsgScannersDialog(const Title: string;
Scanners: TStrings): TModalResult;
implementation
{$R *.lfm}
function ShowEditMsgScannersDialog(const Title: string;
Scanners: TStrings): TModalResult;
var
EditMsgScannersDialog: TEditMsgScannersDialog;
begin
EditMsgScannersDialog:=TEditMsgScannersDialog.Create(nil);
try
EditMsgScannersDialog.Scanners:=Scanners;
EditMsgScannersDialog.Caption:=Title;
Result:=EditMsgScannersDialog.ShowModal;
if Result=mrOk then
Scanners.Assign(EditMsgScannersDialog.Scanners);
finally
EditMsgScannersDialog.Free;
end;
end;
{ TEditMsgScannersDialog }
procedure TEditMsgScannersDialog.FormCreate(Sender: TObject);
begin
FScanners:=TStringList.Create;
AvailableGroupBox.Caption:=rsAvailableScanners;
ScannersGroupBox.Caption:=rsScanners;
AddSpeedButton.Hint:=lisAdd;
RemoveSpeedButton.Hint:=lisRemove;
AddSpeedButton.LoadGlyphFromResourceName(HInstance, 'arrow_left');
RemoveSpeedButton.LoadGlyphFromResourceName(HInstance, 'arrow_right');
FillAvailableListbox;
end;
procedure TEditMsgScannersDialog.AddSpeedButtonClick(Sender: TObject);
var
i: LongInt;
ShortDesc: string;
Scanner: TIDEMsgScannerType;
HasChanged: Boolean;
begin
HasChanged:=false;
for i:=0 to AvailableListBox.Items.Count-1 do begin
if not AvailableListBox.Selected[i] then continue;
ShortDesc:=AvailableListBox.Items[i];
Scanner:=IDEMsgScanners.TypeOfShortDesc(ShortDesc);
if Scanner=nil then continue;
if IndexOfUsedScanner(Scanner.Name)>=0 then continue;
HasChanged:=true;
FScanners.Add(Scanner.Name);
end;
if HasChanged then begin
FillAvailableListbox;
FillScannersListbox;
UpdateButtons;
end;
end;
procedure TEditMsgScannersDialog.FormDestroy(Sender: TObject);
begin
FreeAndNil(FScanners);
end;
procedure TEditMsgScannersDialog.RemoveSpeedButtonClick(Sender: TObject);
var
i: Integer;
HasChanged: Boolean;
begin
HasChanged:=false;
for i:=ScannersListBox.Items.Count-1 downto 0 do begin
if not ScannersListBox.Selected[i] then continue;
if i>=FScanners.Count then continue;
HasChanged:=true;
FScanners.Delete(i);
end;
if HasChanged then begin
FillAvailableListbox;
FillScannersListbox;
UpdateButtons;
end;
end;
procedure TEditMsgScannersDialog.SetScanners(const AValue: TStrings);
begin
if FScanners=AValue then exit;
FScanners.Assign(AValue);
FillScannersListbox;
FillAvailableListbox;
UpdateButtons;
end;
procedure TEditMsgScannersDialog.UpdateButtons;
begin
AddSpeedButton.Enabled:=AvailableListBox.SelCount>=0;
RemoveSpeedButton.Enabled:=ScannersListBox.SelCount>=0;
end;
procedure TEditMsgScannersDialog.FillAvailableListbox;
var
sl: TStringList;
i: Integer;
begin
sl:=TStringList.Create;
for i:=0 to IDEMsgScanners.Count-1 do begin
if IndexOfUsedScanner(IDEMsgScanners[i].Name)<0 then
sl.Add(IDEMsgScanners[i].ShortDescription);
end;
sl.Sort;
AvailableListBox.Items.Assign(sl);
sl.Free;
end;
procedure TEditMsgScannersDialog.FillScannersListbox;
var
sl: TStringList;
i: Integer;
Scanner: TIDEMsgScannerType;
s: string;
begin
sl:=TStringList.Create;
for i:=0 to FScanners.Count-1 do begin
s:=FScanners[i];
Scanner:=IDEMsgScanners.TypeOfName(s);
if Scanner<>nil then
s:=Scanner.ShortDescription;
sl.Add(s);
end;
ScannersListBox.Items.Assign(sl);
sl.Free;
end;
function TEditMsgScannersDialog.IndexOfUsedScanner(const ScannerName: string
): integer;
begin
Result:=FScanners.Count-1;
while (Result>=0) do begin
if SysUtils.CompareText(ScannerName,FScanners[Result])=0 then exit;
dec(Result);
end;
end;
end.

View File

@ -695,22 +695,14 @@ end;
procedure TEditIDEMsgHelpDialog.UpdateCurMessage;
var
{$IFNDEF EnableOldExtTools}
Line: TMessageLine;
{$ELSE}
Line: TIDEMessageLine;
{$ENDIF}
sl: TStringList;
MsgFile: TFPCMsgFile;
FPCMsg: TFPCMsgItem;
begin
CurMsg:='';
CurFPCId:=-1;
{$IFNDEF EnableOldExtTools}
Line:=IDEMessagesWindow.GetSelectedLine;
{$ELSE}
Line:=IDEMessagesWindow.GetSelectedLine;
{$ENDIF}
if Line=nil then begin
CurMsgMemo.Text:=lisNoMessageSelected;
CurMsgMemo.Enabled:=false;
@ -719,16 +711,12 @@ begin
sl:=TStringList.Create;
try
sl.Add('Msg='+Line.Msg);
{$IFNDEF EnableOldExtTools}
sl.Add('MsgID='+IntToStr(Line.MsgID));
{$ENDIF}
MsgFile:=FPCMsgHelpDB.GetMsgFile;
if MsgFile<>nil then begin
FPCMsg:=nil;
{$IFNDEF EnableOldExtTools}
if Line.MsgID>0 then
FPCMsg:=MsgFile.FindWithID(Line.MsgID);
{$ENDIF}
if FPCMsg=nil then
FPCMsg:=MsgFile.FindWithMessage(Line.Msg);
if FPCMsg<>nil then begin
@ -736,12 +724,6 @@ begin
sl.Add('FPC Msg='+FPCMsg.GetName);
end;
end;
{$IFNDEF EnableOldExtTools}
{$ELSE}
sl.Add('Directory='+Line.Directory);
if Line.Parts<>nil then
sl.AddStrings(Line.Parts);
{$ENDIF}
CurMsgMemo.Text:=sl.Text;
finally
sl.Free;