public void PerformDataViewBoundsCalculations() { int num = this.DataViewReferenceBottomScreen; int num2 = this.DataViewReferenceBottomLayout; for (int i = 0; i < this.Items.Count; i++) { PlotLayoutBlockGroup plotLayoutBlockGroup = this.Items[i]; PlotLayoutDataView plotLayoutDataView = plotLayoutBlockGroup.Object as PlotLayoutDataView; if (plotLayoutDataView != null) { if (num2 != this.DataViewReferenceBottomLayout) { num2 -= plotLayoutBlockGroup.DepthBottomLayout; } int num3 = num2 - plotLayoutBlockGroup.DataViewHeightLayout; plotLayoutBlockGroup.InnerRectangleLayout = Rectangle.FromLTRB(this.DataViewReferenceLeftLayout, num3, this.DataViewReferenceRightLayout, num2); plotLayoutBlockGroup.BoundsLayout = Rectangle.FromLTRB(this.DataViewReferenceLeftLayout - plotLayoutBlockGroup.DepthLeftLayout, num3 - plotLayoutBlockGroup.DepthTopLayout, this.DataViewReferenceRightLayout + plotLayoutBlockGroup.DepthRightLayout, num2 + plotLayoutBlockGroup.DepthBottomLayout); num2 = num3 - plotLayoutBlockGroup.DepthTopLayout; if (plotLayoutDataView.Visible) { if (num != this.DataViewReferenceBottomScreen) { num -= plotLayoutBlockGroup.DepthBottomScreen; } int num4 = num - plotLayoutBlockGroup.DataViewHeightScreen; plotLayoutBlockGroup.InnerRectangleScreen = Rectangle.FromLTRB(this.DataViewReferenceLeftScreen, num4, this.DataViewReferenceRightScreen, num); plotLayoutBlockGroup.BoundsScreen = Rectangle.FromLTRB(this.DataViewReferenceLeftScreen - plotLayoutBlockGroup.DepthLeftScreen, num4 - plotLayoutBlockGroup.DepthTopScreen, this.DataViewReferenceRightScreen + plotLayoutBlockGroup.DepthRightScreen, num + plotLayoutBlockGroup.DepthBottomScreen); num = num4 - plotLayoutBlockGroup.DepthTopScreen; } } } }
public void Add(PlotLayoutBlockGroup value) { if (value.Object is PlotLayoutDataView) { PlotLayoutDataView plotLayoutDataView = value.Object as PlotLayoutDataView; this.Items.Add(value); plotLayoutDataView.StackingGroup = this; } }
private void AssignGroups() { this.PlotDockGroup.Clear(); this.LayoutGroupOrphan.Clear(); this.StackingGroups.Clear(); foreach (PlotLayoutBlockGroup dataViewGroup in this.DataViewGroups) { dataViewGroup.Clear(); PlotLayoutStackingGroup plotLayoutStackingGroup = this.StackingGroups.GetStackingGroup(dataViewGroup.DataView); if (plotLayoutStackingGroup == null) { plotLayoutStackingGroup = new PlotLayoutStackingGroup(); plotLayoutStackingGroup.Index = dataViewGroup.DataView.StackingGroupIndex; this.StackingGroups.Add(plotLayoutStackingGroup); } plotLayoutStackingGroup.Add(dataViewGroup); } foreach (PlotLayoutBlockItem blockItem in this.BlockItems) { if (blockItem.Object is PlotLayoutAxis) { PlotLayoutAxis plotLayoutAxis = blockItem.Object as PlotLayoutAxis; PlotLayoutBlockGroup blockGroup = this.GetBlockGroup(plotLayoutAxis.DockDataView); if (blockGroup != null) { blockGroup.Add(blockItem); } else { this.LayoutGroupOrphan.Add(blockItem); } } else if (blockItem.Object is PlotLayoutDockableAll) { PlotLayoutDockableAll plotLayoutDockableAll = blockItem.Object as PlotLayoutDockableAll; if (plotLayoutDockableAll.DockStyle == PlotDockStyleAll.Plot) { this.PlotDockGroup.Add(blockItem); } else { PlotLayoutBlockGroup blockGroup = this.GetBlockGroup(plotLayoutDockableAll.DockDataView); if (blockGroup != null) { blockGroup.Add(blockItem); } else { this.LayoutGroupOrphan.Add(blockItem); } } } } }
public PlotLayoutManager(Plot plot) { this.m_LayoutObjects = new PlotLayoutBaseCollection(); this.m_BlockItems = new PlotLayoutBlockItemCollection(); this.m_StackingGroups = new PlotLayoutStackingGroupCollection(); this.m_DataViewGroups = new PlotLayoutBlockGroupCollection(); this.m_ListDataViews = new PlotLayoutBaseCollection(); this.m_PlotDockGroup = new PlotLayoutBlockGroup(); this.m_LayoutGroupOrphan = new PlotLayoutBlockGroup(); this.m_BlockObjects = new PlotLayoutBlockBaseCollection(); plot.PlotObjectAdded += this.plot_PlotObjectAdded; plot.PlotObjectRemoved += this.plot_PlotObjectRemoved; this.AutoInsertEnabled = true; this.Plot = plot; }
private void Setup(PaintArgs p, Rectangle rScreen, Rectangle rLayout) { if (this.m_ObjectsDirty) { this.LayoutObjects.Clear(); foreach (PlotLayoutBase xAxis in this.Plot.XAxes) { this.LayoutObjects.Add(xAxis); } foreach (PlotLayoutBase yAxis in this.Plot.YAxes) { this.LayoutObjects.Add(yAxis); } foreach (PlotLayoutBase legend in this.Plot.Legends) { this.LayoutObjects.Add(legend); } foreach (PlotLayoutBase table in this.Plot.Tables) { this.LayoutObjects.Add(table); } foreach (PlotLayoutBase label in this.Plot.Labels) { this.LayoutObjects.Add(label); } this.BlockItems.Clear(); this.BlockObjects.Clear(); this.BlockObjects.Add(this.PlotDockGroup); foreach (PlotLayoutBase layoutObject in this.LayoutObjects) { PlotLayoutBlockItem plotLayoutBlockItem = new PlotLayoutBlockItem(); plotLayoutBlockItem.Object = layoutObject; this.BlockItems.Add(plotLayoutBlockItem); this.BlockObjects.Add(plotLayoutBlockItem); } this.DataViewGroups.Clear(); foreach (PlotLayoutDataView dataView in this.Plot.DataViews) { PlotLayoutBlockGroup plotLayoutBlockGroup = new PlotLayoutBlockGroup(); plotLayoutBlockGroup.Object = dataView; plotLayoutBlockGroup.DataView = dataView; this.DataViewGroups.Add(plotLayoutBlockGroup); this.BlockObjects.Add(plotLayoutBlockGroup); } this.m_ObjectsDirty = false; } foreach (PlotLayoutBase layoutObject2 in this.LayoutObjects) { layoutObject2.Bounds = rScreen; layoutObject2.BoundsClip = rScreen; layoutObject2.TextOverlapPixelsStart = 0; layoutObject2.TextOverlapPixelsStop = 0; } for (int i = 0; i < 2; i++) { this.AssignGroups(); foreach (PlotLayoutDataView dataView2 in this.Plot.DataViews) { dataView2.Bounds = Rectangle.Empty; dataView2.BoundsClip = Rectangle.Empty; dataView2.DockDepthPixels = 0; dataView2.TextOverlapPixelsStart = 0; dataView2.TextOverlapPixelsStop = 0; } foreach (PlotLayoutBase layoutObject3 in this.LayoutObjects) { ((IPlotLayout)layoutObject3).CalculateDepthPixels(p); } this.PlotDockGroup.SortDockOrders(); this.DataViewGroups.SortDockOrders(); this.StackingGroups.SortStackingIndex(); this.StackingGroups.SortDataViewsDockOrder(); this.PlotDockGroup.Calculate(p); this.DataViewGroups.Calculate(p); this.PlotDockGroup.InnerRectangleScreen = new Rectangle(rScreen.Left + this.PlotDockGroup.DepthLeftScreen, rScreen.Top + this.PlotDockGroup.DepthTopScreen, rScreen.Width - this.PlotDockGroup.DepthWidthScreen, rScreen.Height - this.PlotDockGroup.DepthHeightScreen); this.PlotDockGroup.InnerRectangleLayout = new Rectangle(rLayout.Left + this.PlotDockGroup.DepthLeftLayout, rLayout.Left + this.PlotDockGroup.DepthTopLayout, rLayout.Width - this.PlotDockGroup.DepthWidthLayout, rLayout.Height - this.PlotDockGroup.DepthHeightLayout); this.StackingGroups.BoundsScreen = this.PlotDockGroup.InnerRectangleScreen; this.StackingGroups.BoundsLayout = this.PlotDockGroup.InnerRectangleLayout; this.StackingGroups.Calculate(); this.StackingGroups.SetDataViewWidthsAndReferences(); this.StackingGroups.CalculateEachStackingGroupBounds(); this.StackingGroups.PerformDataViewHeightCalculations(); this.StackingGroups.PerformDataViewBoundsCalculations(); this.PlotDockGroup.CalculateAndSetAllDockObjectBounds(); this.DataViewGroups.CalculateAndSetAllDockObjectBounds(); this.BlockItems.TransferBoundsToLayoutObjects(); this.DataViewGroups.TransferBoundsToLayoutObjects(); } }
public void Calculate() { this.MaxDepthLeftScreen = 0; this.MaxDepthLeftLayout = 0; this.MaxDepthRightScreen = 0; this.MaxDepthRightLayout = 0; this.MaxDepthTopScreen = 0; this.MaxDepthTopLayout = 0; this.MaxDepthBottomScreen = 0; this.MaxDepthBottomLayout = 0; this.TotalDepthHeightScreen = 0; this.TotalDepthHeightLayout = 0; this.TotalInnerDepthHeightScreen = 0; this.TotalInnerDepthHeightLayout = 0; this.TotalDockDepthRatioScreen = 0.0; this.TotalDockDepthRatioLayout = 0.0; PlotLayoutBlockGroup plotLayoutBlockGroup = null; PlotLayoutBlockGroup plotLayoutBlockGroup2 = null; this.DataViewVisibleCount = 0; for (int i = 0; i < this.Items.Count; i++) { PlotLayoutBlockGroup plotLayoutBlockGroup3 = this.Items[i]; PlotLayoutDataView plotLayoutDataView = plotLayoutBlockGroup3.Object as PlotLayoutDataView; if (plotLayoutDataView != null) { this.TotalDockDepthRatioLayout += plotLayoutDataView.DockDepthRatio; this.MaxDepthLeftLayout = Math.Max(this.MaxDepthLeftLayout, plotLayoutBlockGroup3.DepthLeftLayout); this.MaxDepthRightLayout = Math.Max(this.MaxDepthRightLayout, plotLayoutBlockGroup3.DepthRightLayout); this.TotalDepthHeightLayout += plotLayoutBlockGroup3.DepthHeightLayout; if (plotLayoutDataView.Visible) { this.TotalDockDepthRatioScreen += plotLayoutDataView.DockDepthRatio; if (plotLayoutBlockGroup == null) { plotLayoutBlockGroup = plotLayoutBlockGroup3; } plotLayoutBlockGroup2 = plotLayoutBlockGroup3; this.MaxDepthLeftScreen = Math.Max(this.MaxDepthLeftScreen, plotLayoutBlockGroup3.DepthLeftScreen); this.MaxDepthRightScreen = Math.Max(this.MaxDepthRightScreen, plotLayoutBlockGroup3.DepthRightScreen); this.TotalDepthHeightScreen += plotLayoutBlockGroup3.DepthHeightScreen; this.DataViewVisibleCount++; } } } if (plotLayoutBlockGroup != null) { this.MaxDepthBottomScreen = plotLayoutBlockGroup.DepthBottomScreen; } if (plotLayoutBlockGroup2 != null) { this.MaxDepthTopScreen = plotLayoutBlockGroup2.DepthTopScreen; } if (this.Items.Count != 0) { this.MaxDepthBottomLayout = this.Items[0].DepthBottomLayout; this.MaxDepthTopLayout = this.Items[this.Items.Count - 1].DepthTopLayout; } if (this.DataViewVisibleCount >= 2) { for (int j = 0; j < this.Items.Count; j++) { PlotLayoutBlockGroup plotLayoutBlockGroup3 = this.Items[j]; PlotLayoutDataView plotLayoutDataView = plotLayoutBlockGroup3.Object as PlotLayoutDataView; if (plotLayoutDataView.Visible) { if (plotLayoutBlockGroup3 == plotLayoutBlockGroup) { this.TotalInnerDepthHeightScreen += plotLayoutBlockGroup3.DepthTopScreen; } else if (plotLayoutBlockGroup3 == plotLayoutBlockGroup2) { this.TotalInnerDepthHeightScreen += plotLayoutBlockGroup3.DepthBottomScreen; } else { this.TotalInnerDepthHeightScreen += plotLayoutBlockGroup3.DepthHeightScreen; } } } } if (this.Items.Count >= 2) { for (int k = 0; k < this.Items.Count; k++) { PlotLayoutBlockGroup plotLayoutBlockGroup3 = this.Items[k]; PlotLayoutDataView plotLayoutDataView = plotLayoutBlockGroup3.Object as PlotLayoutDataView; if (k == 0) { this.TotalInnerDepthHeightLayout += plotLayoutBlockGroup3.DepthTopLayout; } else if (k == this.Items.Count - 1) { this.TotalInnerDepthHeightLayout += plotLayoutBlockGroup3.DepthBottomLayout; } else { this.TotalInnerDepthHeightLayout += plotLayoutBlockGroup3.DepthHeightLayout; } } } }
public int IndexOf(PlotLayoutBlockGroup value) { return(this.m_List.IndexOf(value)); }
public int Add(PlotLayoutBlockGroup value) { return(this.m_List.Add(value)); }
public void UpdateDestinationSide() { Rectangle rectangle; if (this.DestinationType == PlotDragType.Group) { PlotLayoutBlockGroup plotLayoutBlockGroup = this.Destination as PlotLayoutBlockGroup; rectangle = plotLayoutBlockGroup.InnerRectangleLayout; Point[] array = new Point[3]; Point point = new Point((rectangle.Left + rectangle.Right) / 2, (rectangle.Top + rectangle.Bottom) / 2); array[0] = new Point(rectangle.Left, rectangle.Top); array[1] = point; array[2] = new Point(rectangle.Left, rectangle.Bottom); if (HitTest.Contains(this.MousePoint, array)) { this.DestinationRect = new Rectangle(rectangle.Left - 10, rectangle.Top, 21, rectangle.Height); this.DestinationSide = PlotDragSide.Left; this.Destination.List = plotLayoutBlockGroup.ListLeft; this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower; } else { array[0] = new Point(rectangle.Right, rectangle.Top); array[1] = point; array[2] = new Point(rectangle.Right, rectangle.Bottom); if (HitTest.Contains(this.MousePoint, array)) { this.DestinationRect = new Rectangle(rectangle.Right - 10, rectangle.Top, 21, rectangle.Height); this.DestinationSide = PlotDragSide.Right; this.Destination.List = plotLayoutBlockGroup.ListRight; this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower; } else { array[0] = new Point(rectangle.Left, rectangle.Top); array[1] = point; array[2] = new Point(rectangle.Right, rectangle.Top); if (HitTest.Contains(this.MousePoint, array)) { this.DestinationRect = new Rectangle(rectangle.Left, rectangle.Top - 10, rectangle.Width, 21); this.DestinationSide = PlotDragSide.Top; this.Destination.List = plotLayoutBlockGroup.ListTop; this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower; } else { this.DestinationRect = new Rectangle(rectangle.Left, rectangle.Bottom - 10, rectangle.Width, 21); this.DestinationSide = PlotDragSide.Bottom; this.Destination.List = plotLayoutBlockGroup.ListBottom; this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower; } } } } else { rectangle = this.Destination.BoundsLayout; iRectangle iRectangle = new iRectangle(rectangle); if (this.Destination.Object != null && !this.Destination.Object.DockHorizontal) { iRectangle.Height /= 3; if (iRectangle.Rectangle.Contains(this.MousePoint)) { rectangle.Offset(0, -10); this.DestinationRect = rectangle; this.DestinationSide = PlotDragSide.Top; if (this.Destination.Object.DockTop) { this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Higher; } else { this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower; } } else { iRectangle.OffsetY(7); if (iRectangle.Rectangle.Contains(this.MousePoint)) { this.DestinationRect = rectangle; this.DestinationSide = PlotDragSide.Stack; this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Same; } else { rectangle.Offset(0, 10); this.DestinationRect = rectangle; this.DestinationSide = PlotDragSide.Bottom; if (this.Destination.Object.DockTop) { this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower; } else { this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Higher; } } } } else { iRectangle.Width /= 3; if (iRectangle.Rectangle.Contains(this.MousePoint)) { rectangle.Offset(-10, 0); this.DestinationRect = rectangle; this.DestinationSide = PlotDragSide.Left; if (this.Destination.Object.DockLeft) { this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Higher; } else { this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower; } } else { iRectangle.OffsetX(7); if (iRectangle.Rectangle.Contains(this.MousePoint)) { this.DestinationRect = rectangle; this.DestinationSide = PlotDragSide.Stack; this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Same; } else { rectangle.Offset(10, 0); this.DestinationRect = rectangle; this.DestinationSide = PlotDragSide.Right; if (this.Destination.Object != null && !this.Destination.Object.DockLeft) { this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Higher; } else { this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower; } } } } } }