public bool PerformDrop(EditorWindow dropWindow, DropInfo dropInfo, Vector2 screenPos) { var extraInfo = dropInfo.userData as ExtraDropInfo; var rootWindow = extraInfo.rootWindow; var edge = extraInfo.edge; var dropIndex = extraInfo.index; var dropRect = dropInfo.rect; var beginning = (edge & ViewEdge.Before) != 0; var wantsVertical = (edge & ViewEdge.FitsVertical) != 0; SplitView parentForDrop = null; if (vertical == wantsVertical || children.Length < 2) { // Current view can accommodate desired drop if (!beginning) { if (rootWindow) { dropIndex = children.Length; } else { ++dropIndex; } } parentForDrop = this; } else if (rootWindow) { // Docking to a window: need to insert a parent var newParent = ScriptableObject.CreateInstance <SplitView>(); newParent.position = position; if (window.rootView == this) { window.rootView = newParent; } else // Main window has MainView as its root { parent.AddChild(newParent, parent.IndexOfChild(this)); } newParent.AddChild(this); position = new Rect(Vector2.zero, position.size); dropIndex = beginning ? 0 : 1; parentForDrop = newParent; } else { // Docking in a view: need to insert a child var newChild = ScriptableObject.CreateInstance <SplitView>(); newChild.AddChild(children[dropIndex]); AddChild(newChild, dropIndex); newChild.position = newChild.children[0].position; newChild.children[0].position = new Rect(Vector2.zero, newChild.position.size); dropIndex = beginning ? 0 : 1; parentForDrop = newChild; } dropRect.position = dropRect.position - screenPosition.position; var newDockArea = ScriptableObject.CreateInstance <DockArea>(); parentForDrop.vertical = wantsVertical; parentForDrop.MakeRoomForRect(dropRect); parentForDrop.AddChild(newDockArea, dropIndex); newDockArea.position = dropRect; DockArea.s_OriginalDragSource.RemoveTab(dropWindow, killIfEmpty: true, sendEvents: false); dropWindow.m_Parent = newDockArea; newDockArea.AddTab(dropWindow, sendPaneEvents: false); Reflow(); RecalcMinMaxAndReflowAll(this); newDockArea.MakeVistaDWMHappyDance(); return(true); }
public bool PerformDrop(EditorWindow w, DropInfo di, Vector2 screenPos) { int userData = (int)di.userData; DockArea instance1 = ScriptableObject.CreateInstance <DockArea>(); Rect rect = di.rect; if (userData == -1 || userData == -2 || userData == -3) { bool flag1 = userData == -2; bool flag2 = userData == -1; this.splitState = (SplitterState)null; if (this.vertical == flag2 || this.children.Length < 2) { this.vertical = flag2; rect.x -= this.screenPosition.x; rect.y -= this.screenPosition.y; this.MakeRoomForRect(rect); this.AddChild((View)instance1, !flag1 ? this.children.Length : 0); instance1.position = rect; } else { SplitView instance2 = ScriptableObject.CreateInstance <SplitView>(); Rect position = this.position; instance2.vertical = flag2; instance2.position = new Rect(position.x, position.y, position.width, position.height); if ((Object)this.window.mainView == (Object)this) { this.window.mainView = (View)instance2; } else { this.parent.AddChild((View)instance2, this.parent.IndexOfChild((View)this)); } instance2.AddChild((View)this); this.position = new Rect(0.0f, 0.0f, position.width, position.height); Rect r = rect; r.x -= this.screenPosition.x; r.y -= this.screenPosition.y; instance2.MakeRoomForRect(r); instance1.position = r; instance2.AddChild((View)instance1, !flag1 ? 1 : 0); } } else if (userData < 1000) { Rect r = rect; r.x -= this.screenPosition.x; r.y -= this.screenPosition.y; this.MakeRoomForRect(r); this.AddChild((View)instance1, userData); instance1.position = r; } else { int idx = userData % 1000; if (this.children.Length != 1) { SplitView instance2 = ScriptableObject.CreateInstance <SplitView>(); instance2.vertical = !this.vertical; Rect position = this.children[idx].position; instance2.AddChild(this.children[idx]); this.AddChild((View)instance2, idx); instance2.position = position; // ISSUE: explicit reference operation // ISSUE: variable of a reference type Rect& local = @position; float num1 = 0.0f; position.y = num1; double num2 = (double)num1; // ISSUE: explicit reference operation (^ local).x = (float)num2; instance2.children[0].position = position; Rect r = rect; r.x -= instance2.screenPosition.x; r.y -= instance2.screenPosition.y; instance2.MakeRoomForRect(r); instance2.AddChild((View)instance1, userData >= 2000 ? 1 : 0); instance1.position = r; } else { this.vertical = !this.vertical; Rect r = rect; r.x -= this.screenPosition.x; r.y -= this.screenPosition.y; this.MakeRoomForRect(r); this.AddChild((View)instance1, userData != 1000 ? 1 : 0); instance1.position = r; } } DockArea.s_OriginalDragSource.RemoveTab(w); w.m_Parent = (HostView)instance1; instance1.AddTab(w); this.Reflow(); SplitView.RecalcMinMaxAndReflowAll(this); instance1.MakeVistaDWMHappyDance(); return(true); }
public bool PerformDrop(EditorWindow w, DropInfo di, Vector2 screenPos) { int userData = (int)di.userData; DockArea child = ScriptableObject.CreateInstance <DockArea>(); Rect r = di.rect; switch (userData) { case -1: case -2: case -3: { bool flag = userData == -2; bool flag2 = userData == -1; this.splitState = null; if ((this.vertical == flag2) || (base.children.Length < 2)) { this.vertical = flag2; r.x -= base.screenPosition.x; r.y -= base.screenPosition.y; this.MakeRoomForRect(r); this.AddChild(child, !flag ? base.children.Length : 0); child.position = r; } else { SplitView view = ScriptableObject.CreateInstance <SplitView>(); Rect position = base.position; view.vertical = flag2; view.position = new Rect(position.x, position.y, position.width, position.height); if (base.window.mainView == this) { base.window.mainView = view; } else { base.parent.AddChild(view, base.parent.IndexOfChild(this)); } view.AddChild(this); base.position = new Rect(0f, 0f, position.width, position.height); Rect rect3 = r; rect3.x -= base.screenPosition.x; rect3.y -= base.screenPosition.y; view.MakeRoomForRect(rect3); child.position = rect3; view.AddChild(child, !flag ? 1 : 0); } break; } default: if (userData < 0x3e8) { Rect rect4 = r; rect4.x -= base.screenPosition.x; rect4.y -= base.screenPosition.y; this.MakeRoomForRect(rect4); this.AddChild(child, userData); child.position = rect4; } else { int index = userData % 0x3e8; if (base.children.Length != 1) { SplitView view2 = ScriptableObject.CreateInstance <SplitView>(); view2.vertical = !this.vertical; Rect rect5 = base.children[index].position; view2.AddChild(base.children[index]); this.AddChild(view2, index); view2.position = rect5; float num3 = 0f; rect5.y = num3; rect5.x = num3; view2.children[0].position = rect5; Rect rect6 = r; rect6.x -= view2.screenPosition.x; rect6.y -= view2.screenPosition.y; view2.MakeRoomForRect(rect6); view2.AddChild(child, (userData >= 0x7d0) ? 1 : 0); child.position = rect6; } else { this.vertical = !this.vertical; Rect rect7 = r; rect7.x -= base.screenPosition.x; rect7.y -= base.screenPosition.y; this.MakeRoomForRect(rect7); this.AddChild(child, (userData != 0x3e8) ? 1 : 0); child.position = rect7; } } break; } DockArea.s_OriginalDragSource.RemoveTab(w); w.m_Parent = child; child.AddTab(w); this.Reflow(); RecalcMinMaxAndReflowAll(this); child.MakeVistaDWMHappyDance(); return(true); }
public bool PerformDrop(EditorWindow dropWindow, DropInfo dropInfo, Vector2 screenPos) { ExtraDropInfo userData = dropInfo.userData as ExtraDropInfo; bool rootWindow = userData.rootWindow; ViewEdge edge = userData.edge; int index = userData.index; Rect r = dropInfo.rect; bool flag2 = (edge & ViewEdge.Before) != ViewEdge.None; bool flag3 = (edge & ViewEdge.FitsVertical) != ViewEdge.None; SplitView view = null; if ((this.vertical == flag3) || (base.children.Length < 2)) { if (!flag2) { if (rootWindow) { index = base.children.Length; } else { index++; } } view = this; } else if (rootWindow) { SplitView view2 = ScriptableObject.CreateInstance <SplitView>(); view2.position = base.position; if (base.window.rootView == this) { base.window.rootView = view2; } else { base.parent.AddChild(view2, base.parent.IndexOfChild(this)); } view2.AddChild(this); base.position = new Rect(Vector2.zero, base.position.size); index = !flag2 ? 1 : 0; view = view2; } else { SplitView view3 = ScriptableObject.CreateInstance <SplitView>(); view3.AddChild(base.children[index]); this.AddChild(view3, index); view3.position = view3.children[0].position; view3.children[0].position = new Rect(Vector2.zero, view3.position.size); index = !flag2 ? 1 : 0; view = view3; } r.position -= base.screenPosition.position; DockArea child = ScriptableObject.CreateInstance <DockArea>(); view.vertical = flag3; view.MakeRoomForRect(r); view.AddChild(child, index); child.position = r; DockArea.s_OriginalDragSource.RemoveTab(dropWindow); dropWindow.m_Parent = child; child.AddTab(dropWindow); this.Reflow(); RecalcMinMaxAndReflowAll(this); child.MakeVistaDWMHappyDance(); return(true); }
public bool PerformDrop(EditorWindow w, DropInfo di, Vector2 screenPos) { int num = (int)di.userData; DockArea dockArea = ScriptableObject.CreateInstance <DockArea>(); Rect rect = di.rect; if (num == -1 || num == -2 || num == -3) { bool flag = num == -2; bool flag2 = num == -1; this.splitState = null; if (this.vertical == flag2 || base.children.Length < 2) { this.vertical = flag2; rect.x -= base.screenPosition.x; rect.y -= base.screenPosition.y; this.MakeRoomForRect(rect); this.AddChild(dockArea, (!flag) ? base.children.Length : 0); dockArea.position = rect; } else { SplitView splitView = ScriptableObject.CreateInstance <SplitView>(); Rect position = base.position; splitView.vertical = flag2; splitView.position = new Rect(position.x, position.y, position.width, position.height); if (base.window.mainView == this) { base.window.mainView = splitView; } else { base.parent.AddChild(splitView, base.parent.IndexOfChild(this)); } splitView.AddChild(this); base.position = new Rect(0f, 0f, position.width, position.height); Rect rect2 = rect; rect2.x -= base.screenPosition.x; rect2.y -= base.screenPosition.y; splitView.MakeRoomForRect(rect2); dockArea.position = rect2; splitView.AddChild(dockArea, (!flag) ? 1 : 0); } } else { if (num < 1000) { Rect rect3 = rect; rect3.x -= base.screenPosition.x; rect3.y -= base.screenPosition.y; this.MakeRoomForRect(rect3); this.AddChild(dockArea, num); dockArea.position = rect3; } else { int num2 = num % 1000; if (base.children.Length != 1) { SplitView splitView2 = ScriptableObject.CreateInstance <SplitView>(); splitView2.vertical = !this.vertical; Rect position2 = base.children[num2].position; splitView2.AddChild(base.children[num2]); this.AddChild(splitView2, num2); splitView2.position = position2; float num3 = 0f; position2.y = num3; position2.x = num3; splitView2.children[0].position = position2; Rect rect4 = rect; rect4.x -= splitView2.screenPosition.x; rect4.y -= splitView2.screenPosition.y; splitView2.MakeRoomForRect(rect4); splitView2.AddChild(dockArea, (num >= 2000) ? 1 : 0); dockArea.position = rect4; } else { this.vertical = !this.vertical; Rect rect5 = rect; rect5.x -= base.screenPosition.x; rect5.y -= base.screenPosition.y; this.MakeRoomForRect(rect5); this.AddChild(dockArea, (num != 1000) ? 1 : 0); dockArea.position = rect5; } } } DockArea.s_OriginalDragSource.RemoveTab(w); w.m_Parent = dockArea; dockArea.AddTab(w); this.Reflow(); SplitView.RecalcMinMaxAndReflowAll(this); dockArea.MakeVistaDWMHappyDance(); return(true); }