Instead of InputWidget, use new InputCompositeWidget UserControl which includes a button you can use to summon a contextmenu of special bindings (such as WMouse L), which the textbox part (still InputWidget) will ignore otherwise.

This commit is contained in:
zeromus 2014-04-19 21:03:49 +00:00
parent 1669fd7755
commit c7e37753bf
9 changed files with 525 additions and 196 deletions

View File

@ -278,6 +278,12 @@
<Compile Include="config\HotkeyConfig.Designer.cs"> <Compile Include="config\HotkeyConfig.Designer.cs">
<DependentUpon>HotkeyConfig.cs</DependentUpon> <DependentUpon>HotkeyConfig.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="config\InputCompositeWidget.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="config\InputCompositeWidget.Designer.cs">
<DependentUpon>InputCompositeWidget.cs</DependentUpon>
</Compile>
<Compile Include="config\InputWidget.cs"> <Compile Include="config\InputWidget.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
@ -1000,6 +1006,9 @@
<EmbeddedResource Include="config\HotkeyConfig.resx"> <EmbeddedResource Include="config\HotkeyConfig.resx">
<DependentUpon>HotkeyConfig.cs</DependentUpon> <DependentUpon>HotkeyConfig.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="config\InputCompositeWidget.resx">
<DependentUpon>InputCompositeWidget.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="config\N64\N64VideoPluginconfig.resx"> <EmbeddedResource Include="config\N64\N64VideoPluginconfig.resx">
<DependentUpon>N64VideoPluginconfig.cs</DependentUpon> <DependentUpon>N64VideoPluginconfig.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@ -28,198 +28,205 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ControllerConfig)); this.components = new System.ComponentModel.Container();
this.tabControl1 = new System.Windows.Forms.TabControl(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ControllerConfig));
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.label2 = new System.Windows.Forms.Label(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.checkBoxAutoTab = new System.Windows.Forms.CheckBox(); this.label2 = new System.Windows.Forms.Label();
this.checkBoxUDLR = new System.Windows.Forms.CheckBox(); this.checkBoxAutoTab = new System.Windows.Forms.CheckBox();
this.buttonOK = new System.Windows.Forms.Button(); this.checkBoxUDLR = new System.Windows.Forms.CheckBox();
this.buttonCancel = new System.Windows.Forms.Button(); this.buttonOK = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.buttonCancel = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.buttonLoadDefaults = new System.Windows.Forms.Button(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.buttonSaveDefaults = new System.Windows.Forms.Button(); this.buttonLoadDefaults = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout(); this.buttonSaveDefaults = new System.Windows.Forms.Button();
this.tableLayoutPanel1.SuspendLayout(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.tabControl1.SuspendLayout();
this.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
// ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
// tabControl1 this.SuspendLayout();
// //
this.tabControl1.Controls.Add(this.tabPage1); // tabControl1
this.tabControl1.Controls.Add(this.tabPage2); //
this.tabControl1.Controls.Add(this.tabPage3); this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(3, 3); this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.SelectedIndex = 0; this.tabControl1.Location = new System.Drawing.Point(3, 3);
this.tabControl1.Size = new System.Drawing.Size(562, 493); this.tabControl1.Name = "tabControl1";
this.tabControl1.TabIndex = 1; this.tabControl1.SelectedIndex = 0;
// this.tabControl1.Size = new System.Drawing.Size(562, 493);
// tabPage1 this.tabControl1.TabIndex = 1;
// //
this.tabPage1.Location = new System.Drawing.Point(4, 22); // tabPage1
this.tabPage1.Name = "tabPage1"; //
this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Size = new System.Drawing.Size(554, 467); this.tabPage1.Name = "tabPage1";
this.tabPage1.TabIndex = 0; this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Text = "Normal Controls"; this.tabPage1.Size = new System.Drawing.Size(554, 467);
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.TabIndex = 0;
// this.tabPage1.Text = "Normal Controls";
// tabPage2 this.tabPage1.UseVisualStyleBackColor = true;
// //
this.tabPage2.Location = new System.Drawing.Point(4, 22); // tabPage2
this.tabPage2.Name = "tabPage2"; //
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Size = new System.Drawing.Size(554, 467); this.tabPage2.Name = "tabPage2";
this.tabPage2.TabIndex = 1; this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Text = "Autofire Controls"; this.tabPage2.Size = new System.Drawing.Size(554, 467);
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.TabIndex = 1;
// this.tabPage2.Text = "Autofire Controls";
// tabPage3 this.tabPage2.UseVisualStyleBackColor = true;
// //
this.tabPage3.Location = new System.Drawing.Point(4, 22); // tabPage3
this.tabPage3.Name = "tabPage3"; //
this.tabPage3.Size = new System.Drawing.Size(554, 467); this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.TabIndex = 2; this.tabPage3.Name = "tabPage3";
this.tabPage3.Text = "Analog Controls"; this.tabPage3.Size = new System.Drawing.Size(554, 467);
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.TabIndex = 2;
// this.tabPage3.Text = "Analog Controls";
// label2 this.tabPage3.UseVisualStyleBackColor = true;
// //
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); // label2
this.label2.AutoSize = true; //
this.label2.Location = new System.Drawing.Point(12, 519); this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.Name = "label2"; this.label2.AutoSize = true;
this.label2.Size = new System.Drawing.Size(140, 13); this.label2.Location = new System.Drawing.Point(12, 519);
this.label2.TabIndex = 2; this.label2.Name = "label2";
this.label2.Text = "Escape clears a keybinding."; this.label2.Size = new System.Drawing.Size(140, 13);
// this.label2.TabIndex = 2;
// checkBoxAutoTab this.label2.Text = "Escape clears a keybinding.";
// //
this.checkBoxAutoTab.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); // checkBoxAutoTab
this.checkBoxAutoTab.AutoSize = true; //
this.checkBoxAutoTab.Location = new System.Drawing.Point(187, 517); this.checkBoxAutoTab.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBoxAutoTab.Name = "checkBoxAutoTab"; this.checkBoxAutoTab.AutoSize = true;
this.checkBoxAutoTab.Size = new System.Drawing.Size(70, 17); this.checkBoxAutoTab.Location = new System.Drawing.Point(187, 517);
this.checkBoxAutoTab.TabIndex = 3; this.checkBoxAutoTab.Name = "checkBoxAutoTab";
this.checkBoxAutoTab.Text = "Auto Tab"; this.checkBoxAutoTab.Size = new System.Drawing.Size(70, 17);
this.checkBoxAutoTab.UseVisualStyleBackColor = true; this.checkBoxAutoTab.TabIndex = 3;
this.checkBoxAutoTab.CheckedChanged += new System.EventHandler(this.checkBoxAutoTab_CheckedChanged); this.checkBoxAutoTab.Text = "Auto Tab";
// this.checkBoxAutoTab.UseVisualStyleBackColor = true;
// checkBoxUDLR this.checkBoxAutoTab.CheckedChanged += new System.EventHandler(this.checkBoxAutoTab_CheckedChanged);
// //
this.checkBoxUDLR.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); // checkBoxUDLR
this.checkBoxUDLR.AutoSize = true; //
this.checkBoxUDLR.Location = new System.Drawing.Point(263, 517); this.checkBoxUDLR.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBoxUDLR.Name = "checkBoxUDLR"; this.checkBoxUDLR.AutoSize = true;
this.checkBoxUDLR.Size = new System.Drawing.Size(84, 17); this.checkBoxUDLR.Location = new System.Drawing.Point(263, 517);
this.checkBoxUDLR.TabIndex = 4; this.checkBoxUDLR.Name = "checkBoxUDLR";
this.checkBoxUDLR.Text = "Allow UDLR"; this.checkBoxUDLR.Size = new System.Drawing.Size(101, 17);
this.checkBoxUDLR.UseVisualStyleBackColor = true; this.checkBoxUDLR.TabIndex = 4;
this.checkBoxUDLR.CheckedChanged += new System.EventHandler(this.checkBoxUDLR_CheckedChanged); this.checkBoxUDLR.Text = "Allow U+D/L+R";
// this.checkBoxUDLR.UseVisualStyleBackColor = true;
// buttonOK this.checkBoxUDLR.CheckedChanged += new System.EventHandler(this.checkBoxUDLR_CheckedChanged);
// //
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); // buttonOK
this.buttonOK.Location = new System.Drawing.Point(764, 514); //
this.buttonOK.Name = "buttonOK"; this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.Location = new System.Drawing.Point(764, 514);
this.buttonOK.TabIndex = 5; this.buttonOK.Name = "buttonOK";
this.buttonOK.Text = "OK"; this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.UseVisualStyleBackColor = true; this.buttonOK.TabIndex = 5;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); this.buttonOK.Text = "OK";
// this.buttonOK.UseVisualStyleBackColor = true;
// buttonCancel this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
// //
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); // buttonCancel
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; //
this.buttonCancel.Location = new System.Drawing.Point(845, 514); this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.Location = new System.Drawing.Point(845, 514);
this.buttonCancel.TabIndex = 6; this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Text = "Cancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.TabIndex = 6;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); this.buttonCancel.Text = "Cancel";
// this.buttonCancel.UseVisualStyleBackColor = true;
// tableLayoutPanel1 this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
// //
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) // tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 340F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 340F));
this.tableLayoutPanel1.Controls.Add(this.tabControl1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.tabControl1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.pictureBox1, 1, 0); this.tableLayoutPanel1.Controls.Add(this.pictureBox1, 1, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12); this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(908, 499); this.tableLayoutPanel1.Size = new System.Drawing.Size(908, 499);
this.tableLayoutPanel1.TabIndex = 7; this.tableLayoutPanel1.TabIndex = 7;
// //
// pictureBox1 // pictureBox1
// //
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Location = new System.Drawing.Point(571, 23); this.pictureBox1.Location = new System.Drawing.Point(571, 23);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 23, 3, 3); this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 23, 3, 3);
this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(334, 473); this.pictureBox1.Size = new System.Drawing.Size(334, 473);
this.pictureBox1.TabIndex = 2; this.pictureBox1.TabIndex = 2;
this.pictureBox1.TabStop = false; this.pictureBox1.TabStop = false;
// //
// buttonLoadDefaults // buttonLoadDefaults
// //
this.buttonLoadDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonLoadDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonLoadDefaults.Location = new System.Drawing.Point(683, 514); this.buttonLoadDefaults.Location = new System.Drawing.Point(683, 514);
this.buttonLoadDefaults.Name = "buttonLoadDefaults"; this.buttonLoadDefaults.Name = "buttonLoadDefaults";
this.buttonLoadDefaults.Size = new System.Drawing.Size(75, 23); this.buttonLoadDefaults.Size = new System.Drawing.Size(75, 23);
this.buttonLoadDefaults.TabIndex = 8; this.buttonLoadDefaults.TabIndex = 8;
this.buttonLoadDefaults.Text = "Defaults"; this.buttonLoadDefaults.Text = "Defaults";
this.buttonLoadDefaults.UseVisualStyleBackColor = true; this.buttonLoadDefaults.UseVisualStyleBackColor = true;
this.buttonLoadDefaults.Click += new System.EventHandler(this.buttonLoadDefaults_Click); this.buttonLoadDefaults.Click += new System.EventHandler(this.buttonLoadDefaults_Click);
// //
// buttonSaveDefaults // buttonSaveDefaults
// //
this.buttonSaveDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonSaveDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonSaveDefaults.Location = new System.Drawing.Point(602, 514); this.buttonSaveDefaults.Location = new System.Drawing.Point(602, 514);
this.buttonSaveDefaults.Name = "buttonSaveDefaults"; this.buttonSaveDefaults.Name = "buttonSaveDefaults";
this.buttonSaveDefaults.Size = new System.Drawing.Size(75, 23); this.buttonSaveDefaults.Size = new System.Drawing.Size(75, 23);
this.buttonSaveDefaults.TabIndex = 9; this.buttonSaveDefaults.TabIndex = 9;
this.buttonSaveDefaults.Text = "Save Defs"; this.buttonSaveDefaults.Text = "Save Defs";
this.buttonSaveDefaults.UseVisualStyleBackColor = true; this.buttonSaveDefaults.UseVisualStyleBackColor = true;
this.buttonSaveDefaults.Click += new System.EventHandler(this.buttonSaveDefaults_Click); this.buttonSaveDefaults.Click += new System.EventHandler(this.buttonSaveDefaults_Click);
// //
// ControllerConfig // contextMenuStrip1
// //
this.AcceptButton = this.buttonOK; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; //
this.CancelButton = this.buttonCancel; // ControllerConfig
this.ClientSize = new System.Drawing.Size(932, 544); //
this.Controls.Add(this.buttonSaveDefaults); this.AcceptButton = this.buttonOK;
this.Controls.Add(this.buttonLoadDefaults); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.Controls.Add(this.checkBoxUDLR); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel1); this.CancelButton = this.buttonCancel;
this.Controls.Add(this.buttonCancel); this.ClientSize = new System.Drawing.Size(932, 544);
this.Controls.Add(this.buttonOK); this.Controls.Add(this.buttonSaveDefaults);
this.Controls.Add(this.checkBoxAutoTab); this.Controls.Add(this.buttonLoadDefaults);
this.Controls.Add(this.label2); this.Controls.Add(this.checkBoxUDLR);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Controls.Add(this.tableLayoutPanel1);
this.Name = "ControllerConfig"; this.Controls.Add(this.buttonCancel);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Controls.Add(this.buttonOK);
this.Text = "Controller Config"; this.Controls.Add(this.checkBoxAutoTab);
this.Load += new System.EventHandler(this.NewControllerConfig_Load); this.Controls.Add(this.label2);
this.tabControl1.ResumeLayout(false); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.tableLayoutPanel1.ResumeLayout(false); this.Name = "ControllerConfig";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.ResumeLayout(false); this.Text = "Controller Config";
this.PerformLayout(); this.Load += new System.EventHandler(this.NewControllerConfig_Load);
this.tabControl1.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
} }
@ -238,5 +245,6 @@
private System.Windows.Forms.Button buttonLoadDefaults; private System.Windows.Forms.Button buttonLoadDefaults;
private System.Windows.Forms.TabPage tabPage3; private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Button buttonSaveDefaults; private System.Windows.Forms.Button buttonSaveDefaults;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
} }
} }

View File

@ -117,6 +117,9 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>

View File

@ -26,7 +26,7 @@ namespace BizHawk.Client.EmuHawk
public int ColumnWidth = 280; public int ColumnWidth = 280;
public int LabelWidth = 60; public int LabelWidth = 60;
protected List<InputWidget> Inputs = new List<InputWidget>(); protected List<InputCompositeWidget> Inputs = new List<InputCompositeWidget>();
protected List<Label> Labels = new List<Label>(); protected List<Label> Labels = new List<Label>();
private Size _panelSize = new Size(0, 0); private Size _panelSize = new Size(0, 0);
@ -109,7 +109,7 @@ namespace BizHawk.Client.EmuHawk
x += ColumnWidth; x += ColumnWidth;
} }
InputWidget iw = new InputWidget InputCompositeWidget iw = new InputCompositeWidget
{ {
Location = new Point(x, y), Location = new Point(x, y),
Size = new Size(InputSize, 23), Size = new Size(InputSize, 23),

View File

@ -63,18 +63,18 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private IEnumerable<InputWidget> InputWidgets private IEnumerable<InputCompositeWidget> InputWidgets
{ {
get get
{ {
var widgets = new List<InputWidget>(); var widgets = new List<InputCompositeWidget>();
for (var x = 0; x < HotkeyTabControl.TabPages.Count; x++) for (var x = 0; x < HotkeyTabControl.TabPages.Count; x++)
{ {
for (var y = 0; y < HotkeyTabControl.TabPages[x].Controls.Count; y++) for (var y = 0; y < HotkeyTabControl.TabPages[x].Controls.Count; y++)
{ {
if (HotkeyTabControl.TabPages[x].Controls[y] is InputWidget) if (HotkeyTabControl.TabPages[x].Controls[y] is InputCompositeWidget)
{ {
widgets.Add(HotkeyTabControl.TabPages[x].Controls[y] as InputWidget); widgets.Add(HotkeyTabControl.TabPages[x].Controls[y] as InputCompositeWidget);
} }
} }
} }

View File

@ -0,0 +1,102 @@
namespace BizHawk.Client.EmuHawk
{
partial class InputCompositeWidget
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
DropdownMenu.Dispose();
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InputCompositeWidget));
this.btnSpecial = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.widget = new BizHawk.Client.EmuHawk.InputWidget();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// btnSpecial
//
this.btnSpecial.Image = ((System.Drawing.Image)(resources.GetObject("btnSpecial.Image")));
this.btnSpecial.Location = new System.Drawing.Point(472, 0);
this.btnSpecial.Margin = new System.Windows.Forms.Padding(2, 0, 0, 0);
this.btnSpecial.Name = "btnSpecial";
this.btnSpecial.Size = new System.Drawing.Size(20, 20);
this.btnSpecial.TabIndex = 6;
this.btnSpecial.UseVisualStyleBackColor = true;
this.btnSpecial.Click += new System.EventHandler(this.btnSpecial_Click);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.widget, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.btnSpecial, 1, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(492, 20);
this.tableLayoutPanel1.TabIndex = 8;
//
// widget
//
this.widget.AutoTab = true;
this.widget.Bindings = "button1";
this.widget.Dock = System.Windows.Forms.DockStyle.Fill;
this.widget.Location = new System.Drawing.Point(0, 0);
this.widget.Margin = new System.Windows.Forms.Padding(0);
this.widget.Name = "widget";
this.widget.Size = new System.Drawing.Size(470, 20);
this.widget.TabIndex = 8;
this.widget.Text = "button1";
this.widget.WidgetName = null;
//
// InputCompositeWidget
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "InputCompositeWidget";
this.Size = new System.Drawing.Size(492, 20);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnSpecial;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private InputWidget widget;
}
}

View File

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public partial class InputCompositeWidget : UserControl
{
public InputCompositeWidget()
{
InitializeComponent();
DropdownMenu = new ContextMenuStrip();
DropdownMenu.ItemClicked += new ToolStripItemClickedEventHandler(DropdownMenu_ItemClicked);
foreach (var str in InputWidget.SpecialBindings)
{
var tsi = new ToolStripMenuItem(str);
DropdownMenu.Items.Add(tsi);
}
btnSpecial.ContextMenuStrip = DropdownMenu;
}
ContextMenuStrip DropdownMenu;
public bool AutoTab { get { return widget.AutoTab; } set { widget.AutoTab = true; } }
public string WidgetName { get { return widget.WidgetName; } set { widget.WidgetName = value; } }
public string Bindings { get { return widget.Bindings; } set { widget.Bindings = value; } }
public void Clear()
{
widget.Clear();
}
private void btnSpecial_Click(object sender, EventArgs e)
{
DropdownMenu.Show(Control.MousePosition);
}
void DropdownMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
widget.SetBinding(e.ClickedItem.Text);
}
}
}

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnSpecial.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAAkAAAAGCAYAAAARx7TFAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADrwAAA68AZW8ckkAAAAWdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjA76PVpAAAA
HUlEQVQYV2MgBfzHg1EAQQUwQFABDBBUgAUwMAAAQwwP8VwP41AAAAAASUVORK5CYII=
</value>
</data>
</root>

View File

@ -17,6 +17,14 @@ namespace BizHawk.Client.EmuHawk
private int _pos; // Which mapping the widget will listen for private int _pos; // Which mapping the widget will listen for
private string _wasPressed = string.Empty; private string _wasPressed = string.Empty;
/// <summary>
/// These bindings get ignored by the widget and can only be entered by SetBinding() via the contextmenu from the InputCompositeWidget
/// </summary>
public static readonly string[] SpecialBindings = new[] {
"WMouse L","WMouse M","WMouse R",
"WMouse 1", "WMouse 2"
};
public InputWidget() public InputWidget()
{ {
ContextMenu = new ContextMenu(); ContextMenu = new ContextMenu();
@ -108,6 +116,19 @@ namespace BizHawk.Client.EmuHawk
Text = string.Empty; Text = string.Empty;
} }
/// <summary>
/// sets a binding manually. This may not be implemented quite right.
/// </summary>
public void SetBinding(string bindingStr)
{
_bindings[_pos] = bindingStr;
UpdateLabel();
Increment();
}
/// <summary>
/// Poll input events and apply processing related to accepting that as a binding
/// </summary>
private void ReadKeys() private void ReadKeys()
{ {
Input.Instance.Update(); Input.Instance.Update();
@ -119,6 +140,12 @@ namespace BizHawk.Client.EmuHawk
if (bindingStr != null) if (bindingStr != null)
{ {
//ignore special bindings
if (SpecialBindings.Contains(bindingStr))
{
return;
}
if (bindingStr == "Escape") if (bindingStr == "Escape")
{ {
EraseMappings(); EraseMappings();