Add Orientation option to ContentWindow

This commit is contained in:
ScottLongley
2021-08-25 20:37:16 +10:00
parent aa75a2aeb0
commit 64650367be
2 changed files with 21 additions and 1 deletions

View File

@@ -127,6 +127,13 @@ namespace FlaxEditor.Options
[EditorDisplay("Interface"), EditorOrder(250), Tooltip("Editor icons scale. Editor restart required.")]
public float IconsScale { get; set; } = 1.0f;
/// <summary>
/// Gets or sets the editor content window orientation.
/// </summary>
[DefaultValue(FlaxEngine.GUI.Orientation.Horizontal)]
[EditorDisplay("Interface"), EditorOrder(280), Tooltip("Editor content window orientation.")]
public FlaxEngine.GUI.Orientation ContentWindowOrientation { get; set; } = FlaxEngine.GUI.Orientation.Horizontal;
/// <summary>
/// Gets or sets the timestamps prefix mode for output log messages.
/// </summary>

View File

@@ -10,6 +10,7 @@ using FlaxEditor.GUI;
using FlaxEditor.GUI.ContextMenu;
using FlaxEditor.GUI.Input;
using FlaxEditor.GUI.Tree;
using FlaxEditor.Options;
using FlaxEngine;
using FlaxEngine.Assertions;
using FlaxEngine.GUI;
@@ -73,6 +74,9 @@ namespace FlaxEditor.Windows
editor.ContentDatabase.WorkspaceModified += () => _isWorkspaceDirty = true;
editor.ContentDatabase.ItemRemoved += ContentDatabaseOnItemRemoved;
var options = Editor.Options;
options.OptionsChanged += OnOptionsChanged;
// Toolstrip
_toolStrip = new ToolStrip(34.0f)
{
@@ -91,7 +95,7 @@ namespace FlaxEditor.Windows
};
// Split panel
_split = new SplitPanel(Orientation.Horizontal, ScrollBars.Both, ScrollBars.Vertical)
_split = new SplitPanel(options.Options.Interface.ContentWindowOrientation, ScrollBars.Both, ScrollBars.Vertical)
{
AnchorPreset = AnchorPresets.StretchAll,
Offsets = new Margin(0, 0, _toolStrip.Bottom, 0),
@@ -234,6 +238,13 @@ namespace FlaxEditor.Windows
return menu;
}
private void OnOptionsChanged(EditorOptions options)
{
_split.Orientation = options.Interface.ContentWindowOrientation;
RefreshView();
}
private void OnViewTypeButtonClicked(ContextMenuButton button)
{
View.ViewType = (ContentViewType)button.Tag;
@@ -917,6 +928,8 @@ namespace FlaxEditor.Windows
_itemsSearchBox = null;
_viewDropdown = null;
Editor.Options.OptionsChanged -= OnOptionsChanged;
base.OnDestroy();
}
}