Format code

#3544
This commit is contained in:
Wojtek Figat
2025-06-15 20:31:04 +02:00
parent 00055ef663
commit 648504ceb1
2 changed files with 26 additions and 32 deletions

View File

@@ -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)
@@ -218,16 +222,12 @@ namespace FlaxEditor.GUI
/// <inheritdoc /> /// <inheritdoc />
public override bool OnMouseDoubleClick(Float2 location, MouseButton button) public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{ {
if(button == MouseButton.Left) if (button == MouseButton.Left)
{ {
if (AutoCheck) OnClicked();
Checked = !Checked;
Clicked?.Invoke();
(Parent as ToolStrip)?.OnButtonClicked(this);
return true; return true;
} }
return false; return false;
} }

View File

@@ -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>
@@ -353,11 +353,11 @@ namespace FlaxEditor.Windows
}).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, () => { OnGroupButtonPressed(0); }) _groupButtons[0] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Error32, () => { OnGroupButtonPressed(0); })
.SetAutoCheck(true).LinkTooltip("Shows/hides error messages"); .SetAutoCheck(true).LinkTooltip("Shows/hides error messages");
_groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning32, () => { OnGroupButtonPressed(1); }) _groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning32, () => { OnGroupButtonPressed(1); })
.SetAutoCheck(true).LinkTooltip("Shows/hides warning messages"); .SetAutoCheck(true).LinkTooltip("Shows/hides warning messages");
_groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info32, () => { OnGroupButtonPressed(2); }) _groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info32, () => { OnGroupButtonPressed(2); })
.SetAutoCheck(true).LinkTooltip("Shows/hides info messages"); .SetAutoCheck(true).LinkTooltip("Shows/hides info messages");
UpdateCount(); UpdateCount();
// Split panel // Split panel
@@ -409,21 +409,21 @@ namespace FlaxEditor.Windows
private void OnGroupButtonPressed(int index) private void OnGroupButtonPressed(int index)
{ {
UpdateLogTypeVisibility((LogGroup)index, _groupButtons[index].Checked); UpdateLogTypeVisibility((LogGroup)index, _groupButtons[index].Checked);
if(Input.GetKey(KeyboardKeys.Shift)) if (Input.GetKey(KeyboardKeys.Shift))
{ {
for(int i = 0; i < (int)LogGroup.Max; i++) for (int i = 0; i < (int)LogGroup.Max; i++)
{ {
if(i == index) if (i == index)
continue; continue;
_groupButtons[i].Checked = !_groupButtons[index].Checked; _groupButtons[i].Checked = !_groupButtons[index].Checked;
UpdateLogTypeVisibility((LogGroup)i, _groupButtons[i].Checked); UpdateLogTypeVisibility((LogGroup)i, _groupButtons[i].Checked);
} }
} }
Editor.Options.Options.Interface.DebugLogShowErrorMessages = _groupButtons[0].Checked; var options = Editor.Options.Options.Interface;
Editor.Options.Options.Interface.DebugLogShowWarningMessages = _groupButtons[1].Checked; options.DebugLogShowErrorMessages = _groupButtons[0].Checked;
Editor.Options.Options.Interface.DebugLogShowInfoMessages = _groupButtons[2].Checked; options.DebugLogShowWarningMessages = _groupButtons[1].Checked;
options.DebugLogShowInfoMessages = _groupButtons[2].Checked;
Editor.Options.Apply(Editor.Options.Options); Editor.Options.Apply(Editor.Options.Options);
} }
@@ -464,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);