public void OnEnable() { if (m_RootView) { m_RootView.Initialize(this); } SetBackgroundColor(skinBackgroundColor); }
internal virtual void Initialize(ContainerWindow win) { this.SetWindow(win); View[] children = this.m_Children; for (int i = 0; i < children.Length; i++) { View view = children[i]; view.m_Parent = this; view.Initialize(win); } }
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); } }
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); } } } } } }
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); } } } } } }