diff --git a/Source/Editor/GUI/AssetPicker.cs b/Source/Editor/GUI/AssetPicker.cs index 7e7b9816f..84f58daf1 100644 --- a/Source/Editor/GUI/AssetPicker.cs +++ b/Source/Editor/GUI/AssetPicker.cs @@ -173,7 +173,7 @@ namespace FlaxEditor.GUI else { // No element selected - Render2D.FillRectangle(iconRect, Style.Current.BackgroundNormal); + Render2D.FillRectangle(iconRect, style.BackgroundNormal); Render2D.DrawText(style.FontMedium, "No asset\nselected", iconRect, Color.Orange, TextAlignment.Center, TextAlignment.Center, TextWrapping.NoWrap, 1.0f, Height / DefaultIconSize); } diff --git a/Source/Editor/GUI/Row.cs b/Source/Editor/GUI/Row.cs index 81a9d459d..f6bd5b02a 100644 --- a/Source/Editor/GUI/Row.cs +++ b/Source/Editor/GUI/Row.cs @@ -98,7 +98,7 @@ namespace FlaxEditor.GUI rect.Width -= leftDepthMargin; Render2D.PushClip(rect); - Render2D.DrawText(style.FontMedium, text, rect, Style.Current.Foreground, column.CellAlignment, TextAlignment.Center); + Render2D.DrawText(style.FontMedium, text, rect, style.Foreground, column.CellAlignment, TextAlignment.Center); Render2D.PopClip(); x += width; diff --git a/Source/Editor/GUI/Timeline/Timeline.cs b/Source/Editor/GUI/Timeline/Timeline.cs index a32b35692..6b4d7bf4c 100644 --- a/Source/Editor/GUI/Timeline/Timeline.cs +++ b/Source/Editor/GUI/Timeline/Timeline.cs @@ -627,10 +627,11 @@ namespace FlaxEditor.GUI.Timeline Parent = this }; + var style = Style.Current; var headerTopArea = new ContainerControl { AutoFocus = false, - BackgroundColor = Style.Current.LightBackground, + BackgroundColor = style.LightBackground, AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = new Margin(0, 0, 0, HeaderTopAreaHeight), Parent = _splitter.Panel1 @@ -683,7 +684,7 @@ namespace FlaxEditor.GUI.Timeline { AutoFocus = false, ClipChildren = false, - BackgroundColor = Style.Current.LightBackground, + BackgroundColor = style.LightBackground, AnchorPreset = AnchorPresets.HorizontalStretchBottom, Offsets = new Margin(0, 0, -playbackButtonsSize, playbackButtonsSize), Parent = _splitter.Panel1 @@ -845,7 +846,7 @@ namespace FlaxEditor.GUI.Timeline _timeIntervalsHeader = new TimeIntervalsHeader(this) { AutoFocus = false, - BackgroundColor = Style.Current.Background.RGBMultiplied(0.9f), + BackgroundColor = style.Background.RGBMultiplied(0.9f), AnchorPreset = AnchorPresets.HorizontalStretchTop, Offsets = new Margin(0, 0, 0, HeaderTopAreaHeight), Parent = _splitter.Panel2 @@ -854,7 +855,7 @@ namespace FlaxEditor.GUI.Timeline { AutoFocus = false, ClipChildren = false, - BackgroundColor = Style.Current.Background.RGBMultiplied(0.7f), + BackgroundColor = style.Background.RGBMultiplied(0.7f), AnchorPreset = AnchorPresets.StretchAll, Offsets = new Margin(0, 0, HeaderTopAreaHeight, 0), Parent = _splitter.Panel2 diff --git a/Source/Editor/Options/OptionsModule.cs b/Source/Editor/Options/OptionsModule.cs index 51aa70257..1137e4c37 100644 --- a/Source/Editor/Options/OptionsModule.cs +++ b/Source/Editor/Options/OptionsModule.cs @@ -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 /// The style object. 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 /// The style object. 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; } diff --git a/Source/Editor/Options/ThemeOptions.cs b/Source/Editor/Options/ThemeOptions.cs index a033b34da..674e281af 100644 --- a/Source/Editor/Options/ThemeOptions.cs +++ b/Source/Editor/Options/ThemeOptions.cs @@ -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 { 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) diff --git a/Source/Editor/Windows/Profiler/Assets.cs b/Source/Editor/Windows/Profiler/Assets.cs index b8b898246..536d65a74 100644 --- a/Source/Editor/Windows/Profiler/Assets.cs +++ b/Source/Editor/Windows/Profiler/Assets.cs @@ -62,8 +62,9 @@ namespace FlaxEditor.Windows.Profiler _memoryUsageChart.SelectedSampleChanged += OnSelectedSampleChanged; // Table - var headerColor = Style.Current.LightBackground; - var textColor = Style.Current.Foreground; + var style = Style.Current; + var headerColor = style.LightBackground; + var textColor = style.Foreground; _table = new Table { Columns = new[] diff --git a/Source/Editor/Windows/Profiler/CPU.cs b/Source/Editor/Windows/Profiler/CPU.cs index df4d5b59b..0cbb3fa9b 100644 --- a/Source/Editor/Windows/Profiler/CPU.cs +++ b/Source/Editor/Windows/Profiler/CPU.cs @@ -92,8 +92,9 @@ namespace FlaxEditor.Windows.Profiler }; // Table - var headerColor = Style.Current.LightBackground; - var textColor = Style.Current.Foreground; + var style = Style.Current; + var headerColor = style.LightBackground; + var textColor = style.Foreground; _table = new Table { Columns = new[] diff --git a/Source/Editor/Windows/Profiler/GPU.cs b/Source/Editor/Windows/Profiler/GPU.cs index e6a93df72..d2c34d335 100644 --- a/Source/Editor/Windows/Profiler/GPU.cs +++ b/Source/Editor/Windows/Profiler/GPU.cs @@ -63,8 +63,9 @@ namespace FlaxEditor.Windows.Profiler }; // Table - var headerColor = Style.Current.LightBackground; - var textColor = Style.Current.Foreground; + var style = Style.Current; + var headerColor = style.LightBackground; + var textColor = style.Foreground; _table = new Table { Columns = new[] diff --git a/Source/Editor/Windows/Profiler/MemoryGPU.cs b/Source/Editor/Windows/Profiler/MemoryGPU.cs index e894ef0e2..e7c085362 100644 --- a/Source/Editor/Windows/Profiler/MemoryGPU.cs +++ b/Source/Editor/Windows/Profiler/MemoryGPU.cs @@ -63,8 +63,9 @@ namespace FlaxEditor.Windows.Profiler _memoryUsageChart.SelectedSampleChanged += OnSelectedSampleChanged; // Table - var headerColor = Style.Current.LightBackground; - var textColor = Style.Current.Foreground; + var style = Style.Current; + var headerColor = style.LightBackground; + var textColor = style.Foreground; _table = new Table { Columns = new[] diff --git a/Source/Editor/Windows/Profiler/Network.cs b/Source/Editor/Windows/Profiler/Network.cs index 669cf4a65..1ac9777c1 100644 --- a/Source/Editor/Windows/Profiler/Network.cs +++ b/Source/Editor/Windows/Profiler/Network.cs @@ -252,8 +252,9 @@ namespace FlaxEditor.Windows.Profiler private static Table InitTable(ContainerControl parent, string name) { - var headerColor = Style.Current.LightBackground; - var textColor = Style.Current.Foreground; + var style = Style.Current; + var headerColor = style.LightBackground; + var textColor = style.Foreground; var table = new Table { Columns = new[] diff --git a/Source/Editor/Windows/Profiler/SingleChart.cs b/Source/Editor/Windows/Profiler/SingleChart.cs index 29780150a..4f36692e5 100644 --- a/Source/Editor/Windows/Profiler/SingleChart.cs +++ b/Source/Editor/Windows/Profiler/SingleChart.cs @@ -105,7 +105,7 @@ namespace FlaxEditor.Windows.Profiler if (_selectedSampleIndex != -1) { float selectedX = Width - (_samples.Count - _selectedSampleIndex - 1) * PointsOffset; - Render2D.DrawLine(new Float2(selectedX, 0), new Float2(selectedX, chartHeight), Style.Current.Foreground, 1.5f); + Render2D.DrawLine(new Float2(selectedX, 0), new Float2(selectedX, chartHeight), style.Foreground, 1.5f); } int samplesInViewCount = Math.Min((int)(Width / PointsOffset), _samples.Count) - 1; @@ -138,8 +138,8 @@ namespace FlaxEditor.Windows.Profiler var headerRect = new Rectangle(0, chartHeight, Width, TitleHeight); var headerTextRect = new Rectangle(2, chartHeight, Width - 4, TitleHeight); Render2D.FillRectangle(headerRect, style.BackgroundNormal); - Render2D.DrawText(style.FontMedium, Title, headerTextRect, Style.Current.ForegroundGrey, TextAlignment.Near, TextAlignment.Center); - Render2D.DrawText(style.FontMedium, _sample, headerTextRect, Style.Current.Foreground, TextAlignment.Far, TextAlignment.Center); + Render2D.DrawText(style.FontMedium, Title, headerTextRect, style.ForegroundGrey, TextAlignment.Near, TextAlignment.Center); + Render2D.DrawText(style.FontMedium, _sample, headerTextRect, style.Foreground, TextAlignment.Far, TextAlignment.Center); } private void OnClick(ref Float2 location)