diff --git a/Source/Editor/GUI/NavigationBar.cs b/Source/Editor/GUI/NavigationBar.cs
index b2a6406d2..94f01bf98 100644
--- a/Source/Editor/GUI/NavigationBar.cs
+++ b/Source/Editor/GUI/NavigationBar.cs
@@ -27,6 +27,8 @@ namespace FlaxEditor.GUI
///
protected override void Arrange()
{
+ base.Arrange();
+
// Arrange buttons
float x = DefaultButtonsMargin;
for (int i = 0; i < _children.Count; i++)
@@ -50,10 +52,11 @@ namespace FlaxEditor.GUI
return;
var lastToolstripButton = toolstrip.LastButton;
+ var parentSize = Parent.Size;
Bounds = new Rectangle
(
new Vector2(lastToolstripButton.Right + 8.0f, 0),
- new Vector2(Parent.Width - X - 8.0f, 32)
+ new Vector2(parentSize.X - X - 8.0f, toolstrip.Height)
);
}
}
diff --git a/Source/Editor/GUI/ToolStrip.cs b/Source/Editor/GUI/ToolStrip.cs
index dee5b7905..27fb9961a 100644
--- a/Source/Editor/GUI/ToolStrip.cs
+++ b/Source/Editor/GUI/ToolStrip.cs
@@ -1,7 +1,6 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
using System;
-using FlaxEditor.Options;
using FlaxEngine;
using FlaxEngine.GUI;
@@ -21,7 +20,7 @@ namespace FlaxEditor.GUI
///
/// The default margin horizontally.
///
- public const int DefaultMarginH = 4;
+ public const int DefaultMarginH = 2;
///
/// Event fired when button gets clicked.
@@ -64,18 +63,19 @@ namespace FlaxEditor.GUI
///
/// Gets the height for the items.
///
- public float ItemsHeight => Height + itemScale * DefaultMarginV;
- private float itemScale;
-
+ public float ItemsHeight => Height - 2 * DefaultMarginV;
+
///
/// Initializes a new instance of the class.
///
- public ToolStrip()
+ /// The toolstrip height.
+ /// The toolstrip Y position.
+ public ToolStrip(float height = 32.0f, float y = 0)
{
- itemScale = Style.Current.IconSizeExtra;
AutoFocus = false;
AnchorPreset = AnchorPresets.HorizontalStretchTop;
BackgroundColor = Style.Current.LightBackground;
+ Offsets = new Margin(0, 0, y, height * Editor.Instance.Options.Options.Interface.IconsScale);
}
///
diff --git a/Source/Editor/Modules/UIModule.cs b/Source/Editor/Modules/UIModule.cs
index c7bda3bb3..6b01986a9 100644
--- a/Source/Editor/Modules/UIModule.cs
+++ b/Source/Editor/Modules/UIModule.cs
@@ -493,10 +493,9 @@ namespace FlaxEditor.Modules
private void InitToolstrip(RootControl mainWindow)
{
- ToolStrip = new ToolStrip
+ ToolStrip = new ToolStrip(34.0f, MainMenu.Bottom)
{
Parent = mainWindow,
- Bounds = new Rectangle(0, MainMenu.Bottom, mainWindow.Width, 34),
};
_toolStripSaveAll = (ToolStripButton)ToolStrip.AddButton(Editor.Icons.Save32, Editor.SaveAll).LinkTooltip("Save all (Ctrl+S)");
diff --git a/Source/Editor/Options/InterfaceOptions.cs b/Source/Editor/Options/InterfaceOptions.cs
index 30179aa3c..e8929b77b 100644
--- a/Source/Editor/Options/InterfaceOptions.cs
+++ b/Source/Editor/Options/InterfaceOptions.cs
@@ -71,6 +71,13 @@ namespace FlaxEditor.Options
[DefaultValue(TimestampsFormats.None)]
[EditorDisplay("Interface"), EditorOrder(210), Tooltip("The timestamps prefix mode for debug log messages.")]
public TimestampsFormats DebugLogTimestampsFormat { get; set; } = TimestampsFormats.None;
+
+ ///
+ /// Gets or sets the editor icons scale. Editor restart required.
+ ///
+ [DefaultValue(1.0f), Limit(0.1f, 4.0f, 0.01f)]
+ [EditorDisplay("Interface"), EditorOrder(250), Tooltip("Editor icons scale. Editor restart required.")]
+ public float IconsScale { get; set; } = 1.0f;
///
/// Gets or sets the timestamps prefix mode for output log messages.
@@ -131,7 +138,7 @@ namespace FlaxEditor.Options
/// Gets or sets a value indicating whether auto-focus game window on play mode start.
///
[DefaultValue(true)]
- [EditorDisplay("Play In-Editor", "Focus Game Window On Play"), EditorOrder(200), Tooltip("Determines whether auto-focus game window on play mode start.")]
+ [EditorDisplay("Play In-Editor", "Focus Game Window On Play"), EditorOrder(400), Tooltip("Determines whether auto-focus game window on play mode start.")]
public bool FocusGameWinOnPlay { get; set; } = true;
private static FontAsset DefaultFont => FlaxEngine.Content.LoadAsyncInternal(EditorAssets.PrimaryFont);
diff --git a/Source/Editor/Windows/Assets/AssetEditorWindow.cs b/Source/Editor/Windows/Assets/AssetEditorWindow.cs
index bbceb111e..756adbe05 100644
--- a/Source/Editor/Windows/Assets/AssetEditorWindow.cs
+++ b/Source/Editor/Windows/Assets/AssetEditorWindow.cs
@@ -51,7 +51,6 @@ namespace FlaxEditor.Windows.Assets
_toolstrip = new ToolStrip
{
- Offsets = new Margin(0, 0, 0, 32),
Parent = this
};
_toolstrip.AddButton(editor.Icons.Find32, () => Editor.Windows.ContentWin.Select(_item)).LinkTooltip("Show and select in Content Window");
diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs
index e57b314c7..66ed50daf 100644
--- a/Source/Editor/Windows/ContentWindow.cs
+++ b/Source/Editor/Windows/ContentWindow.cs
@@ -72,10 +72,9 @@ namespace FlaxEditor.Windows
editor.ContentDatabase.ItemRemoved += ContentDatabaseOnItemRemoved;
// Toolstrip
- _toolStrip = new ToolStrip
+ _toolStrip = new ToolStrip(34.0f)
{
Parent = this,
- Bounds = new Rectangle(0, 0, Width, 34),
};
_importButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Import32, () => Editor.ContentImporting.ShowImportFileDialog(CurrentViewFolder)).LinkTooltip("Import content");
_toolStrip.AddSeparator();
diff --git a/Source/Editor/Windows/DebugLogWindow.cs b/Source/Editor/Windows/DebugLogWindow.cs
index 771c1e24e..8aad9fc35 100644
--- a/Source/Editor/Windows/DebugLogWindow.cs
+++ b/Source/Editor/Windows/DebugLogWindow.cs
@@ -282,9 +282,8 @@ namespace FlaxEditor.Windows
OnEditorOptionsChanged(Editor.Options.Options);
// Toolstrip
- var toolstrip = new ToolStrip
+ var toolstrip = new ToolStrip(22.0f)
{
- Offsets = new Margin(0, 0, 0, 22),
Parent = this,
};
toolstrip.AddButton("Clear", Clear).LinkTooltip("Clears all log entries");
diff --git a/Source/Editor/Windows/EditorOptionsWindow.cs b/Source/Editor/Windows/EditorOptionsWindow.cs
index 6f81108ee..01b26a65c 100644
--- a/Source/Editor/Windows/EditorOptionsWindow.cs
+++ b/Source/Editor/Windows/EditorOptionsWindow.cs
@@ -36,7 +36,6 @@ namespace FlaxEditor.Windows
var toolstrip = new ToolStrip
{
- Offsets = new Margin(0, 0, 0, 32),
Parent = this
};
_saveButton = (ToolStripButton)toolstrip.AddButton(editor.Icons.Save32, SaveData).LinkTooltip("Save");
diff --git a/Source/Editor/Windows/Profiler/ProfilerWindow.cs b/Source/Editor/Windows/Profiler/ProfilerWindow.cs
index 549eb5f54..e6de1fd69 100644
--- a/Source/Editor/Windows/Profiler/ProfilerWindow.cs
+++ b/Source/Editor/Windows/Profiler/ProfilerWindow.cs
@@ -90,7 +90,6 @@ namespace FlaxEditor.Windows.Profiler
var toolstrip = new ToolStrip
{
- Offsets = new Margin(0, 0, 0, 32),
Parent = this,
};
_liveRecordingButton = toolstrip.AddButton(editor.Icons.Play32);
diff --git a/Source/Editor/Windows/ToolboxWindow.cs b/Source/Editor/Windows/ToolboxWindow.cs
index db0ca5106..d10a111b6 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 = 48 + Style.Current.IconSizeExtra;
+ float tabSize = 48 * Editor.Options.Options.Interface.IconsScale;
TabsControl = new Tabs
{
AnchorPreset = AnchorPresets.StretchAll,
diff --git a/Source/Editor/Windows/VisualScriptDebuggerWindow.cs b/Source/Editor/Windows/VisualScriptDebuggerWindow.cs
index 6c1eb296a..897f30552 100644
--- a/Source/Editor/Windows/VisualScriptDebuggerWindow.cs
+++ b/Source/Editor/Windows/VisualScriptDebuggerWindow.cs
@@ -399,7 +399,6 @@ namespace FlaxEditor.Windows
var toolstrip = new ToolStrip
{
- Offsets = new Margin(0, 0, 0, 32),
Parent = this
};
toolstrip.AddButton(editor.Icons.Docs32, () => Platform.OpenUrl(Utilities.Constants.DocsUrl + "manual/scripting/visual/index.html")).LinkTooltip("See documentation to learn more");
@@ -416,7 +415,7 @@ namespace FlaxEditor.Windows
var tabs = new Tabs
{
AnchorPreset = AnchorPresets.StretchAll,
- Offsets = new Margin(0, 0, 32, 0),
+ Offsets = new Margin(0, 0, toolstrip.Bottom, 0),
TabsSize = new Vector2(80, 20),
TabsTextHorizontalAlignment = TextAlignment.Center,
UseScroll = true,
diff --git a/Source/Engine/UI/GUI/Style.cs b/Source/Engine/UI/GUI/Style.cs
index 6755c36f5..db7561de4 100644
--- a/Source/Engine/UI/GUI/Style.cs
+++ b/Source/Engine/UI/GUI/Style.cs
@@ -68,12 +68,6 @@ namespace FlaxEngine.GUI
set => _fontSmall = new FontReference(value);
}
- ///
- /// Size of toolbar icons
- ///
- [EditorOrder(50)]
- public int IconSizeExtra;
-
///
/// The background color.
///