interface, add more message contexts

This commit is contained in:
Basile Burg 2016-07-07 20:51:05 +02:00
parent 44b2ed66f1
commit b86e65cba0
2 changed files with 30 additions and 1 deletions

View File

@ -252,7 +252,16 @@ type
/// describes the message kind, 'amkAuto' implies that an ICELogMessageObserver guess the kind. /// describes the message kind, 'amkAuto' implies that an ICELogMessageObserver guess the kind.
TCEAppMessageKind = (amkAuto, amkBub, amkInf, amkHint, amkWarn, amkErr); TCEAppMessageKind = (amkAuto, amkBub, amkInf, amkHint, amkWarn, amkErr);
/// describes the message context. Used by a ICELogMessageObserver to filter the messages. /// describes the message context. Used by a ICELogMessageObserver to filter the messages.
TCEAppMessageCtxt = (amcAll, amcEdit, amcProj, amcApp, amcMisc); TCEAppMessageCtxt = (
amcAll, // used as filter
amcEdit, // used as filter
amcProj, // used as filter
amcApp, // used as filter
amcMisc, // used as filter
amcAutoEdit, // same as amcEdit but the message data is set automatically from the widget side
amcAutoProj, // same as amcProj but the message data is set automatically from the widget side
amcAutoCompile // same as amcAutoEdit or amcAutoProj, according to what's being compiled.
);
(** (**
* Single service provided by the messages widget. * Single service provided by the messages widget.

View File

@ -83,6 +83,7 @@ type
fEditorMessagePos: TCEEditorMessagePos; fEditorMessagePos: TCEEditorMessagePos;
fDemanglerAvailable: boolean; fDemanglerAvailable: boolean;
fMsgColors: array[TCEAppMessageKind] of TColor; fMsgColors: array[TCEAppMessageKind] of TColor;
fProjCompile: boolean;
fActAutoSel: TAction; fActAutoSel: TAction;
fActClearAll: TAction; fActClearAll: TAction;
fActClearCurCat: TAction; fActClearCurCat: TAction;
@ -674,10 +675,12 @@ end;
procedure TCEMessagesWidget.projCompiling(aProject: ICECommonProject); procedure TCEMessagesWidget.projCompiling(aProject: ICECommonProject);
begin begin
fProjCompile := true;
end; end;
procedure TCEMessagesWidget.projCompiled(aProject: ICECommonProject; success: boolean); procedure TCEMessagesWidget.projCompiled(aProject: ICECommonProject; success: boolean);
begin begin
fProjCompile := false;
end; end;
{$ENDREGION} {$ENDREGION}
@ -761,6 +764,23 @@ begin
msg := aValue; msg := aValue;
if aKind = amkAuto then if aKind = amkAuto then
aKind := guessMessageKind(msg); aKind := guessMessageKind(msg);
if aCtxt = amcAutoCompile then
begin
case fProjCompile of
false: aCtxt := amcAutoEdit;
true: aCtxt := amcAutoProj;
end;
end;
if aCtxt = amcAutoEdit then
begin
aData := fDoc;
aCtxt := amcEdit;
end
else if aCtxt = amcAutoProj then
begin
aData := fProj;
aCtxt := amcProj;
end;
dt := new(PMessageData); dt := new(PMessageData);
dt^.data := aData; dt^.data := aData;
dt^.ctxt := aCtxt; dt^.ctxt := aCtxt;