Ram Watch - a "Display on Screen" menu option

This commit is contained in:
andres.delikat 2011-09-12 23:08:42 +00:00
parent 73add14d28
commit c8e0043713
3 changed files with 51 additions and 8 deletions

View File

@ -172,6 +172,9 @@
public int DispMultianchor = 0; public int DispMultianchor = 0;
public bool DisplayGDI = false; public bool DisplayGDI = false;
public bool DisplayStatusBar = true; public bool DisplayStatusBar = true;
public int DispRamWatchx = 0;
public int DispRamWatchy = 60;
public bool DisplayRamWatch = false;
// Sound options // Sound options
public bool SoundEnabled = true; public bool SoundEnabled = true;

View File

@ -106,6 +106,7 @@
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.MemDomainLabel = new System.Windows.Forms.Label(); this.MemDomainLabel = new System.Windows.Forms.Label();
this.displayWatchesOnScreenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
@ -373,6 +374,7 @@
this.showChangeCountsToolStripMenuItem, this.showChangeCountsToolStripMenuItem,
this.showPreviousValueToolStripMenuItem, this.showPreviousValueToolStripMenuItem,
this.prevValueShowsChangeAmountToolStripMenuItem, this.prevValueShowsChangeAmountToolStripMenuItem,
this.displayWatchesOnScreenToolStripMenuItem,
this.toolStripSeparator7, this.toolStripSeparator7,
this.saveWindowPositionToolStripMenuItem, this.saveWindowPositionToolStripMenuItem,
this.restoreWindowSizeToolStripMenuItem}); this.restoreWindowSizeToolStripMenuItem});
@ -386,40 +388,40 @@
this.showChangeCountsToolStripMenuItem.Checked = true; this.showChangeCountsToolStripMenuItem.Checked = true;
this.showChangeCountsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.showChangeCountsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.showChangeCountsToolStripMenuItem.Name = "showChangeCountsToolStripMenuItem"; this.showChangeCountsToolStripMenuItem.Name = "showChangeCountsToolStripMenuItem";
this.showChangeCountsToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.showChangeCountsToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.showChangeCountsToolStripMenuItem.Text = "Change Counts"; this.showChangeCountsToolStripMenuItem.Text = "Change Counts";
this.showChangeCountsToolStripMenuItem.Click += new System.EventHandler(this.showChangeCountsToolStripMenuItem_Click); this.showChangeCountsToolStripMenuItem.Click += new System.EventHandler(this.showChangeCountsToolStripMenuItem_Click);
// //
// showPreviousValueToolStripMenuItem // showPreviousValueToolStripMenuItem
// //
this.showPreviousValueToolStripMenuItem.Name = "showPreviousValueToolStripMenuItem"; this.showPreviousValueToolStripMenuItem.Name = "showPreviousValueToolStripMenuItem";
this.showPreviousValueToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.showPreviousValueToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.showPreviousValueToolStripMenuItem.Text = "Previous Value"; this.showPreviousValueToolStripMenuItem.Text = "Previous Value";
this.showPreviousValueToolStripMenuItem.Click += new System.EventHandler(this.showPreviousValueToolStripMenuItem_Click); this.showPreviousValueToolStripMenuItem.Click += new System.EventHandler(this.showPreviousValueToolStripMenuItem_Click);
// //
// prevValueShowsChangeAmountToolStripMenuItem // prevValueShowsChangeAmountToolStripMenuItem
// //
this.prevValueShowsChangeAmountToolStripMenuItem.Name = "prevValueShowsChangeAmountToolStripMenuItem"; this.prevValueShowsChangeAmountToolStripMenuItem.Name = "prevValueShowsChangeAmountToolStripMenuItem";
this.prevValueShowsChangeAmountToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.prevValueShowsChangeAmountToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.prevValueShowsChangeAmountToolStripMenuItem.Text = "Prev Value as change"; this.prevValueShowsChangeAmountToolStripMenuItem.Text = "Prev Value as change";
this.prevValueShowsChangeAmountToolStripMenuItem.Click += new System.EventHandler(this.prevValueShowsChangeAmountToolStripMenuItem_Click); this.prevValueShowsChangeAmountToolStripMenuItem.Click += new System.EventHandler(this.prevValueShowsChangeAmountToolStripMenuItem_Click);
// //
// toolStripSeparator7 // toolStripSeparator7
// //
this.toolStripSeparator7.Name = "toolStripSeparator7"; this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(200, 6); this.toolStripSeparator7.Size = new System.Drawing.Size(214, 6);
// //
// saveWindowPositionToolStripMenuItem // saveWindowPositionToolStripMenuItem
// //
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem"; this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem";
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.saveWindowPositionToolStripMenuItem.Text = "Save Window Position"; this.saveWindowPositionToolStripMenuItem.Text = "Save Window Position";
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click); this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click);
// //
// restoreWindowSizeToolStripMenuItem // restoreWindowSizeToolStripMenuItem
// //
this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem"; this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem";
this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.restoreWindowSizeToolStripMenuItem.Text = "Restore Default Settings"; this.restoreWindowSizeToolStripMenuItem.Text = "Restore Default Settings";
this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click); this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click);
// //
@ -804,6 +806,13 @@
this.MemDomainLabel.Size = new System.Drawing.Size(0, 13); this.MemDomainLabel.Size = new System.Drawing.Size(0, 13);
this.MemDomainLabel.TabIndex = 6; this.MemDomainLabel.TabIndex = 6;
// //
// displayWatchesOnScreenToolStripMenuItem
//
this.displayWatchesOnScreenToolStripMenuItem.Name = "displayWatchesOnScreenToolStripMenuItem";
this.displayWatchesOnScreenToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.displayWatchesOnScreenToolStripMenuItem.Text = "Display Watches On Screen";
this.displayWatchesOnScreenToolStripMenuItem.Click += new System.EventHandler(this.displayWatchesOnScreenToolStripMenuItem_Click);
//
// RamWatch // RamWatch
// //
this.AllowDrop = true; this.AllowDrop = true;
@ -915,5 +924,6 @@
private System.Windows.Forms.Label MemDomainLabel; private System.Windows.Forms.Label MemDomainLabel;
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem displayWatchesOnScreenToolStripMenuItem;
} }
} }

View File

@ -19,6 +19,8 @@ namespace BizHawk.MultiClient
//TODO: //TODO:
//When receiving a watch from a different domain, should something be done? //When receiving a watch from a different domain, should something be done?
//when sorting, "Prev as Change" option not taken into account //when sorting, "Prev as Change" option not taken into account
//A GUI interface for setting the x,y coordinates of the ram watch display
//Allow each watch to be on or off screen, and on its own x,y
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;
@ -64,8 +66,9 @@ namespace BizHawk.MultiClient
public void UpdateValues() public void UpdateValues()
{ {
if (!this.IsHandleCreated || this.IsDisposed) return;
WatchListView.BlazingFast = true; if ((!this.IsHandleCreated || this.IsDisposed) && !Global.Config.DisplayRamWatch) return;
for (int x = 0; x < watchList.Count; x++) for (int x = 0; x < watchList.Count; x++)
{ {
watchList[x].prev = watchList[x].value; watchList[x].prev = watchList[x].value;
@ -73,8 +76,24 @@ namespace BizHawk.MultiClient
if (watchList[x].value != watchList[x].prev) if (watchList[x].value != watchList[x].prev)
watchList[x].changecount++; watchList[x].changecount++;
} }
if (Global.Config.DisplayRamWatch)
{
Global.RenderPanel.ClearGUIText();
for (int x = 0; x < watchList.Count; x++)
{
Global.RenderPanel.AddGUIText(watchList[x].ToString(),
Global.Config.DispRamWatchx, (Global.Config.DispRamWatchy + (x * 12)));
}
}
if (!this.IsHandleCreated || this.IsDisposed) return;
WatchListView.BlazingFast = true;
WatchListView.Refresh(); WatchListView.Refresh();
WatchListView.BlazingFast = false; WatchListView.BlazingFast = false;
} }
public void AddWatch(Watch w) public void AddWatch(Watch w)
@ -1112,6 +1131,7 @@ namespace BizHawk.MultiClient
private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{ {
displayWatchesOnScreenToolStripMenuItem.Checked = Global.Config.DisplayRamWatch;
prevValueShowsChangeAmountToolStripMenuItem.Checked = Global.Config.RamWatchShowChangeFromPrev; prevValueShowsChangeAmountToolStripMenuItem.Checked = Global.Config.RamWatchShowChangeFromPrev;
saveWindowPositionToolStripMenuItem.Checked = Global.Config.RamWatchSaveWindowPosition; saveWindowPositionToolStripMenuItem.Checked = Global.Config.RamWatchSaveWindowPosition;
} }
@ -1456,5 +1476,15 @@ namespace BizHawk.MultiClient
{ {
WatchListView.Refresh(); WatchListView.Refresh();
} }
private void displayWatchesOnScreenToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.DisplayRamWatch ^= true;
if (!Global.Config.DisplayRamWatch)
Global.RenderPanel.ClearGUIText();
else
UpdateValues();
}
} }
} }