Debugger: Memory viewer - Allow word wrapping in label tooltips (prevents content from being cut off entirely) + improved popup display location
This commit is contained in:
parent
9666426dc1
commit
d966fd50c1
5 changed files with 22 additions and 6 deletions
|
@ -419,17 +419,18 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
set { this.ctrlHexBox.ByteEditingMode = value; }
|
||||
}
|
||||
|
||||
public delegate void ByteMouseHoverHandler(int address);
|
||||
public delegate void ByteMouseHoverHandler(int address, Point position);
|
||||
public event ByteMouseHoverHandler ByteMouseHover;
|
||||
private void ctrlHexBox_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
BytePositionInfo bpi = ctrlHexBox.GetHexBytePositionInfo(e.Location);
|
||||
ByteMouseHover?.Invoke((int)bpi.Index);
|
||||
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)));
|
||||
}
|
||||
|
||||
private void ctrlHexBox_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
ByteMouseHover?.Invoke(-1);
|
||||
ByteMouseHover?.Invoke(-1, Point.Empty);
|
||||
}
|
||||
|
||||
private void UpdateLocationLabel()
|
||||
|
|
|
@ -2953,6 +2953,17 @@ namespace Be.Windows.Forms
|
|||
UpdateScrollSize();
|
||||
}
|
||||
|
||||
public Point GetBytePosition(long byteIndex)
|
||||
{
|
||||
if(byteIndex < _startByte) {
|
||||
return Point.Empty;
|
||||
}
|
||||
|
||||
Point gp = GetGridBytePoint(byteIndex - _startByte);
|
||||
PointF pos = GetBytePointF(gp);
|
||||
return this.PointToScreen(new Point((int)pos.X, (int)pos.Y));
|
||||
}
|
||||
|
||||
PointF GetBytePointF(long byteIndex)
|
||||
{
|
||||
Point gp = GetGridBytePoint(byteIndex);
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
if(!this.Visible) {
|
||||
this._parentContainedFocus = focusTarget.ContainsFocus;
|
||||
this.Location = _requestedLocation;
|
||||
UpdateLocation();
|
||||
this.Show();
|
||||
} else {
|
||||
UpdateLocation();
|
||||
|
|
|
@ -93,6 +93,10 @@ namespace Mesen.GUI.Debugger
|
|||
}
|
||||
tlpMain.ResumeLayout();
|
||||
this.Width = this.tlpMain.Width;
|
||||
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.Height = this.tlpMain.Height;
|
||||
this.BringToFront();
|
||||
|
||||
|
|
|
@ -558,7 +558,7 @@ namespace Mesen.GUI.Debugger
|
|||
private frmCodeTooltip _tooltip = null;
|
||||
private CodeLabel _lastLabelTooltip = null;
|
||||
private int _lastTooltipAddress = -1;
|
||||
private void ctrlHexViewer_ByteMouseHover(int address)
|
||||
private void ctrlHexViewer_ByteMouseHover(int address, Point position)
|
||||
{
|
||||
if(address < 0 || !mnuShowLabelInfoOnMouseOver.Checked) {
|
||||
if(_tooltip != null) {
|
||||
|
@ -622,7 +622,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
_tooltip = new frmCodeTooltip(this, values);
|
||||
_tooltip.FormClosed += (s, evt) => { _tooltip = null; };
|
||||
_tooltip.SetFormLocation(new Point(Cursor.Position.X + 10, Cursor.Position.Y + 10), ctrlHexViewer);
|
||||
_tooltip.SetFormLocation(new Point(position.X, position.Y), ctrlHexViewer);
|
||||
_lastLabelTooltip = label;
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue