public void PopupShowAsync(Point aLocation, HeapCellArrayWithStatistics aCells, HeapStatistics aStats, Size aOffset, System.Windows.Forms.KeyEventHandler aKeyHandler) { //System.Diagnostics.Debug.WriteLine( "PopupBase - Timer Started" ); iKeyHandler = aKeyHandler; PrepareContent(aCells, aStats); // iHoverPos = aLocation; // iShowPos = aLocation; iShowPos.Offset(aOffset.Width, aOffset.Height); // If we are using an async timer delay then we must start the timer and // when it expires, the popup will become visible. Otherwise, we show // the popup immediately. if (VisibilityDelay > 0) { iTimer.Stop(); iTimer.Enabled = true; iTimer.Start(); } else { PopupShow(); } }
public override void PrepareContent(HeapCellArrayWithStatistics aCells, HeapStatistics aStats, RawItem aRawItem) { try { System.Diagnostics.Debug.Assert(aCells.Count == 1); System.Diagnostics.Debug.Assert(aRawItem.Tag != null && aRawItem.Tag is RelationshipInfo); HeapCell cell = aCells[0]; RelationshipManager relMgr = cell.RelationshipManager; RelationshipInfo relInfo = (RelationshipInfo)aRawItem.Tag; // StringBuilder msg = new StringBuilder(); // msg.AppendFormat("This is an embedded reference to the cell at address 0x{0}", relInfo.ToCell.Address.ToString("x8")); if (relInfo.ToCell.Symbol != null) { msg.AppendFormat(", which is an instance of a {0} object.", relInfo.ToCell.SymbolString); } msg.Append(System.Environment.NewLine + System.Environment.NewLine); // msg.AppendFormat("In total, this cell references {0} other cell(s), and is referenced by {1} cell(s)", relMgr.EmbeddedReferencesTo.Count, relMgr.ReferencedBy.Count); msg.Append(System.Environment.NewLine + System.Environment.NewLine); // iLbl_Description.Text = msg.ToString(); } finally { base.PrepareContent(aCells, aStats, aRawItem); } }
public override void PopupShowAsyncImpl(HeapCellArrayWithStatistics aCells, HeapStatistics aStats, Point aLocalControlCoordinates, Point aScreenCoordinates, Size aOffsetBy, System.Windows.Forms.KeyEventHandler aKeyHandler) { PopupHide(); // if (aCells.Count == 1) { HeapCell cell = aCells[0]; // switch (cell.Type) { default: case HeapCell.TType.EAllocated: if (cell.Symbol != null) { iActivePopup = new PopupCellAllocatedSymbols(); } else { iActivePopup = new PopupCellAllocatedRaw(); } break; case HeapCell.TType.EFree: iActivePopup = new PopupCellFree(); break; } } else if (aCells.Count > 1) { iActivePopup = new PopupMultiCellSelection(); iActivePopup.VisibilityDelay = 0; } // iActivePopup.PopupShowAsync(aScreenCoordinates, aCells, aStats, aOffsetBy, aKeyHandler); }
public override void PrepareContent(HeapCellArrayWithStatistics aCells, HeapStatistics aStats) { try { HeapCell cell = aCells[0]; System.Diagnostics.Debug.Assert(cell.Type == HeapCell.TType.EAllocated); System.Diagnostics.Debug.Assert(cell.Symbol != null); RelationshipManager relMgr = cell.RelationshipManager; // TrackingInfo info = aStats.StatsAllocated.TrackerSymbols[cell.Symbol]; int instCount = info.AssociatedCellCount; // Title = instCount + " Instance(s)"; // StringBuilder msg = new StringBuilder(); // msg.AppendFormat("This allocated cell is an instance of {0} from {1}", cell.Symbol.NameWithoutVTablePrefix, cell.Symbol.ObjectWithoutSection); msg.Append(System.Environment.NewLine + System.Environment.NewLine); msg.AppendFormat("There {0} {1} instance{2} of this symbol, with each instance using {3} bytes of memory (plus cell header overhead).", (instCount == 0 || instCount > 1) ? "are" : "is", info.AssociatedCellCount, (instCount == 0 || instCount > 1) ? "s" : string.Empty, cell.PayloadLength); msg.Append(System.Environment.NewLine + System.Environment.NewLine); // msg.AppendFormat("In total, cells of this type use {0} bytes of heap memory", info.AssociatedMemory); msg.Append(System.Environment.NewLine + System.Environment.NewLine); // msg.AppendFormat("This cell references {0} other cell(s), and is referenced by {1} cell(s)", relMgr.EmbeddedReferencesTo.Count, relMgr.ReferencedBy.Count); msg.Append(System.Environment.NewLine + System.Environment.NewLine); // iLbl_Description.Text = msg.ToString(); } finally { base.PrepareContent(aCells, aStats); } }
public PageSimpleListing(HeapCellArrayWithStatistics aArray, Workbook aWorkbook, string aCaption, int aMasterCol, int aOtherCol) : base(aArray, aWorkbook, aCaption) { iMasterCol = aMasterCol; iOtherCol = aOtherCol; iMakeStats = true; }
public PageBase(HeapCellArrayWithStatistics aArray, Workbook aWorkbook, string aSheetName) { iArray = aArray; iWorkbook = aWorkbook; iWorksheet = (Worksheet)iWorkbook.Sheets.Add(iWorkbook.Sheets.get_Item(1), Type.Missing, 1, XlSheetType.xlWorksheet); iWorksheet.Name = aSheetName; }
public void PopupShowAsync(HeapCellArrayWithStatistics aCells, HeapStatistics aStats, Point aLocalControlCoordinates, Point aScreenCoordinates, Size aOffsetBy, System.Windows.Forms.KeyEventHandler aKeyHandler) { lock (this) { PopupShowAsyncImpl(aCells, aStats, aLocalControlCoordinates, aScreenCoordinates, aOffsetBy, aKeyHandler); } }
public override void PrepareContent(HeapCellArrayWithStatistics aCells, HeapStatistics aStats) { try { HeapCell cell = aCells[0]; System.Diagnostics.Debug.Assert(cell.Type == HeapCell.TType.EFree); // StringBuilder msg = new StringBuilder(); // msg.AppendFormat("This free cell has a {0} byte header and a is occupying a total of {1} byte(s) of heap space.", cell.HeaderSize, cell.Length); msg.Append(System.Environment.NewLine + System.Environment.NewLine); // msg.AppendFormat("In total, this heap contains {0} bytes of free space.", aStats.StatsFree.TypeSize); msg.Append(System.Environment.NewLine + System.Environment.NewLine); // if (cell.Symbol != null) { // Free cells can contain symbols if we attempt to decode them... msg.AppendFormat("The free cell may have originally been of type \"{0}.\"", cell.SymbolString); msg.Append(System.Environment.NewLine + System.Environment.NewLine); } // iLbl_Description.Text = msg.ToString(); } finally { base.PrepareContent(aCells, aStats); } }
public override void PrepareContent(HeapCellArrayWithStatistics aCells, HeapStatistics aStats) { try { Title = aCells.Count + " Cells Selected"; StringBuilder msg = new StringBuilder(); // if (aCells.Statistics.StatsAllocated.TypeCount > 0) { msg.AppendFormat("Selection contains {0} allocated cell{1}", aCells.Statistics.StatsAllocated.TypeCount, (aCells.Statistics.StatsAllocated.TypeCount == 1) ? string.Empty : "s"); if (aCells.Statistics.StatsAllocated.TrackerDescriptors.AssociatedCellCount > 0) { msg.AppendFormat(", {0} descriptor{1}", aCells.Statistics.StatsAllocated.TrackerDescriptors.AssociatedCellCount, (aCells.Statistics.StatsAllocated.TrackerDescriptors.AssociatedCellCount == 1) ? string.Empty : "s"); } if (aCells.Statistics.StatsAllocated.TrackerSymbols.Count > 0) { msg.AppendFormat(" and {0} symbol instance{1}", aCells.Statistics.StatsAllocated.TrackerSymbols.Count, (aCells.Statistics.StatsAllocated.TrackerSymbols.Count == 1) ? string.Empty : "s"); msg.AppendFormat(" from {0} different object{1}", aCells.Statistics.StatsAllocated.TrackerObjects.Count, (aCells.Statistics.StatsAllocated.TrackerObjects.Count == 1) ? string.Empty : "s"); } msg.Append("."); msg.Append(System.Environment.NewLine + System.Environment.NewLine); if (aCells.Statistics.StatsAllocated.CellSmallest != null) { msg.AppendFormat("The smallest allocated cell is {0} bytes long. ", aCells.Statistics.StatsAllocated.CellSmallest.Length); } if (aCells.Statistics.StatsAllocated.CellLargest != null && (aCells.Statistics.StatsAllocated.CellSmallest.Address != aCells.Statistics.StatsAllocated.CellLargest.Address)) { msg.AppendFormat("The largest allocated cell is {0} bytes long. ", aCells.Statistics.StatsAllocated.CellLargest.Length); } msg.Append(System.Environment.NewLine + System.Environment.NewLine); } if (aCells.Statistics.StatsFree.TypeCount > 0) { msg.AppendFormat("Selection contains {0} free cell{1}", aCells.Statistics.StatsFree.TypeCount, (aCells.Statistics.StatsFree.TypeCount == 1) ? string.Empty : "s"); msg.Append("."); msg.Append(System.Environment.NewLine + System.Environment.NewLine); if (aCells.Statistics.StatsFree.CellSmallest != null) { msg.AppendFormat("The smallest free cell is {0} bytes long. ", aCells.Statistics.StatsFree.CellSmallest.Length); } if (aCells.Statistics.StatsFree.CellLargest != null && (aCells.Statistics.StatsFree.CellSmallest.Address != aCells.Statistics.StatsFree.CellLargest.Address)) { msg.AppendFormat("The largest free cell is {0} bytes long. ", aCells.Statistics.StatsFree.CellLargest.Length); } } iLbl_Description.Text = msg.ToString(); } finally { base.PrepareContent(aCells, aStats); } }
public void PopupRelocate(HeapCellArrayWithStatistics aCells, HeapStatistics aStats, Point aLocalControlCoordiantes, Point aScreenCoordinates, Size aOffsetBy) { if (iActivePopup != null && Visible) { lock (this) { iActivePopup.PopupRelocate(aScreenCoordinates, aCells, aStats, aOffsetBy); } } }
private void AsyncShowPopup(HeapCellArrayWithStatistics aCells, Point aPos, RawItem aRawItem) { if (iFactory.PopupManager.SupportsRawItemInfo && aRawItem != null && aRawItem.Tag != null && aRawItem.Tag is RelationshipInfo && aCells.Count == 1) { HeapCell cell = aCells[0]; iFactory.PopupManager.PopupShowAsync(cell, aRawItem, Reconstructor.Statistics, aPos, PointToScreen(aPos), CellBoxSizeIncludingPadding, new KeyEventHandler(HeapDataRenderer_KeyDown)); } else { iFactory.PopupManager.PopupShowAsync(aCells, Reconstructor.Statistics, aPos, PointToScreen(aPos), CellBoxSizeIncludingPadding, new KeyEventHandler(HeapDataRenderer_KeyDown)); } iMouseHoverPosition = aPos; }
public override void PopupShowAsyncImpl(HeapCellArrayWithStatistics aCells, HeapStatistics aStats, Point aLocalControlCoordinates, Point aScreenCoordinates, Size aCellBoxSizeIncludingPadding, System.Windows.Forms.KeyEventHandler aKeyHandler) { PopupHide(); // if (aCells.Count == 1) { HeapCell cell = aCells[0]; // If there's a free cell with a symbol (possible, if the user wanted to decode free cell contents) // then we should just display the allocated symbol popup (even though it's a free cell!) if (cell.Symbol != null) { if (cell.Type == HeapCell.TType.EFree) { int x = 0; x++; } iActivePopup = new PopupCellAllocatedSymbols(); } else if (cell.Type == HeapCell.TType.EAllocated) { iActivePopup = new PopupCellAllocatedRaw(); } else if (cell.Type == HeapCell.TType.EFree) { iActivePopup = new PopupCellFree(); } iActivePopup.ColourFromHoverCoordinate = true; } else if (aCells.Count > 1) { iActivePopup = new PopupMultiCellSelection(); iActivePopup.VisibilityDelay = 0; } // iActivePopup.PopupShowAsync(aScreenCoordinates, aCells, aStats, aCellBoxSizeIncludingPadding, aKeyHandler); }
public void PopupRelocate(Point aLocation, HeapCellArrayWithStatistics aCells, HeapStatistics aStats, Size aOffset) { PrepareContent(aCells, aStats); Invalidate(); iShowPos = aLocation; iShowPos.Offset(aOffset.Width, aOffset.Height); // Get the screen size Rectangle rect = Screen.GetWorkingArea(this); // Make sure that the popup is displayed within the screen bounds. Point pos = iShowPos; if (iShowPos.X + this.Width > rect.Right) { pos.X = rect.Width - this.Width; } if (iShowPos.Y + this.Height > rect.Bottom) { pos.Y = rect.Bottom - this.Height; } Location = pos; }
private void HeapDataRenderer_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (Cells.Count > 0) { Point mousePos = new Point(e.X, e.Y); HeapCell cell = CellByPosition(mousePos); // if (cell != null) { // Also try to get the raw item associated with the hover position. This can // also return null. RawItem rawItem = RawItemByPixelPos(mousePos); // Now process the mouse movement if (iMouseSelectionCell != null) { int mouseBoundStart = (int)iMouseSelectionCell.Tag; int mouseBoundLower = (int)iMouseSelectionCellBoundaryLower.Tag; int mouseBoundUpper = (int)iMouseSelectionCellBoundaryUpper.Tag; int originalSelectionRangeCount = (mouseBoundUpper - mouseBoundLower); int index = CellIndex(cell); if (index < mouseBoundStart) { // Reset upper boundary iMouseSelectionCellBoundaryUpper = iMouseSelectionCell; iMouseSelectionCellBoundaryLower = cell; iMouseSelectionCellBoundaryLower.Tag = index; } else if (index > mouseBoundStart) { // Reset lower boundary iMouseSelectionCellBoundaryLower = iMouseSelectionCell; iMouseSelectionCellBoundaryUpper = cell; iMouseSelectionCellBoundaryUpper.Tag = index; } else if (index == mouseBoundStart) { iMouseSelectionCellBoundaryUpper = iMouseSelectionCell; iMouseSelectionCellBoundaryLower = iMouseSelectionCell; } // Update boundary mouseBoundLower = (int)iMouseSelectionCellBoundaryLower.Tag; mouseBoundUpper = (int)iMouseSelectionCellBoundaryUpper.Tag; // Work out if this is a multi-select scenario int selectionRangeCount = mouseBoundUpper - mouseBoundLower; bool selectionHasChanged = (selectionRangeCount != originalSelectionRangeCount); if (selectionHasChanged && Math.Abs(selectionRangeCount) + 1 > 1) { // Build array of selected cells HeapCellArrayWithStatistics cells = new HeapCellArrayWithStatistics(); for (index = mouseBoundLower; index <= mouseBoundUpper; index++) { cell = Cells[index]; cells.Add(cell); } // Show popup bool popupVisible = iFactory.PopupManager.Visible; Point pos = new Point(e.X, e.Y); if (!popupVisible || !(e.X == iMouseHoverPosition.X && e.Y == iMouseHoverPosition.Y)) { if (!popupVisible) { //System.Diagnostics.Debug.WriteLine( "Mouse MOVE - MS [popup not vis], Differing Coords: [ " + e.X + ", " + e.Y + " ] -> Popup Show" ); AsyncShowPopup(cells, pos, rawItem); } else { //System.Diagnostics.Debug.WriteLine( "Mouse MOVE - MS [popup visible], Differing Coords: [ " + e.X + ", " + e.Y + " ] -> Popup Already Shown" ); iMouseHoverPosition = pos; iFactory.PopupManager.PopupRelocate(cells, Reconstructor.Statistics, pos, PointToScreen(pos), CellBoxSizeIncludingPadding); } } else if (!popupVisible) { //System.Diagnostics.Debug.WriteLine( "Mouse MOVE - MS [popup not vis], Differing Coords: [ " + e.X + ", " + e.Y + " ] -> Popup Show" ); AsyncShowPopup(cells, pos, rawItem); } } else if (selectionHasChanged) { //System.Diagnostics.Debug.WriteLine( "Mouse MOVE - Have Existing Selection: [ " + e.X + ", " + e.Y + " ] -> Single Item Hover" ); iFactory.PopupManager.PopupHide(); } } else { if (iFactory.PopupManager.Visible) { if (!(e.X == iMouseHoverPosition.X && e.Y == iMouseHoverPosition.Y)) { //System.Diagnostics.Debug.WriteLine( "Mouse MOVE: [ " + e.X + ", " + e.Y + " ] -> Popup Hidden" ); iFactory.PopupManager.PopupHide(); } } else if (!(e.X == iMouseHoverPosition.X && e.Y == iMouseHoverPosition.Y)) { //System.Diagnostics.Debug.WriteLine( "Mouse MOVE: [ " + e.X + ", " + e.Y + " ] -> Popup Show Async" ); Point pos = new Point(e.X, e.Y); HeapCellArrayWithStatistics cells = new HeapCellArrayWithStatistics(); cells.Add(cell); AsyncShowPopup(cells, pos, rawItem); } } // Invalidate(); } // iFocusedCellMouse = cell; } }
public override void PopupShowAsyncImpl(HeapCellArrayWithStatistics aCells, HeapStatistics aStats, Point aLocalControlCoordinates, Point aScreenCoordinates, Size aCellBoxSizeIncludingPadding, System.Windows.Forms.KeyEventHandler aKeyHandler) { base.PopupShowAsyncImpl(aCells, aStats, aLocalControlCoordinates, aScreenCoordinates, aCellBoxSizeIncludingPadding, aKeyHandler); }
public override void PrepareContent(HeapCellArrayWithStatistics aCells, HeapStatistics aStats) { System.Diagnostics.Debug.Assert(aCells.Count == 1); // try { HeapCell cell = aCells[0]; System.Diagnostics.Debug.Assert(cell.Type == HeapCell.TType.EAllocated); int descriptorLength = 0; if (cell.IsDescriptor) { descriptorLength = cell.DescriptorLength; string title = "[ASCII] Des. Len: ["; if (cell.IsDescriptorUnicode) { title = "[UNICD] Des. Len: ["; } // this.Title = title + descriptorLength.ToString("d6") + "]"; } // Data values & characterised data int labelNumber = 0; int itemIndex = 0; foreach (RawItem item in cell) { // Build the names of the labels we will adjust labelNumber = (itemIndex / KNumberOfLabelRows) + 1; string labelNameValues = KLabelValuesPrefix + labelNumber.ToString("d1"); string labelNameChars = KLabelCharsPrefix + labelNumber.ToString("d1"); // Get the label object by name System.Windows.Forms.Label labelValues = LabelByName(labelNameValues); System.Windows.Forms.Label labelChars = LabelByName(labelNameChars); // Reset contents if first time we have populated the label if (labelValues == null || labelChars == null) { break; } else if ((itemIndex % KNumberOfLabelRows == 0) || itemIndex == 0) { labelValues.Text = string.Empty; labelChars.Text = string.Empty; labelValues.Visible = true; labelChars.Visible = true; } // Add new data to the label labelValues.Text += item.Data.ToString("x8") + " "; if (cell.IsDescriptor) { labelChars.Text += item.OriginalCharacterisedData; } else { labelChars.Text += item.CharacterisedData; } // Next item ++itemIndex; } // Reduce height of form based upon usage of labels int unusedLabelHeight = iLbl_Values1.Height * (KNumberOfLabelRows - Math.Min(KNumberOfLabelRows, labelNumber)); int formHeight = this.Height; int newFormHeight = formHeight - unusedLabelHeight; // Hide unused items for (++labelNumber; labelNumber <= KNumberOfLabelRows; labelNumber++) { // Build the names of the labels we will adjust string labelNameValues = KLabelValuesPrefix + labelNumber.ToString("d1"); string labelNameChars = KLabelCharsPrefix + labelNumber.ToString("d1"); System.Windows.Forms.Label labelValues = LabelByName(labelNameValues); labelValues.Visible = false; System.Windows.Forms.Label labelChars = LabelByName(labelNameChars); labelChars.Visible = false; } // Set final height base.Height = newFormHeight; } finally { base.PrepareContent(aCells, aStats); } }
public PageSimpleListing(HeapCellArrayWithStatistics aArray, Workbook aWorkbook, string aCaption, bool aMakeStats) : this(aArray, aWorkbook, aCaption, 1, 2) { iMakeStats = aMakeStats; }
public PageSimpleListing(HeapCellArrayWithStatistics aArray, Workbook aWorkbook, string aCaption) : this(aArray, aWorkbook, aCaption, true) { }
public virtual void PrepareContent(HeapCellArrayWithStatistics aCells, HeapStatistics aStats, RawItem aRawItem) { PrepareContent(aCells, aStats); }
public virtual void PrepareContent(HeapCellArrayWithStatistics aCells, HeapStatistics aStats) { // Set title and border colour HeapCell firstCell = aCells[0]; ColourTitle = HeapCtrlLib.Renderers.Utilities.HeapCellRendererColour.ColourByCellType(firstCell); ColourBorder = ColourUtils.Darken(ColourTitle); // Get stats long lengthPayload = aCells.Statistics.SizeTotalPayload; long lengthHeader = aCells.Statistics.SizeTotalHeader; float lengthsAsHeapPercentage = aStats.CellLengthAsHeapPercentage(lengthHeader + lengthPayload); // Header length iLbl_Title_Length_Header.Text = "H: [" + lengthHeader.ToString("d6") + "]"; // Payload length iLbl_Title_Length_Payload.Text = "P: [" + lengthPayload.ToString("d8") + "]"; // Set cell allocation number (for allocated cells) or then // the cell index for free cells. string heapSpecificPrefix = "H: "; if (aCells.Count == 1) { float lengthsAsTypePercentage = aStats.CellLengthAsTypePercentage(firstCell); // string typeSpecificPrefix = "A: "; if (firstCell.Type == HeapCell.TType.EFree) { typeSpecificPrefix = "F: "; } // if (HeapCell.IsDebugAllocator) { switch (firstCell.Type) { case HeapCell.TType.EAllocated: iLbl_Footer.Text = "Alloc #: [" + firstCell.AllocationNumber.ToString("d6") + " / " + aStats.StatsAllocated.CellAllocationNumberLargest.AllocationNumber.ToString("d6") + "]"; break; case HeapCell.TType.EFree: iLbl_Footer.Text = "Free cell #: [" + firstCell.AllocationNumber.ToString("d4") + " / " + aStats.StatsFree.TypeCount.ToString("d4") + "]"; break; } } else { iLbl_Footer.Text = "[ " + firstCell.Address.ToString("x8") + " ]"; } // iLbl_Footer_Percentage_OfType.Text = typeSpecificPrefix + "[" + lengthsAsTypePercentage.ToString("#00.00") + "%]"; } else { heapSpecificPrefix = "Of Heap: "; iLbl_Footer.Text = string.Empty; iLbl_Footer_Percentage_OfType.Visible = false; } // iLbl_Footer_Percentage_OfTotal.Text = heapSpecificPrefix + "[" + lengthsAsHeapPercentage.ToString("#00.00") + "%]"; }
public PageUnique(HeapReconstructor aReconstructor, HeapCellArrayWithStatistics aArray, Workbook aWorkbook, string aCaption, int aMasterCol, int aOtherCol) : base(aArray, aWorkbook, aCaption, aMasterCol, aOtherCol) { iReconstructor = aReconstructor; }
public PageUnchanged(HeapCellArrayWithStatistics aArray, Workbook aWorkbook) : base(aArray, aWorkbook, "Unchanged") { }