Exemplo n.º 1
0
 public void PrepareToNavigate(HeapRenderingNavigator aNavigator)
 {
     SelectionBorder.PrepareToNavigate(aNavigator);
     Header.PrepareToNavigate(aNavigator);
     Content.PrepareToNavigate(aNavigator);
     ContentBorder.PrepareToNavigate(aNavigator);
 }
Exemplo n.º 2
0
 public void PrepareToNavigate(HeapRenderingNavigator aNavigator)
 {
     iLargestRectangleCalculator = new HeapCellLargestRectangleCalculator(aNavigator, 1 /* skip first box, start at 2nd box which has index 1 */);
 }
Exemplo n.º 3
0
 public void PrepareToNavigate(HeapRenderingNavigator aNavigator)
 {
 }
        protected override void OnPaint(PaintEventArgs aArgs)
        {
            try
            {
                // First must measure the size of the header text as we need
                // this in order to layout the boxes. We cannot measure the text width
                // without a graphics object, hence we have to do that here. There must
                // be a better way?
                iHeaderTextWidth = iFactory.Renderers.Header.MeasureCellHeaderText(aArgs.Graphics);

                // Store our graphics object for later use
                iGraphics = aArgs.Graphics;

                // Make the navigator object that will help us lay out the cells
                HeapRenderingNavigator navigator = new HeapRenderingNavigator(Cells);

                // Queue events we want to receive
                navigator.iNavBegin        += new HeapCtrlLib.Utilities.HeapRenderingNavigator.NavBegin(Navigator_NavBegin);
                navigator.iNavEnd          += new HeapCtrlLib.Utilities.HeapRenderingNavigator.NavEnd(Navigator_NavEnd);
                navigator.iNavNewRowHeader += new HeapCtrlLib.Utilities.HeapRenderingNavigator.NavNewRowHeader(Navigator_NavNewRowHeader);
                navigator.iNavNewColumn    += new HeapCtrlLib.Utilities.HeapRenderingNavigator.NavNewColumn(Navigator_NavNewColumn);
                navigator.iNavHeapCellEnd  += new HeapCtrlLib.Utilities.HeapRenderingNavigator.NavHeapCellEnd(Navigator_NavHeapCellEnd);

                // The padding amount we apply around the entire control area in order to
                // center the data.
                Size centerAlignmentPadding = RowsAndColumnsRemainingPixelsDistributedEvenly;

                // The co-ordinates at which we will render a box (or header).
                Point startPos = new Point(centerAlignmentPadding.Width, centerAlignmentPadding.Height);

                // Tell the renderers we're about to start
                iFactory.Renderers.PrepareToNavigate(navigator);

                // Do it
                navigator.Navigate(iCellIndex, iCellAddress, iHeaderTextWidth, startPos, RowsAndColumns, CellBoxSize, CellPadding);

                // Draw link lines
                aArgs.Graphics.Clip = new Region(CellBoxRect);

                foreach (HeapCell cell in BreadcrumbCellsOutgoing)
                {
                    RelationshipManager relManager = cell.RelationshipManager;

                    // Draw embedded (outgoing) lines
                    foreach (RelationshipInfo outgoingRelationship in relManager.EmbeddedReferencesTo)
                    {
                        // Get coordinates of top left corner of the box for the specified
                        // address. If we have a clean link, we point right at the cell header.
                        // If not, then we point at the box in question within the target cell.
                        uint targetAddress = outgoingRelationship.FromCellRawItem.Data;
                        if (outgoingRelationship.IsCleanLink)
                        {
                            targetAddress = outgoingRelationship.ToCell.Address;
                        }
                        Point pixelPosEnd = AddressToPixelCoordinate(targetAddress);
                        pixelPosEnd += CellBoxSizeIncludingPaddingHalved;
                        Point pixelPosStart = AddressToPixelCoordinate(outgoingRelationship.FromCellRawItem.Address);
                        pixelPosStart += CellBoxSizeIncludingPaddingHalved;
                        //
                        Color outgoingPenColour = Color.FromArgb(120, 255, 0, 0);
                        using (Pen pen = new Pen(outgoingPenColour, 4.0f))
                        {
                            pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                            pen.EndCap    = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
                            //
                            aArgs.Graphics.DrawLine(pen, pixelPosStart, pixelPosEnd);
                        }
                    }
                }

                foreach (HeapCell cell in BreadcrumbCellsIncoming)
                {
                    RelationshipManager relManager = cell.RelationshipManager;

                    // Draw incoming links
                    foreach (HeapCell fromCell in relManager.ReferencedBy)
                    {
                        Point pixelPosStart = AddressToPixelCoordinate(fromCell.Address);
                        pixelPosStart += CellBoxSizeIncludingPaddingHalved;
                        Point pixelPosEnd = AddressToPixelCoordinate(cell.Address);
                        pixelPosEnd += CellBoxSizeIncludingPaddingHalved;
                        //
                        Color outgoingPenColour = Color.FromArgb(100, 0, 0, 255);
                        using (Pen pen = new Pen(outgoingPenColour, 4.0f))
                        {
                            pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                            pen.EndCap    = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
                            //
                            aArgs.Graphics.DrawLine(pen, pixelPosStart, pixelPosEnd);
                        }
                    }
                }
            }
            finally
            {
                iGraphics = null;
                base.OnPaint(aArgs);
            }
        }
 public void PrepareToNavigate(HeapRenderingNavigator aNavigator)
 {
     iLargestRectangleCalculator = new HeapCellLargestRectangleCalculator(aNavigator);
 }