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