Beispiel #1
0
        /// <summary>
        /// Opens the specified editor window (shows it with editor options handling for new windows).
        /// </summary>
        /// <param name="window">The window.</param>
        public void Open(EditorWindow window)
        {
            var newLocation = (DockState)Editor.Options.Options.Interface.NewWindowLocation;

            if (newLocation == DockState.Float)
            {
                // Check if there is a floating window that has the same size
                var defaultSize = window.DefaultSize;
                for (var i = 0; i < Editor.UI.MasterPanel.FloatingPanels.Count; i++)
                {
                    var win = Editor.UI.MasterPanel.FloatingPanels[i];
                    if (Float2.Abs(win.Size - defaultSize).LengthSquared < 100)
                    {
                        window.Show(DockState.DockFill, win);
                        window.Focus();
                        return;
                    }
                }

                window.ShowFloating(defaultSize);
            }
            else
            {
                window.Show(newLocation);
            }
        }