mirror of https://gitlab.com/basile.b/dexed.git
added option to colorize messages background
This commit is contained in:
parent
ec22f7b979
commit
4391cb2680
|
@ -37,6 +37,7 @@ inherited CEMessagesWidget: TCEMessagesWidget
|
||||||
ShowLines = False
|
ShowLines = False
|
||||||
ShowRoot = False
|
ShowRoot = False
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
OnCustomDrawItem = ListCustomDrawItem
|
||||||
OnKeyDown = ListKeyDown
|
OnKeyDown = ListKeyDown
|
||||||
Options = [tvoAllowMultiselect, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoToolTips, tvoThemedDraw]
|
Options = [tvoAllowMultiselect, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoToolTips, tvoThemedDraw]
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ 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, TreeFilterEdit,
|
lcltype, ce_widget, ActnList, Menus, clipbrd, AnchorDocking, TreeFilterEdit,
|
||||||
Buttons, ce_writableComponent, ce_common, ce_project, ce_synmemo,
|
Buttons, ce_writableComponent, ce_common, ce_project, ce_synmemo, GraphType,
|
||||||
ce_dlangutils, ce_interfaces, ce_observer;
|
ce_dlangutils, ce_interfaces, ce_observer;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -28,6 +28,7 @@ type
|
||||||
fAutoSelect: boolean;
|
fAutoSelect: boolean;
|
||||||
fSingleClick: boolean;
|
fSingleClick: boolean;
|
||||||
fFont: TFont;
|
fFont: TFont;
|
||||||
|
fMsgColors: array[TCEAppMessageKind] of TColor;
|
||||||
procedure setFont(aValue: TFont);
|
procedure setFont(aValue: TFont);
|
||||||
published
|
published
|
||||||
property fastDisplay: boolean read fFastDisplay write fFastDisplay;
|
property fastDisplay: boolean read fFastDisplay write fFastDisplay;
|
||||||
|
@ -35,6 +36,11 @@ type
|
||||||
property autoSelect: boolean read fAutoSelect write fAutoSelect;
|
property autoSelect: boolean read fAutoSelect write fAutoSelect;
|
||||||
property singleMessageClick: boolean read fSingleClick write fSingleClick;
|
property singleMessageClick: boolean read fSingleClick write fSingleClick;
|
||||||
property font: TFont read fFont write setFont;
|
property font: TFont read fFont write setFont;
|
||||||
|
property colorBuble: TColor read fMsgColors[amkBub] write fMsgColors[amkBub];
|
||||||
|
property colorInfo: TColor read fMsgColors[amkInf] write fMsgColors[amkInf];
|
||||||
|
property colorHint: TColor read fMsgColors[amkHint] write fMsgColors[amkHint];
|
||||||
|
property colorWarning: TColor read fMsgColors[amkWarn] write fMsgColors[amkWarn];
|
||||||
|
property colorError: TColor read fMsgColors[amkErr] write fMsgColors[amkErr];
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
|
@ -61,8 +67,11 @@ type
|
||||||
ToolButton8: TToolButton;
|
ToolButton8: TToolButton;
|
||||||
btnSelApp: TToolButton;
|
btnSelApp: TToolButton;
|
||||||
TreeFilterEdit1: TTreeFilterEdit;
|
TreeFilterEdit1: TTreeFilterEdit;
|
||||||
|
procedure ListCustomDrawItem(Sender: TCustomTreeView; Node: TTreeNode;
|
||||||
|
State: TCustomDrawState; var DefaultDraw: Boolean);
|
||||||
procedure ListKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure ListKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
private
|
private
|
||||||
|
fMsgColors: array[TCEAppMessageKind] of TColor;
|
||||||
fActAutoSel: TAction;
|
fActAutoSel: TAction;
|
||||||
fActClearAll: TAction;
|
fActClearAll: TAction;
|
||||||
fActClearCurCat: TAction;
|
fActClearCurCat: TAction;
|
||||||
|
@ -95,6 +104,12 @@ type
|
||||||
function iconIndex(aKind: TCEAppMessageKind): Integer;
|
function iconIndex(aKind: TCEAppMessageKind): Integer;
|
||||||
procedure handleMessageClick(Sender: TObject);
|
procedure handleMessageClick(Sender: TObject);
|
||||||
//
|
//
|
||||||
|
procedure setColorError(aValue: TColor);
|
||||||
|
procedure setColorInfo(aValue: TColor);
|
||||||
|
procedure setColorHint(aValue: TColor);
|
||||||
|
procedure setColorBuble(aValue: TColor);
|
||||||
|
procedure setColorWarning(aValue: TColor);
|
||||||
|
//
|
||||||
procedure projNew(aProject: TCEProject);
|
procedure projNew(aProject: TCEProject);
|
||||||
procedure projClosing(aProject: TCEProject);
|
procedure projClosing(aProject: TCEProject);
|
||||||
procedure projFocused(aProject: TCEProject);
|
procedure projFocused(aProject: TCEProject);
|
||||||
|
@ -126,6 +141,12 @@ type
|
||||||
property maxMessageCount: Integer read fMaxMessCnt write setMaxMessageCount;
|
property maxMessageCount: Integer read fMaxMessCnt write setMaxMessageCount;
|
||||||
property autoSelectCategory: boolean read fAutoSelect write setAutoSelectCategory;
|
property autoSelectCategory: boolean read fAutoSelect write setAutoSelectCategory;
|
||||||
property singleMessageClick: boolean read fSingleClick write setSingleMessageClick;
|
property singleMessageClick: boolean read fSingleClick write setSingleMessageClick;
|
||||||
|
//
|
||||||
|
property colorBuble: TColor read fMsgColors[amkBub] write setColorBuble;
|
||||||
|
property colorInfo: TColor read fMsgColors[amkInf] write setColorInfo;
|
||||||
|
property colorHint: TColor read fMsgColors[amkHint] write setColorHint;
|
||||||
|
property colorWarning: TColor read fMsgColors[amkWarn] write setColorWarning;
|
||||||
|
property colorError: TColor read fMsgColors[amkErr] write setColorError;
|
||||||
public
|
public
|
||||||
constructor create(aOwner: TComponent); override;
|
constructor create(aOwner: TComponent); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
|
@ -175,6 +196,7 @@ begin
|
||||||
fAutoSelect := opts.fAutoSelect;
|
fAutoSelect := opts.fAutoSelect;
|
||||||
fSingleClick := opts.fSingleClick;
|
fSingleClick := opts.fSingleClick;
|
||||||
fFastDisplay := opts.fFastDisplay;
|
fFastDisplay := opts.fFastDisplay;
|
||||||
|
fMsgColors := opts.fMsgColors;
|
||||||
fFont.EndUpdate;
|
fFont.EndUpdate;
|
||||||
end
|
end
|
||||||
else if Source is TCEMessagesWidget then
|
else if Source is TCEMessagesWidget then
|
||||||
|
@ -185,6 +207,7 @@ begin
|
||||||
fAutoSelect := widg.fAutoSelect;
|
fAutoSelect := widg.fAutoSelect;
|
||||||
fSingleClick := widg.fSingleClick;
|
fSingleClick := widg.fSingleClick;
|
||||||
fFastDisplay := widg.fastDisplay;
|
fFastDisplay := widg.fastDisplay;
|
||||||
|
fMsgColors := widg.fMsgColors;
|
||||||
end
|
end
|
||||||
else inherited;
|
else inherited;
|
||||||
end;
|
end;
|
||||||
|
@ -201,6 +224,7 @@ begin
|
||||||
widg.autoSelectCategory := fAutoSelect;
|
widg.autoSelectCategory := fAutoSelect;
|
||||||
widg.singleMessageClick := fSingleClick;
|
widg.singleMessageClick := fSingleClick;
|
||||||
widg.fastDisplay:= fFastDisplay;
|
widg.fastDisplay:= fFastDisplay;
|
||||||
|
widg.fMsgColors := fMsgColors;
|
||||||
end
|
end
|
||||||
else inherited;
|
else inherited;
|
||||||
end;
|
end;
|
||||||
|
@ -237,6 +261,12 @@ begin
|
||||||
//
|
//
|
||||||
inherited;
|
inherited;
|
||||||
//
|
//
|
||||||
|
fMsgColors[amkBub] := clDefault;
|
||||||
|
fMsgColors[amkHint] := clDefault;
|
||||||
|
fMsgColors[amkInf] := clDefault;
|
||||||
|
fMsgColors[amkErr] := clDefault;
|
||||||
|
fMsgColors[amkWarn] := clDefault;
|
||||||
|
//
|
||||||
updaterByLoopInterval := 12;
|
updaterByLoopInterval := 12;
|
||||||
fOptions := TCEMessagesOptions.Create(Self);
|
fOptions := TCEMessagesOptions.Create(Self);
|
||||||
fOptions.assign(self);
|
fOptions.assign(self);
|
||||||
|
@ -368,6 +398,59 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.setColorError(aValue: TColor);
|
||||||
|
begin
|
||||||
|
fMsgColors[amkErr] := aValue;
|
||||||
|
List.Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.setColorInfo(aValue: TColor);
|
||||||
|
begin
|
||||||
|
fMsgColors[amkInf] := aValue;
|
||||||
|
List.Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.setColorHint(aValue: TColor);
|
||||||
|
begin
|
||||||
|
fMsgColors[amkHint] := aValue;
|
||||||
|
List.Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.setColorBuble(aValue: TColor);
|
||||||
|
begin
|
||||||
|
fMsgColors[amkBub] := aValue;
|
||||||
|
List.Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.setColorWarning(aValue: TColor);
|
||||||
|
begin
|
||||||
|
fMsgColors[amkWarn] := aValue;
|
||||||
|
List.Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMessagesWidget.ListCustomDrawItem(Sender: TCustomTreeView;
|
||||||
|
Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
|
||||||
|
var
|
||||||
|
rc: TRect;
|
||||||
|
customdraw: Boolean;
|
||||||
|
begin
|
||||||
|
customdraw := fMsgColors[TCEAppMessageKind(node.ImageIndex + 1)] <> clDefault;
|
||||||
|
if customdraw then
|
||||||
|
begin
|
||||||
|
rc := node.DisplayRect(false);
|
||||||
|
Sender.Canvas.Brush.Color := fMsgColors[TCEAppMessageKind(node.ImageIndex + 1)];
|
||||||
|
if node.Selected then
|
||||||
|
begin
|
||||||
|
Sender.Canvas.DrawFocusRect(rc);
|
||||||
|
Sender.Canvas.Brush.Color := Sender.Canvas.Brush.Color - $232323;
|
||||||
|
end;
|
||||||
|
Sender.Canvas.FillRect(rc);
|
||||||
|
Sender.Canvas.TextOut(rc.Left + 30, rc.Top, node.Text);
|
||||||
|
list.Images.Draw(sender.Canvas, rc.Left + 1, (rc.Top + rc.Bottom - list.Images.Height) div 2,
|
||||||
|
node.ImageIndex, Node.NodeEffect);
|
||||||
|
end;
|
||||||
|
DefaultDraw := not customdraw;
|
||||||
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION ICEEditableOptions ----------------------------------------------------}
|
{$REGION ICEEditableOptions ----------------------------------------------------}
|
||||||
|
|
Loading…
Reference in New Issue