From fadcd6c572afda6d8a0a96ea5b34e0f1f7fc4689 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Wed, 19 Jan 2011 04:18:33 +0000 Subject: [PATCH] Ram Watch - hook up auto-load feature --- BizHawk.MultiClient/Config.cs | 4 ++++ BizHawk.MultiClient/MainForm.Designer.cs | 2 +- BizHawk.MultiClient/MainForm.cs | 12 ++++++++++-- BizHawk.MultiClient/RamWatch.Designer.cs | 1 + BizHawk.MultiClient/RamWatch.cs | 19 ++++++++++++++++++- 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index f40c28eb11..dbb01b360e 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -8,6 +8,10 @@ public bool AutoLoadMostRecentRom = false; //TODO: eventually make a class or struct for all the auto-loads, which will include recent roms, movies, etc, as well as autoloading any modeless dialog public RecentFiles RecentRoms = new RecentFiles(8); + // RamWatch Settings + public bool AutoLoadRamWatch = false; + public RecentFiles RecentWatches = new RecentFiles(8); + // Client Hotkey Bindings public string HardResetBinding = "LeftShift+Tab"; public string FastForwardBinding = "J1 B6"; diff --git a/BizHawk.MultiClient/MainForm.Designer.cs b/BizHawk.MultiClient/MainForm.Designer.cs index 0901235ee5..89131821ff 100644 --- a/BizHawk.MultiClient/MainForm.Designer.cs +++ b/BizHawk.MultiClient/MainForm.Designer.cs @@ -708,7 +708,7 @@ this.rAMWatchToolStripMenuItem.Name = "rAMWatchToolStripMenuItem"; this.rAMWatchToolStripMenuItem.Size = new System.Drawing.Size(139, 22); this.rAMWatchToolStripMenuItem.Text = "RAM &Watch"; - this.rAMWatchToolStripMenuItem.Click += new System.EventHandler(this.rAMWatchToolStripMenuItem_Click); + this.rAMWatchToolStripMenuItem.Click += new System.EventHandler(this.RAMWatchToolStripMenuItem_Click); // // rAMSearchToolStripMenuItem // diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 475e21722f..c31ab9a384 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -1,4 +1,4 @@ - using System; + using System; using System.Drawing; using System.Drawing.Imaging; using System.IO; @@ -80,6 +80,9 @@ namespace BizHawk.MultiClient LoadRom(args[0]); else if (Global.Config.AutoLoadMostRecentRom && !Global.Config.RecentRoms.IsEmpty()) LoadRomFromRecent(Global.Config.RecentRoms.GetRecentFileByPosition(0)); + + if (Global.Config.AutoLoadRamWatch) + LoadRamWatch(); } private void LoadRomFromRecent(string rom) @@ -778,10 +781,15 @@ namespace BizHawk.MultiClient recentROMToolStripMenuItem.DropDownItems.Add(auto); } - private void rAMWatchToolStripMenuItem_Click(object sender, EventArgs e) + private void LoadRamWatch() //TODO: accept a filename parameter and feed it to ram watch for loading { RamWatch RamWatch1 = new RamWatch(); RamWatch1.Show(); } + + private void RAMWatchToolStripMenuItem_Click(object sender, EventArgs e) + { + LoadRamWatch(); + } } } \ No newline at end of file diff --git a/BizHawk.MultiClient/RamWatch.Designer.cs b/BizHawk.MultiClient/RamWatch.Designer.cs index a4606e02e1..cda9dd6f60 100644 --- a/BizHawk.MultiClient/RamWatch.Designer.cs +++ b/BizHawk.MultiClient/RamWatch.Designer.cs @@ -92,6 +92,7 @@ this.filesToolStripMenuItem.Name = "filesToolStripMenuItem"; this.filesToolStripMenuItem.Size = new System.Drawing.Size(40, 20); this.filesToolStripMenuItem.Text = "&Files"; + this.filesToolStripMenuItem.DropDownOpened += new System.EventHandler(this.filesToolStripMenuItem_DropDownOpened); // // newListToolStripMenuItem // diff --git a/BizHawk.MultiClient/RamWatch.cs b/BizHawk.MultiClient/RamWatch.cs index 4a6a91dbdc..c30d168261 100644 --- a/BizHawk.MultiClient/RamWatch.cs +++ b/BizHawk.MultiClient/RamWatch.cs @@ -178,7 +178,16 @@ namespace BizHawk.MultiClient private void autoLoadToolStripMenuItem_Click(object sender, EventArgs e) { - + if (Global.Config.AutoLoadRamWatch == true) + { + Global.Config.AutoLoadRamWatch = false; + autoLoadToolStripMenuItem.Checked = false; + } + else + { + Global.Config.AutoLoadRamWatch = true; + autoLoadToolStripMenuItem.Checked = true; + } } private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e) @@ -236,5 +245,13 @@ namespace BizHawk.MultiClient for (int x = 0; x < watchList.Count; x++) TempDisplayWatchInTempList(watchList[x]); } + + private void filesToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + if (Global.Config.AutoLoadRamWatch == true) + autoLoadToolStripMenuItem.Checked = true; + else + autoLoadToolStripMenuItem.Checked = false; + } } }