mirror of https://gitlab.com/basile.b/dexed.git
Applied changes from ce_interfaces & ce_observer
This commit is contained in:
parent
f263fbdf54
commit
9df88278a0
|
@ -203,7 +203,7 @@ type
|
||||||
fInitialized: boolean;
|
fInitialized: boolean;
|
||||||
fRunnableSw: string;
|
fRunnableSw: string;
|
||||||
fRunProc: TCheckedAsyncProcess;
|
fRunProc: TCheckedAsyncProcess;
|
||||||
fLogMessager: TCELogMessageSubject;
|
fMsgs: ICEMessagesDisplay;
|
||||||
fMainMenuSubj: TCEMainMenuSubject;
|
fMainMenuSubj: TCEMainMenuSubject;
|
||||||
procedure updateMainMenuProviders;
|
procedure updateMainMenuProviders;
|
||||||
|
|
||||||
|
@ -298,7 +298,6 @@ uses
|
||||||
constructor TCEMainForm.create(aOwner: TComponent);
|
constructor TCEMainForm.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited create(aOwner);
|
inherited create(aOwner);
|
||||||
fLogMessager := TCELogMessageSubject.create;
|
|
||||||
fMainMenuSubj:= TCEMainMenuSubject.create;
|
fMainMenuSubj:= TCEMainMenuSubject.create;
|
||||||
//
|
//
|
||||||
EntitiesConnector.addObserver(self);
|
EntitiesConnector.addObserver(self);
|
||||||
|
@ -414,6 +413,8 @@ begin
|
||||||
fTodolWidg:= TCETodoListWidget.create(self);
|
fTodolWidg:= TCETodoListWidget.create(self);
|
||||||
//fResWidg := TCEResmanWidget.create(self);
|
//fResWidg := TCEResmanWidget.create(self);
|
||||||
|
|
||||||
|
getMessageDisplay(fMsgs);
|
||||||
|
|
||||||
{$IFDEF WIN32}
|
{$IFDEF WIN32}
|
||||||
fCdbWidg := TCECdbWidget.create(self);
|
fCdbWidg := TCECdbWidget.create(self);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
@ -639,7 +640,6 @@ begin
|
||||||
fProject.Free;
|
fProject.Free;
|
||||||
FreeRunnableProc;
|
FreeRunnableProc;
|
||||||
//
|
//
|
||||||
fLogMessager.Free;
|
|
||||||
fMainMenuSubj.Free;
|
fMainMenuSubj.Free;
|
||||||
EntitiesConnector.removeObserver(self);
|
EntitiesConnector.removeObserver(self);
|
||||||
inherited;
|
inherited;
|
||||||
|
@ -656,7 +656,7 @@ begin
|
||||||
if fMesgWidg = nil then
|
if fMesgWidg = nil then
|
||||||
ce_common.dlgOkError(E.Message)
|
ce_common.dlgOkError(E.Message)
|
||||||
else
|
else
|
||||||
fMesgWidg.lmFromString(E.Message, nil, amcApp, amkErr);
|
fMsgs.message(E.Message, nil, amcApp, amkErr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure TCEMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
|
@ -1203,10 +1203,10 @@ begin
|
||||||
try
|
try
|
||||||
processOutputToStrings(proc, lst);
|
processOutputToStrings(proc, lst);
|
||||||
if proc = fRunProc then for str in lst do
|
if proc = fRunProc then for str in lst do
|
||||||
subjLmFromString(fLogMessager, str, fDoc, amcEdit, amkBub)
|
fMsgs.message(str, fDoc, amcEdit, amkBub)
|
||||||
else if proc.Executable = DCompiler then
|
else if proc.Executable = DCompiler then
|
||||||
for str in lst do
|
for str in lst do
|
||||||
subjLmFromString(fLogMessager, str, fDoc, amcEdit, amkAuto);
|
fMsgs.message(str, fDoc, amcEdit, amkAuto);
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -1217,6 +1217,7 @@ var
|
||||||
proc: TProcess;
|
proc: TProcess;
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
str: string;
|
str: string;
|
||||||
|
inph: TObject;
|
||||||
begin
|
begin
|
||||||
proc := TProcess(sender);
|
proc := TProcess(sender);
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
|
@ -1226,13 +1227,16 @@ begin
|
||||||
if proc = fRunProc then
|
if proc = fRunProc then
|
||||||
begin
|
begin
|
||||||
for str in lst do
|
for str in lst do
|
||||||
subjLmFromString(fLogMessager, str, fDoc, amcEdit, amkBub);
|
fMsgs.message(str, fDoc, amcEdit, amkBub);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
if proc = fPrInpWidg.process then
|
//if proc = fPrInpWidg.process then
|
||||||
fPrInpWidg.process := nil;
|
//fPrInpWidg.process := nil;
|
||||||
|
|
||||||
|
inph := EntitiesConnector.getSingleService('ICEProcInputHandler');
|
||||||
|
if (inph <> nil) then (inph as ICEProcInputHandler).removeProcess(proc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.compileAndRunFile(unittest: boolean; const runArgs: string = '');
|
procedure TCEMainForm.compileAndRunFile(unittest: boolean; const runArgs: string = '');
|
||||||
|
@ -1253,9 +1257,8 @@ begin
|
||||||
dmdproc := TProcess.Create(nil);
|
dmdproc := TProcess.Create(nil);
|
||||||
try
|
try
|
||||||
|
|
||||||
subjLmClearByData(fLogMessager, fDoc);
|
fMsgs.clearByData(fDoc);
|
||||||
subjLmFromString(fLogMessager, 'compiling ' + shortenPath(fDoc.fileName, 25),
|
fMsgs.message('compiling ' + shortenPath(fDoc.fileName, 25), fDoc, amcEdit, amkInf);
|
||||||
fDoc, amcEdit, amkInf);
|
|
||||||
|
|
||||||
if fileExists(fDoc.fileName) then fDoc.save
|
if fileExists(fDoc.fileName) then fDoc.save
|
||||||
else fDoc.saveTempFile;
|
else fDoc.saveTempFile;
|
||||||
|
@ -1284,20 +1287,20 @@ begin
|
||||||
|
|
||||||
if (dmdProc.ExitStatus = 0) then
|
if (dmdProc.ExitStatus = 0) then
|
||||||
begin
|
begin
|
||||||
subjLmFromString(fLogMessager, shortenPath(fDoc.fileName, 25)
|
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled',
|
||||||
+ ' successfully compiled', fDoc, amcEdit, amkInf);
|
fDoc, amcEdit, amkInf);
|
||||||
|
|
||||||
fRunProc.CurrentDirectory := extractFilePath(fRunProc.Executable);
|
fRunProc.CurrentDirectory := extractFilePath(fRunProc.Executable);
|
||||||
if runArgs <> '' then
|
if runArgs <> '' then
|
||||||
fRunProc.Parameters.DelimitedText := symbolExpander.get(runArgs);
|
fRunProc.Parameters.DelimitedText := symbolExpander.get(runArgs);
|
||||||
fRunProc.Executable := fname + exeExt;
|
fRunProc.Executable := fname + exeExt;
|
||||||
fPrInpWidg.process := fRunProc;
|
getprocInputHandler.addProcess(fRunProc);
|
||||||
fRunProc.Execute;
|
fRunProc.Execute;
|
||||||
sysutils.DeleteFile(fname + objExt);
|
sysutils.DeleteFile(fname + objExt);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
subjLmFromString(fLogMessager, shortenPath(fDoc.fileName,25)
|
fMsgs.message(shortenPath(fDoc.fileName,25) + ' has not been compiled',
|
||||||
+ ' has not been compiled', fDoc, amcEdit, amkErr);
|
fDoc, amcEdit, amkErr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -21,7 +21,7 @@ type
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCEMessagesWidget }
|
{ TCEMessagesWidget }
|
||||||
TCEMessagesWidget = class(TCEWidget, ICEMultiDocObserver, ICEProjectObserver, ICELogMessageObserver)
|
TCEMessagesWidget = class(TCEWidget, ICEMultiDocObserver, ICEProjectObserver, ICEMessagesDisplay)
|
||||||
btnClearCat: TBitBtn;
|
btnClearCat: TBitBtn;
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
List: TTreeView;
|
List: TTreeView;
|
||||||
|
@ -79,6 +79,11 @@ type
|
||||||
procedure docClosing(aDoc: TCESynMemo);
|
procedure docClosing(aDoc: TCESynMemo);
|
||||||
procedure docFocused(aDoc: TCESynMemo);
|
procedure docFocused(aDoc: TCESynMemo);
|
||||||
procedure docChanged(aDoc: TCESynMemo);
|
procedure docChanged(aDoc: TCESynMemo);
|
||||||
|
//
|
||||||
|
function singleServiceName: string;
|
||||||
|
procedure message(const aValue: string; aData: Pointer; aCtxt: TCEAppMessageCtxt; aKind: TCEAppMessageKind);
|
||||||
|
procedure clearbyContext(aCtxt: TCEAppMessageCtxt);
|
||||||
|
procedure clearbyData(aData: Pointer);
|
||||||
protected
|
protected
|
||||||
procedure sesoptDeclareProperties(aFiler: TFiler); override;
|
procedure sesoptDeclareProperties(aFiler: TFiler); override;
|
||||||
//
|
//
|
||||||
|
@ -92,10 +97,7 @@ type
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
//
|
//
|
||||||
procedure scrollToBack;
|
procedure scrollToBack;
|
||||||
//
|
|
||||||
procedure lmFromString(const aValue: string; aData: Pointer; aCtxt: TCEAppMessageCtxt; aKind: TCEAppMessageKind);
|
|
||||||
procedure lmClearbyContext(aCtxt: TCEAppMessageCtxt);
|
|
||||||
procedure lmClearbyData(aData: Pointer);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function guessMessageKind(const aMessg: string): TCEAppMessageKind;
|
function guessMessageKind(const aMessg: string): TCEAppMessageKind;
|
||||||
|
@ -153,6 +155,7 @@ begin
|
||||||
btnClearCat.OnClick := @actClearCurCatExecute;
|
btnClearCat.OnClick := @actClearCurCatExecute;
|
||||||
//
|
//
|
||||||
EntitiesConnector.addObserver(self);
|
EntitiesConnector.addObserver(self);
|
||||||
|
EntitiesConnector.addSingleService(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCEMessagesWidget.destroy;
|
destructor TCEMessagesWidget.destroy;
|
||||||
|
@ -180,7 +183,7 @@ begin
|
||||||
if List.Items[i].MultiSelected then
|
if List.Items[i].MultiSelected then
|
||||||
List.Items.Delete(List.Items[i]);
|
List.Items.Delete(List.Items[i]);
|
||||||
end
|
end
|
||||||
else lmClearbyContext(amcAll);
|
else clearbyContext(amcAll);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -285,18 +288,18 @@ end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.actClearAllExecute(Sender: TObject);
|
procedure TCEMessagesWidget.actClearAllExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
lmClearbyContext(amcAll);
|
clearbyContext(amcAll);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.actClearCurCatExecute(Sender: TObject);
|
procedure TCEMessagesWidget.actClearCurCatExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
case fCtxt of
|
case fCtxt of
|
||||||
amcAll, amcApp, amcMisc :
|
amcAll, amcApp, amcMisc :
|
||||||
lmClearbyContext(fCtxt);
|
clearbyContext(fCtxt);
|
||||||
amcEdit: if fDoc <> nil then
|
amcEdit: if fDoc <> nil then
|
||||||
lmClearbyData(fDoc);
|
clearbyData(fDoc);
|
||||||
amcProj: if fProj <> nil then
|
amcProj: if fProj <> nil then
|
||||||
lmClearbyData(fProj);
|
clearbyData(fProj);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -357,7 +360,7 @@ begin
|
||||||
if fProj <> aProject then
|
if fProj <> aProject then
|
||||||
exit;
|
exit;
|
||||||
//
|
//
|
||||||
lmClearByData(aProject);
|
clearbyData(aProject);
|
||||||
fProj := nil;
|
fProj := nil;
|
||||||
filterMessages(fCtxt);
|
filterMessages(fCtxt);
|
||||||
end;
|
end;
|
||||||
|
@ -388,7 +391,7 @@ end;
|
||||||
procedure TCEMessagesWidget.docClosing(aDoc: TCESynMemo);
|
procedure TCEMessagesWidget.docClosing(aDoc: TCESynMemo);
|
||||||
begin
|
begin
|
||||||
if aDoc <> fDoc then exit;
|
if aDoc <> fDoc then exit;
|
||||||
lmClearbyData(fDoc);
|
clearbyData(fDoc);
|
||||||
fDoc := nil;
|
fDoc := nil;
|
||||||
filterMessages(fCtxt);
|
filterMessages(fCtxt);
|
||||||
end;
|
end;
|
||||||
|
@ -406,8 +409,13 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION ICELogMessageObserver -------------------------------------------------}
|
{$REGION ICEMessagesDisplay ----------------------------------------------------}
|
||||||
procedure TCEMessagesWidget.lmFromString(const aValue: string; aData: Pointer;
|
function TCEMessagesWidget.singleServiceName: string;
|
||||||
|
begin
|
||||||
|
exit('ICEMessagesDisplay');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.message(const aValue: string; aData: Pointer;
|
||||||
aCtxt: TCEAppMessageCtxt; aKind: TCEAppMessageKind);
|
aCtxt: TCEAppMessageCtxt; aKind: TCEAppMessageKind);
|
||||||
var
|
var
|
||||||
dt: PMessageData;
|
dt: PMessageData;
|
||||||
|
@ -430,7 +438,7 @@ begin
|
||||||
filterMessages(fCtxt);
|
filterMessages(fCtxt);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.lmClearByContext(aCtxt: TCEAppMessageCtxt);
|
procedure TCEMessagesWidget.clearByContext(aCtxt: TCEAppMessageCtxt);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
msgdt: PMessageData;
|
msgdt: PMessageData;
|
||||||
|
@ -448,7 +456,7 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.lmClearByData(aData: Pointer);
|
procedure TCEMessagesWidget.clearByData(aData: Pointer);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
msgdt: PMessageData;
|
msgdt: PMessageData;
|
||||||
|
|
|
@ -36,7 +36,6 @@ type
|
||||||
private
|
private
|
||||||
fFavorites: TStringList;
|
fFavorites: TStringList;
|
||||||
fLastFold: string;
|
fLastFold: string;
|
||||||
fLogMessager: TCELogMessageSubject;
|
|
||||||
procedure lstFavDblClick(Sender: TObject);
|
procedure lstFavDblClick(Sender: TObject);
|
||||||
procedure optset_LastFold(aReader: TReader);
|
procedure optset_LastFold(aReader: TReader);
|
||||||
procedure optget_LastFold(aWriter: TWriter);
|
procedure optget_LastFold(aWriter: TWriter);
|
||||||
|
@ -97,7 +96,6 @@ begin
|
||||||
png.Free;
|
png.Free;
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
fLogMessager := TCELogMessageSubject.create;
|
|
||||||
fFavorites := TStringList.Create;
|
fFavorites := TStringList.Create;
|
||||||
fFavorites.onChange := @favStringsChange;
|
fFavorites.onChange := @favStringsChange;
|
||||||
lstFiles.OnDeletion := @lstDeletion;
|
lstFiles.OnDeletion := @lstDeletion;
|
||||||
|
@ -122,7 +120,6 @@ end;
|
||||||
|
|
||||||
destructor TCEMiniExplorerWidget.destroy;
|
destructor TCEMiniExplorerWidget.destroy;
|
||||||
begin
|
begin
|
||||||
fLogMessager.Free;
|
|
||||||
fFavorites.Free;
|
fFavorites.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
@ -320,7 +317,7 @@ begin
|
||||||
if lstFiles.Selected.Data = nil then exit;
|
if lstFiles.Selected.Data = nil then exit;
|
||||||
fname := PString(lstFiles.Selected.Data)^;
|
fname := PString(lstFiles.Selected.Data)^;
|
||||||
if not fileExists(fname) then exit;
|
if not fileExists(fname) then exit;
|
||||||
if not shellOpen(fname) then subjLmFromString(fLogMessager,
|
if not shellOpen(fname) then getMessageDisplay.message(
|
||||||
(format('the shell failed to open "%s"', [shortenPath(fname, 25)])),
|
(format('the shell failed to open "%s"', [shortenPath(fname, 25)])),
|
||||||
nil, amcMisc, amkErr);
|
nil, amcMisc, amkErr);
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -6,10 +6,10 @@ interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||||
Menus, StdCtrls, ce_widget, process, ce_common;
|
Menus, StdCtrls, ce_widget, process, ce_common, ce_interfaces, ce_observer;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCEProcInputWidget = class(TCEWidget)
|
TCEProcInputWidget = class(TCEWidget, ICEProcInputHandler)
|
||||||
btnSend: TButton;
|
btnSend: TButton;
|
||||||
txtInp: TEdit;
|
txtInp: TEdit;
|
||||||
txtExeName: TStaticText;
|
txtExeName: TStaticText;
|
||||||
|
@ -20,16 +20,18 @@ type
|
||||||
fMru: TMRUList;
|
fMru: TMRUList;
|
||||||
fProc: TProcess;
|
fProc: TProcess;
|
||||||
procedure sendInput;
|
procedure sendInput;
|
||||||
procedure setProc(const aValue: TProcess);
|
|
||||||
//
|
//
|
||||||
procedure optset_InputMru(aReader: TReader);
|
procedure optset_InputMru(aReader: TReader);
|
||||||
procedure optget_InputMru(aWriter: TWriter);
|
procedure optget_InputMru(aWriter: TWriter);
|
||||||
|
//
|
||||||
|
function singleServiceName: string;
|
||||||
|
procedure addProcess(aProcess: TProcess);
|
||||||
|
procedure removeProcess(aProcess: TProcess);
|
||||||
public
|
public
|
||||||
constructor create(aOwner: TComponent); override;
|
constructor create(aOwner: TComponent); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
//
|
//
|
||||||
procedure sesoptDeclareProperties(aFiler: TFiler); override;
|
procedure sesoptDeclareProperties(aFiler: TFiler); override;
|
||||||
property process: TProcess read fProc write setProc;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
@ -44,6 +46,7 @@ begin
|
||||||
inherited;
|
inherited;
|
||||||
fMru := TMRUList.Create;
|
fMru := TMRUList.Create;
|
||||||
fMru.maxCount := 25;
|
fMru.maxCount := 25;
|
||||||
|
EntitiesConnector.addSingleService(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCEProcInputWidget.destroy;
|
destructor TCEProcInputWidget.destroy;
|
||||||
|
@ -71,8 +74,13 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION --------------------------------------------------------------------}
|
{$ENDREGION --------------------------------------------------------------------}
|
||||||
|
|
||||||
{$REGION Process input things --------------------------------------------------}
|
{$REGION ICEProcInputHandler ---------------------------------------------------}
|
||||||
procedure TCEProcInputWidget.setProc(const aValue: TProcess);
|
function TCEProcInputWidget.singleServiceName: string;
|
||||||
|
begin
|
||||||
|
exit('ICEProcInputHandler');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEProcInputWidget.addProcess(aProcess: TProcess);
|
||||||
begin
|
begin
|
||||||
// TODO-cfeature: process list, imply that each TCESynMemo must have its own runnable TProcess
|
// TODO-cfeature: process list, imply that each TCESynMemo must have its own runnable TProcess
|
||||||
// currently they share the CEMainForm.fRunProc variable.
|
// currently they share the CEMainForm.fRunProc variable.
|
||||||
|
@ -81,14 +89,22 @@ begin
|
||||||
|
|
||||||
txtExeName.Caption := 'no process';
|
txtExeName.Caption := 'no process';
|
||||||
fProc := nil;
|
fProc := nil;
|
||||||
if aValue = nil then
|
if aProcess = nil then
|
||||||
exit;
|
exit;
|
||||||
if not (poUsePipes in aValue.Options) then
|
if not (poUsePipes in aProcess.Options) then
|
||||||
exit;
|
exit;
|
||||||
fProc := aValue;
|
fProc := aProcess;
|
||||||
txtExeName.Caption := shortenPath(fProc.Executable);
|
txtExeName.Caption := shortenPath(fProc.Executable);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEProcInputWidget.removeProcess(aProcess: TProcess);
|
||||||
|
begin
|
||||||
|
if fProc = aProcess then
|
||||||
|
addProcess(nil);
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION Process input things --------------------------------------------------}
|
||||||
procedure TCEProcInputWidget.sendInput;
|
procedure TCEProcInputWidget.sendInput;
|
||||||
var
|
var
|
||||||
inp: string;
|
inp: string;
|
||||||
|
|
|
@ -34,7 +34,6 @@ type
|
||||||
fUpdateCount: NativeInt;
|
fUpdateCount: NativeInt;
|
||||||
fProjectSubject: TCECustomSubject;
|
fProjectSubject: TCECustomSubject;
|
||||||
fRunner: TCheckedAsyncProcess;
|
fRunner: TCheckedAsyncProcess;
|
||||||
fLogMessager: TCECustomSubject;
|
|
||||||
fOutputFilename: string;
|
fOutputFilename: string;
|
||||||
fCanBeRun: boolean;
|
fCanBeRun: boolean;
|
||||||
procedure updateOutFilename;
|
procedure updateOutFilename;
|
||||||
|
@ -92,13 +91,12 @@ type
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
ce_interfaces, controls, dialogs, ce_symstring, ce_libman, ce_main, ce_dcd;
|
ce_interfaces, controls, dialogs, ce_symstring, ce_libman, ce_dcd;
|
||||||
|
|
||||||
constructor TCEProject.create(aOwner: TComponent);
|
constructor TCEProject.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited create(aOwner);
|
inherited create(aOwner);
|
||||||
//
|
//
|
||||||
fLogMessager := TCELogMessageSubject.create;
|
|
||||||
fProjectSubject := TCEProjectSubject.create;
|
fProjectSubject := TCEProjectSubject.create;
|
||||||
//
|
//
|
||||||
fLibAliases := TStringList.Create;
|
fLibAliases := TStringList.Create;
|
||||||
|
@ -123,7 +121,6 @@ destructor TCEProject.destroy;
|
||||||
begin
|
begin
|
||||||
subjProjClosing(TCEProjectSubject(fProjectSubject), self);
|
subjProjClosing(TCEProjectSubject(fProjectSubject), self);
|
||||||
fProjectSubject.Free;
|
fProjectSubject.Free;
|
||||||
fLogMessager.Free;
|
|
||||||
//
|
//
|
||||||
fOnChange := nil;
|
fOnChange := nil;
|
||||||
fLibAliases.Free;
|
fLibAliases.Free;
|
||||||
|
@ -611,22 +608,24 @@ var
|
||||||
compilproc: TProcess;
|
compilproc: TProcess;
|
||||||
olddir, prjpath: string;
|
olddir, prjpath: string;
|
||||||
prjname: string;
|
prjname: string;
|
||||||
|
msgs: ICEMessagesDisplay;
|
||||||
begin
|
begin
|
||||||
result := false;
|
result := false;
|
||||||
config := currentConfiguration;
|
config := currentConfiguration;
|
||||||
|
msgs := getMessageDisplay;
|
||||||
if config = nil then
|
if config = nil then
|
||||||
begin
|
begin
|
||||||
subjLmFromString(TCELogMessageSubject(fLogMessager),
|
msgs.message('unexpected project error: no active configuration',
|
||||||
'unexpected project error: no active configuration', Self, amcProj, amkErr);
|
Self, amcProj, amkErr);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
subjLmClearByData(TCELogMessageSubject(fLogMessager), Self);
|
msgs.clearByData(Self);
|
||||||
subjProjCompiling(TCEProjectSubject(fProjectSubject), Self);
|
subjProjCompiling(TCEProjectSubject(fProjectSubject), Self);
|
||||||
//
|
//
|
||||||
if not runPrePostProcess(config.preBuildProcess) then
|
if not runPrePostProcess(config.preBuildProcess) then
|
||||||
subjLmFromString(TCELogMessageSubject(fLogMessager),
|
msgs.message('project warning: the pre-compilation process has not been properly executed',
|
||||||
'project warning: the pre-compilation process has not been properly executed', Self, amcProj, amkWarn);
|
Self, amcProj, amkWarn);
|
||||||
//
|
//
|
||||||
if Sources.Count = 0 then exit;
|
if Sources.Count = 0 then exit;
|
||||||
//
|
//
|
||||||
|
@ -635,8 +634,7 @@ begin
|
||||||
olddir := '';
|
olddir := '';
|
||||||
getDir(0, olddir);
|
getDir(0, olddir);
|
||||||
try
|
try
|
||||||
subjLmFromString(TCELogMessageSubject(fLogMessager),
|
msgs.message('compiling ' + prjname, Self, amcProj, amkInf);
|
||||||
'compiling ' + prjname, Self, amcProj, amkInf);
|
|
||||||
prjpath := extractFilePath(fileName);
|
prjpath := extractFilePath(fileName);
|
||||||
if directoryExists(prjpath) then
|
if directoryExists(prjpath) then
|
||||||
begin
|
begin
|
||||||
|
@ -651,16 +649,14 @@ begin
|
||||||
while compilProc.Running do
|
while compilProc.Running do
|
||||||
compProcOutput(compilproc);
|
compProcOutput(compilproc);
|
||||||
if compilproc.ExitStatus = 0 then begin
|
if compilproc.ExitStatus = 0 then begin
|
||||||
subjLmFromString(TCELogMessageSubject(fLogMessager),
|
msgs.message(prjname + ' has been successfully compiled', Self, amcProj, amkInf);
|
||||||
prjname + ' has been successfully compiled', Self, amcProj, amkInf);
|
|
||||||
result := true;
|
result := true;
|
||||||
end else
|
end else
|
||||||
subjLmFromString(TCELogMessageSubject(fLogMessager),
|
msgs.message(prjname + ' has not been compiled', Self, amcProj, amkWarn);
|
||||||
prjname + ' has not been compiled', Self, amcProj, amkWarn);
|
|
||||||
|
|
||||||
if not runPrePostProcess(config.PostBuildProcess) then
|
if not runPrePostProcess(config.PostBuildProcess) then
|
||||||
subjLmFromString(TCELogMessageSubject(fLogMessager),
|
msgs.message( 'project warning: the post-compilation process has not been properly executed',
|
||||||
'project warning: the post-compilation process has not been properly executed', Self, amcProj, amkWarn);
|
Self, amcProj, amkWarn);
|
||||||
|
|
||||||
finally
|
finally
|
||||||
updateOutFilename;
|
updateOutFilename;
|
||||||
|
@ -694,8 +690,8 @@ begin
|
||||||
//
|
//
|
||||||
if not fileExists(outputFilename) then
|
if not fileExists(outputFilename) then
|
||||||
begin
|
begin
|
||||||
subjLmFromString(TCELogMessageSubject(fLogMessager),
|
getMessageDisplay.message('output executable missing: ' + shortenPath(outputFilename, 25),
|
||||||
'output executable missing: ' + shortenPath(outputFilename, 25), Self, amcProj, amkErr);
|
Self, amcProj, amkErr);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
|
@ -705,7 +701,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;
|
getprocInputHandler.addProcess(fRunner);
|
||||||
end;
|
end;
|
||||||
fRunner.Execute;
|
fRunner.Execute;
|
||||||
//
|
//
|
||||||
|
@ -717,34 +713,35 @@ var
|
||||||
proc: TProcess;
|
proc: TProcess;
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
str: string;
|
str: string;
|
||||||
|
msgs: ICEMessagesDisplay;
|
||||||
begin
|
begin
|
||||||
proc := TProcess(sender);
|
proc := TProcess(sender);
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
|
msgs := getMessageDisplay;
|
||||||
try
|
try
|
||||||
processOutputToStrings(proc, lst);
|
processOutputToStrings(proc, lst);
|
||||||
for str in lst do
|
for str in lst do
|
||||||
subjLmFromString(TCELogMessageSubject(fLogMessager),
|
msgs.message(str, Self, amcProj, amkBub);
|
||||||
str, Self, amcProj, amkBub);
|
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
if not proc.Active then
|
if not proc.Active then
|
||||||
if CEMainForm.processInput.process = proc then
|
getprocInputHandler.removeProcess(proc);
|
||||||
CEMainForm.processInput.process := nil;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProject.compProcOutput(proc: TProcess);
|
procedure TCEProject.compProcOutput(proc: TProcess);
|
||||||
var
|
var
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
str: string;
|
str: string;
|
||||||
|
msgs: ICEMessagesDisplay;
|
||||||
begin
|
begin
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
|
msgs := getMessageDisplay;
|
||||||
try
|
try
|
||||||
processOutputToStrings(proc, lst);
|
processOutputToStrings(proc, lst);
|
||||||
for str in lst do
|
for str in lst do
|
||||||
subjLmFromString(TCELogMessageSubject(fLogMessager),
|
msgs.message(str, Self, amcProj, amkAuto);
|
||||||
str, Self, amcProj, amkAuto);
|
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -23,8 +23,8 @@ type
|
||||||
procedure TreeFilterEdit1AfterFilter(Sender: TObject);
|
procedure TreeFilterEdit1AfterFilter(Sender: TObject);
|
||||||
procedure TreeKeyPress(Sender: TObject; var Key: char);
|
procedure TreeKeyPress(Sender: TObject; var Key: char);
|
||||||
private
|
private
|
||||||
|
fMsgs: ICEMessagesDisplay;
|
||||||
fDmdProc: TCheckedAsyncProcess;
|
fDmdProc: TCheckedAsyncProcess;
|
||||||
fLogMessager: TCELogMessageSubject;
|
|
||||||
fActCopyIdent: TAction;
|
fActCopyIdent: TAction;
|
||||||
fActRefresh: TAction;
|
fActRefresh: TAction;
|
||||||
fActRefreshOnChange: TAction;
|
fActRefreshOnChange: TAction;
|
||||||
|
@ -97,7 +97,6 @@ constructor TCEStaticExplorerWidget.create(aOwner: TComponent);
|
||||||
var
|
var
|
||||||
png: TPortableNetworkGraphic;
|
png: TPortableNetworkGraphic;
|
||||||
begin
|
begin
|
||||||
fLogMessager := TCELogMessageSubject.create;
|
|
||||||
fAutoRefresh := false;
|
fAutoRefresh := false;
|
||||||
fRefreshOnFocus := true;
|
fRefreshOnFocus := true;
|
||||||
fRefreshOnChange := false;
|
fRefreshOnChange := false;
|
||||||
|
@ -160,13 +159,13 @@ begin
|
||||||
EntitiesConnector.removeObserver(self);
|
EntitiesConnector.removeObserver(self);
|
||||||
//
|
//
|
||||||
killProcess(fDmdProc);
|
killProcess(fDmdProc);
|
||||||
fLogMessager.Free;
|
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEStaticExplorerWidget.SetVisible(Value: boolean);
|
procedure TCEStaticExplorerWidget.SetVisible(Value: boolean);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
getMessageDisplay(fMsgs);
|
||||||
if Value then
|
if Value then
|
||||||
produceJsonInfo;
|
produceJsonInfo;
|
||||||
end;
|
end;
|
||||||
|
@ -557,8 +556,7 @@ begin
|
||||||
'template' :ndCat := Tree.Items.AddChildObject(ndTmp, nme, ln);
|
'template' :ndCat := Tree.Items.AddChildObject(ndTmp, nme, ln);
|
||||||
'union' :ndCat := Tree.Items.AddChildObject(ndUni, nme, ln);
|
'union' :ndCat := Tree.Items.AddChildObject(ndUni, nme, ln);
|
||||||
'variable' :ndCat := Tree.Items.AddChildObject(ndVar, nme, ln);
|
'variable' :ndCat := Tree.Items.AddChildObject(ndVar, nme, ln);
|
||||||
else subjLmFromString(fLogMessager, 'static explorer does not handle this kind: '
|
else fMsgs.message('static explorer does not handle this kind: '+ knd, nil, amcApp, amkWarn);
|
||||||
+ knd, nil, amcApp, amkWarn);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if ndCat = nil then
|
if ndCat = nil then
|
||||||
|
|
|
@ -559,6 +559,7 @@ begin
|
||||||
inherited;
|
inherited;
|
||||||
if (Button = mbMiddle) and (Shift = [ssCtrl]) then
|
if (Button = mbMiddle) and (Shift = [ssCtrl]) then
|
||||||
Font.Size := fStoredFontSize
|
Font.Size := fStoredFontSize
|
||||||
|
//TODO-cLCL&LAZ-specific: test this feature under gtk2/linux on next release, should work
|
||||||
else if Button = mbExtra1 then
|
else if Button = mbExtra1 then
|
||||||
fPositions.back
|
fPositions.back
|
||||||
else if Button = mbExtra2 then
|
else if Button = mbExtra2 then
|
||||||
|
|
|
@ -71,7 +71,7 @@ type
|
||||||
fDoc: TCESynMemo;
|
fDoc: TCESynMemo;
|
||||||
fToolProcess: TCheckedAsyncProcess;
|
fToolProcess: TCheckedAsyncProcess;
|
||||||
fTodos: TTodoItems;
|
fTodos: TTodoItems;
|
||||||
fLogMessager: TCELogMessageSubject;
|
fMsgs: ICEMessagesDisplay;
|
||||||
// ICEMultiDocObserver
|
// ICEMultiDocObserver
|
||||||
procedure docNew(aDoc: TCESynMemo);
|
procedure docNew(aDoc: TCESynMemo);
|
||||||
procedure docFocused(aDoc: TCESynMemo);
|
procedure docFocused(aDoc: TCESynMemo);
|
||||||
|
@ -173,7 +173,6 @@ var
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
fTodos := TTodoItems.Create(self);
|
fTodos := TTodoItems.Create(self);
|
||||||
fLogMessager := TCELogMessageSubject.create;
|
|
||||||
lstItems.OnDblClick := @lstItemsDoubleClick;
|
lstItems.OnDblClick := @lstItemsDoubleClick;
|
||||||
btnRefresh.OnClick := @btnRefreshClick;
|
btnRefresh.OnClick := @btnRefreshClick;
|
||||||
fAutoRefresh := true;
|
fAutoRefresh := true;
|
||||||
|
@ -197,7 +196,6 @@ end;
|
||||||
destructor TCETodoListWidget.destroy;
|
destructor TCETodoListWidget.destroy;
|
||||||
begin
|
begin
|
||||||
killToolProcess;
|
killToolProcess;
|
||||||
fLogMessager.Free;
|
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -355,14 +353,15 @@ var
|
||||||
msg: string;
|
msg: string;
|
||||||
ctxt: TTodoContext;
|
ctxt: TTodoContext;
|
||||||
begin
|
begin
|
||||||
|
getMessageDisplay(fMsgs);
|
||||||
str := TStringList.Create;
|
str := TStringList.Create;
|
||||||
try
|
try
|
||||||
processOutputToStrings(fToolProcess, str);
|
processOutputToStrings(fToolProcess, str);
|
||||||
ctxt := getContext;
|
ctxt := getContext;
|
||||||
for msg in str do case ctxt of
|
for msg in str do case ctxt of
|
||||||
tcNone: subjLmFromString(fLogMessager, msg, nil, amcMisc, amkAuto);
|
tcNone: fMsgs.message(msg, nil, amcMisc, amkAuto);
|
||||||
tcFile: subjLmFromString(fLogMessager, msg, fDoc, amcEdit, amkAuto);
|
tcFile: fMsgs.message(msg, fDoc, amcEdit, amkAuto);
|
||||||
tcProject:subjLmFromString(fLogMessager, msg, fProj, amcProj, amkAuto);
|
tcProject:fMsgs.message(msg, fProj, amcProj, amkAuto);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
str.Free;
|
str.Free;
|
||||||
|
|
|
@ -23,7 +23,7 @@ type
|
||||||
fChainBefore: TStringList;
|
fChainBefore: TStringList;
|
||||||
fChainAfter: TStringList;
|
fChainAfter: TStringList;
|
||||||
//fShortcut: string;
|
//fShortcut: string;
|
||||||
fLogMessager: TCELogMessageSubject;
|
fMsgs: ICEMessagesDisplay;
|
||||||
procedure setParameters(aValue: TStringList);
|
procedure setParameters(aValue: TStringList);
|
||||||
procedure setChainBefore(aValue: TStringList);
|
procedure setChainBefore(aValue: TStringList);
|
||||||
procedure setChainAfter(aValue: TStringList);
|
procedure setChainAfter(aValue: TStringList);
|
||||||
|
@ -84,7 +84,6 @@ begin
|
||||||
fParameters := TStringList.create;
|
fParameters := TStringList.create;
|
||||||
fChainBefore := TStringList.Create;
|
fChainBefore := TStringList.Create;
|
||||||
fChainAfter := TStringList.Create;
|
fChainAfter := TStringList.Create;
|
||||||
fLogMessager := TCELogMessageSubject.create;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCEToolItem.destroy;
|
destructor TCEToolItem.destroy;
|
||||||
|
@ -92,7 +91,6 @@ begin
|
||||||
fParameters.Free;
|
fParameters.Free;
|
||||||
fChainAfter.Free;
|
fChainAfter.Free;
|
||||||
fChainBefore.Free;
|
fChainBefore.Free;
|
||||||
fLogMessager.Free;
|
|
||||||
killProcess(fProcess);
|
killProcess(fProcess);
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
@ -152,11 +150,12 @@ var
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
str: string;
|
str: string;
|
||||||
begin
|
begin
|
||||||
|
getMessageDisplay(fMsgs);
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
processOutputToStrings(fProcess, lst);
|
processOutputToStrings(fProcess, lst);
|
||||||
for str in lst do
|
for str in lst do
|
||||||
subjLmFromString(fLogMessager, str, nil, amcMisc, amkAuto);
|
fMsgs.message(str, nil, amcMisc, amkAuto);
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue