From 08ebd99ed4d234c976c322c973ff4e435d46cac4 Mon Sep 17 00:00:00 2001 From: David Conway Date: Thu, 24 Dec 2020 18:02:26 +1100 Subject: [PATCH] Add ToolStrip and Toolbox icon scaling settings --- Source/Editor/GUI/ToolStrip.cs | 7 +++++-- Source/Editor/Options/InterfaceOptions.cs | 14 ++++++++++++++ Source/Editor/Windows/ToolboxWindow.cs | 3 ++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Source/Editor/GUI/ToolStrip.cs b/Source/Editor/GUI/ToolStrip.cs index e3c0a82e1..20c0ae9a1 100644 --- a/Source/Editor/GUI/ToolStrip.cs +++ b/Source/Editor/GUI/ToolStrip.cs @@ -1,6 +1,7 @@ // Copyright (c) 2012-2020 Wojciech Figat. All rights reserved. using System; +using FlaxEditor.Options; using FlaxEngine; using FlaxEngine.GUI; @@ -20,7 +21,7 @@ namespace FlaxEditor.GUI /// /// The default margin horizontally. /// - public const int DefaultMarginH = 2; + public const int DefaultMarginH = 4; /// /// Event fired when button gets clicked. @@ -63,13 +64,15 @@ namespace FlaxEditor.GUI /// /// Gets the height for the items. /// - public float ItemsHeight => Height - 2 * DefaultMarginV; + public float ItemsHeight => Height - itemScale * DefaultMarginV; + private float itemScale = 2; /// /// Initializes a new instance of the class. /// public ToolStrip() { + itemScale = Editor.Instance.Options.Options.Interface.ToolStripScale; AutoFocus = false; AnchorPreset = AnchorPresets.HorizontalStretchTop; BackgroundColor = Style.Current.LightBackground; diff --git a/Source/Editor/Options/InterfaceOptions.cs b/Source/Editor/Options/InterfaceOptions.cs index 981e4a653..287e27c85 100644 --- a/Source/Editor/Options/InterfaceOptions.cs +++ b/Source/Editor/Options/InterfaceOptions.cs @@ -44,6 +44,20 @@ 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 ef2937e84..478692ff1 100644 --- a/Source/Editor/Windows/ToolboxWindow.cs +++ b/Source/Editor/Windows/ToolboxWindow.cs @@ -308,11 +308,12 @@ namespace FlaxEditor.Windows /// public override void OnInit() { + float tabSize = Editor.Instance.Options.Options.Interface.ToolBoxIconScale; TabsControl = new Tabs { AnchorPreset = AnchorPresets.StretchAll, Offsets = Margin.Zero, - TabsSize = new Vector2(48, 48), + TabsSize = new Vector2(tabSize, tabSize), Parent = this };