Merge branch 'Zode-debug-quicktoggle'
This commit is contained in:
@@ -122,6 +122,14 @@ namespace FlaxEditor.GUI
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnClicked()
|
||||||
|
{
|
||||||
|
if (AutoCheck)
|
||||||
|
Checked = !Checked;
|
||||||
|
Clicked?.Invoke();
|
||||||
|
(Parent as ToolStrip)?.OnButtonClicked(this);
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
@@ -196,11 +204,7 @@ namespace FlaxEditor.GUI
|
|||||||
if (button == MouseButton.Left && _primaryMouseDown)
|
if (button == MouseButton.Left && _primaryMouseDown)
|
||||||
{
|
{
|
||||||
_primaryMouseDown = false;
|
_primaryMouseDown = false;
|
||||||
if (AutoCheck)
|
OnClicked();
|
||||||
Checked = !Checked;
|
|
||||||
Clicked?.Invoke();
|
|
||||||
(Parent as ToolStrip)?.OnButtonClicked(this);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (button == MouseButton.Right && _secondaryMouseDown)
|
if (button == MouseButton.Right && _secondaryMouseDown)
|
||||||
@@ -215,6 +219,18 @@ namespace FlaxEditor.GUI
|
|||||||
return base.OnMouseUp(location, button);
|
return base.OnMouseUp(location, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
|
||||||
|
{
|
||||||
|
if (button == MouseButton.Left)
|
||||||
|
{
|
||||||
|
OnClicked();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnMouseLeave()
|
public override void OnMouseLeave()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ namespace FlaxEditor.Windows
|
|||||||
private Color _colorWarning;
|
private Color _colorWarning;
|
||||||
private Color _colorError;
|
private Color _colorError;
|
||||||
private bool _colorDebugLogText;
|
private bool _colorDebugLogText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DebugLogWindow"/> class.
|
/// Initializes a new instance of the <see cref="DebugLogWindow"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -352,24 +352,12 @@ namespace FlaxEditor.Windows
|
|||||||
editor.Options.Apply(editor.Options.Options);
|
editor.Options.Apply(editor.Options.Options);
|
||||||
}).SetAutoCheck(true).LinkTooltip("Performs auto pause on error");
|
}).SetAutoCheck(true).LinkTooltip("Performs auto pause on error");
|
||||||
toolstrip.AddSeparator();
|
toolstrip.AddSeparator();
|
||||||
_groupButtons[0] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Error32, () =>
|
_groupButtons[0] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Error32, () => { OnGroupButtonPressed(0); })
|
||||||
{
|
.SetAutoCheck(true).LinkTooltip("Shows/hides error messages");
|
||||||
UpdateLogTypeVisibility(LogGroup.Error, _groupButtons[0].Checked);
|
_groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning32, () => { OnGroupButtonPressed(1); })
|
||||||
editor.Options.Options.Interface.DebugLogShowErrorMessages = _groupButtons[0].Checked;
|
.SetAutoCheck(true).LinkTooltip("Shows/hides warning messages");
|
||||||
editor.Options.Apply(editor.Options.Options);
|
_groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info32, () => { OnGroupButtonPressed(2); })
|
||||||
}).SetAutoCheck(true).LinkTooltip("Shows/hides error messages");
|
.SetAutoCheck(true).LinkTooltip("Shows/hides info messages");
|
||||||
_groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning32, () =>
|
|
||||||
{
|
|
||||||
UpdateLogTypeVisibility(LogGroup.Warning, _groupButtons[1].Checked);
|
|
||||||
editor.Options.Options.Interface.DebugLogShowWarningMessages = _groupButtons[1].Checked;
|
|
||||||
editor.Options.Apply(editor.Options.Options);
|
|
||||||
}).SetAutoCheck(true).LinkTooltip("Shows/hides warning messages");
|
|
||||||
_groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info32, () =>
|
|
||||||
{
|
|
||||||
UpdateLogTypeVisibility(LogGroup.Info, _groupButtons[2].Checked);
|
|
||||||
editor.Options.Options.Interface.DebugLogShowInfoMessages = _groupButtons[2].Checked;
|
|
||||||
editor.Options.Apply(editor.Options.Options);
|
|
||||||
}).SetAutoCheck(true).LinkTooltip("Shows/hides info messages");
|
|
||||||
UpdateCount();
|
UpdateCount();
|
||||||
|
|
||||||
// Split panel
|
// Split panel
|
||||||
@@ -418,6 +406,27 @@ namespace FlaxEditor.Windows
|
|||||||
OnEditorOptionsChanged(Editor.Options.Options);
|
OnEditorOptionsChanged(Editor.Options.Options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnGroupButtonPressed(int index)
|
||||||
|
{
|
||||||
|
UpdateLogTypeVisibility((LogGroup)index, _groupButtons[index].Checked);
|
||||||
|
if (Input.GetKey(KeyboardKeys.Shift))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < (int)LogGroup.Max; i++)
|
||||||
|
{
|
||||||
|
if (i == index)
|
||||||
|
continue;
|
||||||
|
_groupButtons[i].Checked = !_groupButtons[index].Checked;
|
||||||
|
UpdateLogTypeVisibility((LogGroup)i, _groupButtons[i].Checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var options = Editor.Options.Options.Interface;
|
||||||
|
options.DebugLogShowErrorMessages = _groupButtons[0].Checked;
|
||||||
|
options.DebugLogShowWarningMessages = _groupButtons[1].Checked;
|
||||||
|
options.DebugLogShowInfoMessages = _groupButtons[2].Checked;
|
||||||
|
Editor.Options.Apply(Editor.Options.Options);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnEditorOptionsChanged(EditorOptions options)
|
private void OnEditorOptionsChanged(EditorOptions options)
|
||||||
{
|
{
|
||||||
_timestampsFormats = options.Interface.DebugLogTimestampsFormat;
|
_timestampsFormats = options.Interface.DebugLogTimestampsFormat;
|
||||||
@@ -455,15 +464,9 @@ namespace FlaxEditor.Windows
|
|||||||
// Create new entry
|
// Create new entry
|
||||||
switch (_timestampsFormats)
|
switch (_timestampsFormats)
|
||||||
{
|
{
|
||||||
case InterfaceOptions.TimestampsFormats.Utc:
|
case InterfaceOptions.TimestampsFormats.Utc: desc.Title = $"[{DateTime.UtcNow}] {desc.Title}"; break;
|
||||||
desc.Title = $"[{DateTime.UtcNow}] {desc.Title}";
|
case InterfaceOptions.TimestampsFormats.LocalTime: desc.Title = $"[{DateTime.Now}] {desc.Title}"; break;
|
||||||
break;
|
case InterfaceOptions.TimestampsFormats.TimeSinceStartup: desc.Title = string.Format("[{0:g}] ", TimeSpan.FromSeconds(Time.TimeSinceStartup)) + desc.Title; break;
|
||||||
case InterfaceOptions.TimestampsFormats.LocalTime:
|
|
||||||
desc.Title = $"[{DateTime.Now}] {desc.Title}";
|
|
||||||
break;
|
|
||||||
case InterfaceOptions.TimestampsFormats.TimeSinceStartup:
|
|
||||||
desc.Title = string.Format("[{0:g}] ", TimeSpan.FromSeconds(Time.TimeSinceStartup)) + desc.Title;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
var newEntry = new LogEntry(this, ref desc);
|
var newEntry = new LogEntry(this, ref desc);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user