Controller Config - don't need the save all button anymore

This commit is contained in:
adelikat 2013-07-27 18:22:15 +00:00
parent fcddc9f038
commit 00e1469dfc
3 changed files with 8 additions and 38 deletions

View File

@ -178,10 +178,7 @@ namespace BizHawk.MultiClient
protected void restoreDefaultsToolStripMenuItem_Click(object sender, EventArgs e)
{
// this is a TODO: we have no concept of default values in our config system at the moment
// so for the moment, "defaults" = "no binds at all"
RealConfigObject.Clear();
SetWidgetStrings();
//TODO
}
}
}

View File

@ -41,7 +41,6 @@
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.buttonLoadDefaults = new System.Windows.Forms.Button();
this.buttonSaveAllDefaults = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@ -186,17 +185,6 @@
this.buttonLoadDefaults.UseVisualStyleBackColor = true;
this.buttonLoadDefaults.Click += new System.EventHandler(this.buttonLoadDefaults_Click);
//
// buttonSaveAllDefaults
//
this.buttonSaveAllDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonSaveAllDefaults.Location = new System.Drawing.Point(534, 485);
this.buttonSaveAllDefaults.Name = "buttonSaveAllDefaults";
this.buttonSaveAllDefaults.Size = new System.Drawing.Size(75, 23);
this.buttonSaveAllDefaults.TabIndex = 9;
this.buttonSaveAllDefaults.Text = "Save All";
this.buttonSaveAllDefaults.UseVisualStyleBackColor = true;
this.buttonSaveAllDefaults.Click += new System.EventHandler(this.buttonSaveAllDefaults_Click);
//
// NewControllerConfig
//
this.AcceptButton = this.buttonOK;
@ -204,7 +192,6 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(864, 515);
this.Controls.Add(this.buttonSaveAllDefaults);
this.Controls.Add(this.buttonLoadDefaults);
this.Controls.Add(this.checkBoxUDLR);
this.Controls.Add(this.tableLayoutPanel1);
@ -237,7 +224,6 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button buttonLoadDefaults;
private System.Windows.Forms.Button buttonSaveAllDefaults;
private System.Windows.Forms.TabPage tabPage3;
}
}

View File

@ -36,8 +36,6 @@ namespace BizHawk.MultiClient.config
private NewControllerConfig()
{
InitializeComponent();
if (!MainForm.INTERIM)
buttonSaveAllDefaults.Hide();
}
delegate Control PanelCreator<T>(Dictionary<string, T> settings, List<string> buttons, Size size);
@ -221,6 +219,12 @@ namespace BizHawk.MultiClient.config
}
private void buttonLoadDefaults_Click(object sender, EventArgs e)
{
RestoreDefaults();
Close();
}
public void RestoreDefaults()
{
// this is not clever. i'm going to replace it with something more clever
@ -228,7 +232,7 @@ namespace BizHawk.MultiClient.config
cd = ConfigService.Load(ControlDefaultPath, cd);
Dictionary<string, string> settings;
Dictionary<string, Config.AnalogBind> asettings;
if (cd.AllTrollers.TryGetValue(ControllerType, out settings))
{
Global.Config.AllTrollers[ControllerType] = settings;
@ -255,23 +259,6 @@ namespace BizHawk.MultiClient.config
{
Global.Config.AllTrollersAnalog[ControllerType].Clear();
}
Close();
}
private void buttonSaveAllDefaults_Click(object sender, EventArgs e)
{
var result = MessageBox.Show("OK to save defaults for ALL cores?", "Bizhawk", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
ControlDefaults cd = new ControlDefaults
{
AllTrollers = Global.Config.AllTrollers,
AllTrollersAutoFire = Global.Config.AllTrollersAutoFire,
AllTrollersAnalog = Global.Config.AllTrollersAnalog
};
ConfigService.Save(ControlDefaultPath, cd);
}
}
class ControlDefaults