diff --git a/GUI.NET/Config/DebugInfo.cs b/GUI.NET/Config/DebugInfo.cs index f3365bd7..595b3c1b 100644 --- a/GUI.NET/Config/DebugInfo.cs +++ b/GUI.NET/Config/DebugInfo.cs @@ -236,6 +236,7 @@ namespace Mesen.GUI.Config public bool RamAutoRefresh = true; public RefreshSpeed RamAutoRefreshSpeed = RefreshSpeed.Normal; public bool RamIgnoreRedundantWrites = false; + public bool RamHighlightCurrentRowColumn = true; public int RamColumnCount = 2; public string RamFontFamily = BaseControl.MonospaceFontFamily; diff --git a/GUI.NET/Debugger/Controls/ctrlHexViewer.cs b/GUI.NET/Debugger/Controls/ctrlHexViewer.cs index 719b7f8e..588e548f 100644 --- a/GUI.NET/Debugger/Controls/ctrlHexViewer.cs +++ b/GUI.NET/Debugger/Controls/ctrlHexViewer.cs @@ -32,6 +32,7 @@ namespace Mesen.GUI.Debugger.Controls this.ctrlHexBox.ShadowSelectionColor = Color.FromArgb(100, 60, 128, 200); this.ctrlHexBox.InfoBackColor = Color.FromArgb(235, 235, 235); this.ctrlHexBox.InfoForeColor = Color.Gray; + this.ctrlHexBox.HighlightCurrentRowColumn = true; } protected override void OnLoad(EventArgs e) @@ -420,6 +421,13 @@ namespace Mesen.GUI.Debugger.Controls set { this.ctrlHexBox.ByteEditingMode = value; } } + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool HighlightCurrentRowColumn + { + get { return this.ctrlHexBox.HighlightCurrentRowColumn; } + set { this.ctrlHexBox.HighlightCurrentRowColumn = value; } + } + public delegate void ByteMouseHoverHandler(int address, Point position); public event ByteMouseHoverHandler ByteMouseHover; private void ctrlHexBox_MouseMove(object sender, MouseEventArgs e) diff --git a/GUI.NET/Debugger/HexBox/HexBox.cs b/GUI.NET/Debugger/HexBox/HexBox.cs index 8d83cd96..af2d1f75 100644 --- a/GUI.NET/Debugger/HexBox/HexBox.cs +++ b/GUI.NET/Debugger/HexBox/HexBox.cs @@ -2442,6 +2442,8 @@ namespace Be.Windows.Forms r.Exclude(_recContent); e.Graphics.ExcludeClip(r); + e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.Default; + UpdateVisibilityBytes(); if(_caretVisible && _keyInterpreter.GetType() != typeof(StringKeyInterpreter)) { @@ -2450,16 +2452,16 @@ namespace Be.Windows.Forms e.Graphics.FillRectangle(Brushes.Yellow, _caretPos.X - 1, _caretPos.Y, caretWidth, caretHeight); } - if (_lineInfoVisible) - PaintLineInfo(e.Graphics, _startByte, _endByte); - PaintHexAndStringView(e.Graphics, _startByte, _endByte); if (_shadowSelectionVisible && _stringViewVisible) PaintCurrentBytesSign(e.Graphics); - - if (_columnInfoVisible) + + if(_lineInfoVisible) + PaintLineInfo(e.Graphics, _startByte, _endByte); + if(_columnInfoVisible) PaintHeaderRow(e.Graphics); - if (_groupSeparatorVisible) + + if(_groupSeparatorVisible) PaintColumnSeparator(e.Graphics); if(_caretVisible && _keyInterpreter.GetType() != typeof(StringKeyInterpreter)) { @@ -2483,6 +2485,7 @@ namespace Be.Windows.Forms g.FillRectangle(backBrush, _recLineInfo.X-4, _recLineInfo.Y, _recLineInfo.Width, _recLineInfo.Height); + Point gp = GetGridBytePoint(_bytePos - _startByte); for(int i = 0; i < maxLine; i++) { long firstLineByte = (startByte + (_iHexMaxHBytes) * i) + _lineInfoOffset; @@ -2496,6 +2499,13 @@ namespace Be.Windows.Forms formattedInfo = new string('~', LineInfoCharCount); } + if(gp.Y == i && _highlightCurrentRowColumn && !(_keyInterpreter is StringKeyInterpreter)) { + using(SolidBrush highlightBrush = new SolidBrush(Color.FromArgb(15, 0, 0, 0))) { + g.FillRectangle(highlightBrush, _recHex.X, bytePointF.Y, _recHex.Width - (int)(_charSize.Width*2.5), _charSize.Height); + } + g.FillRectangle(Brushes.White, _recLineInfo.X - 4, bytePointF.Y, _recLineInfo.Width, _charSize.Height); + } + g.DrawString(formattedInfo, Font, brush, new PointF(_recLineInfo.X, bytePointF.Y), _stringFormat); } } @@ -2507,6 +2517,18 @@ namespace Be.Windows.Forms using(Brush brush = new SolidBrush(this.InfoForeColor)) { using(Brush backBrush = new SolidBrush(this.InfoBackColor)) { g.FillRectangle(backBrush, 0, 0, this.ClientRectangle.Width, _recLineInfo.Y); + + if(_highlightCurrentRowColumn && !(_keyInterpreter is StringKeyInterpreter)) { + Point gp = GetGridBytePoint(_bytePos - _startByte); + PointF bytePointF = GetBytePointF(gp); + float columnLeft = _recColumnInfo.Left + _charSize.Width * gp.X * 3 - _charSize.Width / 2; + using(SolidBrush highlightBrush = new SolidBrush(Color.FromArgb(15, 0, 0, 0))) { + g.FillRectangle(highlightBrush, columnLeft, _recHex.Y, _charSize.Width * 3, bytePointF.Y - _recHex.Y); + g.FillRectangle(highlightBrush, columnLeft, bytePointF.Y + _charSize.Height, _charSize.Width * 3, _recHex.Height - (bytePointF.Y - _recHex.Y) - _charSize.Height); + } + g.FillRectangle(Brushes.White, columnLeft, 0, _charSize.Width * 3, _recLineInfo.Y); + } + for(int col = 0; col < _iHexMaxHBytes; col++) { PaintColumnInfo(g, (byte)col, brush, col); } @@ -2824,7 +2846,6 @@ namespace Be.Windows.Forms } } - g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.GammaCorrected; g.DrawImage(bitmap, rec.Left, rec.Top); } @@ -3262,12 +3283,7 @@ namespace Be.Windows.Forms if (_byteProvider == value) return; - if(_keyInterpreter == null) { - if(value == null) - ActivateEmptyKeyInterpreter(); - else - ActivateKeyInterpreter(); - } + ActivateKeyInterpreter(); if (_byteProvider != null) _byteProvider.LengthChanged -= new EventHandler(_byteProvider_LengthChanged); @@ -3292,11 +3308,6 @@ namespace Be.Windows.Forms SetPosition(0, 0); SetSelectionLength(0); } - - if (_caretVisible) - UpdateCaret(); - else - CreateCaret(); } CheckCurrentLineChanged(); @@ -3309,6 +3320,11 @@ namespace Be.Windows.Forms UpdateVisibilityBytes(); UpdateRectanglePositioning(); + if(_caretVisible) + UpdateCaret(); + else + CreateCaret(); + Invalidate(); } } @@ -3514,7 +3530,18 @@ namespace Be.Windows.Forms Invalidate(); } } long _selectionLength; - + + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool HighlightCurrentRowColumn + { + get { return _highlightCurrentRowColumn; } + set + { + _highlightCurrentRowColumn = value; + Invalidate(); + } + } + bool _highlightCurrentRowColumn; /// /// Gets or sets the info color used for column info and line info. When this property is null, then ForeColor property is used. diff --git a/GUI.NET/Debugger/frmMemoryViewer.Designer.cs b/GUI.NET/Debugger/frmMemoryViewer.Designer.cs index 64f31a4d..b72b2501 100644 --- a/GUI.NET/Debugger/frmMemoryViewer.Designer.cs +++ b/GUI.NET/Debugger/frmMemoryViewer.Designer.cs @@ -59,6 +59,7 @@ this.mnuCustomFadeSpeed = new System.Windows.Forms.ToolStripMenuItem(); this.dataTypeHighlightingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mnuHighlightLabelledBytes = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuHighlightBreakpoints = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripSeparator(); this.mnuHighlightCodeBytes = new System.Windows.Forms.ToolStripMenuItem(); this.mnuHighlightDataBytes = new System.Windows.Forms.ToolStripMenuItem(); @@ -109,7 +110,7 @@ this.ctrlMemoryAccessCounters = new Mesen.GUI.Debugger.Controls.ctrlMemoryAccessCounters(); this.tpgProfiler = new System.Windows.Forms.TabPage(); this.ctrlProfiler = new Mesen.GUI.Debugger.Controls.ctrlProfiler(); - this.mnuHighlightBreakpoints = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuHighlightCurrentRowColumn = new System.Windows.Forms.ToolStripMenuItem(); this.flowLayoutPanel1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.tabMain.SuspendLayout(); @@ -258,7 +259,8 @@ this.toolStripMenuItem10, this.mnuIgnoreRedundantWrites, this.mnuEnablePerByteNavigation, - this.mnuByteEditingMode}); + this.mnuByteEditingMode, + this.mnuHighlightCurrentRowColumn}); this.mnuView.Name = "mnuView"; this.mnuView.Size = new System.Drawing.Size(44, 20); this.mnuView.Text = "View"; @@ -383,6 +385,14 @@ this.mnuHighlightLabelledBytes.Text = "Labeled bytes"; this.mnuHighlightLabelledBytes.Click += new System.EventHandler(this.mnuColorProviderOptions_Click); // + // mnuHighlightBreakpoints + // + this.mnuHighlightBreakpoints.CheckOnClick = true; + this.mnuHighlightBreakpoints.Name = "mnuHighlightBreakpoints"; + this.mnuHighlightBreakpoints.Size = new System.Drawing.Size(236, 22); + this.mnuHighlightBreakpoints.Text = "Breakpoints"; + this.mnuHighlightBreakpoints.Click += new System.EventHandler(this.mnuColorProviderOptions_Click); + // // toolStripMenuItem8 // this.toolStripMenuItem8.Name = "toolStripMenuItem8"; @@ -790,13 +800,13 @@ this.ctrlProfiler.Size = new System.Drawing.Size(606, 343); this.ctrlProfiler.TabIndex = 0; // - // mnuHighlightBreakpoints + // mnuHighlightCurrentRowColumn // - this.mnuHighlightBreakpoints.CheckOnClick = true; - this.mnuHighlightBreakpoints.Name = "mnuHighlightBreakpoints"; - this.mnuHighlightBreakpoints.Size = new System.Drawing.Size(236, 22); - this.mnuHighlightBreakpoints.Text = "Breakpoints"; - this.mnuHighlightBreakpoints.Click += new System.EventHandler(this.mnuColorProviderOptions_Click); + this.mnuHighlightCurrentRowColumn.CheckOnClick = true; + this.mnuHighlightCurrentRowColumn.Name = "mnuHighlightCurrentRowColumn"; + this.mnuHighlightCurrentRowColumn.Size = new System.Drawing.Size(256, 22); + this.mnuHighlightCurrentRowColumn.Text = "Highlight current row/column"; + this.mnuHighlightCurrentRowColumn.CheckedChanged += new System.EventHandler(this.mnuHighlightCurrentRowColumn_CheckedChanged); // // frmMemoryViewer // @@ -905,5 +915,6 @@ private System.Windows.Forms.ToolStripMenuItem mnuGoToAll; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem14; private System.Windows.Forms.ToolStripMenuItem mnuHighlightBreakpoints; + private System.Windows.Forms.ToolStripMenuItem mnuHighlightCurrentRowColumn; } } \ No newline at end of file diff --git a/GUI.NET/Debugger/frmMemoryViewer.cs b/GUI.NET/Debugger/frmMemoryViewer.cs index 0ff16f68..50956ea3 100644 --- a/GUI.NET/Debugger/frmMemoryViewer.cs +++ b/GUI.NET/Debugger/frmMemoryViewer.cs @@ -50,6 +50,9 @@ namespace Mesen.GUI.Debugger this.mnuIgnoreRedundantWrites.Checked = config.RamIgnoreRedundantWrites; this.UpdateFlags(); + this.mnuHighlightCurrentRowColumn.Checked = config.RamHighlightCurrentRowColumn; + this.ctrlHexViewer.HighlightCurrentRowColumn = config.RamHighlightCurrentRowColumn; + this.mnuShowCharacters.Checked = config.RamShowCharacters; this.mnuShowLabelInfoOnMouseOver.Checked = config.RamShowLabelInfo; @@ -439,6 +442,7 @@ namespace Mesen.GUI.Debugger ConfigManager.Config.DebugInfo.RamAutoRefresh = this.mnuAutoRefresh.Checked; ConfigManager.Config.DebugInfo.RamIgnoreRedundantWrites = this.mnuIgnoreRedundantWrites.Checked; + ConfigManager.Config.DebugInfo.RamHighlightCurrentRowColumn = this.mnuHighlightCurrentRowColumn.Checked; ConfigManager.Config.DebugInfo.RamShowCharacters = this.mnuShowCharacters.Checked; ConfigManager.Config.DebugInfo.RamShowLabelInfo = this.mnuShowLabelInfoOnMouseOver.Checked; @@ -743,5 +747,10 @@ namespace Mesen.GUI.Debugger ConfigManager.ApplyChanges(); ctrlHexViewer.ByteEditingMode = ConfigManager.Config.DebugInfo.RamByteEditingMode; } + + private void mnuHighlightCurrentRowColumn_CheckedChanged(object sender, EventArgs e) + { + ctrlHexViewer.HighlightCurrentRowColumn = mnuHighlightCurrentRowColumn.Checked; + } } }