Hex Editor - double clicking an address sends it to Ram Watch

This commit is contained in:
andres.delikat 2011-03-07 17:16:27 +00:00
parent fd383f108c
commit f5f6160079
3 changed files with 44 additions and 1 deletions

View File

@ -197,6 +197,7 @@
this.MemoryViewer.TabIndex = 0;
this.MemoryViewer.Text = "RAM";
this.MemoryViewer.Paint += new System.Windows.Forms.PaintEventHandler(this.MemoryViewer_Paint);
this.MemoryViewer.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.MemoryViewer_MouseDoubleClick);
//
// HexEditor
//

View File

@ -17,7 +17,7 @@ namespace BizHawk.MultiClient
//Users can customize background, & text colors
//Context menu - Poke, Freeze/Unfreeze, Watch
//Tool strip
//Double click addres = send to ram watch
//Double click sends all highlighted to Ram Watch not just currently pointed
//Add to Ram Watch menu item, enabled conditionally on if any address is highlighted
//Text box showing currently highlighted address(es) & total
//Typing legit hex values = memory poke
@ -190,6 +190,46 @@ namespace BizHawk.MultiClient
}
private void MemoryViewer_MouseDoubleClick(object sender, MouseEventArgs e)
{
//Add to RAM Watch
int address = MemoryViewer.GetPointedAddress();
if (address >= 0)
{
Watch w = new Watch();
w.address = address;
switch (MemoryViewer.GetDataSize())
{
default:
case 1:
w.type = atype.BYTE;
break;
case 2:
w.type = atype.WORD;
break;
case 4:
w.type = atype.DWORD;
break;
}
w.bigendian = MemoryViewer.BigEndian;
w.signed = asigned.HEX;
if (!Global.MainForm.RamWatch1.IsHandleCreated || Global.MainForm.RamWatch1.IsDisposed)
{
Global.MainForm.RamWatch1 = new RamWatch();
Global.MainForm.RamWatch1.Show();
}
else
{
Global.MainForm.RamWatch1.Focus();
}
Global.MainForm.RamWatch1.AddWatch(w);
}
}
}
}

View File

@ -18,6 +18,8 @@ namespace BizHawk.MultiClient
{
//TODO:
//Ability to watch in different memory domains
//.wch format includes platform and domain type
//address num digits based on domain size
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight;