From c0cc89201ea28eeb0e4fd2ff147f40141476c4cd Mon Sep 17 00:00:00 2001 From: David Conway Date: Thu, 24 Dec 2020 19:52:06 +1100 Subject: [PATCH] Move icon settings to styles --- Source/Editor/GUI/ToolStrip.cs | 8 ++++---- Source/Editor/Options/InterfaceOptions.cs | 14 -------------- Source/Editor/Windows/ToolboxWindow.cs | 2 +- Source/Engine/UI/GUI/Style.cs | 6 ++++++ 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Source/Editor/GUI/ToolStrip.cs b/Source/Editor/GUI/ToolStrip.cs index 20c0ae9a1..56bf3e278 100644 --- a/Source/Editor/GUI/ToolStrip.cs +++ b/Source/Editor/GUI/ToolStrip.cs @@ -64,15 +64,15 @@ namespace FlaxEditor.GUI /// /// Gets the height for the items. /// - public float ItemsHeight => Height - itemScale * DefaultMarginV; + public float ItemsHeight => Height + itemScale * DefaultMarginV; - private float itemScale = 2; - /// + private float itemScale; + /// class. /// public ToolStrip() { - itemScale = Editor.Instance.Options.Options.Interface.ToolStripScale; + itemScale = Style.Current.IconSizeExtra; AutoFocus = false; AnchorPreset = AnchorPresets.HorizontalStretchTop; BackgroundColor = Style.Current.LightBackground; diff --git a/Source/Editor/Options/InterfaceOptions.cs b/Source/Editor/Options/InterfaceOptions.cs index 287e27c85..981e4a653 100644 --- a/Source/Editor/Options/InterfaceOptions.cs +++ b/Source/Editor/Options/InterfaceOptions.cs @@ -44,20 +44,6 @@ namespace FlaxEditor.Options [EditorDisplay("Interface"), EditorOrder(10), Tooltip("Editor User Interface scale. Applied to all UI elements, windows and text. Can be used to scale the interface up on a bigger display. Editor restart required.")] public float InterfaceScale { get; set; } = 1.0f; - /// - /// Gets or sets the ToolStrip item scale. Applied to ToolStrip UI elements, windows and text. Can be used to scale the toolstrip size to fit display needs. Editor restart required.. - /// - [DefaultValue(2.0f), Limit(1f, 10.0f)] - [EditorDisplay("Interface"), EditorOrder(20), Tooltip("Editor ToolStrip scale. Applied to ToolStrip UI elements, windows and text. Can be used to scale the toolstrip size to fit display needs. Editor restart required.")] - public float ToolStripScale { get; set; } = 2.0f; - - /// - /// Gets or sets the ToolBox Icon scale. Editor ToolBox Icon scale. Applied to ToolBox Icon UI elements. Can be used to scale the toolbox icon size to fit display needs. Editor restart required. - /// - [DefaultValue(32.0f), Limit(1f, 64.0f)] - [EditorDisplay("Interface"), EditorOrder(30), Tooltip("Editor ToolBox Icon scale. Applied to ToolBox Icon UI elements. Can be used to scale the toolbox icon size to fit display needs. Editor restart required.")] - public float ToolBoxIconScale { get; set; } = 32.0f; - /// /// Gets or sets a value indicating whether use native window title bar. Editor restart required. /// diff --git a/Source/Editor/Windows/ToolboxWindow.cs b/Source/Editor/Windows/ToolboxWindow.cs index 7f4069475..31690fe0a 100644 --- a/Source/Editor/Windows/ToolboxWindow.cs +++ b/Source/Editor/Windows/ToolboxWindow.cs @@ -308,7 +308,7 @@ namespace FlaxEditor.Windows /// public override void OnInit() { - float tabSize = Editor.Options.Options.Interface.ToolBoxIconScale; + float tabSize = 48 + Style.Current.IconSizeExtra; TabsControl = new Tabs { AnchorPreset = AnchorPresets.StretchAll, diff --git a/Source/Engine/UI/GUI/Style.cs b/Source/Engine/UI/GUI/Style.cs index 103954174..09c559d0a 100644 --- a/Source/Engine/UI/GUI/Style.cs +++ b/Source/Engine/UI/GUI/Style.cs @@ -68,6 +68,12 @@ namespace FlaxEngine.GUI set => _fontSmall = new FontReference(value); } + /// + /// Size of toolbar icons + /// + [EditorOrder(50)] + public int IconSizeExtra; + /// /// The background color. ///