Controller Config - add a Restore Defaults context menu item that sets up a default mapping for a given controller type.

This commit is contained in:
adelikat 2012-12-03 01:20:06 +00:00
parent d4280b2607
commit e61da61d5d
3 changed files with 531 additions and 550 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,15 +31,17 @@
this.components = new System.ComponentModel.Container();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreDefaultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.clearToolStripMenuItem});
this.clearToolStripMenuItem,
this.restoreDefaultsToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(102, 26);
this.contextMenuStrip1.Size = new System.Drawing.Size(160, 70);
//
// clearToolStripMenuItem
//
@ -48,6 +50,13 @@
this.clearToolStripMenuItem.Text = "&Clear";
this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click);
//
// restoreDefaultsToolStripMenuItem
//
this.restoreDefaultsToolStripMenuItem.Name = "restoreDefaultsToolStripMenuItem";
this.restoreDefaultsToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
this.restoreDefaultsToolStripMenuItem.Text = "&Restore Defaults";
this.restoreDefaultsToolStripMenuItem.Click += new System.EventHandler(this.restoreDefaultsToolStripMenuItem_Click);
//
// ControllerConfigPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -64,5 +73,6 @@
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem restoreDefaultsToolStripMenuItem;
}
}

View File

@ -12,7 +12,7 @@ namespace BizHawk.MultiClient
{
public partial class ControllerConfigPanel : UserControl
{
object ControllerConfigObject; //Object that values will be saved to (In Config.cs)
iControllerConfigObject ControllerConfigObject; //Object that values will be saved to (In Config.cs)
public List<string> buttons = new List<string>();
@ -55,7 +55,7 @@ namespace BizHawk.MultiClient
}
}
public void LoadSettings(object configobj)
public void LoadSettings(iControllerConfigObject configobj)
{
ControllerConfigObject = configobj;
@ -139,5 +139,14 @@ namespace BizHawk.MultiClient
{
ClearAll();
}
private void restoreDefaultsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (ControllerConfigObject is iControllerConfigObject)
{
(ControllerConfigObject as iControllerConfigObject).SetDefaults();
}
SetWidgetStrings();
}
}
}