DisplayAllViews() private method

private DisplayAllViews ( ) : void
return void
示例#1
0
        public static void MaximizePresent(EditorWindow win)
        {
            ContainerWindow.SetFreezeDisplay(true);
            win.Focus();
            WindowLayout.CheckWindowConsistency();
            ContainerWindow window = win.m_Parent.window;

            window.DisplayAllViews();
            win.m_Parent.MakeVistaDWMHappyDance();
            ContainerWindow.SetFreezeDisplay(false);
        }
示例#2
0
        public static void MaximizePresent(EditorWindow win, View rootSplit)
        {
            ContainerWindow.SetFreezeDisplay(true);
            UnityEngine.Object.DestroyImmediate(rootSplit, true);
            win.Focus();
            WindowLayout.CheckWindowConsistency();
            ContainerWindow window = win.m_Parent.window;

            window.DisplayAllViews();
            win.m_Parent.MakeVistaDWMHappyDance();
            ContainerWindow.SetFreezeDisplay(false);
        }
示例#3
0
        public static void MakeMain()
        {
            ContainerWindow containerWindow = ScriptableObject.CreateInstance <ContainerWindow>();
            MainView        mainView        = ScriptableObject.CreateInstance <MainView>();

            mainView.SetMinMaxSizes(MainView.kMinSize, MainView.kMaxSize);
            containerWindow.rootView = mainView;
            Resolution desktopResolution = InternalEditorUtility.GetDesktopResolution();
            int        num  = Mathf.Clamp(desktopResolution.width * 3 / 4, 800, 1400);
            int        num2 = Mathf.Clamp(desktopResolution.height * 3 / 4, 600, 950);

            containerWindow.position = new Rect(60f, 20f, (float)num, (float)num2);
            containerWindow.Show(ShowMode.MainWindow, true, true);
            containerWindow.DisplayAllViews();
        }
示例#4
0
        public static void MakeMain()
        {
            ContainerWindow window  = ScriptableObject.CreateInstance <ContainerWindow>();
            MainWindow      window2 = ScriptableObject.CreateInstance <MainWindow>();

            window2.SetMinMaxSizes(new Vector2(770f, 300f), new Vector2(10000f, 10000f));
            window.mainView = window2;
            Resolution desktopResolution = InternalEditorUtility.GetDesktopResolution();
            int        num  = Mathf.Clamp((desktopResolution.width * 3) / 4, 800, 0x578);
            int        num2 = Mathf.Clamp((desktopResolution.height * 3) / 4, 600, 950);

            window.position = new Rect(60f, 20f, (float)num, (float)num2);
            window.Show(ShowMode.MainWindow, true, true);
            window.DisplayAllViews();
        }
示例#5
0
        public static void MakeMain()
        {
            //Set up default window size
            ContainerWindow cw   = ScriptableObject.CreateInstance <ContainerWindow>();
            var             main = ScriptableObject.CreateInstance <MainView>();

            main.SetMinMaxSizes(kMinSize, kMaxSize);
            cw.rootView = main;

            Resolution res    = Screen.currentResolution;
            int        width  = Mathf.Clamp(res.width * 3 / 4, 800, 1400);
            int        height = Mathf.Clamp(res.height * 3 / 4, 600, 950);

            cw.position = new Rect(60, 20, width, height);

            cw.Show(ShowMode.MainWindow, loadPosition: true, displayImmediately: true, setFocus: true);
            cw.DisplayAllViews();
        }
示例#6
0
        public static void Unmaximize(EditorWindow win)
        {
            HostView parent = win.m_Parent;

            if (parent == null)
            {
                UnityEngine.Debug.LogError("Host view was not found");
                WindowLayout.RevertFactorySettings();
            }
            else
            {
                UnityEngine.Object[] array = InternalEditorUtility.LoadSerializedFileAndForget(Path.Combine(WindowLayout.layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
                if (array.Length < 2)
                {
                    UnityEngine.Debug.Log("Maximized serialized file backup not found");
                    WindowLayout.RevertFactorySettings();
                }
                else
                {
                    SplitView    splitView    = array[0] as SplitView;
                    EditorWindow editorWindow = array[1] as EditorWindow;
                    if (splitView == null)
                    {
                        UnityEngine.Debug.Log("Maximization failed because the root split view was not found");
                        WindowLayout.RevertFactorySettings();
                    }
                    else
                    {
                        ContainerWindow window = win.m_Parent.window;
                        if (window == null)
                        {
                            UnityEngine.Debug.Log("Maximization failed because the root split view has no container window");
                            WindowLayout.RevertFactorySettings();
                        }
                        else
                        {
                            try
                            {
                                ContainerWindow.SetFreezeDisplay(true);
                                if (!parent.parent)
                                {
                                    throw new Exception();
                                }
                                int  idx      = parent.parent.IndexOfChild(parent);
                                Rect position = parent.position;
                                View parent2  = parent.parent;
                                parent2.RemoveChild(idx);
                                parent2.AddChild(splitView, idx);
                                splitView.position = position;
                                DockArea dockArea = editorWindow.m_Parent as DockArea;
                                int      idx2     = dockArea.m_Panes.IndexOf(editorWindow);
                                parent.actualView = null;
                                win.m_Parent      = null;
                                dockArea.AddTab(idx2, win);
                                dockArea.RemoveTab(editorWindow);
                                UnityEngine.Object.DestroyImmediate(editorWindow);
                                UnityEngine.Object[] array2 = array;
                                for (int i = 0; i < array2.Length; i++)
                                {
                                    UnityEngine.Object @object       = array2[i];
                                    EditorWindow       editorWindow2 = @object as EditorWindow;
                                    if (editorWindow2 != null)
                                    {
                                        editorWindow2.MakeParentsSettingsMatchMe();
                                    }
                                }
                                parent2.Initialize(parent2.window);
                                parent2.position = parent2.position;
                                splitView.Reflow();
                                UnityEngine.Object.DestroyImmediate(parent);
                                win.Focus();
                                window.DisplayAllViews();
                                win.m_Parent.MakeVistaDWMHappyDance();
                            }
                            catch (Exception arg)
                            {
                                UnityEngine.Debug.Log("Maximization failed: " + arg);
                                WindowLayout.RevertFactorySettings();
                            }
                            try
                            {
                                if (Application.platform == RuntimePlatform.OSXEditor && SystemInfo.operatingSystem.Contains("10.7") && SystemInfo.graphicsDeviceVendor.Contains("ATI"))
                                {
                                    UnityEngine.Object[] array3 = Resources.FindObjectsOfTypeAll(typeof(GUIView));
                                    for (int j = 0; j < array3.Length; j++)
                                    {
                                        GUIView gUIView = (GUIView)array3[j];
                                        gUIView.Repaint();
                                    }
                                }
                            }
                            finally
                            {
                                ContainerWindow.SetFreezeDisplay(false);
                            }
                        }
                    }
                }
            }
        }
        public static void Unmaximize(EditorWindow win)
        {
            HostView maximizedHostView = win.m_Parent;

            if (maximizedHostView == null)
            {
                Debug.LogError("Host view was not found");
                RevertFactorySettings();
                return;
            }

            UnityObject[] newWindows = InternalEditorUtility.LoadSerializedFileAndForget(Path.Combine(layoutsProjectPath, kMaximizeRestoreFile));

            if (newWindows.Length < 2)
            {
                Debug.Log("Maximized serialized file backup not found");
                RevertFactorySettings();
                return;
            }

            SplitView    oldRoot   = newWindows[0] as SplitView;
            EditorWindow oldWindow = newWindows[1] as EditorWindow;

            if (oldRoot == null)
            {
                Debug.Log("Maximization failed because the root split view was not found");
                RevertFactorySettings();
                return;
            }

            ContainerWindow parentWindow = win.m_Parent.window;

            if (parentWindow == null)
            {
                Debug.Log("Maximization failed because the root split view has no container window");
                RevertFactorySettings();
                return;
            }

            try
            {
                ContainerWindow.SetFreezeDisplay(true);

                // Put the loaded SplitView where the MaximizedHostView was
                if (maximizedHostView.parent)
                {
                    int  i      = maximizedHostView.parent.IndexOfChild(maximizedHostView);
                    Rect r      = maximizedHostView.position;
                    View parent = maximizedHostView.parent;
                    parent.RemoveChild(i);
                    parent.AddChild(oldRoot, i);
                    oldRoot.position = r;

                    // Move the Editor Window to the right spot in the
                    DockArea newDockArea = oldWindow.m_Parent as DockArea;

                    int oldDockAreaIndex = newDockArea.m_Panes.IndexOf(oldWindow);

                    maximizedHostView.actualView = null;
                    win.m_Parent = null;
                    newDockArea.AddTab(oldDockAreaIndex, win);
                    newDockArea.RemoveTab(oldWindow);
                    UnityObject.DestroyImmediate(oldWindow);

                    foreach (UnityObject o in newWindows)
                    {
                        EditorWindow curWin = o as EditorWindow;
                        if (curWin != null)
                        {
                            curWin.MakeParentsSettingsMatchMe();
                        }
                    }

                    parent.Initialize(parent.window);
                    //If parent window had to be resized, call this to make sure new size gets propagated
                    parent.position = parent.position;
                    oldRoot.Reflow();
                }
                else
                {
                    throw new System.Exception();
                }

                // Kill the maximizedMainView
                UnityObject.DestroyImmediate(maximizedHostView);

                win.Focus();

                parentWindow.DisplayAllViews();
                win.m_Parent.MakeVistaDWMHappyDance();
            }
            catch (System.Exception ex)
            {
                Debug.Log("Maximization failed: " + ex);
                RevertFactorySettings();
            }

            try
            {
                // Weird bug on AMD graphic cards under OSX Lion: Sometimes when unmaximizing we get stray white rectangles.
                // work around that by issueing an extra repaint (case 438764)
                if (Application.platform == RuntimePlatform.OSXEditor && SystemInfo.operatingSystem.Contains("10.7") && SystemInfo.graphicsDeviceVendor.Contains("ATI"))
                {
                    foreach (GUIView v in Resources.FindObjectsOfTypeAll(typeof(GUIView)))
                    {
                        v.Repaint();
                    }
                }
            }
            finally
            {
                ContainerWindow.SetFreezeDisplay(false);
            }
        }
示例#8
0
 public static void Unmaximize(EditorWindow win)
 {
     HostView parent = win.m_Parent;
     if (parent == null)
     {
         UnityEngine.Debug.LogError("Host view was not found");
         RevertFactorySettings();
     }
     else
     {
         UnityEngine.Object[] objArray = InternalEditorUtility.LoadSerializedFileAndForget(Path.Combine(layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
         if (objArray.Length < 2)
         {
             UnityEngine.Debug.Log("Maximized serialized file backup not found");
             RevertFactorySettings();
         }
         else
         {
             SplitView child = objArray[0] as SplitView;
             EditorWindow item = objArray[1] as EditorWindow;
             if (child == null)
             {
                 UnityEngine.Debug.Log("Maximization failed because the root split view was not found");
                 RevertFactorySettings();
             }
             else
             {
                 ContainerWindow window = win.m_Parent.window;
                 if (window == null)
                 {
                     UnityEngine.Debug.Log("Maximization failed because the root split view has no container window");
                     RevertFactorySettings();
                 }
                 else
                 {
                     try
                     {
                         ContainerWindow.SetFreezeDisplay(true);
                         if (parent.parent == null)
                         {
                             throw new Exception();
                         }
                         int idx = parent.parent.IndexOfChild(parent);
                         Rect position = parent.position;
                         View view3 = parent.parent;
                         view3.RemoveChild(idx);
                         view3.AddChild(child, idx);
                         child.position = position;
                         DockArea area = item.m_Parent as DockArea;
                         int index = area.m_Panes.IndexOf(item);
                         parent.actualView = null;
                         win.m_Parent = null;
                         area.AddTab(index, win);
                         area.RemoveTab(item);
                         UnityEngine.Object.DestroyImmediate(item);
                         foreach (UnityEngine.Object obj2 in objArray)
                         {
                             EditorWindow window3 = obj2 as EditorWindow;
                             if (window3 != null)
                             {
                                 window3.MakeParentsSettingsMatchMe();
                             }
                         }
                         view3.Initialize(view3.window);
                         view3.position = view3.position;
                         child.Reflow();
                         UnityEngine.Object.DestroyImmediate(parent);
                         win.Focus();
                         window.DisplayAllViews();
                         win.m_Parent.MakeVistaDWMHappyDance();
                     }
                     catch (Exception exception)
                     {
                         UnityEngine.Debug.Log("Maximization failed: " + exception);
                         RevertFactorySettings();
                     }
                     try
                     {
                         if (((Application.platform == RuntimePlatform.OSXEditor) && SystemInfo.operatingSystem.Contains("10.7")) && SystemInfo.graphicsDeviceVendor.Contains("ATI"))
                         {
                             foreach (GUIView view4 in UnityEngine.Resources.FindObjectsOfTypeAll(typeof(GUIView)))
                             {
                                 view4.Repaint();
                             }
                         }
                     }
                     finally
                     {
                         ContainerWindow.SetFreezeDisplay(false);
                     }
                 }
             }
         }
     }
 }
示例#9
0
        public static void Unmaximize(EditorWindow win)
        {
            HostView parent1 = win.m_Parent;

            if ((UnityEngine.Object)parent1 == (UnityEngine.Object)null)
            {
                UnityEngine.Debug.LogError((object)"Host view was not found");
                WindowLayout.RevertFactorySettings();
            }
            else
            {
                UnityEngine.Object[] objectArray = InternalEditorUtility.LoadSerializedFileAndForget(Path.Combine(WindowLayout.layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
                if (objectArray.Length < 2)
                {
                    UnityEngine.Debug.Log((object)"Maximized serialized file backup not found");
                    WindowLayout.RevertFactorySettings();
                }
                else
                {
                    SplitView    splitView = objectArray[0] as SplitView;
                    EditorWindow pane      = objectArray[1] as EditorWindow;
                    if ((UnityEngine.Object)splitView == (UnityEngine.Object)null)
                    {
                        UnityEngine.Debug.Log((object)"Maximization failed because the root split view was not found");
                        WindowLayout.RevertFactorySettings();
                    }
                    else
                    {
                        ContainerWindow window = win.m_Parent.window;
                        if ((UnityEngine.Object)window == (UnityEngine.Object)null)
                        {
                            UnityEngine.Debug.Log((object)"Maximization failed because the root split view has no container window");
                            WindowLayout.RevertFactorySettings();
                        }
                        else
                        {
                            try
                            {
                                ContainerWindow.SetFreezeDisplay(true);
                                if (!(bool)((UnityEngine.Object)parent1.parent))
                                {
                                    throw new Exception();
                                }
                                int  idx1     = parent1.parent.IndexOfChild((View)parent1);
                                Rect position = parent1.position;
                                View parent2  = parent1.parent;
                                parent2.RemoveChild(idx1);
                                parent2.AddChild((View)splitView, idx1);
                                splitView.position = position;
                                DockArea parent3 = pane.m_Parent as DockArea;
                                int      idx2    = parent3.m_Panes.IndexOf(pane);
                                parent1.actualView = (EditorWindow)null;
                                win.m_Parent       = (HostView)null;
                                parent3.AddTab(idx2, win);
                                parent3.RemoveTab(pane);
                                UnityEngine.Object.DestroyImmediate((UnityEngine.Object)pane);
                                foreach (UnityEngine.Object @object in objectArray)
                                {
                                    EditorWindow editorWindow = @object as EditorWindow;
                                    if ((UnityEngine.Object)editorWindow != (UnityEngine.Object)null)
                                    {
                                        editorWindow.MakeParentsSettingsMatchMe();
                                    }
                                }
                                parent2.Initialize(parent2.window);
                                parent2.position = parent2.position;
                                splitView.Reflow();
                                UnityEngine.Object.DestroyImmediate((UnityEngine.Object)parent1);
                                win.Focus();
                                window.DisplayAllViews();
                                win.m_Parent.MakeVistaDWMHappyDance();
                            }
                            catch (Exception ex)
                            {
                                UnityEngine.Debug.Log((object)("Maximization failed: " + (object)ex));
                                WindowLayout.RevertFactorySettings();
                            }
                            try
                            {
                                if (Application.platform != RuntimePlatform.OSXEditor || !SystemInfo.operatingSystem.Contains("10.7") || !SystemInfo.graphicsDeviceVendor.Contains("ATI"))
                                {
                                    return;
                                }
                                foreach (GUIView guiView in Resources.FindObjectsOfTypeAll(typeof(GUIView)))
                                {
                                    guiView.Repaint();
                                }
                            }
                            finally
                            {
                                ContainerWindow.SetFreezeDisplay(false);
                            }
                        }
                    }
                }
            }
        }