added basic process input handling to a project running within the IDE and redirected to the IDE

This commit is contained in:
Basile Burg 2014-11-28 04:46:58 +01:00
parent 5c64186520
commit 6411f4fd65
7 changed files with 29 additions and 17 deletions

View File

@ -178,7 +178,7 @@ end;
procedure TCECdbWidget.cdbOutputToGui; procedure TCECdbWidget.cdbOutputToGui;
var var
lst: TStringList; lst: TStringList;
cnt: Integer; str: string;
begin begin
if fCdbProc = nil then if fCdbProc = nil then
exit; exit;
@ -186,8 +186,8 @@ begin
lst := TStringList.Create; lst := TStringList.Create;
try try
processOutputToStrings(fCdbProc, lst); processOutputToStrings(fCdbProc, lst);
for cnt := 0 to lst.Count-1 do for str in lst do
lstCdbOut.AddItem(lst.Strings[cnt], nil); lstCdbOut.AddItem(str, nil);
lstCdbOut.Items[lstCdbOut.Items.Count-1].MakeVisible(true); lstCdbOut.Items[lstCdbOut.Items.Count-1].MakeVisible(true);
finally finally
lst.Free; lst.Free;

View File

@ -274,6 +274,7 @@ type
// //
procedure openFile(const aFilename: string); procedure openFile(const aFilename: string);
// //
property processInput: TCEProcInputWidget read fPrInpWidg;
property WidgetList: TCEWidgetList read fWidgList; property WidgetList: TCEWidgetList read fWidgList;
end; end;

View File

@ -1,26 +1,26 @@
inherited CEProcInputWidget: TCEProcInputWidget inherited CEProcInputWidget: TCEProcInputWidget
Left = 1427 Left = 868
Height = 61 Height = 61
Top = 335 Top = 335
Width = 481 Width = 608
Caption = 'Process input' Caption = 'Process input'
ClientHeight = 61 ClientHeight = 61
ClientWidth = 481 ClientWidth = 608
inherited Back: TPanel inherited Back: TPanel
Height = 61 Height = 61
Width = 481 Width = 608
ClientHeight = 61 ClientHeight = 61
ClientWidth = 481 ClientWidth = 608
inherited Content: TPanel inherited Content: TPanel
Height = 61 Height = 61
Width = 481 Width = 608
ClientHeight = 61 ClientHeight = 61
ClientWidth = 481 ClientWidth = 608
object txtInp: TEdit[0] object txtInp: TEdit[0]
Left = 4 Left = 4
Height = 27 Height = 27
Top = 30 Top = 30
Width = 394 Width = 521
Align = alClient Align = alClient
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Top = 2 BorderSpacing.Top = 2
@ -30,7 +30,7 @@ inherited CEProcInputWidget: TCEProcInputWidget
TabOrder = 0 TabOrder = 0
end end
object btnSend: TButton[1] object btnSend: TButton[1]
Left = 402 Left = 529
Height = 27 Height = 27
Top = 30 Top = 30
Width = 75 Width = 75
@ -46,7 +46,7 @@ inherited CEProcInputWidget: TCEProcInputWidget
Left = 4 Left = 4
Height = 22 Height = 22
Top = 4 Top = 4
Width = 473 Width = 600
Align = alTop Align = alTop
BorderSpacing.Around = 4 BorderSpacing.Around = 4
BorderStyle = sbsSunken BorderStyle = sbsSunken

View File

@ -74,6 +74,12 @@ end;
{$REGION Process input things --------------------------------------------------} {$REGION Process input things --------------------------------------------------}
procedure TCEProcInputWidget.setProc(const aValue: TProcess); procedure TCEProcInputWidget.setProc(const aValue: TProcess);
begin begin
// TODO: process list
// TODO: each TCESynMemo must have its own runnable TProcess
// currently they share the CEMainForm.fRunProc variable.
if fProc <> nil then
fProc.Terminate(1);
txtExeName.Caption := 'no process'; txtExeName.Caption := 'no process';
fProc := nil; fProc := nil;
if aValue = nil then if aValue = nil then

View File

@ -90,7 +90,7 @@ type
implementation implementation
uses uses
ce_interfaces, controls, dialogs, ce_symstring, ce_libman; ce_interfaces, controls, dialogs, ce_symstring, ce_libman, ce_main;
constructor TCEProject.create(aOwner: TComponent); constructor TCEProject.create(aOwner: TComponent);
begin begin
@ -581,6 +581,7 @@ begin
if poUsePipes in fRunner.Options then begin if poUsePipes in fRunner.Options then begin
fRunner.OnReadData := @runProcOutput; fRunner.OnReadData := @runProcOutput;
fRunner.OnTerminate := @runProcOutput; fRunner.OnTerminate := @runProcOutput;
CEMainForm.processInput.process := fRunner;
end; end;
fRunner.Execute; fRunner.Execute;
// //
@ -603,6 +604,10 @@ begin
finally finally
lst.Free; lst.Free;
end; end;
//
if not proc.Active then
if CEMainForm.processInput.process = proc then
CEMainForm.processInput.process := nil;
end; end;
procedure TCEProject.compProcOutput(proc: TProcess); procedure TCEProject.compProcOutput(proc: TProcess);

View File

@ -22,7 +22,7 @@ type
//fShortcut: string; //fShortcut: string;
fLogMessager: TCELogMessageSubject; fLogMessager: TCELogMessageSubject;
procedure setParameters(const aValue: TStringList); procedure setParameters(const aValue: TStringList);
procedure processOUtput(sender: TObject); procedure processOutput(sender: TObject);
published published
property toolAlias: string read fToolAlias write fToolAlias; property toolAlias: string read fToolAlias write fToolAlias;
property options: TProcessOptions read fOpts write fOpts; property options: TProcessOptions read fOpts write fOpts;