mirror of https://gitlab.com/basile.b/dexed.git
r23
This commit is contained in:
parent
b522b1da03
commit
7ef9784253
|
@ -7,8 +7,6 @@ interface
|
||||||
uses
|
uses
|
||||||
classes, sysutils, process;
|
classes, sysutils, process;
|
||||||
|
|
||||||
//TODO-cfeature: scanner for -I and -J sources is the item is a folder.
|
|
||||||
|
|
||||||
(*
|
(*
|
||||||
|
|
||||||
procedure to add a new compiler option:
|
procedure to add a new compiler option:
|
||||||
|
@ -21,7 +19,7 @@ procedure to add a new compiler option:
|
||||||
type
|
type
|
||||||
|
|
||||||
(*****************************************************************************
|
(*****************************************************************************
|
||||||
* Base class for encapsulating some compiler options.
|
* Base class designed to encapsulate some compiler options.
|
||||||
* A descendant must be able to generate the related options
|
* A descendant must be able to generate the related options
|
||||||
* as a string representing the partial switches/arguments.
|
* as a string representing the partial switches/arguments.
|
||||||
*)
|
*)
|
||||||
|
@ -362,7 +360,7 @@ begin
|
||||||
if assigned(fOnChange) then fOnChange(self);
|
if assigned(fOnChange) then fOnChange(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$REGION TDocOpts **************************************************************}
|
{$REGION TDocOpts --------------------------------------------------------------}
|
||||||
procedure TDocOpts.getOpts(const aList: TStrings);
|
procedure TDocOpts.getOpts(const aList: TStrings);
|
||||||
begin
|
begin
|
||||||
if fGenDoc then aList.Add('-D');
|
if fGenDoc then aList.Add('-D');
|
||||||
|
@ -429,7 +427,7 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION TMsgOpts **************************************************************}
|
{$REGION TMsgOpts --------------------------------------------------------------}
|
||||||
constructor TMsgOpts.create;
|
constructor TMsgOpts.create;
|
||||||
begin
|
begin
|
||||||
fDepHandling := TDepHandling.warning;
|
fDepHandling := TDepHandling.warning;
|
||||||
|
@ -520,7 +518,7 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION TOutputOpts ***********************************************************}
|
{$REGION TOutputOpts -----------------------------------------------------------}
|
||||||
constructor TOutputOpts.create;
|
constructor TOutputOpts.create;
|
||||||
begin
|
begin
|
||||||
fVerIds := TStringList.Create;
|
fVerIds := TStringList.Create;
|
||||||
|
@ -706,7 +704,7 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION TDebugOpts ************************************************************}
|
{$REGION TDebugOpts ------------------------------------------------------------}
|
||||||
constructor TDebugOpts.create;
|
constructor TDebugOpts.create;
|
||||||
begin
|
begin
|
||||||
fDbgIdents := TStringList.Create;
|
fDbgIdents := TStringList.Create;
|
||||||
|
@ -826,7 +824,7 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION TPathsOpts ************************************************************}
|
{$REGION TPathsOpts ------------------------------------------------------------}
|
||||||
constructor TPathsOpts.create;
|
constructor TPathsOpts.create;
|
||||||
begin
|
begin
|
||||||
fSrcs := TStringList.Create;
|
fSrcs := TStringList.Create;
|
||||||
|
@ -914,7 +912,7 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION TOtherOpts ************************************************************}
|
{$REGION TOtherOpts ------------------------------------------------------------}
|
||||||
constructor TOtherOpts.create;
|
constructor TOtherOpts.create;
|
||||||
begin
|
begin
|
||||||
fCustom := TStringList.Create;
|
fCustom := TStringList.Create;
|
||||||
|
@ -959,7 +957,7 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION TCustomProcOptions ****************************************************}
|
{$REGION TCustomProcOptions ----------------------------------------------------}
|
||||||
constructor TCustomProcOptions.create;
|
constructor TCustomProcOptions.create;
|
||||||
begin
|
begin
|
||||||
fParameters := TStringList.Create;
|
fParameters := TStringList.Create;
|
||||||
|
@ -1035,7 +1033,7 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION TCompilerConfiguration ************************************************}
|
{$REGION TCompilerConfiguration ------------------------------------------------}
|
||||||
constructor TCompilerConfiguration.create(aCollection: TCollection);
|
constructor TCompilerConfiguration.create(aCollection: TCollection);
|
||||||
begin
|
begin
|
||||||
inherited create(aCollection);
|
inherited create(aCollection);
|
||||||
|
|
|
@ -12,7 +12,6 @@ uses
|
||||||
ce_project;
|
ce_project;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TCEEditorWidget }
|
|
||||||
TCEEditorWidget = class(TCEWidget)
|
TCEEditorWidget = class(TCEWidget)
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
PageControl: TExtendedNotebook;
|
PageControl: TExtendedNotebook;
|
||||||
|
@ -168,7 +167,7 @@ end;
|
||||||
|
|
||||||
procedure TCEEditorWidget.removeEditor(const aIndex: NativeInt);
|
procedure TCEEditorWidget.removeEditor(const aIndex: NativeInt);
|
||||||
begin
|
begin
|
||||||
CEMainForm.MessageWidget.ClearMessages(msEditor);
|
CEMainForm.MessageWidget.ClearMessages(mcEditor);
|
||||||
editor[aIndex].OnChange:= nil;
|
editor[aIndex].OnChange:= nil;
|
||||||
pageControl.Pages[aIndex].Free;
|
pageControl.Pages[aIndex].Free;
|
||||||
end;
|
end;
|
||||||
|
@ -236,6 +235,7 @@ end;
|
||||||
|
|
||||||
procedure TCEEditorWidget.UpdateByDelay;
|
procedure TCEEditorWidget.UpdateByDelay;
|
||||||
var
|
var
|
||||||
|
dt: PMessageItemData;
|
||||||
ed: TCESynMemo;
|
ed: TCESynMemo;
|
||||||
err: TLexError;
|
err: TLexError;
|
||||||
md: string;
|
md: string;
|
||||||
|
@ -248,15 +248,20 @@ begin
|
||||||
CEMainForm.docChangeNotify(Self, editorIndex);
|
CEMainForm.docChangeNotify(Self, editorIndex);
|
||||||
if ed.Lines.Count = 0 then exit;
|
if ed.Lines.Count = 0 then exit;
|
||||||
//
|
//
|
||||||
CEMainForm.MessageWidget.ClearMessages(msEditor);
|
CEMainForm.MessageWidget.ClearMessages(mcEditor);
|
||||||
lex(ed.Lines.Text, tokLst);
|
lex(ed.Lines.Text, tokLst);
|
||||||
|
|
||||||
if ed.isDSource then
|
if ed.isDSource then
|
||||||
begin
|
begin
|
||||||
checkSyntacticErrors(tokLst, errLst);
|
checkSyntacticErrors(tokLst, errLst);
|
||||||
for err in errLst do
|
for err in errLst do begin
|
||||||
CEMainForm.MessageWidget.addMessage(format( '%s (@line:%4.d @char:%.4d)',
|
dt := newMessageData;
|
||||||
[err.msg, err.position.y, err.position.x]), msEditor);
|
dt^.editor := ed;
|
||||||
|
dt^.position := point(err.position.x, err.position.y);
|
||||||
|
dt^.ctxt := mcEditor;
|
||||||
|
CEMainForm.MessageWidget.addMessage(format( '%s (@line:%.4d @char:%.4d)',
|
||||||
|
[err.msg, err.position.y, err.position.x]), dt);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
md := '';
|
md := '';
|
||||||
|
|
|
@ -15,7 +15,7 @@ type
|
||||||
|
|
||||||
TCEMainForm = class;
|
TCEMainForm = class;
|
||||||
|
|
||||||
//TODO: options
|
//TODO-cfeature: options
|
||||||
//TODO-cwidget: options editor
|
//TODO-cwidget: options editor
|
||||||
(**
|
(**
|
||||||
* Encapsulates the options in a writable component.
|
* Encapsulates the options in a writable component.
|
||||||
|
@ -221,7 +221,7 @@ type
|
||||||
procedure widgetShowFromAction(sender: TObject);
|
procedure widgetShowFromAction(sender: TObject);
|
||||||
|
|
||||||
// run & exec sub routines
|
// run & exec sub routines
|
||||||
procedure ProcessOutputToMsg(const aProcess: TProcess;aCtxt: TMessageContext = msUnknown);
|
procedure ProcessOutputToMsg(const aProcess: TProcess;aCtxt: TMessageContext = mcUnknown);
|
||||||
procedure compileAndRunFile(const edIndex: NativeInt; const runArgs: string = '');
|
procedure compileAndRunFile(const edIndex: NativeInt; const runArgs: string = '');
|
||||||
procedure compileProject(const aProject: TCEProject);
|
procedure compileProject(const aProject: TCEProject);
|
||||||
procedure runProject(const aProject: TCEProject; const runArgs: string = '');
|
procedure runProject(const aProject: TCEProject; const runArgs: string = '');
|
||||||
|
@ -921,13 +921,14 @@ end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION run -------------------------------------------------------------------}
|
{$REGION run -------------------------------------------------------------------}
|
||||||
procedure TCEMainForm.ProcessOutputToMsg(const aProcess: TProcess; aCtxt: TMessageContext = msUnknown);
|
procedure TCEMainForm.ProcessOutputToMsg(const aProcess: TProcess; aCtxt: TMessageContext = mcUnknown);
|
||||||
var
|
var
|
||||||
str: TMemoryStream;
|
str: TMemoryStream;
|
||||||
lns: TStringList;
|
lns: TStringList;
|
||||||
readCnt: LongInt;
|
readCnt: LongInt;
|
||||||
readSz: LongInt;
|
readSz: LongInt;
|
||||||
ioBuffSz: LongInt;
|
ioBuffSz: LongInt;
|
||||||
|
dt: PMessageItemData;
|
||||||
msg: string;
|
msg: string;
|
||||||
begin
|
begin
|
||||||
If not (poUsePipes in aProcess.Options) then exit;
|
If not (poUsePipes in aProcess.Options) then exit;
|
||||||
|
@ -946,7 +947,15 @@ begin
|
||||||
end;
|
end;
|
||||||
Str.SetSize(readSz);
|
Str.SetSize(readSz);
|
||||||
lns.LoadFromStream(Str);
|
lns.LoadFromStream(Str);
|
||||||
for msg in lns do fMesgWidg.addMessage(msg, aCtxt);
|
for msg in lns do begin
|
||||||
|
fMesgWidg.addMessage(msg, aCtxt);
|
||||||
|
dt := newMessageData;
|
||||||
|
dt^.ctxt := aCtxt;
|
||||||
|
dt^.position := getLineFromDmdMessage(msg);
|
||||||
|
dt^.editor := getFileFromDmdMessage(msg);
|
||||||
|
if dt^.editor = nil then
|
||||||
|
dt^.editor := EditWidget.currentEditor;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
str.Free;
|
str.Free;
|
||||||
lns.Free;
|
lns.Free;
|
||||||
|
@ -954,7 +963,7 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// TODO: input handling
|
// TODO-cfeature: input handling
|
||||||
procedure TCEMainForm.compileAndRunFile(const edIndex: NativeInt; const runArgs: string = '');
|
procedure TCEMainForm.compileAndRunFile(const edIndex: NativeInt; const runArgs: string = '');
|
||||||
var
|
var
|
||||||
dmdproc: TProcess;
|
dmdproc: TProcess;
|
||||||
|
@ -967,7 +976,7 @@ begin
|
||||||
getDir(0, olddir);
|
getDir(0, olddir);
|
||||||
try
|
try
|
||||||
|
|
||||||
fMesgWidg.addCeInf( 'compiling ' + fEditWidg.editor[edIndex].fileName, msEditor );
|
fMesgWidg.addCeInf( 'compiling ' + fEditWidg.editor[edIndex].fileName, mcEditor );
|
||||||
|
|
||||||
temppath := GetTempDir(false);
|
temppath := GetTempDir(false);
|
||||||
chDir(temppath);
|
chDir(temppath);
|
||||||
|
@ -987,9 +996,8 @@ begin
|
||||||
try
|
try
|
||||||
dmdproc.Execute;
|
dmdproc.Execute;
|
||||||
while dmdproc.Running do if dmdproc.ExitStatus <> 0 then break;
|
while dmdproc.Running do if dmdproc.ExitStatus <> 0 then break;
|
||||||
ProcessOutputToMsg(dmdproc, msEditor);
|
|
||||||
finally
|
finally
|
||||||
DeleteFile(fname + '.d');
|
ProcessOutputToMsg(dmdproc, mcEditor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
|
@ -1000,7 +1008,7 @@ begin
|
||||||
begin
|
begin
|
||||||
|
|
||||||
fMesgWidg.addCeInf( fEditWidg.editor[edIndex].fileName
|
fMesgWidg.addCeInf( fEditWidg.editor[edIndex].fileName
|
||||||
+ ' successfully compiled', msEditor );
|
+ ' successfully compiled', mcEditor );
|
||||||
|
|
||||||
runproc.Options:= [poStderrToOutPut, poUsePipes];
|
runproc.Options:= [poStderrToOutPut, poUsePipes];
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
|
@ -1010,9 +1018,11 @@ begin
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
runproc.Executable := fname;
|
runproc.Executable := fname;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
try
|
||||||
runproc.Execute;
|
runproc.Execute;
|
||||||
while runproc.Running do if runproc.ExitStatus <> 0 then break;
|
while runproc.Running do if runproc.ExitStatus <> 0 then break;
|
||||||
ProcessOutputToMsg(runproc, msEditor);
|
ProcessOutputToMsg(runproc, mcEditor);
|
||||||
|
finally
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
DeleteFile(fname + '.exe');
|
DeleteFile(fname + '.exe');
|
||||||
DeleteFile(fname + '.obj');
|
DeleteFile(fname + '.obj');
|
||||||
|
@ -1020,14 +1030,16 @@ begin
|
||||||
DeleteFile(fname);
|
DeleteFile(fname);
|
||||||
DeleteFile(fname + '.o');
|
DeleteFile(fname + '.o');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
fMesgWidg.addCeErr( fEditWidg.editor[edIndex].fileName
|
fMesgWidg.addCeErr( fEditWidg.editor[edIndex].fileName
|
||||||
+ ' has not been compiled', msEditor );
|
+ ' has not been compiled', mcEditor );
|
||||||
|
|
||||||
finally
|
finally
|
||||||
dmdproc.Free;
|
dmdproc.Free;
|
||||||
runproc.Free;
|
runproc.Free;
|
||||||
|
DeleteFile(fname + '.d');
|
||||||
chDir(olddir);
|
chDir(olddir);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -1040,14 +1052,14 @@ var
|
||||||
i: NativeInt;
|
i: NativeInt;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
fMesgWidg.ClearMessages(msProject);
|
fMesgWidg.ClearMessages(mcProject);
|
||||||
|
|
||||||
for i := 0 to fWidgList.Count-1 do
|
for i := 0 to fWidgList.Count-1 do
|
||||||
fWidgList.widget[i].projCompile(aProject);
|
fWidgList.widget[i].projCompile(aProject);
|
||||||
|
|
||||||
if aProject.Sources.Count = 0 then
|
if aProject.Sources.Count = 0 then
|
||||||
begin
|
begin
|
||||||
fMesgWidg.addCeErr( aProject.fileName + ' has no source files', msProject);
|
fMesgWidg.addCeErr( aProject.fileName + ' has no source files', mcProject);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1066,7 +1078,7 @@ begin
|
||||||
ppproc.Free;
|
ppproc.Free;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else fMesgWidg.addCeWarn('the pre-compilation executable does not exist', msProject);
|
else fMesgWidg.addCeWarn('the pre-compilation executable does not exist', mcProject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
olddir := '';
|
olddir := '';
|
||||||
|
@ -1075,7 +1087,7 @@ begin
|
||||||
try
|
try
|
||||||
|
|
||||||
|
|
||||||
fMesgWidg.addCeInf( 'compiling ' + aProject.fileName, msProject);
|
fMesgWidg.addCeInf( 'compiling ' + aProject.fileName, mcProject);
|
||||||
application.ProcessMessages;
|
application.ProcessMessages;
|
||||||
|
|
||||||
prjpath := extractFilePath(aProject.fileName);
|
prjpath := extractFilePath(aProject.fileName);
|
||||||
|
@ -1091,7 +1103,7 @@ begin
|
||||||
try
|
try
|
||||||
dmdproc.Execute;
|
dmdproc.Execute;
|
||||||
while dmdproc.Running do if dmdproc.ExitStatus <> 0 then break;
|
while dmdproc.Running do if dmdproc.ExitStatus <> 0 then break;
|
||||||
ProcessOutputToMsg(dmdproc, msProject);
|
ProcessOutputToMsg(dmdproc, mcProject);
|
||||||
finally
|
finally
|
||||||
{$IFDEF MSWINDOWS} // STILL_ACTIVE ambiguity
|
{$IFDEF MSWINDOWS} // STILL_ACTIVE ambiguity
|
||||||
if (dmdProc.ExitStatus = 0) or (dmdProc.ExitStatus = 259) then
|
if (dmdProc.ExitStatus = 0) or (dmdProc.ExitStatus = 259) then
|
||||||
|
@ -1099,10 +1111,10 @@ begin
|
||||||
if dmdProc.ExitStatus = 0 then
|
if dmdProc.ExitStatus = 0 then
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
fMesgWidg.addCeInf( aProject.fileName
|
fMesgWidg.addCeInf( aProject.fileName
|
||||||
+ ' successfully compiled', msProject)
|
+ ' successfully compiled', mcProject)
|
||||||
else
|
else
|
||||||
fMesgWidg.addCeErr( aProject.fileName
|
fMesgWidg.addCeErr( aProject.fileName
|
||||||
+ ' has not been compiled', msProject);
|
+ ' has not been compiled', mcProject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with fProject.currentConfiguration do
|
with fProject.currentConfiguration do
|
||||||
|
@ -1120,7 +1132,7 @@ begin
|
||||||
ppproc.Free;
|
ppproc.Free;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else fMesgWidg.addCeWarn('the post-compilation executable does not exist', msProject);
|
else fMesgWidg.addCeWarn('the post-compilation executable does not exist', mcProject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
|
@ -1160,7 +1172,7 @@ begin
|
||||||
|
|
||||||
if not fileExists(procname) then
|
if not fileExists(procname) then
|
||||||
begin
|
begin
|
||||||
fMesgWidg.addCeErr('output executable missing: ' + procname, msProject);
|
fMesgWidg.addCeErr('output executable missing: ' + procname, mcProject);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1169,7 +1181,7 @@ begin
|
||||||
runproc.CurrentDirectory := extractFilePath(runproc.Executable);
|
runproc.CurrentDirectory := extractFilePath(runproc.Executable);
|
||||||
runproc.Execute;
|
runproc.Execute;
|
||||||
while runproc.Running do if runproc.ExitStatus <> 0 then break;
|
while runproc.Running do if runproc.ExitStatus <> 0 then break;
|
||||||
ProcessOutputToMsg(runproc, msProject);
|
ProcessOutputToMsg(runproc, mcProject);
|
||||||
|
|
||||||
finally
|
finally
|
||||||
runproc.Free;
|
runproc.Free;
|
||||||
|
|
|
@ -38,6 +38,7 @@ inherited CEMessagesWidget: TCEMessagesWidget
|
||||||
ShowLines = False
|
ShowLines = False
|
||||||
ShowRoot = False
|
ShowRoot = False
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
OnDblClick = ListDblClick
|
||||||
OnKeyDown = ListKeyDown
|
OnKeyDown = ListKeyDown
|
||||||
Options = [tvoAllowMultiselect, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoToolTips, tvoThemedDraw]
|
Options = [tvoAllowMultiselect, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoToolTips, tvoThemedDraw]
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,22 +7,24 @@ interface
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ComCtrls,
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ComCtrls,
|
||||||
lcltype, ce_widget, ActnList, Menus, clipbrd, AnchorDocking, ce_project,
|
lcltype, ce_widget, ActnList, Menus, clipbrd, AnchorDocking, ce_project,
|
||||||
ce_synmemo;
|
ce_synmemo, ce_dlangutils;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
TMessageContext = (msUnknown, msProject, msEditor);
|
TMessageContext = (mcUnknown, mcProject, mcEditor, mcApplication);
|
||||||
|
|
||||||
PMessageItemData = ^TMessageItemData;
|
PMessageItemData = ^TMessageItemData;
|
||||||
TMessageItemData = record
|
TMessageItemData = record
|
||||||
ctxt: TMessageContext;
|
ctxt: TMessageContext;
|
||||||
data: Pointer;
|
editor: TCESynMemo;
|
||||||
|
project: TCEProject;
|
||||||
|
position: TPoint;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCEMessagesWidget }
|
|
||||||
TCEMessagesWidget = class(TCEWidget)
|
TCEMessagesWidget = class(TCEWidget)
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
List: TTreeView;
|
List: TTreeView;
|
||||||
|
procedure ListDblClick(Sender: TObject);
|
||||||
procedure ListKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure ListKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
private
|
private
|
||||||
fActClearAll: TAction;
|
fActClearAll: TAction;
|
||||||
|
@ -30,7 +32,7 @@ type
|
||||||
fActSaveMsg: TAction;
|
fActSaveMsg: TAction;
|
||||||
fActCopyMsg: TAction;
|
fActCopyMsg: TAction;
|
||||||
fActSelAll: TAction;
|
fActSelAll: TAction;
|
||||||
fProject: TCEProject;
|
fProj: TCEProject;
|
||||||
fMaxMessCnt: Integer;
|
fMaxMessCnt: Integer;
|
||||||
fDoc: TCESynMemo;
|
fDoc: TCESynMemo;
|
||||||
procedure filterMessages;
|
procedure filterMessages;
|
||||||
|
@ -43,16 +45,22 @@ type
|
||||||
procedure setMaxMessageCount(aValue: Integer);
|
procedure setMaxMessageCount(aValue: Integer);
|
||||||
procedure listDeletion(Sender: TObject; Node: TTreeNode);
|
procedure listDeletion(Sender: TObject; Node: TTreeNode);
|
||||||
function newMessageItemData(aCtxt: TMessageContext): PMessageItemData;
|
function newMessageItemData(aCtxt: TMessageContext): PMessageItemData;
|
||||||
|
//
|
||||||
|
procedure optset_MaxMessageCount(aReader: TReader);
|
||||||
|
procedure optget_MaxMessageCount(awriter: TWriter);
|
||||||
published
|
published
|
||||||
property maxMessageCount: Integer read fMaxMessCnt write setMaxMessageCount default 125;
|
property maxMessageCount: Integer read fMaxMessCnt write setMaxMessageCount default 125;
|
||||||
public
|
public
|
||||||
constructor create(aOwner: TComponent); override;
|
constructor create(aOwner: TComponent); override;
|
||||||
//
|
//
|
||||||
procedure scrollToBack;
|
procedure scrollToBack;
|
||||||
procedure addMessage(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
procedure addMessage(const aMsg: string; aCtxt: TMessageContext = mcUnknown);
|
||||||
procedure addCeInf(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
procedure addMessage(const aMsg: string; const aData: PMessageItemData);
|
||||||
procedure addCeErr(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
procedure addCeInf(const aMsg: string; aCtxt: TMessageContext = mcUnknown);
|
||||||
procedure addCeWarn(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
procedure addCeErr(const aMsg: string; aCtxt: TMessageContext = mcUnknown);
|
||||||
|
procedure addCeWarn(const aMsg: string; aCtxt: TMessageContext = mcUnknown);
|
||||||
|
//
|
||||||
|
procedure declareProperties(aFiler: TFiler); override;
|
||||||
//
|
//
|
||||||
function contextName: string; override;
|
function contextName: string; override;
|
||||||
function contextActionCount: integer; override;
|
function contextActionCount: integer; override;
|
||||||
|
@ -60,6 +68,7 @@ type
|
||||||
//
|
//
|
||||||
procedure projNew(const aProject: TCEProject); override;
|
procedure projNew(const aProject: TCEProject); override;
|
||||||
procedure projClose(const aProject: TCEProject); override;
|
procedure projClose(const aProject: TCEProject); override;
|
||||||
|
procedure projFocused(const aProject: TCEProject); override;
|
||||||
//
|
//
|
||||||
procedure docFocused(const aDoc: TCESynMemo); override;
|
procedure docFocused(const aDoc: TCESynMemo); override;
|
||||||
procedure docClose(const aDoc: TCESynMemo); override;
|
procedure docClose(const aDoc: TCESynMemo); override;
|
||||||
|
@ -68,13 +77,12 @@ type
|
||||||
procedure ClearMessages(aCtxt: TMessageContext);
|
procedure ClearMessages(aCtxt: TMessageContext);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
PTCEMessageItem = ^TCEMessageItem;
|
|
||||||
TCEMessageItem = class(TListItem)
|
|
||||||
end;
|
|
||||||
|
|
||||||
TMessageKind = (msgkUnknown, msgkInfo, msgkHint, msgkWarn, msgkError);
|
TMessageKind = (msgkUnknown, msgkInfo, msgkHint, msgkWarn, msgkError);
|
||||||
|
|
||||||
function semanticMsgAna(const aMessg: string): TMessageKind;
|
function semanticMsgAna(const aMessg: string): TMessageKind;
|
||||||
|
function getLineFromDmdMessage(const aMessage: string): TPoint;
|
||||||
|
function getFileFromDmdMessage(const aMessage: string): TCESynMemo;
|
||||||
|
function newMessageData: PMessageItemData;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
@ -82,6 +90,7 @@ implementation
|
||||||
uses
|
uses
|
||||||
ce_main;
|
ce_main;
|
||||||
|
|
||||||
|
{$REGION Standard Comp/Obj------------------------------------------------------}
|
||||||
constructor TCEMessagesWidget.create(aOwner: TComponent);
|
constructor TCEMessagesWidget.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
fMaxMessCnt := 125;
|
fMaxMessCnt := 125;
|
||||||
|
@ -108,45 +117,12 @@ begin
|
||||||
List.OnDeletion := @ListDeletion;
|
List.OnDeletion := @ListDeletion;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.clearOutOfRangeMessg;
|
|
||||||
begin
|
|
||||||
while List.Items.Count > fMaxMessCnt do
|
|
||||||
List.Items.Delete(List.Items.GetFirstNode);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.setMaxMessageCount(aValue: Integer);
|
|
||||||
begin
|
|
||||||
if aValue < 10 then aValue := 10;
|
|
||||||
if aValue > 1023 then aValue := 1023;
|
|
||||||
if fMaxMessCnt = aValue then exit;
|
|
||||||
fMaxMessCnt := aValue;
|
|
||||||
clearOutOfRangeMessg;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TCEMessagesWidget.newMessageItemData(aCtxt: TMessageContext): PMessageItemData;
|
|
||||||
begin
|
|
||||||
result := new(PMessageItemData);
|
|
||||||
result^.ctxt := aCtxt;
|
|
||||||
case aCtxt of
|
|
||||||
msUnknown: result^.data := nil;
|
|
||||||
msProject: result^.data := Pointer(fProject);
|
|
||||||
msEditor: result^.data := Pointer(fDoc);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.listDeletion(Sender: TObject; Node: TTreeNode);
|
procedure TCEMessagesWidget.listDeletion(Sender: TObject; Node: TTreeNode);
|
||||||
begin
|
begin
|
||||||
if node.Data <> nil then
|
if node.Data <> nil then
|
||||||
Dispose( PMessageItemData(Node.Data));
|
Dispose( PMessageItemData(Node.Data));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.scrollToBack;
|
|
||||||
begin
|
|
||||||
if not Visible then exit;
|
|
||||||
if List.BottomItem <> nil then
|
|
||||||
List.BottomItem.MakeVisible;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.ListKeyDown(Sender: TObject; var Key: Word;
|
procedure TCEMessagesWidget.ListKeyDown(Sender: TObject; var Key: Word;
|
||||||
Shift: TShiftState);
|
Shift: TShiftState);
|
||||||
var
|
var
|
||||||
|
@ -163,88 +139,36 @@ begin
|
||||||
else ClearAllMessages;
|
else ClearAllMessages;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
procedure TCEMessagesWidget.filterMessages;
|
{$REGION ICEWidgetPersist ------------------------------------------------------}
|
||||||
var
|
procedure TCEMessagesWidget.setMaxMessageCount(aValue: Integer);
|
||||||
itm: TTreeNode;
|
|
||||||
dat: PMessageItemData;
|
|
||||||
i: NativeInt;
|
|
||||||
begin
|
begin
|
||||||
for i := 0 to List.Items.Count-1 do
|
if aValue < 10 then aValue := 10;
|
||||||
begin
|
if aValue > 1023 then aValue := 1023;
|
||||||
itm := List.Items[i];
|
if fMaxMessCnt = aValue then exit;
|
||||||
dat := PMessageItemData(itm.Data);
|
fMaxMessCnt := aValue;
|
||||||
case dat^.ctxt of
|
|
||||||
msProject: itm.Visible := Pointer(fProject) = (dat^.data);
|
|
||||||
msEditor: itm.Visible := Pointer(fDoc) = (dat^.data);
|
|
||||||
else itm.Visible := true;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.ClearAllMessages;
|
|
||||||
begin
|
|
||||||
List.Items.Clear;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.ClearMessages(aCtxt: TMessageContext);
|
|
||||||
var
|
|
||||||
i: NativeInt;
|
|
||||||
begin
|
|
||||||
for i := List.Items.Count-1 downto 0 do
|
|
||||||
begin
|
|
||||||
if PMessageItemData(List.Items[i].Data)^.ctxt = aCtxt then
|
|
||||||
List.Items.Delete(List.Items[i]);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.addCeInf(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
|
||||||
var
|
|
||||||
item: TTreeNode;
|
|
||||||
begin
|
|
||||||
item := List.Items.Add(nil, 'Coedit information: ' + aMsg);
|
|
||||||
item.Data := newMessageItemData(aCtxt);
|
|
||||||
item.ImageIndex := 1;
|
|
||||||
item.SelectedIndex := 1;
|
|
||||||
clearOutOfRangeMessg;
|
|
||||||
scrollToBack;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.addCeWarn(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
|
||||||
var
|
|
||||||
item: TTreeNode;
|
|
||||||
begin
|
|
||||||
item := List.Items.Add(nil, 'Coedit warning: ' + aMsg);
|
|
||||||
item.Data := newMessageItemData(aCtxt);
|
|
||||||
item.ImageIndex := 3;
|
|
||||||
item.SelectedIndex := 3;
|
|
||||||
clearOutOfRangeMessg;
|
|
||||||
scrollToBack;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.addCeErr(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
|
||||||
var
|
|
||||||
item: TTreeNode;
|
|
||||||
begin
|
|
||||||
item := List.Items.Add(nil, 'Coedit error: ' + aMsg);
|
|
||||||
item.Data := newMessageItemData(aCtxt);
|
|
||||||
item.ImageIndex := 4;
|
|
||||||
item.SelectedIndex := 4;
|
|
||||||
clearOutOfRangeMessg;
|
|
||||||
scrollToBack;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.addMessage(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
|
||||||
var
|
|
||||||
item: TTreeNode;
|
|
||||||
begin
|
|
||||||
item := List.Items.Add(nil, aMsg);
|
|
||||||
item.Data := newMessageItemData(aCtxt);
|
|
||||||
item.ImageIndex := Integer( semanticMsgAna(aMsg) );
|
|
||||||
item.SelectedIndex := Integer( semanticMsgAna(aMsg) );
|
|
||||||
clearOutOfRangeMessg;
|
clearOutOfRangeMessg;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.optset_MaxMessageCount(aReader: TReader);
|
||||||
|
begin
|
||||||
|
maxMessageCount := aReader.ReadInteger;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.optget_MaxMessageCount(aWriter: TWriter);
|
||||||
|
begin
|
||||||
|
aWriter.WriteInteger(fMaxMessCnt);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.declareProperties(aFiler: TFiler);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
aFiler.DefineProperty(Name + '_MaxMessageCount', @optset_MaxMessageCount, @optget_MaxMessageCount, true);
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION ICEContextualActions---------------------------------------------------}
|
||||||
function TCEMessagesWidget.contextName: string;
|
function TCEMessagesWidget.contextName: string;
|
||||||
begin
|
begin
|
||||||
result := 'Messages';
|
result := 'Messages';
|
||||||
|
@ -267,31 +191,6 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.projNew(const aProject: TCEProject);
|
|
||||||
begin
|
|
||||||
fProject := aProject;
|
|
||||||
filterMessages;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.projClose(const aProject: TCEProject);
|
|
||||||
begin
|
|
||||||
if fProject = aProject then ClearMessages(msProject);
|
|
||||||
fProject := nil;
|
|
||||||
filterMessages;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.docFocused(const aDoc: TCESynMemo);
|
|
||||||
begin
|
|
||||||
fDoc := aDoc;
|
|
||||||
filterMessages;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.docClose(const aDoc: TCESynMemo);
|
|
||||||
begin
|
|
||||||
fDoc := nil;
|
|
||||||
filterMessages;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEMessagesWidget.actClearAllExecute(Sender: TObject);
|
procedure TCEMessagesWidget.actClearAllExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ClearAllMessages;
|
ClearAllMessages;
|
||||||
|
@ -299,7 +198,7 @@ end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.actClearEdiExecute(Sender: TObject);
|
procedure TCEMessagesWidget.actClearEdiExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ClearMessages(msEditor);
|
ClearMessages(mcEditor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.actCopyMsgExecute(Sender: TObject);
|
procedure TCEMessagesWidget.actCopyMsgExecute(Sender: TObject);
|
||||||
|
@ -343,8 +242,191 @@ begin
|
||||||
free;
|
free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION ICEProjectMonitor -----------------------------------------------------}
|
||||||
|
procedure TCEMessagesWidget.projNew(const aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
fProj := aProject;
|
||||||
|
filterMessages;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.projClose(const aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
if fProj = aProject then ClearMessages(mcProject);
|
||||||
|
fProj := nil;
|
||||||
|
filterMessages;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.projFocused(const aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
fProj := aProject;
|
||||||
|
filterMessages;
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION ICEMultiDocMonitor ----------------------------------------------------}
|
||||||
|
procedure TCEMessagesWidget.docFocused(const aDoc: TCESynMemo);
|
||||||
|
begin
|
||||||
|
fDoc := aDoc;
|
||||||
|
filterMessages;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.docClose(const aDoc: TCESynMemo);
|
||||||
|
begin
|
||||||
|
fDoc := nil;
|
||||||
|
filterMessages;
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION Messages --------------------------------------------------------------}
|
||||||
|
procedure TCEMessagesWidget.clearOutOfRangeMessg;
|
||||||
|
begin
|
||||||
|
while List.Items.Count > fMaxMessCnt do
|
||||||
|
List.Items.Delete(List.Items.GetFirstNode);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function newMessageData: PMessageItemData;
|
||||||
|
begin
|
||||||
|
result := new(PMessageItemData);
|
||||||
|
result^.ctxt := mcUnknown;
|
||||||
|
result^.project := nil;
|
||||||
|
result^.editor := nil;
|
||||||
|
result^.position := point(0,0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCEMessagesWidget.newMessageItemData(aCtxt: TMessageContext): PMessageItemData;
|
||||||
|
begin
|
||||||
|
result := new(PMessageItemData);
|
||||||
|
result^.ctxt := aCtxt;
|
||||||
|
result^.project := fProj;
|
||||||
|
result^.editor := fDoc;
|
||||||
|
result^.position := point(0,0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.scrollToBack;
|
||||||
|
begin
|
||||||
|
if not Visible then exit;
|
||||||
|
if List.BottomItem <> nil then
|
||||||
|
List.BottomItem.MakeVisible;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.ListDblClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
dat: PMessageItemData;
|
||||||
|
begin
|
||||||
|
if List.Selected = nil then exit;
|
||||||
|
if List.Selected.Data = nil then exit;
|
||||||
|
//
|
||||||
|
dat := PMessageItemData(List.Selected.Data);
|
||||||
|
if dat^.editor = nil then exit;
|
||||||
|
CEMainForm.openFile(dat^.editor.fileName);
|
||||||
|
dat^.editor.CaretXY := dat^.position;
|
||||||
|
dat^.editor.SelectLine;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.filterMessages;
|
||||||
|
var
|
||||||
|
itm: TTreeNode;
|
||||||
|
dat: PMessageItemData;
|
||||||
|
i: NativeInt;
|
||||||
|
begin
|
||||||
|
if updating then exit;
|
||||||
|
for i := 0 to List.Items.Count-1 do
|
||||||
|
begin
|
||||||
|
itm := List.Items[i];
|
||||||
|
dat := PMessageItemData(itm.Data);
|
||||||
|
case dat^.ctxt of
|
||||||
|
mcProject: itm.Visible := fProj = dat^.project;
|
||||||
|
mcEditor: itm.Visible := fDoc = dat^.editor;
|
||||||
|
else itm.Visible := true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.ClearAllMessages;
|
||||||
|
begin
|
||||||
|
List.Items.Clear;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.ClearMessages(aCtxt: TMessageContext);
|
||||||
|
var
|
||||||
|
i: NativeInt;
|
||||||
|
dt: TMessageItemData;
|
||||||
|
begin
|
||||||
|
for i := List.Items.Count-1 downto 0 do
|
||||||
|
begin
|
||||||
|
dt := PMessageItemData(List.Items[i].Data)^;
|
||||||
|
if dt.ctxt = aCtxt then case aCtxt of
|
||||||
|
mcEditor: if dt.editor = fDoc then List.Items.Delete(List.Items[i]);
|
||||||
|
mcProject: if dt.project = fProj then List.Items.Delete(List.Items[i]);
|
||||||
|
else List.Items.Delete(List.Items[i]);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.addCeInf(const aMsg: string; aCtxt: TMessageContext = mcUnknown);
|
||||||
|
var
|
||||||
|
item: TTreeNode;
|
||||||
|
begin
|
||||||
|
item := List.Items.Add(nil, 'Coedit information: ' + aMsg);
|
||||||
|
item.Data := newMessageItemData(aCtxt);
|
||||||
|
item.ImageIndex := 1;
|
||||||
|
item.SelectedIndex := 1;
|
||||||
|
clearOutOfRangeMessg;
|
||||||
|
scrollToBack;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.addCeWarn(const aMsg: string; aCtxt: TMessageContext = mcUnknown);
|
||||||
|
var
|
||||||
|
item: TTreeNode;
|
||||||
|
begin
|
||||||
|
item := List.Items.Add(nil, 'Coedit warning: ' + aMsg);
|
||||||
|
item.Data := newMessageItemData(aCtxt);
|
||||||
|
item.ImageIndex := 3;
|
||||||
|
item.SelectedIndex := 3;
|
||||||
|
clearOutOfRangeMessg;
|
||||||
|
scrollToBack;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.addCeErr(const aMsg: string; aCtxt: TMessageContext = mcUnknown);
|
||||||
|
var
|
||||||
|
item: TTreeNode;
|
||||||
|
begin
|
||||||
|
item := List.Items.Add(nil, 'Coedit error: ' + aMsg);
|
||||||
|
item.Data := newMessageItemData(aCtxt);
|
||||||
|
item.ImageIndex := 4;
|
||||||
|
item.SelectedIndex := 4;
|
||||||
|
clearOutOfRangeMessg;
|
||||||
|
scrollToBack;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.addMessage(const aMsg: string; const aData: PMessageItemData);
|
||||||
|
var
|
||||||
|
item: TTreeNode;
|
||||||
|
imgIx: Integer;
|
||||||
|
begin
|
||||||
|
item := List.Items.Add(nil, aMsg);
|
||||||
|
item.Data := aData;
|
||||||
|
imgIx := Integer(semanticMsgAna(aMsg));
|
||||||
|
item.ImageIndex := imgIx;
|
||||||
|
item.SelectedIndex := imgIx;
|
||||||
|
clearOutOfRangeMessg;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.addMessage(const aMsg: string; aCtxt: TMessageContext = mcUnknown);
|
||||||
|
var
|
||||||
|
item: TTreeNode;
|
||||||
|
imgIx: Integer;
|
||||||
|
begin
|
||||||
|
item := List.Items.Add(nil, aMsg);
|
||||||
|
item.Data := newMessageItemData(aCtxt);
|
||||||
|
imgIx := Integer(semanticMsgAna(aMsg));
|
||||||
|
item.ImageIndex := imgIx;
|
||||||
|
item.SelectedIndex := imgIx;
|
||||||
|
clearOutOfRangeMessg;
|
||||||
|
end;
|
||||||
|
|
||||||
// TODO: link to editor line when possible.
|
|
||||||
function semanticMsgAna(const aMessg: string): TMessageKind;
|
function semanticMsgAna(const aMessg: string): TMessageKind;
|
||||||
var
|
var
|
||||||
pos: Nativeint;
|
pos: Nativeint;
|
||||||
|
@ -395,4 +477,70 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function getLineFromDmdMessage(const aMessage: string): TPoint;
|
||||||
|
var
|
||||||
|
i: NativeInt;
|
||||||
|
ident: string;
|
||||||
|
begin
|
||||||
|
result.x := 0;
|
||||||
|
result.y := 0;
|
||||||
|
ident := '';
|
||||||
|
i := 0;
|
||||||
|
while (true) do
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
if i > length(aMessage) then exit;
|
||||||
|
if aMessage[i] = '.' then
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
if i > length(aMessage) then exit;
|
||||||
|
if aMessage[i] = 'd' then
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
if i > length(aMessage) then exit;
|
||||||
|
if aMessage[i] = '(' then
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
if i > length(aMessage) then exit;
|
||||||
|
while( isNumber(aMessage[i]) ) do
|
||||||
|
begin
|
||||||
|
ident += aMessage[i];
|
||||||
|
inc(i);
|
||||||
|
if i > length(aMessage) then exit;
|
||||||
|
end;
|
||||||
|
if aMessage[i] = ')' then
|
||||||
|
begin
|
||||||
|
result.y := strToInt(ident);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getFileFromDmdMessage(const aMessage: string): TCESynMemo;
|
||||||
|
var
|
||||||
|
i: NativeInt;
|
||||||
|
ident: string;
|
||||||
|
begin
|
||||||
|
ident := '';
|
||||||
|
i := 0;
|
||||||
|
result := nil;
|
||||||
|
while(true) do
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
if i > length(aMessage) then exit;
|
||||||
|
if aMessage[i] = '(' then
|
||||||
|
begin
|
||||||
|
if not fileExists(ident) then exit;
|
||||||
|
CEMainForm.openFile(ident);
|
||||||
|
result := CEMainForm.EditWidget.currentEditor;
|
||||||
|
end;
|
||||||
|
ident += aMessage[i];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -9,8 +9,6 @@ uses
|
||||||
Menus, StdCtrls, ComCtrls, Buttons, ce_widget, lcltype;
|
Menus, StdCtrls, ComCtrls, Buttons, ce_widget, lcltype;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TCEMiniExplorerWidget }
|
|
||||||
TCEMiniExplorerWidget = class(TCEWidget)
|
TCEMiniExplorerWidget = class(TCEWidget)
|
||||||
Bevel1: TBevel;
|
Bevel1: TBevel;
|
||||||
Bevel2: TBevel;
|
Bevel2: TBevel;
|
||||||
|
@ -67,8 +65,6 @@ implementation
|
||||||
uses
|
uses
|
||||||
ce_main, ce_common;
|
ce_main, ce_common;
|
||||||
|
|
||||||
//TODO-cbugfix: click on the expander glyph, sometime the subdirs are not scanned but the fake sub item is still displayed
|
|
||||||
|
|
||||||
{$REGION Standard Comp/Obj------------------------------------------------------}
|
{$REGION Standard Comp/Obj------------------------------------------------------}
|
||||||
constructor TCEMiniExplorerWidget.create(aIwner: TComponent);
|
constructor TCEMiniExplorerWidget.create(aIwner: TComponent);
|
||||||
begin
|
begin
|
||||||
|
@ -252,7 +248,7 @@ begin
|
||||||
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 CEMainForm.MessageWidget.addCeErr
|
if not shellOpen(fname) then CEMainForm.MessageWidget.addCeErr
|
||||||
(format('the shell failed to open "%s"',[shortenPath(fname,25)]));
|
(format('the shell failed to open "%s"', [shortenPath(fname, 25)]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
@ -333,6 +329,9 @@ end;
|
||||||
|
|
||||||
procedure TCEMiniExplorerWidget.treeExpanding(Sender: TObject; Node: TTreeNode; var allow: boolean);
|
procedure TCEMiniExplorerWidget.treeExpanding(Sender: TObject; Node: TTreeNode; var allow: boolean);
|
||||||
begin
|
begin
|
||||||
|
if Node <> nil then
|
||||||
|
treeScanSubFolders(Node);
|
||||||
|
allow := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMiniExplorerWidget.treeCollapsed(Sender: TObject; Node: TTreeNode);
|
procedure TCEMiniExplorerWidget.treeCollapsed(Sender: TObject; Node: TTreeNode);
|
||||||
|
|
|
@ -10,8 +10,6 @@ uses
|
||||||
ce_dmdwrap, ce_project, ce_widget, AnchorDocking;
|
ce_dmdwrap, ce_project, ce_widget, AnchorDocking;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TCEProjectConfigurationWidget }
|
|
||||||
TCEProjectConfigurationWidget = class(TCEWidget)
|
TCEProjectConfigurationWidget = class(TCEWidget)
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
selConf: TComboBox;
|
selConf: TComboBox;
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
inherited CEProjectInspectWidget: TCEProjectInspectWidget
|
inherited CEProjectInspectWidget: TCEProjectInspectWidget
|
||||||
Left = 1640
|
Left = 1242
|
||||||
Height = 383
|
Height = 257
|
||||||
Top = 90
|
Top = 360
|
||||||
Width = 264
|
Width = 264
|
||||||
AllowDropFiles = True
|
AllowDropFiles = True
|
||||||
Caption = 'Project inspector'
|
Caption = 'Project inspector'
|
||||||
ClientHeight = 383
|
ClientHeight = 257
|
||||||
ClientWidth = 264
|
ClientWidth = 264
|
||||||
OnDropFiles = FormDropFiles
|
OnDropFiles = FormDropFiles
|
||||||
inherited Back: TPanel
|
inherited Back: TPanel
|
||||||
Height = 383
|
Height = 257
|
||||||
Width = 264
|
Width = 264
|
||||||
ClientHeight = 383
|
ClientHeight = 257
|
||||||
ClientWidth = 264
|
ClientWidth = 264
|
||||||
inherited Content: TPanel
|
inherited Content: TPanel
|
||||||
Height = 383
|
Height = 257
|
||||||
Width = 264
|
Width = 264
|
||||||
ClientHeight = 383
|
ClientHeight = 257
|
||||||
ClientWidth = 264
|
ClientWidth = 264
|
||||||
PopupMenu = nil
|
PopupMenu = nil
|
||||||
object Tree: TTreeView[0]
|
object Tree: TTreeView[0]
|
||||||
Left = 2
|
Left = 2
|
||||||
Height = 353
|
Height = 227
|
||||||
Top = 28
|
Top = 28
|
||||||
Width = 260
|
Width = 260
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
|
|
@ -10,7 +10,6 @@ uses
|
||||||
ce_common, ce_widget, AnchorDocking;
|
ce_common, ce_widget, AnchorDocking;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TCEProjectInspectWidget }
|
|
||||||
TCEProjectInspectWidget = class(TCEWidget)
|
TCEProjectInspectWidget = class(TCEWidget)
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
|
@ -54,6 +53,7 @@ implementation
|
||||||
uses
|
uses
|
||||||
ce_main;
|
ce_main;
|
||||||
|
|
||||||
|
{$REGION Standard Comp/Obj------------------------------------------------------}
|
||||||
constructor TCEProjectInspectWidget.create(aOwner: TComponent);
|
constructor TCEProjectInspectWidget.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
fActOpenFile := TAction.Create(self);
|
fActOpenFile := TAction.Create(self);
|
||||||
|
@ -71,7 +71,9 @@ begin
|
||||||
//
|
//
|
||||||
Tree.PopupMenu := contextMenu;
|
Tree.PopupMenu := contextMenu;
|
||||||
end;
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION ICEContextualActions---------------------------------------------------}
|
||||||
function TCEProjectInspectWidget.contextName: string;
|
function TCEProjectInspectWidget.contextName: string;
|
||||||
begin
|
begin
|
||||||
exit('Inspector');
|
exit('Inspector');
|
||||||
|
@ -91,6 +93,13 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEProjectInspectWidget.actOpenFileExecute(sender: TObject);
|
||||||
|
begin
|
||||||
|
TreeDblClick(sender);
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION ICEProjectMonitor -----------------------------------------------------}
|
||||||
procedure TCEProjectInspectWidget.projNew(const aProject: TCEProject);
|
procedure TCEProjectInspectWidget.projNew(const aProject: TCEProject);
|
||||||
begin
|
begin
|
||||||
fProject := aProject;
|
fProject := aProject;
|
||||||
|
@ -108,6 +117,7 @@ begin
|
||||||
fProject := nil;
|
fProject := nil;
|
||||||
UpdateByEvent;
|
UpdateByEvent;
|
||||||
end;
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
procedure TCEProjectInspectWidget.TreeKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState);
|
procedure TCEProjectInspectWidget.TreeKeyDown(Sender: TObject; var Key: Word;Shift: TShiftState);
|
||||||
begin
|
begin
|
||||||
|
@ -146,11 +156,6 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProjectInspectWidget.actOpenFileExecute(sender: TObject);
|
|
||||||
begin
|
|
||||||
TreeDblClick(sender);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCEProjectInspectWidget.actUpdate(sender: TObject);
|
procedure TCEProjectInspectWidget.actUpdate(sender: TObject);
|
||||||
begin
|
begin
|
||||||
fActSelConf.Enabled := false;
|
fActSelConf.Enabled := false;
|
||||||
|
|
|
@ -10,8 +10,6 @@ uses
|
||||||
ce_widget, ce_synmemo, AnchorDocking;
|
ce_widget, ce_synmemo, AnchorDocking;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TCESearchWidget }
|
|
||||||
TCESearchWidget = class(TCEWidget)
|
TCESearchWidget = class(TCEWidget)
|
||||||
btnFind: TBitBtn;
|
btnFind: TBitBtn;
|
||||||
btnReplace: TBitBtn;
|
btnReplace: TBitBtn;
|
||||||
|
|
|
@ -10,8 +10,6 @@ uses
|
||||||
ce_synmemo, process, actnlist, ce_common, ce_project, AnchorDocking;
|
ce_synmemo, process, actnlist, ce_common, ce_project, AnchorDocking;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TCEStaticExplorerWidget }
|
|
||||||
TCEStaticExplorerWidget = class(TCEWidget)
|
TCEStaticExplorerWidget = class(TCEWidget)
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
|
|
|
@ -9,7 +9,6 @@ uses
|
||||||
LazSynEditText, SynPluginSyncroEdit, SynEditKeyCmds, ce_project, ce_common;
|
LazSynEditText, SynPluginSyncroEdit, SynEditKeyCmds, ce_project, ce_common;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
TCESynMemo = class(TSynMemo)
|
TCESynMemo = class(TSynMemo)
|
||||||
private
|
private
|
||||||
fFilename: string;
|
fFilename: string;
|
||||||
|
|
|
@ -15,8 +15,6 @@ type
|
||||||
* Base type for an UI module.
|
* Base type for an UI module.
|
||||||
*)
|
*)
|
||||||
PTCEWidget = ^TCEWidget;
|
PTCEWidget = ^TCEWidget;
|
||||||
|
|
||||||
{ TCEWidget }
|
|
||||||
TCEWidget = class(TForm, ICEContextualActions, ICEProjectMonitor, ICEMultiDocMonitor, ICEWidgetPersist)
|
TCEWidget = class(TForm, ICEContextualActions, ICEProjectMonitor, ICEMultiDocMonitor, ICEWidgetPersist)
|
||||||
Content: TPanel;
|
Content: TPanel;
|
||||||
Back: TPanel;
|
Back: TPanel;
|
||||||
|
@ -334,9 +332,7 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
(*******************************************************************************
|
{$REGION TCEWidgetList---------------------------------------------------------------}
|
||||||
* TCEWidgetList
|
|
||||||
*)
|
|
||||||
function TCEWidgetList.getWidget(index: integer): TCEWidget;
|
function TCEWidgetList.getWidget(index: integer): TCEWidget;
|
||||||
begin
|
begin
|
||||||
result := PTCEWidget(Items[index])^;
|
result := PTCEWidget(Items[index])^;
|
||||||
|
@ -364,6 +360,7 @@ begin
|
||||||
result.fList := aWidgetList;
|
result.fList := aWidgetList;
|
||||||
result.fIndex := -1;
|
result.fIndex := -1;
|
||||||
end;
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ uses
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
// TODO-cinterface: document content access/modification
|
// TODO-cfeature: document content access/modification
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer can save and load some stuffs on application start/quit
|
* An implementer can save and load some stuffs on application start/quit
|
||||||
|
@ -25,6 +25,7 @@ type
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer declares some actions on demand.
|
* An implementer declares some actions on demand.
|
||||||
|
* TODO-cfeature: improve the interface so that a widget can declare a complete main menu category.
|
||||||
*)
|
*)
|
||||||
ICEContextualActions = interface
|
ICEContextualActions = interface
|
||||||
// declares a context name for the actions
|
// declares a context name for the actions
|
||||||
|
@ -36,7 +37,7 @@ type
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer is informed when a new document is added, focused or closed.
|
* An implementer is informed about the current file(s).
|
||||||
*)
|
*)
|
||||||
ICEMultiDocMonitor = interface
|
ICEMultiDocMonitor = interface
|
||||||
// the new document aDoc has been created (empty, runnable, project source, ...).
|
// the new document aDoc has been created (empty, runnable, project source, ...).
|
||||||
|
@ -50,7 +51,7 @@ type
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* An implementer is informed when a project changes.
|
* An implementer is informed about the current project(s).
|
||||||
*)
|
*)
|
||||||
ICEProjectMonitor = interface
|
ICEProjectMonitor = interface
|
||||||
// the new project aProject has been created/opened
|
// the new project aProject has been created/opened
|
||||||
|
|
Loading…
Reference in New Issue