diff --git a/Source/Editor/GUI/Docking/DockPanelProxy.cs b/Source/Editor/GUI/Docking/DockPanelProxy.cs
index 748ae726c..832ded3ec 100644
--- a/Source/Editor/GUI/Docking/DockPanelProxy.cs
+++ b/Source/Editor/GUI/Docking/DockPanelProxy.cs
@@ -194,11 +194,22 @@ namespace FlaxEditor.GUI.Docking
bool isMouseOver = IsMouseOver && headerRect.Contains(MousePosition);
Render2D.FillRectangle(headerRect, containsFocus ? style.BackgroundSelected : isMouseOver ? style.BackgroundHighlighted : style.LightBackground);
+ float iconWidth = tab.Icon.IsValid ? DockPanel.DefaultButtonsSize + DockPanel.DefaultLeftTextMargin : 0;
+
+ if (tab.Icon.IsValid)
+ {
+ Render2D.DrawSprite(
+ tab.Icon,
+ new Rectangle(DockPanel.DefaultLeftTextMargin, (DockPanel.DefaultHeaderHeight - DockPanel.DefaultButtonsSize) / 2, DockPanel.DefaultButtonsSize, DockPanel.DefaultButtonsSize),
+ style.Foreground);
+
+ }
+
// Draw text
Render2D.DrawText(
style.FontMedium,
tab.Title,
- new Rectangle(DockPanel.DefaultLeftTextMargin, 0, Width - DockPanel.DefaultLeftTextMargin - DockPanel.DefaultButtonsSize - 2 * DockPanel.DefaultButtonsMargin, DockPanel.DefaultHeaderHeight),
+ new Rectangle(DockPanel.DefaultLeftTextMargin + iconWidth, 0, Width - DockPanel.DefaultLeftTextMargin - DockPanel.DefaultButtonsSize - 2 * DockPanel.DefaultButtonsMargin, DockPanel.DefaultHeaderHeight),
style.Foreground,
TextAlignment.Near,
TextAlignment.Center);
@@ -223,7 +234,8 @@ namespace FlaxEditor.GUI.Docking
var tab = _panel.GetTab(i);
Color tabColor = Color.Black;
var titleSize = tab.TitleSize;
- float width = titleSize.X + DockPanel.DefaultButtonsSize + 2 * DockPanel.DefaultButtonsMargin + DockPanel.DefaultLeftTextMargin + DockPanel.DefaultRightTextMargin;
+ float iconWidth = tab.Icon.IsValid ? DockPanel.DefaultButtonsSize + DockPanel.DefaultLeftTextMargin : 0;
+ float width = titleSize.X + DockPanel.DefaultButtonsSize + 2 * DockPanel.DefaultButtonsMargin + DockPanel.DefaultLeftTextMargin + DockPanel.DefaultRightTextMargin + iconWidth;
var tabRect = new Rectangle(x, 0, width, DockPanel.DefaultHeaderHeight);
bool isMouseOver = IsMouseOver && tabRect.Contains(MousePosition);
bool isSelected = _panel.SelectedTab == tab;
@@ -241,11 +253,20 @@ namespace FlaxEditor.GUI.Docking
Render2D.FillRectangle(tabRect, tabColor);
}
+ if (tab.Icon.IsValid)
+ {
+ Render2D.DrawSprite(
+ tab.Icon,
+ new Rectangle(x + DockPanel.DefaultLeftTextMargin, (DockPanel.DefaultHeaderHeight - DockPanel.DefaultButtonsSize) / 2, DockPanel.DefaultButtonsSize, DockPanel.DefaultButtonsSize),
+ style.Foreground);
+
+ }
+
// Draw text
Render2D.DrawText(
style.FontMedium,
tab.Title,
- new Rectangle(x + DockPanel.DefaultLeftTextMargin, 0, 10000, DockPanel.DefaultHeaderHeight),
+ new Rectangle(x + DockPanel.DefaultLeftTextMargin + iconWidth, 0, 10000, DockPanel.DefaultHeaderHeight),
style.Foreground,
TextAlignment.Near,
TextAlignment.Center);
diff --git a/Source/Editor/GUI/Docking/DockWindow.cs b/Source/Editor/GUI/Docking/DockWindow.cs
index 56c78efed..05aed9eaf 100644
--- a/Source/Editor/GUI/Docking/DockWindow.cs
+++ b/Source/Editor/GUI/Docking/DockWindow.cs
@@ -88,6 +88,11 @@ namespace FlaxEditor.GUI.Docking
}
}
+ ///
+ /// Gets or sets the window icon
+ ///
+ public SpriteHandle Icon { get; set; }
+
///
/// Gets the size of the title.
///
diff --git a/Source/Editor/Windows/DebugLogWindow.cs b/Source/Editor/Windows/DebugLogWindow.cs
index 8aad9fc35..e416c334c 100644
--- a/Source/Editor/Windows/DebugLogWindow.cs
+++ b/Source/Editor/Windows/DebugLogWindow.cs
@@ -72,7 +72,7 @@ namespace FlaxEditor.Windows
///
/// The default height of the entries.
///
- public const float DefaultHeight = 48.0f;
+ public const float DefaultHeight = 32.0f;
private DebugLogWindow _window;
public LogGroup Group;
@@ -128,10 +128,11 @@ namespace FlaxEditor.Windows
Render2D.FillRectangle(clientRect, style.Background * 0.9f);
// Icon
- Render2D.DrawSprite(Icon, new Rectangle(5, 8, 32, 32), style.Foreground);
+ var iconColor = Group == LogGroup.Error ? Color.Red : (Group == LogGroup.Warning ? Color.Yellow : style.Foreground);
+ Render2D.DrawSprite(Icon, new Rectangle(5, 0, 32, 32), iconColor);
// Title
- var textRect = new Rectangle(38, 6, clientRect.Width - 40, clientRect.Height - 10);
+ var textRect = new Rectangle(38, 2, clientRect.Width - 40, clientRect.Height - 10);
Render2D.PushClip(ref clientRect);
Render2D.DrawText(style.FontMedium, Desc.Title, textRect, style.Foreground);
Render2D.PopClip();
@@ -267,6 +268,8 @@ namespace FlaxEditor.Windows
private readonly ToolStripButton _pauseOnErrorButton;
private readonly ToolStripButton[] _groupButtons = new ToolStripButton[3];
+ private LogType _iconType = LogType.Info;
+
internal SpriteHandle IconInfo;
internal SpriteHandle IconWarning;
internal SpriteHandle IconError;
@@ -279,6 +282,7 @@ namespace FlaxEditor.Windows
: base(editor, true, ScrollBars.None)
{
Title = "Debug Log";
+ Icon = IconInfo;
OnEditorOptionsChanged(Editor.Options.Options);
// Toolstrip
@@ -333,6 +337,7 @@ namespace FlaxEditor.Windows
Editor.Options.OptionsChanged += OnEditorOptionsChanged;
Debug.Logger.LogHandler.SendLog += LogHandlerOnSendLog;
Debug.Logger.LogHandler.SendExceptionLog += LogHandlerOnSendExceptionLog;
+
}
private void OnEditorOptionsChanged(EditorOptions options)
@@ -381,6 +386,18 @@ namespace FlaxEditor.Windows
_pendingEntries.Add(newEntry);
}
+ if (newEntry.Group == LogGroup.Warning && _iconType < LogType.Warning)
+ {
+ _iconType = LogType.Warning;
+ UpdateIcon();
+ }
+
+ if (newEntry.Group == LogGroup.Error && _iconType < LogType.Error)
+ {
+ _iconType = LogType.Error;
+ UpdateIcon();
+ }
+
// Pause on Error (we should do it as fast as possible)
if (newEntry.Group == LogGroup.Error && _pauseOnErrorButton.Checked && Editor.StateMachine.CurrentState == Editor.StateMachine.PlayingState)
{
@@ -426,6 +443,12 @@ namespace FlaxEditor.Windows
UpdateCount((int)LogGroup.Error, " Error");
UpdateCount((int)LogGroup.Warning, " Warning");
UpdateCount((int)LogGroup.Info, " Message");
+
+ if (_logCountPerGroup[(int)LogGroup.Error] == 0)
+ {
+ _iconType = _logCountPerGroup[(int)LogGroup.Warning] == 0 ? LogType.Info : LogType.Warning;
+ UpdateIcon();
+ }
}
private void UpdateCount(int group, string msg)
@@ -435,6 +458,22 @@ namespace FlaxEditor.Windows
_groupButtons[group].Text = _logCountPerGroup[group] + msg;
}
+ private void UpdateIcon()
+ {
+ if (_iconType == LogType.Warning)
+ {
+ Icon = IconWarning;
+ }
+ else if (_iconType == LogType.Error)
+ {
+ Icon = IconError;
+ }
+ else
+ {
+ Icon = IconInfo;
+ }
+ }
+
private void LogHandlerOnSendLog(LogType level, string msg, Object o, string stackTrace)
{
var desc = new LogEntryDescription
@@ -566,6 +605,14 @@ namespace FlaxEditor.Windows
}
}
+ ///
+ public override void OnStartContainsFocus()
+ {
+ _iconType = LogType.Info;
+ UpdateIcon();
+ base.OnStartContainsFocus();
+ }
+
///
public override void OnDestroy()
{