From 6d4dea9a14f4e8f046ff0e725055390478c6a6f9 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 5 Sep 2015 17:05:14 -0400 Subject: [PATCH] Don't attempt to remember tool window size/position if tool is minimized/maximized, this fixes issue #491 but also fixes the bug in every tool (unless there is a tool that does not implement IAutoToolFormConfig that I missed in this changeset) --- BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs | 12 ++++++++---- BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs | 2 +- BizHawk.Client.EmuHawk/tools/ToolManager.cs | 11 +++++++---- BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs | 11 +++++++---- BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs | 12 ++++++++---- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs index c05f14fe22..53197eba05 100644 --- a/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs +++ b/BizHawk.Client.EmuHawk/tools/Cheats/Cheats.cs @@ -186,10 +186,14 @@ namespace BizHawk.Client.EmuHawk public void SaveConfigSettings() { SaveColumnInfo(); - Settings.Wndx = Location.X; - Settings.Wndy = Location.Y; - Settings.Width = Right - Left; - Settings.Height = Bottom - Top; + + if (WindowState == FormWindowState.Normal) + { + Settings.Wndx = Location.X; + Settings.Wndy = Location.Y; + Settings.Width = Right - Left; + Settings.Height = Bottom - Top; + } } private void LoadConfigSettings() diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 439bf539f4..48162df17c 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -181,7 +181,7 @@ namespace BizHawk.Client.EmuHawk if (!InitializeOnLoad()) { Close(); - this.DialogResult = System.Windows.Forms.DialogResult.Cancel; + DialogResult = DialogResult.Cancel; return; } diff --git a/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/BizHawk.Client.EmuHawk/tools/ToolManager.cs index 26d4511156..c354158128 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -199,10 +199,13 @@ namespace BizHawk.Client.EmuHawk form.FormClosing += (o, e) => { - settings.Wndx = form.Location.X; - settings.Wndy = form.Location.Y; - settings.Width = form.Right - form.Left; // why not form.Size.Width? - settings.Height = form.Bottom - form.Top; + if (form.WindowState == FormWindowState.Normal) + { + settings.Wndx = form.Location.X; + settings.Wndy = form.Location.Y; + settings.Width = form.Right - form.Left; // why not form.Size.Width? + settings.Height = form.Bottom - form.Top; + } }; dest[idx + 0].Click += (o, e) => diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs index 3a407529ec..7ee58c663b 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamSearch.cs @@ -313,10 +313,13 @@ namespace BizHawk.Client.EmuHawk { SaveColumnInfo(); - Settings.Wndx = Location.X; - Settings.Wndy = Location.Y; - Settings.Width = Right - Left; - Settings.Height = Bottom - Top; + if (WindowState == FormWindowState.Normal) + { + Settings.Wndx = Location.X; + Settings.Wndy = Location.Y; + Settings.Width = Right - Left; + Settings.Height = Bottom - Top; + } } public void NewSearch() diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index 8366a20273..e2bc2003c9 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -544,10 +544,14 @@ namespace BizHawk.Client.EmuHawk private void SaveConfigSettings() { SaveColumnInfo(); - Settings.Wndx = Location.X; - Settings.Wndy = Location.Y; - Settings.Width = Right - Left; - Settings.Height = Bottom - Top; + + if (WindowState == FormWindowState.Normal) + { + Settings.Wndx = Location.X; + Settings.Wndy = Location.Y; + Settings.Width = Right - Left; + Settings.Height = Bottom - Top; + } } private void SetMemoryDomain(string name)