RecalcMinMaxAndReflowAll() private static method

private static RecalcMinMaxAndReflowAll ( SplitView start ) : void
start SplitView
return void
Ejemplo n.º 1
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.º 2
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.º 3
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);
        }