Merge branch 'content-window-change' of https://github.com/Tryibion/FlaxEngine into Tryibion-content-window-change
This commit is contained in:
@@ -95,11 +95,19 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
if (!_folder.CanRename)
|
if (!_folder.CanRename)
|
||||||
return;
|
return;
|
||||||
|
Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(false);
|
||||||
// Start renaming the folder
|
// Start renaming the folder
|
||||||
var dialog = RenamePopup.Show(this, HeaderRect, _folder.ShortName, false);
|
var dialog = RenamePopup.Show(this, HeaderRect, _folder.ShortName, false);
|
||||||
dialog.Tag = _folder;
|
dialog.Tag = _folder;
|
||||||
dialog.Renamed += popup => Editor.Instance.Windows.ContentWin.Rename((ContentFolder)popup.Tag, popup.Text);
|
dialog.Renamed += popup =>
|
||||||
|
{
|
||||||
|
Editor.Instance.Windows.ContentWin.Rename((ContentFolder)popup.Tag, popup.Text);
|
||||||
|
Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(true);
|
||||||
|
};
|
||||||
|
dialog.Closed += popup =>
|
||||||
|
{
|
||||||
|
Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(true);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ namespace FlaxEditor.Windows
|
|||||||
private const string ProjectDataLastViewedFolder = "LastViewedFolder";
|
private const string ProjectDataLastViewedFolder = "LastViewedFolder";
|
||||||
private bool _isWorkspaceDirty;
|
private bool _isWorkspaceDirty;
|
||||||
private SplitPanel _split;
|
private SplitPanel _split;
|
||||||
|
private Panel _contentViewPanel;
|
||||||
|
private Panel _contentTreePanel;
|
||||||
private ContentView _view;
|
private ContentView _view;
|
||||||
|
|
||||||
private readonly ToolStrip _toolStrip;
|
private readonly ToolStrip _toolStrip;
|
||||||
@@ -95,7 +97,7 @@ namespace FlaxEditor.Windows
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Split panel
|
// Split panel
|
||||||
_split = new SplitPanel(options.Options.Interface.ContentWindowOrientation, ScrollBars.Both, ScrollBars.Vertical)
|
_split = new SplitPanel(options.Options.Interface.ContentWindowOrientation, ScrollBars.None, ScrollBars.None)
|
||||||
{
|
{
|
||||||
AnchorPreset = AnchorPresets.StretchAll,
|
AnchorPreset = AnchorPresets.StretchAll,
|
||||||
Offsets = new Margin(0, 0, _toolStrip.Bottom, 0),
|
Offsets = new Margin(0, 0, _toolStrip.Bottom, 0),
|
||||||
@@ -120,11 +122,20 @@ namespace FlaxEditor.Windows
|
|||||||
};
|
};
|
||||||
_foldersSearchBox.TextChanged += OnFoldersSearchBoxTextChanged;
|
_foldersSearchBox.TextChanged += OnFoldersSearchBoxTextChanged;
|
||||||
|
|
||||||
|
// Content tree panel
|
||||||
|
_contentTreePanel = new Panel
|
||||||
|
{
|
||||||
|
AnchorPreset = AnchorPresets.StretchAll,
|
||||||
|
Offsets = new Margin(0, 0, headerPanel.Bottom, 0),
|
||||||
|
IsScrollable = true,
|
||||||
|
ScrollBars = ScrollBars.Both,
|
||||||
|
Parent = _split.Panel1,
|
||||||
|
};
|
||||||
|
|
||||||
// Content structure tree
|
// Content structure tree
|
||||||
_tree = new Tree(false)
|
_tree = new Tree(false)
|
||||||
{
|
{
|
||||||
Y = headerPanel.Bottom,
|
Parent = _contentTreePanel,
|
||||||
Parent = _split.Panel1,
|
|
||||||
};
|
};
|
||||||
_tree.SelectedChanged += OnTreeSelectionChanged;
|
_tree.SelectedChanged += OnTreeSelectionChanged;
|
||||||
headerPanel.Parent = _split.Panel1;
|
headerPanel.Parent = _split.Panel1;
|
||||||
@@ -159,13 +170,23 @@ namespace FlaxEditor.Windows
|
|||||||
_viewDropdown.Items.Add(((ContentItemSearchFilter)i).ToString());
|
_viewDropdown.Items.Add(((ContentItemSearchFilter)i).ToString());
|
||||||
_viewDropdown.PopupCreate += OnViewDropdownPopupCreate;
|
_viewDropdown.PopupCreate += OnViewDropdownPopupCreate;
|
||||||
|
|
||||||
|
// Content view panel
|
||||||
|
_contentViewPanel = new Panel
|
||||||
|
{
|
||||||
|
AnchorPreset = AnchorPresets.StretchAll,
|
||||||
|
Offsets = new Margin(0, 0, contentItemsSearchPanel.Bottom + 4, 0),
|
||||||
|
IsScrollable = true,
|
||||||
|
ScrollBars = ScrollBars.Vertical,
|
||||||
|
Parent = _split.Panel2,
|
||||||
|
};
|
||||||
|
|
||||||
// Content View
|
// Content View
|
||||||
_view = new ContentView
|
_view = new ContentView
|
||||||
{
|
{
|
||||||
AnchorPreset = AnchorPresets.HorizontalStretchTop,
|
AnchorPreset = AnchorPresets.HorizontalStretchTop,
|
||||||
Offsets = new Margin(0, 0, contentItemsSearchPanel.Bottom + 4, 0),
|
Offsets = new Margin(0, 0, 0, 0),
|
||||||
IsScrollable = true,
|
IsScrollable = true,
|
||||||
Parent = _split.Panel2,
|
Parent = _contentViewPanel,
|
||||||
};
|
};
|
||||||
_view.OnOpen += Open;
|
_view.OnOpen += Open;
|
||||||
_view.OnNavigateBack += NavigateBackward;
|
_view.OnNavigateBack += NavigateBackward;
|
||||||
@@ -271,6 +292,30 @@ namespace FlaxEditor.Windows
|
|||||||
RefreshView(SelectedNode);
|
RefreshView(SelectedNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables or disables vertical and horizontal scrolling on the content tree panel
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="enabled">The state to set scrolling to</param>
|
||||||
|
public void ScrollingOnTreeView(bool enabled)
|
||||||
|
{
|
||||||
|
if (_contentTreePanel.VScrollBar != null)
|
||||||
|
_contentTreePanel.VScrollBar.ThumbEnabled = enabled;
|
||||||
|
if (_contentTreePanel.HScrollBar != null)
|
||||||
|
_contentTreePanel.HScrollBar.ThumbEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables or disables vertical and horizontal scrolling on the content view panel
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="enabled">The state to set scrolling to</param>
|
||||||
|
public void ScrollingOnContentView(bool enabled)
|
||||||
|
{
|
||||||
|
if (_contentViewPanel.VScrollBar != null)
|
||||||
|
_contentViewPanel.VScrollBar.ThumbEnabled = enabled;
|
||||||
|
if (_contentViewPanel.HScrollBar != null)
|
||||||
|
_contentViewPanel.HScrollBar.ThumbEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows popup dialog with UI to rename content item.
|
/// Shows popup dialog with UI to rename content item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -285,6 +330,7 @@ namespace FlaxEditor.Windows
|
|||||||
_split.Panel2.VScrollBar.ThumbEnabled = false;
|
_split.Panel2.VScrollBar.ThumbEnabled = false;
|
||||||
if (_split.Panel2.HScrollBar != null)
|
if (_split.Panel2.HScrollBar != null)
|
||||||
_split.Panel2.HScrollBar.ThumbEnabled = false;
|
_split.Panel2.HScrollBar.ThumbEnabled = false;
|
||||||
|
ScrollingOnContentView(false);
|
||||||
|
|
||||||
// Show rename popup
|
// Show rename popup
|
||||||
var popup = RenamePopup.Show(item, item.TextRectangle, item.ShortName, true);
|
var popup = RenamePopup.Show(item, item.TextRectangle, item.ShortName, true);
|
||||||
@@ -298,6 +344,7 @@ namespace FlaxEditor.Windows
|
|||||||
_split.Panel2.VScrollBar.ThumbEnabled = true;
|
_split.Panel2.VScrollBar.ThumbEnabled = true;
|
||||||
if (_split.Panel2.HScrollBar != null)
|
if (_split.Panel2.HScrollBar != null)
|
||||||
_split.Panel2.HScrollBar.ThumbEnabled = true;
|
_split.Panel2.HScrollBar.ThumbEnabled = true;
|
||||||
|
ScrollingOnContentView(true);
|
||||||
|
|
||||||
// Check if was creating new element
|
// Check if was creating new element
|
||||||
if (_newElement != null)
|
if (_newElement != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user