public bool PerformDrop(EditorWindow w, DropInfo info, Vector2 screenPos) { s_OriginalDragSource.RemoveTab(w, s_OriginalDragSource != this); int pos2 = s_PlaceholderPos > m_Panes.Count ? m_Panes.Count : s_PlaceholderPos; AddTab(pos2, w); selected = pos2; return(true); }
public bool PerformDrop(EditorWindow w, DropInfo info, Vector2 screenPos) { s_OriginalDragSource.RemoveTab(w, s_OriginalDragSource != this); int tabInsertIndex = s_PlaceholderPos == -1 || s_PlaceholderPos > m_Panes.Count ? m_Panes.Count : s_PlaceholderPos; AddTab(tabInsertIndex, w); selected = tabInsertIndex; return(true); }
public bool PerformDrop(EditorWindow w, DropInfo info, Vector2 screenPos) { // Don't send focus events to the tab being moved s_OriginalDragSource.RemoveTab(w, killIfEmpty: s_OriginalDragSource != this, sendEvents: false); int tabInsertIndex = s_PlaceholderPos == -1 || s_PlaceholderPos > m_Panes.Count ? m_Panes.Count : s_PlaceholderPos; AddTab(tabInsertIndex, w, sendPaneEvents: false); selected = tabInsertIndex; return(true); }
private static void CheckDragWindowExists() { if ((s_DragMode == 1) && (PaneDragTab.get.m_Window == null)) { s_OriginalDragSource.RemoveTab(s_DragPane); Object.DestroyImmediate(s_DragPane); PaneDragTab.get.Close(); GUIUtility.hotControl = 0; ResetDragVars(); } }
// Close the editor window. public void Close() { // Guard against multiple call to Close in the same stack // (since we call DestroyImmediate at the end of Close()). if (!this) { return; } // Ensure to restore normal workspace before destroying. Fix case 406657. if (WindowLayout.IsMaximized(this)) { WindowLayout.Unmaximize(this); } DockArea da = m_Parent as DockArea; if (da) { da.RemoveTab(this, true); } else { m_Parent.window.Close(); } UnityEngine.Object.DestroyImmediate(this, true); EditorWindow.UpdateWindowMenuListing(); }
internal void Reload(object userData) { EditorWindow editorWindow = userData as EditorWindow; if (!(editorWindow == null)) { Type type = editorWindow.GetType(); string json = EditorJsonUtility.ToJson(editorWindow); DockArea dockArea = editorWindow.m_Parent as DockArea; if (dockArea != null) { int idx = dockArea.m_Panes.IndexOf(editorWindow); dockArea.RemoveTab(editorWindow, false); UnityEngine.Object.DestroyImmediate(editorWindow, true); editorWindow = (ScriptableObject.CreateInstance(type) as EditorWindow); dockArea.AddTab(idx, editorWindow); } else { editorWindow.Close(); editorWindow = (ScriptableObject.CreateInstance(type) as EditorWindow); if (editorWindow != null) { editorWindow.Show(); } } EditorJsonUtility.FromJsonOverwrite(json, editorWindow); } }
internal void RemoveFromDockArea() { DockArea da = m_Parent as DockArea; if (da) { da.RemoveTab(this, true); } }
internal void RemoveFromDockArea() { DockArea dockArea = this.m_Parent as DockArea; if (dockArea) { dockArea.RemoveTab(this, true); } }
internal void RemoveFromDockArea() { DockArea parent = this.m_Parent as DockArea; if (!(bool)((UnityEngine.Object)parent)) { return; } parent.RemoveTab(this, true); }
internal void Reload(object userData) { EditorWindow window = userData as EditorWindow; if (window == null) { return; } // Get some info on the existing window. Type windowType = window.GetType(); // Save what we can of the window. string windowJson = EditorJsonUtility.ToJson(window); DockArea dockArea = window.m_Parent as DockArea; if (dockArea != null) { int windowIndex = dockArea.m_Panes.IndexOf(window); // Destroy window. dockArea.RemoveTab(window, false); // Don't kill dock if empty. DestroyImmediate(window, true); // Create window. window = EditorWindow.CreateInstance(windowType) as EditorWindow; dockArea.AddTab(windowIndex, window); } else { // Close the existing window. window.Close(); // Recreate window. window = EditorWindow.CreateInstance(windowType) as EditorWindow; if (window != null) { window.Show(); } } // Restore what we can of the window. EditorJsonUtility.FromJsonOverwrite(windowJson, window); }
public void Close() { if (WindowLayout.IsMaximized(this)) { WindowLayout.Unmaximize(this); } DockArea dockArea = this.m_Parent as DockArea; if (dockArea) { dockArea.RemoveTab(this, true); } else { this.m_Parent.window.Close(); } UnityEngine.Object.DestroyImmediate(this, true); }
public void Close() { if (WindowLayout.IsMaximized(this)) { WindowLayout.Unmaximize(this); } DockArea parent = this.m_Parent as DockArea; if (parent != null) { parent.RemoveTab(this, true); } else { this.m_Parent.window.Close(); } Object.DestroyImmediate(this, true); }
/// <summary> /// <para>Close the editor window.</para> /// </summary> public void Close() { if (WindowLayout.IsMaximized(this)) { WindowLayout.Unmaximize(this); } DockArea parent = this.m_Parent as DockArea; if ((bool)((UnityEngine.Object)parent)) { parent.RemoveTab(this, true); } else { this.m_Parent.window.Close(); } UnityEngine.Object.DestroyImmediate((UnityEngine.Object) this, true); }
// Close the editor window. public void Close() { // Ensure to restore normal workspace before destroying. Fix case 406657. if (WindowLayout.IsMaximized(this)) { WindowLayout.Unmaximize(this); } DockArea da = m_Parent as DockArea; if (da) { da.RemoveTab(this, true); } else { m_Parent.window.Close(); } UnityEngine.Object.DestroyImmediate(this, true); }
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); } } } } } }
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); } } } } } }