AddChild() public method

public AddChild ( View child, int idx ) : void
child View
idx int
return void
Ejemplo n.º 1
0
        /// clean up this view & propagate down
        public void Cleanup()
        {
            // if I'm a one-view splitview, I can propagate my child up and kill myself

            SplitView sp = parent as SplitView;

            if (children.Length == 1 && sp != null)
            {
                View c = children[0];
                c.position = position;
                if (parent != null)
                {
                    parent.AddChild(c, parent.IndexOfChild(this));
                    parent.RemoveChild(this);
                    if (sp)
                    {
                        sp.Cleanup();
                    }
                    c.position = position;
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        DestroyImmediate(this);
                    }
                    return;
                }
                else if (c is SplitView)
                {
                    RemoveChild(c);
                    window.rootView = c;
                    c.position      = new Rect(0, 0, c.window.position.width, window.position.height);
                    c.Reflow();
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        DestroyImmediate(this);
                    }
                    return;
                }
            }

            if (sp)
            {
                sp.Cleanup();
                // the parent might have moved US up and gotten rid of itself
                sp = parent as SplitView;
                if (sp)
                {
                    // If the parent has the same orientation as us, we can move our views up and kill ourselves
                    if (sp.vertical == vertical)
                    {
                        int idx = new List <View>(parent.children).IndexOf(this);
                        foreach (View child in children)
                        {
                            sp.AddChild(child, idx++);
                            child.position = new Rect(position.x + child.position.x, position.y + child.position.y, child.position.width, child.position.height);
                        }
                    }
                }
            }
            if (children.Length == 0)
            {
                if (parent == null && window != null)
                {
                    // if we're root in the window, we'll remove ourselves
                    window.Close();
                }
                else
                {
                    ICleanuppable ic = parent as ICleanuppable;
                    if (parent is SplitView)
                    {
                        ((SplitView)parent).RemoveChildNice(this);
                        if (!Unsupported.IsDestroyScriptableObject(this))
                        {
                            DestroyImmediate(this, true);
                        }
                    }
                    else
                    {
                        // This is we're root in the main window.
                        // We want to stay, but tell the parent (MainWindow) to Cleanup, so he can reduce us to zero-size
                        /*                  parent.RemoveChild (this);*/
                    }
                    ic.Cleanup();
                }
                return;
            }
            else
            {
                splitState = null;
                Reflow();
            }
        }
Ejemplo n.º 2
0
        public void Cleanup()
        {
            SplitView parent1 = this.parent as SplitView;

            if (this.children.Length == 1 && (Object)parent1 != (Object)null)
            {
                View child = this.children[0];
                child.position = this.position;
                if ((Object)this.parent != (Object)null)
                {
                    this.parent.AddChild(child, this.parent.IndexOfChild((View)this));
                    this.parent.RemoveChild((View)this);
                    if ((bool)((Object)parent1))
                    {
                        parent1.Cleanup();
                    }
                    child.position = this.position;
                    if (Unsupported.IsDestroyScriptableObject((ScriptableObject)this))
                    {
                        return;
                    }
                    Object.DestroyImmediate((Object)this);
                    return;
                }
                if (child is SplitView)
                {
                    this.RemoveChild(child);
                    this.window.mainView = child;
                    child.position       = new Rect(0.0f, 0.0f, child.window.position.width, this.window.position.height);
                    child.Reflow();
                    if (Unsupported.IsDestroyScriptableObject((ScriptableObject)this))
                    {
                        return;
                    }
                    Object.DestroyImmediate((Object)this);
                    return;
                }
            }
            if ((bool)((Object)parent1))
            {
                parent1.Cleanup();
                SplitView parent2 = this.parent as SplitView;
                if ((bool)((Object)parent2) && parent2.vertical == this.vertical)
                {
                    int num = new List <View>((IEnumerable <View>) this.parent.children).IndexOf((View)this);
                    foreach (View child in this.children)
                    {
                        parent2.AddChild(child, num++);
                        child.position = new Rect(this.position.x + child.position.x, this.position.y + child.position.y, child.position.width, child.position.height);
                    }
                }
            }
            if (this.children.Length == 0)
            {
                if ((Object)this.parent == (Object)null && (Object)this.window != (Object)null)
                {
                    this.window.Close();
                }
                else
                {
                    ICleanuppable parent2 = this.parent as ICleanuppable;
                    if (this.parent is SplitView)
                    {
                        ((SplitView)this.parent).RemoveChildNice((View)this);
                        if (!Unsupported.IsDestroyScriptableObject((ScriptableObject)this))
                        {
                            Object.DestroyImmediate((Object)this, true);
                        }
                    }
                    parent2.Cleanup();
                }
            }
            else
            {
                this.splitState = (SplitterState)null;
                this.Reflow();
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        public void Cleanup()
        {
            SplitView parent = base.parent as SplitView;

            if ((base.children.Length == 1) && (parent != null))
            {
                View child = base.children[0];
                child.position = base.position;
                if (base.parent != null)
                {
                    base.parent.AddChild(child, base.parent.IndexOfChild(this));
                    base.parent.RemoveChild(this);
                    if (parent != null)
                    {
                        parent.Cleanup();
                    }
                    child.position = base.position;
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        UnityEngine.Object.DestroyImmediate(this);
                    }
                    return;
                }
                if (child is SplitView)
                {
                    this.RemoveChild(child);
                    base.window.rootView = child;
                    child.position       = new Rect(0f, 0f, child.window.position.width, base.window.position.height);
                    child.Reflow();
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        UnityEngine.Object.DestroyImmediate(this);
                    }
                    return;
                }
            }
            if (parent != null)
            {
                parent.Cleanup();
                parent = base.parent as SplitView;
                if ((parent != null) && (parent.vertical == this.vertical))
                {
                    int index = new List <View>(base.parent.children).IndexOf(this);
                    foreach (View view3 in base.children)
                    {
                        parent.AddChild(view3, index++);
                        view3.position = new Rect(base.position.x + view3.position.x, base.position.y + view3.position.y, view3.position.width, view3.position.height);
                    }
                }
            }
            if (base.children.Length == 0)
            {
                if ((base.parent == null) && (base.window != null))
                {
                    base.window.Close();
                }
                else
                {
                    ICleanuppable cleanuppable = base.parent as ICleanuppable;
                    if (base.parent is SplitView)
                    {
                        ((SplitView)base.parent).RemoveChildNice(this);
                        if (!Unsupported.IsDestroyScriptableObject(this))
                        {
                            UnityEngine.Object.DestroyImmediate(this, true);
                        }
                    }
                    cleanuppable.Cleanup();
                }
            }
            else
            {
                this.splitState = null;
                this.Reflow();
            }
        }
Ejemplo n.º 7
0
        public void Cleanup()
        {
            SplitView splitView = base.parent as SplitView;

            if (base.children.Length == 1 && splitView != null)
            {
                View view = base.children[0];
                view.position = base.position;
                if (base.parent != null)
                {
                    base.parent.AddChild(view, base.parent.IndexOfChild(this));
                    base.parent.RemoveChild(this);
                    if (splitView)
                    {
                        splitView.Cleanup();
                    }
                    view.position = base.position;
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        UnityEngine.Object.DestroyImmediate(this);
                    }
                    return;
                }
                if (view is SplitView)
                {
                    this.RemoveChild(view);
                    base.window.rootView = view;
                    view.position        = new Rect(0f, 0f, view.window.position.width, base.window.position.height);
                    view.Reflow();
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        UnityEngine.Object.DestroyImmediate(this);
                    }
                    return;
                }
            }
            if (splitView)
            {
                splitView.Cleanup();
                splitView = (base.parent as SplitView);
                if (splitView)
                {
                    if (splitView.vertical == this.vertical)
                    {
                        int    num      = new List <View>(base.parent.children).IndexOf(this);
                        View[] children = base.children;
                        for (int i = 0; i < children.Length; i++)
                        {
                            View view2 = children[i];
                            splitView.AddChild(view2, num++);
                            view2.position = new Rect(base.position.x + view2.position.x, base.position.y + view2.position.y, view2.position.width, view2.position.height);
                        }
                    }
                }
            }
            if (base.children.Length == 0)
            {
                if (base.parent == null && base.window != null)
                {
                    base.window.Close();
                }
                else
                {
                    ICleanuppable cleanuppable = base.parent as ICleanuppable;
                    if (base.parent is SplitView)
                    {
                        ((SplitView)base.parent).RemoveChildNice(this);
                        if (!Unsupported.IsDestroyScriptableObject(this))
                        {
                            UnityEngine.Object.DestroyImmediate(this, true);
                        }
                    }
                    cleanuppable.Cleanup();
                }
            }
            else
            {
                this.splitState = null;
                this.Reflow();
            }
        }
Ejemplo n.º 8
0
        public bool PerformDrop(EditorWindow dropWindow, DropInfo dropInfo, Vector2 screenPos)
        {
            SplitView.ExtraDropInfo extraDropInfo = dropInfo.userData as SplitView.ExtraDropInfo;
            bool rootWindow = extraDropInfo.rootWindow;

            SplitView.ViewEdge edge = extraDropInfo.edge;
            int       num           = extraDropInfo.index;
            Rect      rect          = dropInfo.rect;
            bool      flag          = (edge & SplitView.ViewEdge.TopLeft) != SplitView.ViewEdge.None;
            bool      flag2         = (edge & SplitView.ViewEdge.FitsVertical) != SplitView.ViewEdge.None;
            SplitView splitView;

            if (this.vertical == flag2 || base.children.Length < 2)
            {
                if (!flag)
                {
                    if (rootWindow)
                    {
                        num = base.children.Length;
                    }
                    else
                    {
                        num++;
                    }
                }
                splitView = this;
            }
            else if (rootWindow)
            {
                SplitView splitView2 = ScriptableObject.CreateInstance <SplitView>();
                splitView2.position = base.position;
                if (base.window.rootView == this)
                {
                    base.window.rootView = splitView2;
                }
                else
                {
                    base.parent.AddChild(splitView2, base.parent.IndexOfChild(this));
                }
                splitView2.AddChild(this);
                base.position = new Rect(Vector2.zero, base.position.size);
                num           = ((!flag) ? 1 : 0);
                splitView     = splitView2;
            }
            else
            {
                SplitView splitView3 = ScriptableObject.CreateInstance <SplitView>();
                splitView3.AddChild(base.children[num]);
                this.AddChild(splitView3, num);
                splitView3.position             = splitView3.children[0].position;
                splitView3.children[0].position = new Rect(Vector2.zero, splitView3.position.size);
                num       = ((!flag) ? 1 : 0);
                splitView = splitView3;
            }
            rect.position -= base.screenPosition.position;
            DockArea dockArea = ScriptableObject.CreateInstance <DockArea>();

            splitView.vertical = flag2;
            splitView.MakeRoomForRect(rect);
            splitView.AddChild(dockArea, num);
            dockArea.position = rect;
            DockArea.s_OriginalDragSource.RemoveTab(dropWindow);
            dropWindow.m_Parent = dockArea;
            dockArea.AddTab(dropWindow);
            this.Reflow();
            SplitView.RecalcMinMaxAndReflowAll(this);
            dockArea.MakeVistaDWMHappyDance();
            return(true);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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);
        }