Debugger: Memory viewer - Fixed some usability issues with tooltips

-Tooltips now always show up even if trying to show the last tooltip shown
-Tooltips no longer appear for the next row of bytes when putting mouse over the text view
This commit is contained in:
Sour 2018-12-26 00:55:46 -05:00
parent d966fd50c1
commit 6c27a273b2
4 changed files with 20 additions and 4 deletions

View file

@ -423,9 +423,13 @@ namespace Mesen.GUI.Debugger.Controls
public event ByteMouseHoverHandler ByteMouseHover;
private void ctrlHexBox_MouseMove(object sender, MouseEventArgs e)
{
BytePositionInfo bpi = ctrlHexBox.GetHexBytePositionInfo(e.Location);
Point position = ctrlHexBox.GetBytePosition(bpi.Index);
ByteMouseHover?.Invoke((int)bpi.Index, new Point(position.X + (int)(ctrlHexBox.CharSize.Width * 2.5), position.Y + (int)(ctrlHexBox.CharSize.Height * 1.1)));
BytePositionInfo? bpi = ctrlHexBox.GetRestrictedHexBytePositionInfo(e.Location);
if(bpi.HasValue) {
Point position = ctrlHexBox.GetBytePosition(bpi.Value.Index);
ByteMouseHover?.Invoke((int)bpi.Value.Index, new Point(position.X + (int)(ctrlHexBox.CharSize.Width * 2.5), position.Y + (int)(ctrlHexBox.CharSize.Height * 1.1)));
} else {
ByteMouseHover?.Invoke(-1, Point.Empty);
}
}
private void ctrlHexBox_MouseLeave(object sender, EventArgs e)

View file

@ -1829,6 +1829,15 @@ namespace Be.Windows.Forms
return;
}
internal BytePositionInfo? GetRestrictedHexBytePositionInfo(Point p)
{
if(_recHex.Contains(p) && p.X < _recHex.Left + (HorizontalByteCount * 3 - 1) * _charSize.Width) {
//Only return the position if the mouse is over a hex digit
return GetHexBytePositionInfo(p);
}
return null;
}
BytePositionInfo? GetBytePositionInfo(Point p)
{
if(_recHex.Contains(p)) {

View file

@ -96,6 +96,7 @@ namespace Mesen.GUI.Debugger
if(this.Location.X + this.Width > _parentForm.ClientSize.Width) {
int maxWidth = _parentForm.ClientSize.Width - this.Location.X - 10;
this.tlpMain.MaximumSize = new Size(maxWidth, _parentForm.ClientSize.Height - 10);
this.MaximumSize = new Size(maxWidth, _parentForm.ClientSize.Height - 10);
}
this.Height = this.tlpMain.Height;
this.BringToFront();

View file

@ -564,6 +564,7 @@ namespace Mesen.GUI.Debugger
if(_tooltip != null) {
_tooltip.Close();
_lastLabelTooltip = null;
_lastTooltipAddress = -1;
}
return;
}
@ -629,6 +630,7 @@ namespace Mesen.GUI.Debugger
if(_tooltip != null) {
_tooltip.Close();
_lastLabelTooltip = null;
_lastTooltipAddress = -1;
}
}
}