From 64650367beb484f68f68816ca15d103d209e370e Mon Sep 17 00:00:00 2001 From: ScottLongley Date: Wed, 25 Aug 2021 20:37:16 +1000 Subject: [PATCH] Add Orientation option to ContentWindow --- Source/Editor/Options/InterfaceOptions.cs | 7 +++++++ Source/Editor/Windows/ContentWindow.cs | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Options/InterfaceOptions.cs b/Source/Editor/Options/InterfaceOptions.cs index c17260055..9d7e61340 100644 --- a/Source/Editor/Options/InterfaceOptions.cs +++ b/Source/Editor/Options/InterfaceOptions.cs @@ -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; + /// + /// Gets or sets the editor content window orientation. + /// + [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; + /// /// Gets or sets the timestamps prefix mode for output log messages. /// diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs index 04a82087c..011df0fe9 100644 --- a/Source/Editor/Windows/ContentWindow.cs +++ b/Source/Editor/Windows/ContentWindow.cs @@ -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(); } }