Esempio n. 1
0
        public void Add(PlotLayoutBlockItem value)
        {
            PlotLayoutDockableDataView plotLayoutDockableDataView = value.Object as PlotLayoutDockableDataView;

            if (plotLayoutDockableDataView != null)
            {
                if (plotLayoutDockableDataView.DockLeft)
                {
                    this.ListLeft.Add(value);
                    value.List = this.ListLeft;
                }
                else if (plotLayoutDockableDataView.DockRight)
                {
                    this.ListRight.Add(value);
                    value.List = this.ListRight;
                }
                else if (plotLayoutDockableDataView.DockTop)
                {
                    this.ListTop.Add(value);
                    value.List = this.ListTop;
                }
                else if (plotLayoutDockableDataView.DockBottom)
                {
                    this.ListBottom.Add(value);
                    value.List = this.ListBottom;
                }
            }
        }
 public void CompleteDrag()
 {
     if (this.Visible)
     {
         PlotLayoutAxis             plotLayoutAxis              = this.Source.Object as PlotLayoutAxis;
         PlotLayoutAxis             plotLayoutAxis2             = this.Destination.Object as PlotLayoutAxis;
         PlotLayoutDockableAll      plotLayoutDockableAll       = this.Source.Object as PlotLayoutDockableAll;
         PlotLayoutDockableAll      plotLayoutDockableAll2      = this.Destination.Object as PlotLayoutDockableAll;
         PlotLayoutDockableDataView plotLayoutDockableDataView  = this.Source.Object as PlotLayoutDockableDataView;
         PlotLayoutDockableDataView plotLayoutDockableDataView2 = this.Destination.Object as PlotLayoutDockableDataView;
         PlotLayoutDataView         plotLayoutDataView          = this.Source.Object as PlotLayoutDataView;
         PlotLayoutDataView         plotLayoutDataView2         = this.Destination.Object as PlotLayoutDataView;
         if (plotLayoutDataView != null && plotLayoutDataView2 != null)
         {
             this.DropDataViewOnDataView();
         }
         else if (plotLayoutDockableDataView != null)
         {
             if (plotLayoutDockableDataView != null && plotLayoutDockableDataView2 != null)
             {
                 this.DropDockableAllOnDockableAll();
             }
             else if (plotLayoutDockableDataView != null && plotLayoutDataView2 != null)
             {
                 this.DropDockableDataViewOnDataView();
             }
             else if (plotLayoutDockableAll != null && this.Destination.Object == null)
             {
                 this.DropDockableAllOnPlotDockGroup();
             }
             if (plotLayoutAxis != null && plotLayoutAxis2 != null)
             {
                 plotLayoutAxis.DockStyle = plotLayoutAxis2.DockStyle;
             }
             else if (plotLayoutDockableAll != null && plotLayoutDockableAll2 != null)
             {
                 plotLayoutDockableAll.DockStyle = plotLayoutDockableAll2.DockStyle;
             }
             else if (plotLayoutDockableAll != null && plotLayoutAxis2 != null)
             {
                 plotLayoutDockableAll.DockStyle = PlotDockStyleAll.DataView;
             }
             else if (plotLayoutDockableAll != null && plotLayoutDataView2 != null)
             {
                 plotLayoutDockableAll.DockStyle = PlotDockStyleAll.DataView;
             }
             else if (plotLayoutAxis != null && plotLayoutDataView2 != null)
             {
                 plotLayoutAxis.DockStyle = PlotDockStyleAxis.DataView;
             }
             else if (plotLayoutDockableAll != null && this.Destination.Object == null)
             {
                 plotLayoutDockableAll.DockStyle = PlotDockStyleAll.Plot;
             }
         }
         (this.m_ControlBase as PlotLayoutViewer).MakeDirty();
     }
 }
Esempio n. 3
0
        public bool IsDocked(PlotLayoutBase value)
        {
            PlotLayoutDockableDataView plotLayoutDockableDataView = value as PlotLayoutDockableDataView;

            if (plotLayoutDockableDataView == null)
            {
                return(false);
            }
            if (!plotLayoutDockableDataView.DocksToDataView)
            {
                return(false);
            }
            if (plotLayoutDockableDataView.DockDataViewName.ToUpper() != base.Name.ToUpper())
            {
                return(false);
            }
            return(true);
        }
        public void DropDockableDataViewOnDataView()
        {
            PlotLayoutDockableDataView plotLayoutDockableDataView = this.Source.Object as PlotLayoutDockableDataView;
            PlotLayoutDataView         plotLayoutDataView         = this.Destination.Object as PlotLayoutDataView;
            int dockOrder = plotLayoutDockableDataView.DockOrder;

            plotLayoutDockableDataView.DockDataViewName = plotLayoutDataView.Name;
            if (this.DestinationSide == PlotDragSide.Left)
            {
                plotLayoutDockableDataView.DockSide = AlignmentQuadSide.Left;
            }
            else if (this.DestinationSide == PlotDragSide.Right)
            {
                plotLayoutDockableDataView.DockSide = AlignmentQuadSide.Right;
            }
            else if (this.DestinationSide == PlotDragSide.Top)
            {
                plotLayoutDockableDataView.DockSide = AlignmentQuadSide.Top;
            }
            else if (this.DestinationSide == PlotDragSide.Bottom)
            {
                plotLayoutDockableDataView.DockSide = AlignmentQuadSide.Bottom;
            }
            this.Source.List.Remove(this.Source);
            this.FixupStacking(this.Source.List, dockOrder);
            if (this.Destination.List != null)
            {
                if (this.Destination.List.Count != 0)
                {
                    plotLayoutDockableDataView.DockOrder = this.Destination.List[0].Object.DockOrder - 1;
                }
                else
                {
                    plotLayoutDockableDataView.DockOrder = 0;
                }
                plotLayoutDockableDataView.DockPercentStart = 0.0;
                plotLayoutDockableDataView.DockPercentStop  = 1.0;
            }
        }
Esempio n. 5
0
        int IComparer.Compare(object x, object y)
        {
            if (!(x is PlotLayoutBlockItem))
            {
                throw new Exception("x is not a PlotLayoutBlockItem object");
            }
            if (!(y is PlotLayoutBlockItem))
            {
                throw new Exception("y is not a PlotLayoutBlockItem object");
            }
            PlotLayoutDockableDataView plotLayoutDockableDataView  = (x as PlotLayoutBlockItem).Object as PlotLayoutDockableDataView;
            PlotLayoutDockableDataView plotLayoutDockableDataView2 = (y as PlotLayoutBlockItem).Object as PlotLayoutDockableDataView;

            if (plotLayoutDockableDataView == null)
            {
                throw new Exception("x's PlotLayoutBlockItem Object is not of type PlotLayoutDockableDataView");
            }
            if (plotLayoutDockableDataView2 == null)
            {
                throw new Exception("y's PlotLayoutBlockItem Object is not of type PlotLayoutDockableDataView");
            }
            return(plotLayoutDockableDataView.DockPercentStart.CompareTo(plotLayoutDockableDataView2.DockPercentStart));
        }
        public void FixupStacking(PlotLayoutBlockItemCollection list, int targetIndex)
        {
            PlotLayoutBlockItemCollection plotLayoutBlockItemCollection = new PlotLayoutBlockItemCollection();

            foreach (PlotLayoutBlockItem item in list)
            {
                if (item.Object.DockOrder == targetIndex)
                {
                    plotLayoutBlockItemCollection.Add(item);
                }
            }
            plotLayoutBlockItemCollection.SortDockPercentStart();
            for (int i = 0; i < plotLayoutBlockItemCollection.Count; i++)
            {
                PlotLayoutBlockItem        plotLayoutBlockItem2       = plotLayoutBlockItemCollection[i];
                PlotLayoutDockableDataView plotLayoutDockableDataView = plotLayoutBlockItem2.Object as PlotLayoutDockableDataView;
                if (plotLayoutDockableDataView != null)
                {
                    plotLayoutDockableDataView.DockPercentStart = (double)i * 1.0 / (double)plotLayoutBlockItemCollection.Count;
                    plotLayoutDockableDataView.DockPercentStop  = plotLayoutDockableDataView.DockPercentStart + 1.0 / (double)plotLayoutBlockItemCollection.Count;
                }
            }
        }
        public void DropDockableAllOnDockableAll()
        {
            PlotLayoutDockableDataView plotLayoutDockableDataView  = this.Source.Object as PlotLayoutDockableDataView;
            PlotLayoutDockableDataView plotLayoutDockableDataView2 = this.Destination.Object as PlotLayoutDockableDataView;
            int  dockOrder = plotLayoutDockableDataView.DockOrder;
            bool flag      = plotLayoutDockableDataView.DockDataViewName == plotLayoutDockableDataView2.DockDataViewName && plotLayoutDockableDataView.DockOrder == plotLayoutDockableDataView2.DockOrder && plotLayoutDockableDataView.DockSide == plotLayoutDockableDataView2.DockSide;

            plotLayoutDockableDataView.DockDataViewName = plotLayoutDockableDataView2.DockDataViewName;
            plotLayoutDockableDataView.DockSide         = plotLayoutDockableDataView2.DockSide;
            if (this.DestinationDockOrderOffset == PlotDragDockOrderOffset.Higher)
            {
                if (this.Destination.List != null)
                {
                    this.Source.List.Remove(this.Source);
                    this.FixupStacking(this.Source.List, dockOrder);
                    int num = this.Destination.Object.DockOrder + 1;
                    foreach (PlotLayoutBlockItem item in this.Destination.List)
                    {
                        if (item.Object.DockOrder >= num)
                        {
                            item.Object.DockOrder++;
                        }
                    }
                    plotLayoutDockableDataView.DockOrder        = num;
                    plotLayoutDockableDataView.DockPercentStart = 0.0;
                    plotLayoutDockableDataView.DockPercentStop  = 1.0;
                }
            }
            else if (this.DestinationDockOrderOffset == PlotDragDockOrderOffset.Lower)
            {
                if (this.Destination.List != null)
                {
                    this.Source.List.Remove(this.Source);
                    this.FixupStacking(this.Source.List, dockOrder);
                    int num = this.Destination.Object.DockOrder;
                    foreach (PlotLayoutBlockItem item2 in this.Destination.List)
                    {
                        if (item2.Object.DockOrder >= num)
                        {
                            item2.Object.DockOrder++;
                        }
                    }
                    plotLayoutDockableDataView.DockOrder        = num;
                    plotLayoutDockableDataView.DockPercentStart = 0.0;
                    plotLayoutDockableDataView.DockPercentStop  = 1.0;
                }
            }
            else if (this.DestinationDockOrderOffset == PlotDragDockOrderOffset.Same)
            {
                if (!flag)
                {
                    plotLayoutDockableDataView.DockOrder = plotLayoutDockableDataView2.DockOrder;
                    this.Source.List.Remove(this.Source);
                    this.Destination.List.Add(this.Source as PlotLayoutBlockItem);
                    this.FixupStacking(this.Destination.List, plotLayoutDockableDataView2.DockOrder);
                    this.FixupStacking(this.Source.List, dockOrder);
                }
                else
                {
                    double dockPercentStart = plotLayoutDockableDataView.DockPercentStart;
                    double dockPercentStop  = plotLayoutDockableDataView.DockPercentStop;
                    plotLayoutDockableDataView.DockPercentStart  = plotLayoutDockableDataView2.DockPercentStart;
                    plotLayoutDockableDataView.DockPercentStop   = plotLayoutDockableDataView2.DockPercentStop;
                    plotLayoutDockableDataView2.DockPercentStart = dockPercentStart;
                    plotLayoutDockableDataView2.DockPercentStop  = dockPercentStop;
                }
            }
        }
Esempio n. 8
0
        public void CalculateAndSetAllDockObjectBounds()
        {
            int num     = this.InnerRectangleScreen.Left;
            int num2    = this.InnerRectangleLayout.Left;
            int height  = this.InnerRectangleScreen.Height;
            int height2 = this.InnerRectangleLayout.Height;
            int maxDepthScreen;
            int maxDepthLayout;

            foreach (PlotLayoutUniqueDockOrder uniqueDockOrder in this.ListLeft.UniqueDockOrders)
            {
                maxDepthScreen = uniqueDockOrder.MaxDepthScreen;
                maxDepthLayout = uniqueDockOrder.MaxDepthLayout;
                int num3  = num - uniqueDockOrder.MaxDockMargin;
                int num4  = num2;
                int left  = num3 - maxDepthScreen;
                int left2 = num4 - maxDepthLayout;
                foreach (PlotLayoutBlockItem item in uniqueDockOrder.Items)
                {
                    PlotLayoutDockableDataView plotLayoutDockableDataView = item.Object as PlotLayoutDockableDataView;
                    if (plotLayoutDockableDataView != null)
                    {
                        int num5   = (int)((double)this.InnerRectangleScreen.Bottom - plotLayoutDockableDataView.DockPercentStart * (double)height);
                        int bottom = (int)((double)this.InnerRectangleLayout.Bottom - plotLayoutDockableDataView.DockPercentStart * (double)height2);
                        num5 -= plotLayoutDockableDataView.TextOverlapPixelsStart + plotLayoutDockableDataView.StackingPixelsStart;
                        int num6 = (int)((double)this.InnerRectangleScreen.Bottom - plotLayoutDockableDataView.DockPercentStop * (double)height);
                        int top  = (int)((double)this.InnerRectangleLayout.Bottom - plotLayoutDockableDataView.DockPercentStop * (double)height2);
                        num6 += plotLayoutDockableDataView.TextOverlapPixelsStop + plotLayoutDockableDataView.StackingPixelsStop;
                        item.BoundsScreen = iRectangle.FromLTRB(left, num6, num3, num5);
                        item.BoundsLayout = iRectangle.FromLTRB(left2, top, num4, bottom);
                        PlotAxis plotAxis = item.Object as PlotAxis;
                        if (plotAxis != null)
                        {
                            item.BoundsClip = iRectangle.FromLTRB(left, num6 - plotAxis.ScaleTextOverlapPixels, num3, num5 + plotAxis.ScaleTextOverlapPixels);
                        }
                        else
                        {
                            item.BoundsClip = item.BoundsScreen;
                        }
                    }
                }
                num  -= maxDepthScreen + uniqueDockOrder.MaxDockMargin;
                num2 -= maxDepthLayout;
            }
            num     = this.InnerRectangleScreen.Right;
            num2    = this.InnerRectangleLayout.Right;
            height  = this.InnerRectangleScreen.Height;
            height2 = this.InnerRectangleLayout.Height;
            foreach (PlotLayoutUniqueDockOrder uniqueDockOrder2 in this.ListRight.UniqueDockOrders)
            {
                maxDepthScreen = uniqueDockOrder2.MaxDepthScreen;
                maxDepthLayout = uniqueDockOrder2.MaxDepthLayout;
                int left  = num + uniqueDockOrder2.MaxDockMargin;
                int left2 = num2;
                int num3  = left + maxDepthScreen;
                int num4  = left2 + maxDepthLayout;
                foreach (PlotLayoutBlockItem item2 in uniqueDockOrder2.Items)
                {
                    PlotLayoutDockableDataView plotLayoutDockableDataView = item2.Object as PlotLayoutDockableDataView;
                    if (plotLayoutDockableDataView != null)
                    {
                        int num5   = (int)((double)this.InnerRectangleScreen.Bottom - plotLayoutDockableDataView.DockPercentStart * (double)height);
                        int bottom = (int)((double)this.InnerRectangleLayout.Bottom - plotLayoutDockableDataView.DockPercentStart * (double)height2);
                        num5 -= plotLayoutDockableDataView.TextOverlapPixelsStart + plotLayoutDockableDataView.StackingPixelsStart;
                        int num6 = (int)((double)this.InnerRectangleScreen.Bottom - plotLayoutDockableDataView.DockPercentStop * (double)height);
                        int top  = (int)((double)this.InnerRectangleLayout.Bottom - plotLayoutDockableDataView.DockPercentStop * (double)height2);
                        num6 += plotLayoutDockableDataView.TextOverlapPixelsStop + plotLayoutDockableDataView.StackingPixelsStop;
                        item2.BoundsScreen = iRectangle.FromLTRB(left, num6, num3, num5);
                        item2.BoundsLayout = iRectangle.FromLTRB(left2, top, num4, bottom);
                        PlotAxis plotAxis = item2.Object as PlotAxis;
                        if (plotAxis != null)
                        {
                            item2.BoundsClip = iRectangle.FromLTRB(left, num6 - plotAxis.ScaleTextOverlapPixels, num3, num5 + plotAxis.ScaleTextOverlapPixels);
                        }
                        else
                        {
                            item2.BoundsClip = item2.BoundsScreen;
                        }
                    }
                }
                num  += maxDepthScreen + uniqueDockOrder2.MaxDockMargin;
                num2 += maxDepthLayout;
            }
            num            = this.InnerRectangleScreen.Top;
            num2           = this.InnerRectangleLayout.Top;
            maxDepthScreen = this.InnerRectangleScreen.Width;
            maxDepthLayout = this.InnerRectangleLayout.Width;
            foreach (PlotLayoutUniqueDockOrder uniqueDockOrder3 in this.ListTop.UniqueDockOrders)
            {
                height  = uniqueDockOrder3.MaxDepthScreen;
                height2 = uniqueDockOrder3.MaxDepthLayout;
                int num5   = num - uniqueDockOrder3.MaxDockMargin;
                int bottom = num2;
                int num6   = num5 - height;
                int top    = bottom - height2;
                foreach (PlotLayoutBlockItem item3 in uniqueDockOrder3.Items)
                {
                    PlotLayoutDockableDataView plotLayoutDockableDataView = item3.Object as PlotLayoutDockableDataView;
                    if (plotLayoutDockableDataView != null)
                    {
                        int left  = (int)((double)this.InnerRectangleScreen.Left + plotLayoutDockableDataView.DockPercentStart * (double)maxDepthScreen);
                        int left2 = (int)((double)this.InnerRectangleLayout.Left + plotLayoutDockableDataView.DockPercentStart * (double)maxDepthLayout);
                        left += plotLayoutDockableDataView.TextOverlapPixelsStart + plotLayoutDockableDataView.StackingPixelsStart;
                        int num3 = (int)((double)this.InnerRectangleScreen.Left + plotLayoutDockableDataView.DockPercentStop * (double)maxDepthScreen);
                        int num4 = (int)((double)this.InnerRectangleLayout.Left + plotLayoutDockableDataView.DockPercentStop * (double)maxDepthLayout);
                        num3 -= plotLayoutDockableDataView.TextOverlapPixelsStop + plotLayoutDockableDataView.StackingPixelsStop;
                        item3.BoundsScreen = iRectangle.FromLTRB(left, num6, num3, num5);
                        item3.BoundsLayout = iRectangle.FromLTRB(left2, top, num4, bottom);
                        PlotAxis plotAxis = item3.Object as PlotAxis;
                        if (plotAxis != null)
                        {
                            item3.BoundsClip = iRectangle.FromLTRB(left - plotAxis.ScaleTextOverlapPixels, num6, num3 + plotAxis.ScaleTextOverlapPixels, num5);
                        }
                        else
                        {
                            item3.BoundsClip = item3.BoundsScreen;
                        }
                    }
                }
                num  -= height + uniqueDockOrder3.MaxDockMargin;
                num2 -= height2;
            }
            num            = this.InnerRectangleScreen.Bottom;
            num2           = this.InnerRectangleLayout.Bottom;
            maxDepthScreen = this.InnerRectangleScreen.Width;
            maxDepthLayout = this.InnerRectangleLayout.Width;
            foreach (PlotLayoutUniqueDockOrder uniqueDockOrder4 in this.ListBottom.UniqueDockOrders)
            {
                height  = uniqueDockOrder4.MaxDepthScreen;
                height2 = uniqueDockOrder4.MaxDepthLayout;
                int num6   = num + uniqueDockOrder4.MaxDockMargin;
                int top    = num2;
                int num5   = num6 + height;
                int bottom = top + height2;
                foreach (PlotLayoutBlockItem item4 in uniqueDockOrder4.Items)
                {
                    PlotLayoutDockableDataView plotLayoutDockableDataView = item4.Object as PlotLayoutDockableDataView;
                    if (plotLayoutDockableDataView != null)
                    {
                        int left  = (int)((double)this.InnerRectangleScreen.Left + plotLayoutDockableDataView.DockPercentStart * (double)maxDepthScreen);
                        int left2 = (int)((double)this.InnerRectangleLayout.Left + plotLayoutDockableDataView.DockPercentStart * (double)maxDepthLayout);
                        left += plotLayoutDockableDataView.TextOverlapPixelsStart + plotLayoutDockableDataView.StackingPixelsStart;
                        int num3 = (int)((double)this.InnerRectangleScreen.Left + plotLayoutDockableDataView.DockPercentStop * (double)maxDepthScreen);
                        int num4 = (int)((double)this.InnerRectangleLayout.Left + plotLayoutDockableDataView.DockPercentStop * (double)maxDepthLayout);
                        num3 -= plotLayoutDockableDataView.TextOverlapPixelsStop + plotLayoutDockableDataView.StackingPixelsStop;
                        item4.BoundsScreen = iRectangle.FromLTRB(left, num6, num3, num5);
                        item4.BoundsLayout = iRectangle.FromLTRB(left2, top, num4, bottom);
                        PlotAxis plotAxis = item4.Object as PlotAxis;
                        if (plotAxis != null)
                        {
                            item4.BoundsClip = iRectangle.FromLTRB(left - plotAxis.ScaleTextOverlapPixels, num6, num3 + plotAxis.ScaleTextOverlapPixels, num5);
                        }
                        else
                        {
                            item4.BoundsClip = item4.BoundsScreen;
                        }
                    }
                }
                num  += height + uniqueDockOrder4.MaxDockMargin;
                num2 += height2;
            }
            int val  = 2147483647;
            int val2 = -2147483648;
            int val3 = 2147483647;
            int val4 = -2147483648;

            if (base.Object != null)
            {
                val  = Math.Min(val, this.ListLeft.GetMinBoundsScreenTop());
                val  = Math.Min(val, this.ListRight.GetMinBoundsScreenTop());
                val2 = Math.Max(val2, this.ListLeft.GetMaxBoundsScreenBottom());
                val2 = Math.Max(val2, this.ListRight.GetMaxBoundsScreenBottom());
                val3 = Math.Min(val3, this.ListTop.GetMinBoundsScreenLeft());
                val3 = Math.Min(val3, this.ListBottom.GetMinBoundsScreenLeft());
                val4 = Math.Max(val4, this.ListTop.GetMaxBoundsScreenRight());
                val4 = Math.Max(val4, this.ListBottom.GetMaxBoundsScreenRight());
                if (val == 2147483647)
                {
                    val = this.InnerRectangleScreen.Top;
                }
                if (val2 == -2147483648)
                {
                    val2 = this.InnerRectangleScreen.Bottom;
                }
                if (val3 == 2147483647)
                {
                    val3 = this.InnerRectangleScreen.Left;
                }
                if (val4 == -2147483648)
                {
                    val4 = this.InnerRectangleScreen.Right;
                }
                this.InnerRectangleScreen = Rectangle.FromLTRB(val3, val, val4, val2);
            }
        }