From f0378a8313c8e580717df37410ec5262ded9684e Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Fri, 25 Feb 2011 02:50:57 +0000 Subject: [PATCH] Ram Search - Refactor saving of config settings, fix remembering of window location & size, and fix anchoring of output label --- BizHawk.MultiClient/MainForm.cs | 2 ++ .../tools/RamSearch.Designer.cs | 2 -- BizHawk.MultiClient/tools/RamSearch.cs | 24 ++++++++----------- BizHawk.MultiClient/tools/RamWatch.cs | 3 +-- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 313a57702a..60a5ea609a 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -1081,6 +1081,8 @@ namespace BizHawk.MultiClient } if (!RamWatch1.IsDisposed) RamWatch1.SaveConfigSettings(); + if (!RamSearch1.IsDisposed) + RamSearch1.SaveConfigSettings(); ConfigService.Save("config.ini", Global.Config); } } diff --git a/BizHawk.MultiClient/tools/RamSearch.Designer.cs b/BizHawk.MultiClient/tools/RamSearch.Designer.cs index 4777bf4a0d..b383b57795 100644 --- a/BizHawk.MultiClient/tools/RamSearch.Designer.cs +++ b/BizHawk.MultiClient/tools/RamSearch.Designer.cs @@ -1107,8 +1107,6 @@ this.Name = "RamSearch"; this.Text = "Ram Search"; this.Load += new System.EventHandler(this.RamSearch_Load); - this.Resize += new System.EventHandler(this.RamSearch_Resize); - this.LocationChanged += new System.EventHandler(this.RamSearch_LocationChanged); this.SearchtoolStrip1.ResumeLayout(false); this.SearchtoolStrip1.PerformLayout(); this.contextMenuStrip1.ResumeLayout(false); diff --git a/BizHawk.MultiClient/tools/RamSearch.cs b/BizHawk.MultiClient/tools/RamSearch.cs index 8688c03159..363447340c 100644 --- a/BizHawk.MultiClient/tools/RamSearch.cs +++ b/BizHawk.MultiClient/tools/RamSearch.cs @@ -17,7 +17,6 @@ namespace BizHawk.MultiClient public partial class RamSearch : Form { //TODO: - //Window position gets saved but doesn't load properly //Context Menu - if highlighted items - show Highlight dependent functions string systemID = "NULL"; @@ -37,10 +36,19 @@ namespace BizHawk.MultiClient int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired int defaultHeight; string currentSearchFile = ""; - + + public void SaveConfigSettings() + { + Global.Config.RamSearchWndx = this.Location.X; + Global.Config.RamSearchWndy = this.Location.Y; + Global.Config.RamSearchWidth = this.Right - this.Left; + Global.Config.RamSearchHeight = this.Bottom - this.Top; + } + public RamSearch() { InitializeComponent(); + Closing += (o, e) => SaveConfigSettings(); } public void UpdateValues() @@ -264,18 +272,6 @@ namespace BizHawk.MultiClient AddToRamWatch(); } - private void RamSearch_LocationChanged(object sender, EventArgs e) - { - Global.Config.RamSearchWndx = this.Location.X; - Global.Config.RamSearchWndy = this.Location.Y; - } - - private void RamSearch_Resize(object sender, EventArgs e) - { - Global.Config.RamSearchWidth = this.Right - this.Left; - Global.Config.RamSearchHeight = this.Bottom - this.Top; - } - private void restoreOriginalWindowSizeToolStripMenuItem_Click(object sender, EventArgs e) { this.Size = new System.Drawing.Size(defaultWidth, defaultHeight); diff --git a/BizHawk.MultiClient/tools/RamWatch.cs b/BizHawk.MultiClient/tools/RamWatch.cs index 913a2147f5..d89ad3174d 100644 --- a/BizHawk.MultiClient/tools/RamWatch.cs +++ b/BizHawk.MultiClient/tools/RamWatch.cs @@ -103,8 +103,7 @@ namespace BizHawk.MultiClient WatchListView.QueryItemText += new QueryItemTextHandler(WatchListView_QueryItemText); WatchListView.QueryItemBkColor += new QueryItemBkColorHandler(WatchListView_QueryItemBkColor); WatchListView.VirtualMode = true; - Closing += (o, e) => SaveConfigSettings(); - + Closing += (o, e) => SaveConfigSettings(); } protected override void OnClosing(CancelEventArgs e)