mirror of https://gitlab.com/basile.b/dexed.git
r19
This commit is contained in:
parent
fc7f4089d0
commit
cf7d601ef9
|
@ -25,7 +25,7 @@ void main(string args[])
|
||||||
}
|
}
|
||||||
// if not UsePipes in RunOptions
|
// if not UsePipes in RunOptions
|
||||||
// then:
|
// then:
|
||||||
// readln;
|
readln;
|
||||||
// (input is passed thru the new console)
|
// (input is passed thru the new console)
|
||||||
|
|
||||||
// else: input is not handled so readln will hang Coedit until
|
// else: input is not handled so readln will hang Coedit until
|
||||||
|
|
|
@ -158,7 +158,7 @@ type
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(*****************************************************************************
|
(*****************************************************************************
|
||||||
* Encapsulates the options/args related to the debuging
|
* Encapsulates the options/args related to the debugging
|
||||||
*)
|
*)
|
||||||
TDebugOpts = class(TOptsGroup)
|
TDebugOpts = class(TOptsGroup)
|
||||||
private
|
private
|
||||||
|
|
|
@ -9,7 +9,7 @@ uses
|
||||||
Graphics, SynEditKeyCmds, ComCtrls, SynEditHighlighter, ExtCtrls, Menus,
|
Graphics, SynEditKeyCmds, ComCtrls, SynEditHighlighter, ExtCtrls, Menus,
|
||||||
SynEditHighlighterFoldBase, SynMacroRecorder, SynPluginSyncroEdit, SynEdit,
|
SynEditHighlighterFoldBase, SynMacroRecorder, SynPluginSyncroEdit, SynEdit,
|
||||||
SynHighlighterLFM, ce_widget, ce_d2syn, ce_synmemo, ce_common, AnchorDocking,
|
SynHighlighterLFM, ce_widget, ce_d2syn, ce_synmemo, ce_common, AnchorDocking,
|
||||||
ce_dlang;
|
ce_dlang, ce_project;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TCEEditorWidget }
|
{ TCEEditorWidget }
|
||||||
|
@ -48,6 +48,9 @@ type
|
||||||
procedure removeEditor(const aIndex: NativeInt);
|
procedure removeEditor(const aIndex: NativeInt);
|
||||||
procedure focusedEditorChanged;
|
procedure focusedEditorChanged;
|
||||||
//
|
//
|
||||||
|
procedure projCompile(const aProject: TCEProject); override;
|
||||||
|
procedure projRun(const aProject: TCEProject); override;
|
||||||
|
//
|
||||||
property currentEditor: TCESynMemo read getCurrentEditor;
|
property currentEditor: TCESynMemo read getCurrentEditor;
|
||||||
property editor[index: NativeInt]: TCESynMemo read getEditor;
|
property editor[index: NativeInt]: TCESynMemo read getEditor;
|
||||||
property editorCount: NativeInt read getEditorCount;
|
property editorCount: NativeInt read getEditorCount;
|
||||||
|
@ -58,7 +61,7 @@ implementation
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
ce_main;
|
ce_main, ce_messages;
|
||||||
|
|
||||||
constructor TCEEditorWidget.create(aOwner: TComponent);
|
constructor TCEEditorWidget.create(aOwner: TComponent);
|
||||||
var
|
var
|
||||||
|
@ -123,7 +126,7 @@ begin
|
||||||
if pageControl.ActivePageIndex <> -1 then
|
if pageControl.ActivePageIndex <> -1 then
|
||||||
mainForm.docFocusedNotify(Self, pageControl.ActivePageIndex);
|
mainForm.docFocusedNotify(Self, pageControl.ActivePageIndex);
|
||||||
//
|
//
|
||||||
if (curr.modified or (pageControl.ActivePage.Caption = '')) then
|
if (pageControl.ActivePage.Caption = '') then
|
||||||
begin
|
begin
|
||||||
fKeyChanged := true;
|
fKeyChanged := true;
|
||||||
beginUpdateByDelay;
|
beginUpdateByDelay;
|
||||||
|
@ -168,6 +171,7 @@ end;
|
||||||
|
|
||||||
procedure TCEEditorWidget.removeEditor(const aIndex: NativeInt);
|
procedure TCEEditorWidget.removeEditor(const aIndex: NativeInt);
|
||||||
begin
|
begin
|
||||||
|
mainForm.MessageWidget.ClearMessages(msEditor);
|
||||||
editor[aIndex].OnChange:= nil;
|
editor[aIndex].OnChange:= nil;
|
||||||
pageControl.Pages[aIndex].Free;
|
pageControl.Pages[aIndex].Free;
|
||||||
end;
|
end;
|
||||||
|
@ -223,6 +227,16 @@ begin
|
||||||
UpdateByEvent;
|
UpdateByEvent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorWidget.projCompile(const aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
stopUpdateByDelay;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorWidget.projRun(const aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
stopUpdateByDelay;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEEditorWidget.UpdateByEvent;
|
procedure TCEEditorWidget.UpdateByEvent;
|
||||||
const
|
const
|
||||||
modstr: array[boolean] of string = ('...', 'MODIFIED');
|
modstr: array[boolean] of string = ('...', 'MODIFIED');
|
||||||
|
@ -251,13 +265,13 @@ begin
|
||||||
mainForm.docChangeNotify(Self, editorIndex);
|
mainForm.docChangeNotify(Self, editorIndex);
|
||||||
if ed.Lines.Count = 0 then exit;
|
if ed.Lines.Count = 0 then exit;
|
||||||
//
|
//
|
||||||
mainForm.MessageWidget.Clear;
|
mainForm.MessageWidget.ClearMessages(msEditor);
|
||||||
lex( ed.Lines.Text, tokLst );
|
lex( ed.Lines.Text, tokLst );
|
||||||
|
|
||||||
checkSyntacticErrors( tokLst, errLst);
|
checkSyntacticErrors( tokLst, errLst);
|
||||||
for err in errLst do
|
for err in errLst do
|
||||||
mainForm.MessageWidget.addMessage(format(
|
mainForm.MessageWidget.addMessage(format( '%s (@line:%4.d @char:%.4d)',
|
||||||
'%s (@line:%4.d @char:%.4d)',[err.msg, err.position.y, err.position.x]));
|
[err.msg, err.position.y, err.position.x]), msEditor);
|
||||||
|
|
||||||
md := '';
|
md := '';
|
||||||
if ed.isDSource then
|
if ed.isDSource then
|
||||||
|
|
|
@ -837,7 +837,7 @@ begin
|
||||||
end;
|
end;
|
||||||
Str.SetSize(readSz);
|
Str.SetSize(readSz);
|
||||||
lns.LoadFromStream(Str);
|
lns.LoadFromStream(Str);
|
||||||
for msg in lns do fMesgWidg.addMessage(msg);
|
for msg in lns do fMesgWidg.addMessage(msg); // proj/file ?
|
||||||
finally
|
finally
|
||||||
str.Free;
|
str.Free;
|
||||||
lns.Free;
|
lns.Free;
|
||||||
|
@ -858,7 +858,7 @@ begin
|
||||||
getDir(0, olddir);
|
getDir(0, olddir);
|
||||||
try
|
try
|
||||||
|
|
||||||
fMesgWidg.addCeInf( 'compiling ' + fEditWidg.editor[edIndex].fileName );
|
fMesgWidg.addCeInf( 'compiling ' + fEditWidg.editor[edIndex].fileName, msEditor );
|
||||||
|
|
||||||
temppath := GetTempDir(false);
|
temppath := GetTempDir(false);
|
||||||
chDir(temppath);
|
chDir(temppath);
|
||||||
|
@ -891,7 +891,7 @@ begin
|
||||||
begin
|
begin
|
||||||
|
|
||||||
fMesgWidg.addCeInf( fEditWidg.editor[edIndex].fileName
|
fMesgWidg.addCeInf( fEditWidg.editor[edIndex].fileName
|
||||||
+ ' successfully compiled' );
|
+ ' successfully compiled', msEditor );
|
||||||
|
|
||||||
runproc.Options:= [poStderrToOutPut, poUsePipes];
|
runproc.Options:= [poStderrToOutPut, poUsePipes];
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
|
@ -913,7 +913,7 @@ begin
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
fMesgWidg.addCeErr( fEditWidg.editor[edIndex].fileName
|
fMesgWidg.addCeErr( fEditWidg.editor[edIndex].fileName
|
||||||
+ ' has not been compiled' );
|
+ ' has not been compiled', msEditor );
|
||||||
|
|
||||||
finally
|
finally
|
||||||
dmdproc.Free;
|
dmdproc.Free;
|
||||||
|
@ -927,13 +927,17 @@ var
|
||||||
dmdproc: TProcess;
|
dmdproc: TProcess;
|
||||||
ppproc: TProcess;
|
ppproc: TProcess;
|
||||||
olddir, prjpath: string;
|
olddir, prjpath: string;
|
||||||
|
i: NativeInt;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
fMesgWidg.Clear;
|
fMesgWidg.ClearMessages(msProject);
|
||||||
|
|
||||||
|
for i := 0 to fWidgList.Count-1 do
|
||||||
|
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' );
|
fMesgWidg.addCeErr( aProject.fileName + ' has no source files', msProject);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -950,7 +954,7 @@ begin
|
||||||
ppproc.Free;
|
ppproc.Free;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else fMesgWidg.addCeWarn('the pre-compilation executable does not exist');
|
else fMesgWidg.addCeWarn('the pre-compilation executable does not exist', msProject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
olddir := '';
|
olddir := '';
|
||||||
|
@ -959,7 +963,7 @@ begin
|
||||||
try
|
try
|
||||||
|
|
||||||
|
|
||||||
fMesgWidg.addCeInf( 'compiling ' + aProject.fileName );
|
fMesgWidg.addCeInf( 'compiling ' + aProject.fileName, msProject);
|
||||||
|
|
||||||
prjpath := extractFilePath(aProject.fileName);
|
prjpath := extractFilePath(aProject.fileName);
|
||||||
if directoryExists(prjpath) then chDir(prjpath);
|
if directoryExists(prjpath) then chDir(prjpath);
|
||||||
|
@ -982,10 +986,10 @@ begin
|
||||||
if dmdProc.ExitStatus = 0 then
|
if dmdProc.ExitStatus = 0 then
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
fMesgWidg.addCeInf( aProject.fileName
|
fMesgWidg.addCeInf( aProject.fileName
|
||||||
+ ' successfully compiled' )
|
+ ' successfully compiled', msProject)
|
||||||
else
|
else
|
||||||
fMesgWidg.addCeErr( aProject.fileName
|
fMesgWidg.addCeErr( aProject.fileName
|
||||||
+ ' has not been compiled' );
|
+ ' has not been compiled', msProject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with fProject.currentConfiguration do
|
with fProject.currentConfiguration do
|
||||||
|
@ -1001,7 +1005,7 @@ begin
|
||||||
ppproc.Free;
|
ppproc.Free;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else fMesgWidg.addCeWarn('the post-compilation executable does not exist');
|
else fMesgWidg.addCeWarn('the post-compilation executable does not exist', msProject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
|
@ -1014,10 +1018,14 @@ procedure TCEMainForm.runProject(const aProject: TCEProject; const runArgs: stri
|
||||||
var
|
var
|
||||||
runproc: TProcess;
|
runproc: TProcess;
|
||||||
procname: string;
|
procname: string;
|
||||||
|
i: NativeInt;
|
||||||
begin
|
begin
|
||||||
if aProject.currentConfiguration.outputOptions.binaryKind <>
|
if aProject.currentConfiguration.outputOptions.binaryKind <>
|
||||||
executable then exit;
|
executable then exit;
|
||||||
|
|
||||||
|
for i := 0 to fWidgList.Count-1 do
|
||||||
|
fWidgList.widget[i].projRun(aProject);
|
||||||
|
|
||||||
runproc := TProcess.Create(nil);
|
runproc := TProcess.Create(nil);
|
||||||
try
|
try
|
||||||
runproc.Options := aProject.currentConfiguration.runOptions.options;
|
runproc.Options := aProject.currentConfiguration.runOptions.options;
|
||||||
|
@ -1040,12 +1048,11 @@ begin
|
||||||
|
|
||||||
if not fileExists(procname) then
|
if not fileExists(procname) then
|
||||||
begin
|
begin
|
||||||
fMesgWidg.addCeErr('output executable missing: ' + procname);
|
fMesgWidg.addCeErr('output executable missing: ' + procname, msProject);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
runproc.Executable := procname;
|
runproc.Executable := procname;
|
||||||
//runproc.Parameters.Text := runArgs;
|
|
||||||
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);
|
ProcessOutputToMsg(runproc);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
inherited CEMessagesWidget: TCEMessagesWidget
|
inherited CEMessagesWidget: TCEMessagesWidget
|
||||||
Left = 621
|
Left = 812
|
||||||
Height = 172
|
Height = 172
|
||||||
Top = 659
|
Top = 258
|
||||||
Width = 744
|
Width = 744
|
||||||
Caption = 'Messages'
|
Caption = 'Messages'
|
||||||
ClientHeight = 172
|
ClientHeight = 172
|
||||||
|
@ -17,32 +17,28 @@ inherited CEMessagesWidget: TCEMessagesWidget
|
||||||
ClientHeight = 172
|
ClientHeight = 172
|
||||||
ClientWidth = 744
|
ClientWidth = 744
|
||||||
PopupMenu = nil
|
PopupMenu = nil
|
||||||
object List: TListView[0]
|
object List: TTreeView[0]
|
||||||
Left = 2
|
Left = 2
|
||||||
Height = 168
|
Height = 168
|
||||||
Top = 2
|
Top = 2
|
||||||
Width = 740
|
Width = 740
|
||||||
Align = alClient
|
Align = alClient
|
||||||
AutoSort = False
|
|
||||||
BorderSpacing.Around = 2
|
BorderSpacing.Around = 2
|
||||||
Columns = <
|
DefaultItemHeight = 16
|
||||||
item
|
|
||||||
Width = 736
|
|
||||||
end>
|
|
||||||
Font.CharSet = ANSI_CHARSET
|
Font.CharSet = ANSI_CHARSET
|
||||||
Font.Height = -12
|
Font.Height = -12
|
||||||
Font.Name = 'Lucida Console'
|
Font.Name = 'Lucida Console'
|
||||||
Font.Pitch = fpFixed
|
Font.Pitch = fpFixed
|
||||||
Font.Quality = fqDraft
|
Font.Quality = fqDraft
|
||||||
HideSelection = False
|
HideSelection = False
|
||||||
IconOptions.WrapText = False
|
Images = imgList
|
||||||
MultiSelect = True
|
MultiSelect = True
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
ShowColumnHeaders = False
|
ShowLines = False
|
||||||
SmallImages = imgList
|
ShowRoot = False
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
ViewStyle = vsReport
|
Options = [tvoAllowMultiselect, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoToolTips, tvoThemedDraw]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,28 +10,47 @@ uses
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
TMessageContext = (msUnknown, msProject, msEditor);
|
||||||
|
|
||||||
|
PMessageItemData = ^TMessageItemData;
|
||||||
|
TMessageItemData = record
|
||||||
|
ctxt: TMessageContext;
|
||||||
|
data: Pointer;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TCEMessagesWidget }
|
{ TCEMessagesWidget }
|
||||||
TCEMessagesWidget = class(TCEWidget)
|
TCEMessagesWidget = class(TCEWidget)
|
||||||
imgList: TImageList;
|
imgList: TImageList;
|
||||||
List: TListView;
|
List: TTreeView;
|
||||||
private
|
private
|
||||||
fActClear: TAction;
|
fActClearAll: TAction;
|
||||||
|
fActClearEdi: TAction;
|
||||||
fActSaveMsg: TAction;
|
fActSaveMsg: TAction;
|
||||||
fActCopyMsg: TAction;
|
fActCopyMsg: TAction;
|
||||||
fActSelAll: TAction;
|
fActSelAll: TAction;
|
||||||
fProject: TCEProject;
|
fProject: TCEProject;
|
||||||
procedure actClearExecute(Sender: TObject);
|
fMaxMessCnt: Integer;
|
||||||
|
fDoc: TCESynMemo;
|
||||||
|
procedure filterMessages;
|
||||||
|
procedure clearOutOfRangeMessg;
|
||||||
|
procedure actClearEdiExecute(Sender: TObject);
|
||||||
|
procedure actClearAllExecute(Sender: TObject);
|
||||||
procedure actSaveMsgExecute(Sender: TObject);
|
procedure actSaveMsgExecute(Sender: TObject);
|
||||||
procedure actCopyMsgExecute(Sender: TObject);
|
procedure actCopyMsgExecute(Sender: TObject);
|
||||||
procedure actSelAllExecute(Sender: TObject);
|
procedure actSelAllExecute(Sender: TObject);
|
||||||
|
procedure setMaxMessageCount(aValue: Integer);
|
||||||
|
procedure listDeletion(Sender: TObject; Node: TTreeNode);
|
||||||
|
function newMessageItemData(aCtxt: TMessageContext): PMessageItemData;
|
||||||
|
published
|
||||||
|
property maxMessageCount: Integer read fMaxMessCnt write setMaxMessageCount default 250;
|
||||||
public
|
public
|
||||||
constructor create(aOwner: TComponent); override;
|
constructor create(aOwner: TComponent); override;
|
||||||
//
|
//
|
||||||
procedure scrollToBack;
|
procedure scrollToBack;
|
||||||
procedure addMessage(const aMsg: string);
|
procedure addMessage(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
||||||
procedure addCeInf(const aMsg: string);
|
procedure addCeInf(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
||||||
procedure addCeErr(const aMsg: string);
|
procedure addCeErr(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
||||||
procedure addCeWarn(const aMsg: string);
|
procedure addCeWarn(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
||||||
//
|
//
|
||||||
function contextName: string; override;
|
function contextName: string; override;
|
||||||
function contextActionCount: integer; override;
|
function contextActionCount: integer; override;
|
||||||
|
@ -43,7 +62,8 @@ type
|
||||||
procedure docFocused(const aDoc: TCESynMemo); override;
|
procedure docFocused(const aDoc: TCESynMemo); override;
|
||||||
procedure docClose(const aDoc: TCESynMemo); override;
|
procedure docClose(const aDoc: TCESynMemo); override;
|
||||||
//
|
//
|
||||||
procedure Clear;
|
procedure ClearAllMessages;
|
||||||
|
procedure ClearMessages(aCtxt: TMessageContext);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
PTCEMessageItem = ^TCEMessageItem;
|
PTCEMessageItem = ^TCEMessageItem;
|
||||||
|
@ -62,9 +82,14 @@ uses
|
||||||
|
|
||||||
constructor TCEMessagesWidget.create(aOwner: TComponent);
|
constructor TCEMessagesWidget.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
fActClear := TAction.Create(self);
|
fMaxMessCnt := 250;
|
||||||
fActClear.OnExecute := @actClearExecute;
|
//
|
||||||
fActClear.caption := 'Clear messages';
|
fActClearAll := TAction.Create(self);
|
||||||
|
fActClearAll.OnExecute := @actClearAllExecute;
|
||||||
|
fActClearAll.caption := 'Clear all messages';
|
||||||
|
fActClearEdi := TAction.Create(self);
|
||||||
|
fActClearEdi.OnExecute := @actClearEdiExecute;
|
||||||
|
fActClearEdi.caption := 'Clear editor messages';
|
||||||
fActCopyMsg := TAction.Create(self);
|
fActCopyMsg := TAction.Create(self);
|
||||||
fActCopyMsg.OnExecute := @actCopyMsgExecute;
|
fActCopyMsg.OnExecute := @actCopyMsgExecute;
|
||||||
fActCopyMsg.Caption := 'Copy message(s)';
|
fActCopyMsg.Caption := 'Copy message(s)';
|
||||||
|
@ -73,63 +98,134 @@ begin
|
||||||
fActSelAll.Caption := 'Select all';
|
fActSelAll.Caption := 'Select all';
|
||||||
fActSaveMsg := TAction.Create(self);
|
fActSaveMsg := TAction.Create(self);
|
||||||
fActSaveMsg.OnExecute := @actSaveMsgExecute;
|
fActSaveMsg.OnExecute := @actSaveMsgExecute;
|
||||||
fActSaveMsg.caption := 'Save messages to...';
|
fActSaveMsg.caption := 'Save selected message(s) to...';
|
||||||
//
|
//
|
||||||
inherited;
|
inherited;
|
||||||
fID := 'ID_MSGS';
|
fID := 'ID_MSGS';
|
||||||
//
|
//
|
||||||
List.PopupMenu := contextMenu;
|
List.PopupMenu := contextMenu;
|
||||||
|
List.OnDeletion := @ListDeletion;
|
||||||
DockMaster.GetAnchorSite(Self).Name := ID;
|
DockMaster.GetAnchorSite(Self).Name := ID;
|
||||||
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);
|
||||||
|
begin
|
||||||
|
if node.Data <> nil then
|
||||||
|
Dispose( PMessageItemData(Node.Data));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.scrollToBack;
|
procedure TCEMessagesWidget.scrollToBack;
|
||||||
begin
|
begin
|
||||||
if not Visible then exit;
|
if not Visible then exit;
|
||||||
List.ViewOrigin := Point(0, List.Items.Count * 25);
|
if List.BottomItem <> nil then
|
||||||
|
List.BottomItem.MakeVisible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.addCeInf(const aMsg: string);
|
procedure TCEMessagesWidget.filterMessages;
|
||||||
var
|
var
|
||||||
item: TCEMessageItem;
|
itm: TTreeNode;
|
||||||
|
dat: PMessageItemData;
|
||||||
|
i: NativeInt;
|
||||||
begin
|
begin
|
||||||
item := TCEMessageItem.Create(List.Items);
|
for i := 0 to List.Items.Count-1 do
|
||||||
item.Caption := 'Coedit information: ' + aMsg;
|
begin
|
||||||
|
itm := List.Items[i];
|
||||||
|
dat := PMessageItemData(itm.Data);
|
||||||
|
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.ImageIndex := 1;
|
||||||
List.Items.AddItem(item);
|
item.SelectedIndex := 1;
|
||||||
|
clearOutOfRangeMessg;
|
||||||
scrollToBack;
|
scrollToBack;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.addCeWarn(const aMsg: string);
|
procedure TCEMessagesWidget.addCeWarn(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
||||||
var
|
var
|
||||||
item: TCEMessageItem;
|
item: TTreeNode;
|
||||||
begin
|
begin
|
||||||
item := TCEMessageItem.Create(List.Items);
|
item := List.Items.Add(nil, 'Coedit warning: ' + aMsg);
|
||||||
item.Caption := 'Coedit warning: ' + aMsg;
|
item.Data := newMessageItemData(aCtxt);
|
||||||
item.ImageIndex := 3;
|
item.ImageIndex := 3;
|
||||||
List.Items.AddItem(item);
|
item.SelectedIndex := 3;
|
||||||
|
clearOutOfRangeMessg;
|
||||||
scrollToBack;
|
scrollToBack;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.addCeErr(const aMsg: string);
|
procedure TCEMessagesWidget.addCeErr(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
||||||
var
|
var
|
||||||
item: TCEMessageItem;
|
item: TTreeNode;
|
||||||
begin
|
begin
|
||||||
item := TCEMessageItem.Create(List.Items);
|
item := List.Items.Add(nil, 'Coedit error: ' + aMsg);
|
||||||
item.Caption := 'Coedit error: ' + aMsg;
|
item.Data := newMessageItemData(aCtxt);
|
||||||
item.ImageIndex := 4;
|
item.ImageIndex := 4;
|
||||||
List.Items.AddItem(item);
|
item.SelectedIndex := 4;
|
||||||
|
clearOutOfRangeMessg;
|
||||||
scrollToBack;
|
scrollToBack;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.addMessage(const aMsg: string);
|
procedure TCEMessagesWidget.addMessage(const aMsg: string; aCtxt: TMessageContext = msUnknown);
|
||||||
var
|
var
|
||||||
item: TCEMessageItem;
|
item: TTreeNode;
|
||||||
begin
|
begin
|
||||||
item := TCEMessageItem.Create(List.Items);
|
item := List.Items.Add(nil, aMsg);
|
||||||
item.Caption := aMsg;
|
item.Data := newMessageItemData(aCtxt);
|
||||||
item.Data := mainForm.EditWidget.currentEditor;
|
|
||||||
item.ImageIndex := Integer( semanticMsgAna(aMsg) );
|
item.ImageIndex := Integer( semanticMsgAna(aMsg) );
|
||||||
List.Items.AddItem(item);
|
item.SelectedIndex := Integer( semanticMsgAna(aMsg) );
|
||||||
|
clearOutOfRangeMessg;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCEMessagesWidget.contextName: string;
|
function TCEMessagesWidget.contextName: string;
|
||||||
|
@ -139,16 +235,17 @@ end;
|
||||||
|
|
||||||
function TCEMessagesWidget.contextActionCount: integer;
|
function TCEMessagesWidget.contextActionCount: integer;
|
||||||
begin
|
begin
|
||||||
result := 4;
|
result := 5;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCEMessagesWidget.contextAction(index: integer): TAction;
|
function TCEMessagesWidget.contextAction(index: integer): TAction;
|
||||||
begin
|
begin
|
||||||
case index of
|
case index of
|
||||||
0: result := fActClear;
|
0: result := fActClearAll;
|
||||||
1: result := fActCopyMsg;
|
1: result := fActClearEdi;
|
||||||
2: result := fActSelAll;
|
2: result := fActCopyMsg;
|
||||||
3: result := fActSaveMsg;
|
3: result := fActSelAll;
|
||||||
|
4: result := fActSaveMsg;
|
||||||
else result := nil;
|
else result := nil;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -156,33 +253,36 @@ end;
|
||||||
procedure TCEMessagesWidget.projNew(const aProject: TCEProject);
|
procedure TCEMessagesWidget.projNew(const aProject: TCEProject);
|
||||||
begin
|
begin
|
||||||
fProject := aProject;
|
fProject := aProject;
|
||||||
|
filterMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.projClose(const aProject: TCEProject);
|
procedure TCEMessagesWidget.projClose(const aProject: TCEProject);
|
||||||
begin
|
begin
|
||||||
if fProject = aProject then
|
if fProject = aProject then ClearMessages(msProject);
|
||||||
actClearExecute(nil);
|
|
||||||
fProject := nil;
|
fProject := nil;
|
||||||
|
filterMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.docFocused(const aDoc: TCESynMemo);
|
procedure TCEMessagesWidget.docFocused(const aDoc: TCESynMemo);
|
||||||
begin
|
begin
|
||||||
Clear;
|
fDoc := aDoc;
|
||||||
|
filterMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.docClose(const aDoc: TCESynMemo);
|
procedure TCEMessagesWidget.docClose(const aDoc: TCESynMemo);
|
||||||
begin
|
begin
|
||||||
Clear;
|
fDoc := nil;
|
||||||
|
filterMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.Clear;
|
procedure TCEMessagesWidget.actClearAllExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
actClearExecute(nil);
|
ClearAllMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.actClearExecute(Sender: TObject);
|
procedure TCEMessagesWidget.actClearEdiExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
List.Clear;
|
ClearMessages(msEditor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.actCopyMsgExecute(Sender: TObject);
|
procedure TCEMessagesWidget.actCopyMsgExecute(Sender: TObject);
|
||||||
|
@ -191,20 +291,23 @@ var
|
||||||
str: string;
|
str: string;
|
||||||
begin
|
begin
|
||||||
str := '';
|
str := '';
|
||||||
for i := 0 to List.Items.Count-1 do if List.Items[i].Selected then
|
for i := 0 to List.Items.Count-1 do if List.Items[i].MultiSelected then
|
||||||
str += List.Items[i].Caption + LineEnding;
|
str += List.Items[i].Text + LineEnding;
|
||||||
Clipboard.AsText := str;
|
Clipboard.AsText := str;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.actSelAllExecute(Sender: TObject);
|
procedure TCEMessagesWidget.actSelAllExecute(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: NativeInt;
|
||||||
begin
|
begin
|
||||||
List.SelectAll;
|
for i := 0 to List.Items.Count-1 do
|
||||||
|
List.Items[i].MultiSelected := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMessagesWidget.actSaveMsgExecute(Sender: TObject);
|
procedure TCEMessagesWidget.actSaveMsgExecute(Sender: TObject);
|
||||||
var
|
var
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
itm: TListItem;
|
itm: TtreeNode;
|
||||||
begin
|
begin
|
||||||
with TSaveDialog.Create(nil) do
|
with TSaveDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
|
@ -213,7 +316,7 @@ begin
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
for itm in List.Items do
|
for itm in List.Items do
|
||||||
lst.Add(itm.Caption);
|
lst.Add(itm.Text);
|
||||||
lst.SaveToFile(filename);
|
lst.SaveToFile(filename);
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
|
|
|
@ -40,18 +40,18 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
|
||||||
0000000700000047656E6572616CFFFFFFFFFFFFFFFF02000000FFFFFFFF0900
|
0000000700000047656E6572616CFFFFFFFFFFFFFFFF02000000FFFFFFFF0900
|
||||||
000000000000010A00000043617465676F72696573FFFFFFFFFFFFFFFF020000
|
000000000000010A00000043617465676F72696573FFFFFFFFFFFFFFFF020000
|
||||||
00FFFFFFFF000000000000000000080000004D65737361676573FFFFFFFFFFFF
|
00FFFFFFFF000000000000000000080000004D65737361676573FFFFFFFFFFFF
|
||||||
FFFF03000000FFFFFFFF000000000000000000080000004465627567696E67FF
|
FFFF03000000FFFFFFFF00000000000000000009000000446562756767696E67
|
||||||
FFFFFFFFFFFFFF04000000FFFFFFFF0000000000000000000D000000446F6375
|
FFFFFFFFFFFFFFFF04000000FFFFFFFF0000000000000000000D000000446F63
|
||||||
6D656E746174696F6EFFFFFFFFFFFFFFFF05000000FFFFFFFF00000000000000
|
756D656E746174696F6EFFFFFFFFFFFFFFFF05000000FFFFFFFF000000000000
|
||||||
0000060000004F7574707574FFFFFFFFFFFFFFFF06000000FFFFFFFF00000000
|
000000060000004F7574707574FFFFFFFFFFFFFFFF06000000FFFFFFFF000000
|
||||||
0000000000060000004F7468657273FFFFFFFFFFFFFFFF07000000FFFFFFFF00
|
000000000000060000004F7468657273FFFFFFFFFFFFFFFF07000000FFFFFFFF
|
||||||
0000000000000000050000005061746873FFFFFFFFFFFFFFFF08000000FFFFFF
|
000000000000000000050000005061746873FFFFFFFFFFFFFFFF08000000FFFF
|
||||||
FF000000000000000000110000005072652D6275696C642070726F63657373FF
|
FFFF000000000000000000110000005072652D6275696C642070726F63657373
|
||||||
FFFFFFFFFFFFFF09000000FFFFFFFF00000000000000000012000000506F7374
|
FFFFFFFFFFFFFFFF09000000FFFFFFFF00000000000000000012000000506F73
|
||||||
2D6275696C642070726F63657373FFFFFFFFFFFFFFFF0A000000FFFFFFFF0000
|
742D6275696C642070726F63657373FFFFFFFFFFFFFFFF0A000000FFFFFFFF00
|
||||||
000000000000000B00000052756E206F7074696F6E73FFFFFFFFFFFFFFFF0B00
|
00000000000000000B00000052756E206F7074696F6E73FFFFFFFFFFFFFFFF0B
|
||||||
0000FFFFFFFF0000000000000000000E000000416C6C2063617465676F726965
|
000000FFFFFFFF0000000000000000000E000000416C6C2063617465676F7269
|
||||||
73
|
6573
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
object Panel1: TPanel[1]
|
object Panel1: TPanel[1]
|
||||||
|
|
|
@ -50,6 +50,8 @@ type
|
||||||
procedure projNew(const aProject: TCEProject); override;
|
procedure projNew(const aProject: TCEProject); override;
|
||||||
procedure projChange(const aProject: TCEProject); override;
|
procedure projChange(const aProject: TCEProject); override;
|
||||||
procedure projClose(const aProject: TCEProject); override;
|
procedure projClose(const aProject: TCEProject); override;
|
||||||
|
procedure projCompile(const aProject: TCEProject); override;
|
||||||
|
procedure projRun(const aProject: TCEProject); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
@ -154,6 +156,16 @@ begin
|
||||||
beginUpdateByDelay;
|
beginUpdateByDelay;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEStaticExplorerWidget.projCompile(const aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
stopUpdateByDelay;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEStaticExplorerWidget.projRun(const aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
stopUpdateByDelay;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEStaticExplorerWidget.UpdateByDelay;
|
procedure TCEStaticExplorerWidget.UpdateByDelay;
|
||||||
begin
|
begin
|
||||||
if not fAutoRefresh then exit;
|
if not fAutoRefresh then exit;
|
||||||
|
|
|
@ -51,6 +51,10 @@ type
|
||||||
// if not re-called during 'updaterByDelayDuration' ms then
|
// if not re-called during 'updaterByDelayDuration' ms then
|
||||||
// 'UpdateByDelay' is called once.
|
// 'UpdateByDelay' is called once.
|
||||||
procedure beginUpdateByDelay;
|
procedure beginUpdateByDelay;
|
||||||
|
// prevent any pending update.
|
||||||
|
procedure stopUpdateByDelay;
|
||||||
|
// immediate call any pending update.
|
||||||
|
procedure endUpdatebyDelay;
|
||||||
// increments the updates count.
|
// increments the updates count.
|
||||||
procedure beginUpdateByEvent;
|
procedure beginUpdateByEvent;
|
||||||
// decrements the update count and call 'UpdateByEvent' if the
|
// decrements the update count and call 'UpdateByEvent' if the
|
||||||
|
@ -67,6 +71,8 @@ type
|
||||||
procedure projNew(const aProject: TCEProject); virtual;
|
procedure projNew(const aProject: TCEProject); virtual;
|
||||||
procedure projChange(const aProject: TCEProject); virtual;
|
procedure projChange(const aProject: TCEProject); virtual;
|
||||||
procedure projClose(const aProject: TCEProject); virtual;
|
procedure projClose(const aProject: TCEProject); virtual;
|
||||||
|
procedure projCompile(const aProject: TCEProject); virtual;
|
||||||
|
procedure projRun(const aProject: TCEProject); virtual;
|
||||||
procedure projFocused(const aProject: TCEProject); virtual;
|
procedure projFocused(const aProject: TCEProject); virtual;
|
||||||
//
|
//
|
||||||
function contextName: string; virtual;
|
function contextName: string; virtual;
|
||||||
|
@ -185,6 +191,16 @@ begin
|
||||||
fUpdaterDelay.OnTimer := @updaterLatchProc;
|
fUpdaterDelay.OnTimer := @updaterLatchProc;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEWidget.stopUpdateByDelay;
|
||||||
|
begin
|
||||||
|
fUpdaterDelay.OnTimer := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEWidget.endUpdateByDelay;
|
||||||
|
begin
|
||||||
|
updaterLatchProc(nil);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEWidget.updaterAutoProc(Sender: TObject);
|
procedure TCEWidget.updaterAutoProc(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
fUpdating := true;
|
fUpdating := true;
|
||||||
|
@ -224,6 +240,14 @@ procedure TCEWidget.projClose(const aProject: TCEProject);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEWidget.projCompile(const aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEWidget.projRun(const aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEWidget.projFocused(const aProject: TCEProject);
|
procedure TCEWidget.projFocused(const aProject: TCEProject);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -37,7 +37,10 @@ type
|
||||||
procedure projNew(const aProject: TCEProject);
|
procedure projNew(const aProject: TCEProject);
|
||||||
procedure projChange(const aProject: TCEProject);
|
procedure projChange(const aProject: TCEProject);
|
||||||
procedure projClose(const aProject: TCEProject);
|
procedure projClose(const aProject: TCEProject);
|
||||||
// not used yet.
|
procedure projCompile(const aProject: TCEProject);
|
||||||
|
procedure projRun(const aProject: TCEProject);
|
||||||
|
|
||||||
|
// not used yet: (project group)
|
||||||
procedure projFocused(const aProject: TCEProject);
|
procedure projFocused(const aProject: TCEProject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue