public void PopupShowAsync(Point aLocation, HeapCell aCell, RawItem aItem, HeapStatistics aStats, Size aOffset, System.Windows.Forms.KeyEventHandler aKeyHandler) { //System.Diagnostics.Debug.WriteLine( "PopupBase - Timer Started" ); iKeyHandler = aKeyHandler; HeapCellArrayWithStatistics array = new HeapCellArrayWithStatistics(); array.Add(aCell); PrepareContent(array, aStats, aItem); // 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(); } }
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; } }