Ram Watch - option to show a Previous value column (off by default)

This commit is contained in:
andres.delikat 2011-02-24 16:17:46 +00:00
parent 92289c0e34
commit b8966c4566
2 changed files with 111 additions and 36 deletions

View File

@ -55,9 +55,13 @@
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.moveUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.moveUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showChangeCountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.WatchListView = new BizHawk.VirtualListView(); this.WatchListView = new BizHawk.VirtualListView();
this.Address = new System.Windows.Forms.ColumnHeader(); this.Address = new System.Windows.Forms.ColumnHeader();
this.Value = new System.Windows.Forms.ColumnHeader(); this.Value = new System.Windows.Forms.ColumnHeader();
this.Prev = new System.Windows.Forms.ColumnHeader();
this.ChangeCounts = new System.Windows.Forms.ColumnHeader(); this.ChangeCounts = new System.Windows.Forms.ColumnHeader();
this.Notes = new System.Windows.Forms.ColumnHeader(); this.Notes = new System.Windows.Forms.ColumnHeader();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
@ -86,9 +90,7 @@
this.MoveDownStripButton1 = new System.Windows.Forms.ToolStripButton(); this.MoveDownStripButton1 = new System.Windows.Forms.ToolStripButton();
this.WatchCountLabel = new System.Windows.Forms.Label(); this.WatchCountLabel = new System.Windows.Forms.Label();
this.MessageLabel = new System.Windows.Forms.Label(); this.MessageLabel = new System.Windows.Forms.Label();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.showPreviousValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showChangeCountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
@ -305,6 +307,32 @@
this.moveDownToolStripMenuItem.Text = "Move &Down"; this.moveDownToolStripMenuItem.Text = "Move &Down";
this.moveDownToolStripMenuItem.Click += new System.EventHandler(this.moveDownToolStripMenuItem_Click); this.moveDownToolStripMenuItem.Click += new System.EventHandler(this.moveDownToolStripMenuItem_Click);
// //
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.showChangeCountsToolStripMenuItem,
this.showPreviousValueToolStripMenuItem,
this.restoreWindowSizeToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
this.optionsToolStripMenuItem.Text = "&Options";
//
// showChangeCountsToolStripMenuItem
//
this.showChangeCountsToolStripMenuItem.Checked = true;
this.showChangeCountsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.showChangeCountsToolStripMenuItem.Name = "showChangeCountsToolStripMenuItem";
this.showChangeCountsToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.showChangeCountsToolStripMenuItem.Text = "Show Change Counts";
this.showChangeCountsToolStripMenuItem.Click += new System.EventHandler(this.showChangeCountsToolStripMenuItem_Click);
//
// restoreWindowSizeToolStripMenuItem
//
this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem";
this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size";
this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click);
//
// WatchListView // WatchListView
// //
this.WatchListView.AllowColumnReorder = true; this.WatchListView.AllowColumnReorder = true;
@ -315,6 +343,7 @@
this.WatchListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.WatchListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Address, this.Address,
this.Value, this.Value,
this.Prev,
this.ChangeCounts, this.ChangeCounts,
this.Notes}); this.Notes});
this.WatchListView.ContextMenuStrip = this.contextMenuStrip1; this.WatchListView.ContextMenuStrip = this.contextMenuStrip1;
@ -342,6 +371,12 @@
this.Value.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.Value.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.Value.Width = 59; this.Value.Width = 59;
// //
// Prev
//
this.Prev.Text = "Prev";
this.Prev.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.Prev.Width = 0;
//
// ChangeCounts // ChangeCounts
// //
this.ChangeCounts.Text = "Changes"; this.ChangeCounts.Text = "Changes";
@ -351,7 +386,7 @@
// Notes // Notes
// //
this.Notes.Text = "Notes"; this.Notes.Text = "Notes";
this.Notes.Width = 190; this.Notes.Width = 160;
// //
// contextMenuStrip1 // contextMenuStrip1
// //
@ -600,30 +635,12 @@
this.MessageLabel.TabIndex = 5; this.MessageLabel.TabIndex = 5;
this.MessageLabel.Text = " "; this.MessageLabel.Text = " ";
// //
// optionsToolStripMenuItem // showPreviousValueToolStripMenuItem
// //
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.showPreviousValueToolStripMenuItem.Name = "showPreviousValueToolStripMenuItem";
this.showChangeCountsToolStripMenuItem, this.showPreviousValueToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.restoreWindowSizeToolStripMenuItem}); this.showPreviousValueToolStripMenuItem.Text = "Show Previous Value";
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; this.showPreviousValueToolStripMenuItem.Click += new System.EventHandler(this.showPreviousValueToolStripMenuItem_Click);
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
this.optionsToolStripMenuItem.Text = "&Options";
//
// showChangeCountsToolStripMenuItem
//
this.showChangeCountsToolStripMenuItem.Checked = true;
this.showChangeCountsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.showChangeCountsToolStripMenuItem.Name = "showChangeCountsToolStripMenuItem";
this.showChangeCountsToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.showChangeCountsToolStripMenuItem.Text = "Show Change Counts";
this.showChangeCountsToolStripMenuItem.Click += new System.EventHandler(this.showChangeCountsToolStripMenuItem_Click);
//
// restoreWindowSizeToolStripMenuItem
//
this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem";
this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size";
this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click);
// //
// RamWatch // RamWatch
// //
@ -680,6 +697,7 @@
private System.Windows.Forms.ToolStrip toolStrip1; private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ColumnHeader Address; private System.Windows.Forms.ColumnHeader Address;
private System.Windows.Forms.ColumnHeader Value; private System.Windows.Forms.ColumnHeader Value;
private System.Windows.Forms.ColumnHeader Prev;
private System.Windows.Forms.ColumnHeader ChangeCounts; private System.Windows.Forms.ColumnHeader ChangeCounts;
private System.Windows.Forms.ColumnHeader Notes; private System.Windows.Forms.ColumnHeader Notes;
private System.Windows.Forms.Label WatchCountLabel; private System.Windows.Forms.Label WatchCountLabel;
@ -717,5 +735,6 @@
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem showChangeCountsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem showChangeCountsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem restoreWindowSizeToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem restoreWindowSizeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem showPreviousValueToolStripMenuItem;
} }
} }

View File

@ -20,9 +20,9 @@ namespace BizHawk.MultiClient
//On Movie UP/Down set highlighted items to be what the user had selected (in their new position) //On Movie UP/Down set highlighted items to be what the user had selected (in their new position)
//DisplayWatches needs to do value display properly like updatevalues, or just run update values //DisplayWatches needs to do value display properly like updatevalues, or just run update values
//Ability to watch in different memory domains //Ability to watch in different memory domains
//IDEAS: //Save column showing in config
//Option to show previous value //Save column widths in config
//Option to show change from previous value //Option for Prev to show change (+2 or -2) etc
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight; int defaultHeight;
@ -87,14 +87,14 @@ namespace BizHawk.MultiClient
void WatchListView_QueryItemText(int index, int column, out string text) void WatchListView_QueryItemText(int index, int column, out string text)
{ {
text = ""; text = "";
if (column == 0) if (column == 0) //Address
{ {
if (watchList[index].type == atype.SEPARATOR) if (watchList[index].type == atype.SEPARATOR)
text = ""; text = "";
else else
text = String.Format("{0:X}", watchList[index].address); text = String.Format("{0:X}", watchList[index].address);
} }
if (column == 1) if (column == 1) //Value
{ {
if (watchList[index].type == atype.SEPARATOR) if (watchList[index].type == atype.SEPARATOR)
text = ""; text = "";
@ -125,11 +125,42 @@ namespace BizHawk.MultiClient
} }
} }
} }
if (column == 2) if (column == 2) //Prev
{
if (watchList[index].type == atype.SEPARATOR)
text = "";
else
{
switch (watchList[index].signed)
{
case asigned.HEX:
switch (watchList[index].type)
{
case atype.BYTE:
text = String.Format("{0:X2}", watchList[index].prev);
break;
case atype.WORD:
text = String.Format("{0:X4}", watchList[index].prev);
break;
case atype.DWORD:
text = String.Format("{0:X8}", watchList[index].prev);
break;
}
break;
case asigned.SIGNED:
text = ((sbyte)watchList[index].prev).ToString();
break;
case asigned.UNSIGNED:
text = watchList[index].prev.ToString();
break;
}
}
}
if (column == 3) //Change Counts
{ {
text = watchList[index].changecount.ToString(); text = watchList[index].changecount.ToString();
} }
if (column == 3) if (column == 4) //Notes
{ {
if (watchList[index].type == atype.SEPARATOR) if (watchList[index].type == atype.SEPARATOR)
text = ""; text = "";
@ -675,6 +706,17 @@ namespace BizHawk.MultiClient
private void restoreWindowSizeToolStripMenuItem_Click(object sender, EventArgs e) private void restoreWindowSizeToolStripMenuItem_Click(object sender, EventArgs e)
{ {
this.Size = new System.Drawing.Size(defaultWidth, defaultHeight); this.Size = new System.Drawing.Size(defaultWidth, defaultHeight);
WatchListView.Columns[0].Width = 59; //Address
WatchListView.Columns[1].Width = 59; //Value
if (showPreviousValueToolStripMenuItem.Checked)
WatchListView.Columns[2].Width = 59; //Prev
else
WatchListView.Columns[2].Width = 0;
if (showChangeCountsToolStripMenuItem.Checked)
WatchListView.Columns[3].Width = 54; //Change counts
else
WatchListView.Columns[3].Width = 0;
WatchListView.Columns[4].Width = 150; //Notes
} }
private void newToolStripButton_Click(object sender, EventArgs e) private void newToolStripButton_Click(object sender, EventArgs e)
@ -902,12 +944,26 @@ namespace BizHawk.MultiClient
if (showChangeCountsToolStripMenuItem.Checked) if (showChangeCountsToolStripMenuItem.Checked)
{ {
showChangeCountsToolStripMenuItem.Checked = false; showChangeCountsToolStripMenuItem.Checked = false;
WatchListView.Columns[2].Width = 0; WatchListView.Columns[3].Width = 0;
} }
else else
{ {
showChangeCountsToolStripMenuItem.Checked = true; showChangeCountsToolStripMenuItem.Checked = true;
WatchListView.Columns[2].Width = 60; WatchListView.Columns[3].Width = 60;
}
}
private void showPreviousValueToolStripMenuItem_Click(object sender, EventArgs e)
{
if (showPreviousValueToolStripMenuItem.Checked)
{
showPreviousValueToolStripMenuItem.Checked = false;
WatchListView.Columns[2].Width = 0;
}
else
{
showPreviousValueToolStripMenuItem.Checked = true;
WatchListView.Columns[2].Width = 59;
} }
} }
} }