Minor improvements to code style #1541

This commit is contained in:
Wojtek Figat
2023-11-13 17:17:05 +01:00
parent 13881c7d97
commit 618273977c
11 changed files with 33 additions and 28 deletions

View File

@@ -208,13 +208,13 @@ namespace FlaxEditor.Options
// If a non-default style was chosen, switch to that style
string styleName = themeOptions.SelectedStyle;
if (styleName != "Default" && styleName != "LightDefault" && themeOptions.Styles.TryGetValue(styleName, out var style) && style != null)
if (styleName != ThemeOptions.DefaultName && styleName != ThemeOptions.LightDefault && themeOptions.Styles.TryGetValue(styleName, out var style) && style != null)
{
Style.Current = style;
}
else
{
if (styleName == "LightDefault")
if (styleName == ThemeOptions.LightDefault)
{
Style.Current = CreateLightStyle();
}
@@ -231,7 +231,6 @@ namespace FlaxEditor.Options
/// <returns>The style object.</returns>
public Style CreateDefaultStyle()
{
// Metro Style colors
var options = Options;
var style = new Style
{
@@ -282,7 +281,6 @@ namespace FlaxEditor.Options
SharedTooltip = new Tooltip(),
};
style.DragWindow = style.BackgroundSelected * 0.7f;
return style;
}
@@ -292,7 +290,6 @@ namespace FlaxEditor.Options
/// <returns>The style object.</returns>
public Style CreateLightStyle()
{
// Metro Style colors
var options = Options;
var style = new Style
{
@@ -334,9 +331,8 @@ namespace FlaxEditor.Options
Scale = Editor.Icons.Scale32,
Scalar = Editor.Icons.Scalar32,
SharedTooltip = new Tooltip()
SharedTooltip = new Tooltip(),
};
return style;
}

View File

@@ -15,6 +15,9 @@ namespace FlaxEditor.Options
[CustomEditor(typeof(ThemeOptionsEditor))]
public sealed class ThemeOptions
{
internal const string DefaultName = "Default";
internal const string LightDefault = "LightDefault";
internal class ThemeOptionsEditor : Editor<ThemeOptions>
{
private LabelElement _infoLabel;
@@ -64,8 +67,8 @@ namespace FlaxEditor.Options
{
var themeOptions = (ThemeOptions)ParentEditor.Values[0];
var options = new string[themeOptions.Styles.Count + 2];
options[0] = "Default";
options[1] = "LightDefault";
options[0] = DefaultName;
options[1] = LightDefault;
int i = 0;
foreach (var styleName in themeOptions.Styles.Keys)