From 6b63db80e270f42b666d82d1cf22898547e8c7aa Mon Sep 17 00:00:00 2001 From: SuuperW Date: Mon, 24 Aug 2020 18:31:22 -0500 Subject: [PATCH] give user the option to (attempt) keep or discard states when changing state history settings --- ....Designer.cs => GreenzoneSettings.Designer.cs} | 2 +- ...tGreenzoneSettings.cs => GreenzoneSettings.cs} | 15 +++++++++++---- ...enzoneSettings.resx => GreenzoneSettings.resx} | 0 .../tools/TAStudio/TAStudio.MenuItems.cs | 11 ++++++----- 4 files changed, 18 insertions(+), 10 deletions(-) rename src/BizHawk.Client.EmuHawk/tools/TAStudio/{DefaultGreenzoneSettings.Designer.cs => GreenzoneSettings.Designer.cs} (96%) rename src/BizHawk.Client.EmuHawk/tools/TAStudio/{DefaultGreenzoneSettings.cs => GreenzoneSettings.cs} (52%) rename src/BizHawk.Client.EmuHawk/tools/TAStudio/{DefaultGreenzoneSettings.resx => GreenzoneSettings.resx} (100%) diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/DefaultGreenzoneSettings.Designer.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.Designer.cs similarity index 96% rename from src/BizHawk.Client.EmuHawk/tools/TAStudio/DefaultGreenzoneSettings.Designer.cs rename to src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.Designer.cs index 34290193c9..b13ad98b2c 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/DefaultGreenzoneSettings.Designer.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.Designer.cs @@ -1,6 +1,6 @@ namespace BizHawk.Client.EmuHawk { - partial class DefaultGreenzoneSettings + partial class GreenzoneSettings { /// /// Required designer variable. diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/DefaultGreenzoneSettings.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs similarity index 52% rename from src/BizHawk.Client.EmuHawk/tools/TAStudio/DefaultGreenzoneSettings.cs rename to src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs index 0d3979022b..0b86914a70 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/DefaultGreenzoneSettings.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs @@ -5,24 +5,31 @@ using BizHawk.Client.Common; namespace BizHawk.Client.EmuHawk { - public partial class DefaultGreenzoneSettings : Form + public partial class GreenzoneSettings : Form { - private readonly Action _saveSettings; + private readonly Action _saveSettings; private ZwinderStateManagerSettings _settings; + private readonly bool _isDefault; - public DefaultGreenzoneSettings(ZwinderStateManagerSettings settings, Action saveSettings) + public GreenzoneSettings(ZwinderStateManagerSettings settings, Action saveSettings, bool isDefault) { InitializeComponent(); Icon = Properties.Resources.TAStudioIcon; _saveSettings = saveSettings; _settings = settings; + _isDefault = isDefault; + if (!isDefault) + Text = "Savestate History Settings"; SettingsPropertyGrid.SelectedObject = _settings; } private void OkBtn_Click(object sender, EventArgs e) { - _saveSettings(_settings); + bool keep = false; + if (!_isDefault) + keep = (MessageBox.Show("Attempt to keep old states?", "Keep old states?", MessageBoxButtons.YesNo) == DialogResult.Yes); + _saveSettings(_settings, keep); Close(); } diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/DefaultGreenzoneSettings.resx b/src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.resx similarity index 100% rename from src/BizHawk.Client.EmuHawk/tools/TAStudio/DefaultGreenzoneSettings.resx rename to src/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.resx diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index d44395e8a5..1c0bef119b 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -998,12 +998,12 @@ namespace BizHawk.Client.EmuHawk private void StateHistorySettingsMenuItem_Click(object sender, EventArgs e) { - new DefaultGreenzoneSettings( + new GreenzoneSettings( new ZwinderStateManagerSettings(CurrentTasMovie.TasStateManager.Settings), - s => { CurrentTasMovie.TasStateManager.UpdateSettings(s, true); }) + (s, k) => { CurrentTasMovie.TasStateManager.UpdateSettings(s, k); }, + false) { Location = this.ChildPointToScreen(TasView), - Text = "Savestate History Settings", Owner = Owner }.ShowDialog(); } @@ -1022,9 +1022,10 @@ namespace BizHawk.Client.EmuHawk private void DefaultStateSettingsMenuItem_Click(object sender, EventArgs e) { - new DefaultGreenzoneSettings( + new GreenzoneSettings( new ZwinderStateManagerSettings(Config.Movies.DefaultTasStateManagerSettings), - s => { Config.Movies.DefaultTasStateManagerSettings = s; }) + (s, k) => { Config.Movies.DefaultTasStateManagerSettings = s; }, + true) { Location = this.ChildPointToScreen(TasView), Owner = Owner