Ram Watch - refactor some code

This commit is contained in:
andres.delikat 2011-03-18 18:13:24 +00:00
parent e7a3ee14f2
commit e2caffcb04
4 changed files with 43 additions and 16 deletions

View File

@ -58,11 +58,11 @@
public bool RamWatchShowChangeColumn = true; public bool RamWatchShowChangeColumn = true;
public bool RamWatchShowPrevColumn = false; public bool RamWatchShowPrevColumn = false;
public bool RamWatchShowChangeFromPrev = true; public bool RamWatchShowChangeFromPrev = true;
public int RamWatchAddressWidth = 59; public int RamWatchAddressWidth = -1;
public int RamWatchValueWidth = 59; public int RamWatchValueWidth = -1;
public int RamWatchPrevWidth = 59; public int RamWatchPrevWidth = -1;
public int RamWatchChangeWidth = 54; public int RamWatchChangeWidth = -1;
public int RamWatchNotesWidth = 130; public int RamWatchNotesWidth = -1;
// RamSearch Settings // RamSearch Settings
public bool AutoLoadRamSearch = false; public bool AutoLoadRamSearch = false;

View File

@ -72,6 +72,13 @@ namespace BizHawk.MultiClient
} }
private void RamSearch_Load(object sender, EventArgs e) private void RamSearch_Load(object sender, EventArgs e)
{
LoadConfigSettings();
StartNewSearch();
SetMemoryDomainMenu();
}
private void LoadConfigSettings()
{ {
defaultWidth = this.Size.Width; //Save these first so that the user can restore to its original size defaultWidth = this.Size.Width; //Save these first so that the user can restore to its original size
defaultHeight = this.Size.Height; defaultHeight = this.Size.Height;
@ -87,8 +94,6 @@ namespace BizHawk.MultiClient
littleEndianToolStripMenuItem.Checked = true; littleEndianToolStripMenuItem.Checked = true;
} }
StartNewSearch();
if (Global.Config.RamSearchWndx >= 0 && Global.Config.RamSearchWndy >= 0) if (Global.Config.RamSearchWndx >= 0 && Global.Config.RamSearchWndy >= 0)
this.Location = new Point(Global.Config.RamSearchWndx, Global.Config.RamSearchWndy); this.Location = new Point(Global.Config.RamSearchWndx, Global.Config.RamSearchWndy);
@ -96,8 +101,6 @@ namespace BizHawk.MultiClient
{ {
this.Size = new System.Drawing.Size(Global.Config.RamSearchWidth, Global.Config.RamSearchHeight); this.Size = new System.Drawing.Size(Global.Config.RamSearchWidth, Global.Config.RamSearchHeight);
} }
SetMemoryDomainMenu();
} }
private void SetMemoryDomainMenu() private void SetMemoryDomainMenu()

View File

@ -100,6 +100,7 @@
this.freezeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.freezeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.freezeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.freezeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.FreezetoolStripButton2 = new System.Windows.Forms.ToolStripButton(); this.FreezetoolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
@ -323,6 +324,7 @@
this.showChangeCountsToolStripMenuItem, this.showChangeCountsToolStripMenuItem,
this.showPreviousValueToolStripMenuItem, this.showPreviousValueToolStripMenuItem,
this.prevValueShowsChangeAmountToolStripMenuItem, this.prevValueShowsChangeAmountToolStripMenuItem,
this.toolStripSeparator7,
this.restoreWindowSizeToolStripMenuItem}); this.restoreWindowSizeToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20); this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
@ -726,6 +728,11 @@
this.FreezetoolStripButton2.Text = "Freeze"; this.FreezetoolStripButton2.Text = "Freeze";
this.FreezetoolStripButton2.Click += new System.EventHandler(this.FreezetoolStripButton2_Click); this.FreezetoolStripButton2.Click += new System.EventHandler(this.FreezetoolStripButton2_Click);
// //
// toolStripSeparator7
//
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(188, 6);
//
// RamWatch // RamWatch
// //
this.AllowDrop = true; this.AllowDrop = true;
@ -827,5 +834,6 @@
private System.Windows.Forms.ToolStripMenuItem freezeToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem freezeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem freezeAddressToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem freezeAddressToolStripMenuItem;
private System.Windows.Forms.ToolStripButton FreezetoolStripButton2; private System.Windows.Forms.ToolStripButton FreezetoolStripButton2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
} }
} }

View File

@ -21,10 +21,16 @@ namespace BizHawk.MultiClient
//Ability to watch in different memory domains //Ability to watch in different memory domains
//.wch format includes platform and domain type //.wch format includes platform and domain type
//address num digits based on domain size //address num digits based on domain size
//Refactor column width settings like Cheats, default valeu = -1, and check for negative values //Restore window size should restore column order as well
//Refactor restore window size by saving widths in constructor and use them to restore
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;
int defaultAddressWidth;
int defaultValueWidth;
int defaultPrevWidth;
int defaultChangeWidth;
int NotesWidth;
List<Watch> watchList = new List<Watch>(); List<Watch> watchList = new List<Watch>();
string currentWatchFile = ""; string currentWatchFile = "";
bool changes = false; bool changes = false;
@ -66,6 +72,11 @@ namespace BizHawk.MultiClient
{ {
defaultWidth = Size.Width; //Save these first so that the user can restore to its original size defaultWidth = Size.Width; //Save these first so that the user can restore to its original size
defaultHeight = Size.Height; defaultHeight = Size.Height;
defaultAddressWidth = WatchListView.Columns[0].Width;
defaultValueWidth = WatchListView.Columns[1].Width;
defaultPrevWidth = WatchListView.Columns[2].Width;
defaultChangeWidth = WatchListView.Columns[3].Width;
NotesWidth = WatchListView.Columns[4].Width;
if (Global.Config.RamWatchWndx >= 0 && Global.Config.RamWatchWndy >= 0) if (Global.Config.RamWatchWndx >= 0 && Global.Config.RamWatchWndy >= 0)
Location = new Point(Global.Config.RamWatchWndx, Global.Config.RamWatchWndy); Location = new Point(Global.Config.RamWatchWndx, Global.Config.RamWatchWndy);
@ -76,11 +87,16 @@ namespace BizHawk.MultiClient
} }
SetPrevColumn(Global.Config.RamWatchShowPrevColumn); SetPrevColumn(Global.Config.RamWatchShowPrevColumn);
SetChangesColumn(Global.Config.RamWatchShowChangeColumn); SetChangesColumn(Global.Config.RamWatchShowChangeColumn);
WatchListView.Columns[0].Width = Global.Config.RamWatchAddressWidth; if (Global.Config.RamWatchAddressWidth > 0)
WatchListView.Columns[1].Width = Global.Config.RamWatchValueWidth; WatchListView.Columns[0].Width = Global.Config.RamWatchAddressWidth;
WatchListView.Columns[2].Width = Global.Config.RamWatchPrevWidth; if (Global.Config.RamWatchValueWidth > 0)
WatchListView.Columns[3].Width = Global.Config.RamWatchChangeWidth; WatchListView.Columns[1].Width = Global.Config.RamWatchValueWidth;
WatchListView.Columns[4].Width = Global.Config.RamWatchNotesWidth; if (Global.Config.RamWatchPrevWidth > 0)
WatchListView.Columns[2].Width = Global.Config.RamWatchPrevWidth;
if (Global.Config.RamWatchChangeWidth > 0)
WatchListView.Columns[3].Width = Global.Config.RamWatchChangeWidth;
if (Global.Config.RamWatchNotesWidth > 0)
WatchListView.Columns[4].Width = Global.Config.RamWatchNotesWidth;
} }
public void SaveConfigSettings() public void SaveConfigSettings()