RemoveChild() public method

public RemoveChild ( View child ) : void
child View
return void
示例#1
0
        public static View MaximizePrepare(EditorWindow win)
        {
            View parent = win.m_Parent.parent;
            View view   = parent;

            while (parent != null && parent is SplitView)
            {
                view   = parent;
                parent = parent.parent;
            }
            DockArea dockArea = win.m_Parent as DockArea;

            if (dockArea == null)
            {
                return(null);
            }
            if (parent == null)
            {
                return(null);
            }
            MainWindow x = view.parent as MainWindow;

            if (x == null)
            {
                return(null);
            }
            ContainerWindow window = win.m_Parent.window;

            if (window == null)
            {
                return(null);
            }
            int num = dockArea.m_Panes.IndexOf(win);

            if (num == -1)
            {
                return(null);
            }
            dockArea.selected = num;
            WindowLayout.SaveSplitViewAndChildren(view, win, Path.Combine(WindowLayout.layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
            dockArea.actualView   = null;
            dockArea.m_Panes[num] = null;
            MaximizedHostView maximizedHostView = ScriptableObject.CreateInstance <MaximizedHostView>();
            int  idx      = parent.IndexOfChild(view);
            Rect position = view.position;

            parent.RemoveChild(view);
            parent.AddChild(maximizedHostView, idx);
            maximizedHostView.actualView = win;
            maximizedHostView.position   = position;
            return(view);
        }
示例#2
0
 public static bool MaximizePrepare(EditorWindow win)
 {
     View parent = win.m_Parent.parent;
     View splitview = parent;
     while ((parent != null) && (parent is SplitView))
     {
         splitview = parent;
         parent = parent.parent;
     }
     DockArea area = win.m_Parent as DockArea;
     if (area == null)
     {
         return false;
     }
     if (parent == null)
     {
         return false;
     }
     MainView view3 = splitview.parent as MainView;
     if (view3 == null)
     {
         return false;
     }
     if (win.m_Parent.window == null)
     {
         return false;
     }
     int index = area.m_Panes.IndexOf(win);
     if (index == -1)
     {
         return false;
     }
     area.selected = index;
     SaveSplitViewAndChildren(splitview, win, Path.Combine(layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
     area.actualView = null;
     area.m_Panes[index] = null;
     MaximizedHostView child = ScriptableObject.CreateInstance<MaximizedHostView>();
     int idx = parent.IndexOfChild(splitview);
     Rect position = splitview.position;
     parent.RemoveChild(splitview);
     parent.AddChild(child, idx);
     child.actualView = win;
     child.position = position;
     UnityEngine.Object.DestroyImmediate(splitview, true);
     return true;
 }
示例#3
0
        public static View MaximizePrepare(EditorWindow win)
        {
            View parent1 = win.m_Parent.parent;
            View view    = parent1;

            for (; (UnityEngine.Object)parent1 != (UnityEngine.Object)null && parent1 is SplitView; parent1 = parent1.parent)
            {
                view = parent1;
            }
            DockArea parent2 = win.m_Parent as DockArea;

            if ((UnityEngine.Object)parent2 == (UnityEngine.Object)null)
            {
                return((View)null);
            }
            if ((UnityEngine.Object)parent1 == (UnityEngine.Object)null)
            {
                return((View)null);
            }
            if ((UnityEngine.Object)(view.parent as MainWindow) == (UnityEngine.Object)null)
            {
                return((View)null);
            }
            if ((UnityEngine.Object)win.m_Parent.window == (UnityEngine.Object)null)
            {
                return((View)null);
            }
            int index = parent2.m_Panes.IndexOf(win);

            if (index == -1)
            {
                return((View)null);
            }
            parent2.selected = index;
            WindowLayout.SaveSplitViewAndChildren(view, win, Path.Combine(WindowLayout.layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
            parent2.m_Panes[index] = (EditorWindow)null;
            MaximizedHostView instance = ScriptableObject.CreateInstance <MaximizedHostView>();
            int  idx      = parent1.IndexOfChild(view);
            Rect position = view.position;

            parent1.RemoveChild(view);
            parent1.AddChild((View)instance, idx);
            instance.position   = position;
            instance.actualView = win;
            return(view);
        }
示例#4
0
        public static bool MaximizePrepare(EditorWindow win)
        {
            View parent = win.m_Parent.parent;
            View view   = parent;

            while (parent != null && parent is SplitView)
            {
                view   = parent;
                parent = parent.parent;
            }
            DockArea dockArea = win.m_Parent as DockArea;
            bool     result;

            if (dockArea == null)
            {
                result = false;
            }
            else if (parent == null)
            {
                result = false;
            }
            else
            {
                MainView x = view.parent as MainView;
                if (x == null)
                {
                    result = false;
                }
                else
                {
                    ContainerWindow window = win.m_Parent.window;
                    if (window == null)
                    {
                        result = false;
                    }
                    else
                    {
                        int num = dockArea.m_Panes.IndexOf(win);
                        if (num == -1)
                        {
                            result = false;
                        }
                        else
                        {
                            dockArea.selected = num;
                            WindowLayout.SaveSplitViewAndChildren(view, win, Path.Combine(WindowLayout.layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
                            dockArea.actualView   = null;
                            dockArea.m_Panes[num] = null;
                            MaximizedHostView maximizedHostView = ScriptableObject.CreateInstance <MaximizedHostView>();
                            int  idx      = parent.IndexOfChild(view);
                            Rect position = view.position;
                            parent.RemoveChild(view);
                            parent.AddChild(maximizedHostView, idx);
                            maximizedHostView.actualView = win;
                            maximizedHostView.position   = position;
                            UnityEngine.Object.DestroyImmediate(view, true);
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
示例#5
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 bool MaximizePrepare(EditorWindow win)
        {
            // Find Root SplitView
            View itor      = win.m_Parent.parent;
            View rootSplit = itor;

            while (itor != null && itor is SplitView)
            {
                rootSplit = itor;
                itor      = itor.parent;
            }

            // Make sure it has a dockarea
            DockArea dockArea = win.m_Parent as DockArea;

            if (dockArea == null)
            {
                return(false);
            }

            if (itor == null)
            {
                return(false);
            }

            var mainView = rootSplit.parent as MainView;

            if (mainView == null)
            {
                return(false);
            }

            ContainerWindow parentWindow = win.m_Parent.window;

            if (parentWindow == null)
            {
                return(false);
            }

            int oldDockIndex = dockArea.m_Panes.IndexOf(win);

            if (oldDockIndex == -1)
            {
                return(false);
            }

            dockArea.selected = oldDockIndex;

            // Save current state to disk
            SaveSplitViewAndChildren(rootSplit, win, Path.Combine(layoutsProjectPath, kMaximizeRestoreFile));

            // Remove the window from the HostView now in order to invoke OnBecameInvisible before OnBecameVisible
            dockArea.actualView = null;

            dockArea.m_Panes[oldDockIndex] = null;

            MaximizedHostView maximizedHostView = ScriptableObject.CreateInstance <MaximizedHostView>();

            int  i = itor.IndexOfChild(rootSplit);
            Rect p = rootSplit.position;

            itor.RemoveChild(rootSplit);
            itor.AddChild(maximizedHostView, i);

            maximizedHostView.actualView = win;
            maximizedHostView.position   = p; // Must be set after actualView so that value is propagated

            UnityObject.DestroyImmediate(rootSplit, true);

            return(true);
        }
        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);
                            }
                        }
                    }
                }
            }
        }