summaryrefslogtreecommitdiff
path: root/Native
diff options
context:
space:
mode:
Diffstat (limited to 'Native')
-rw-r--r--Native/EmuKeyboardDesigner/EmuKeyboardDesigner.csproj9
-rw-r--r--Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suobin43008 -> 49152 bytes
-rw-r--r--Native/EmuKeyboardDesigner/ImageControl.Designer.cs181
-rw-r--r--Native/EmuKeyboardDesigner/ImageControl.cs138
-rw-r--r--Native/EmuKeyboardDesigner/ImageControl.resx120
-rw-r--r--Native/EmuKeyboardDesigner/MainForm.Designer.cs149
-rw-r--r--Native/EmuKeyboardDesigner/MainForm.cs127
7 files changed, 722 insertions, 2 deletions
diff --git a/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.csproj b/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.csproj
index 9f15f6b..28f34ff 100644
--- a/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.csproj
+++ b/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.csproj
@@ -46,6 +46,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="ImageControl.cs">
+ <SubType>UserControl</SubType>
+ </Compile>
+ <Compile Include="ImageControl.Designer.cs">
+ <DependentUpon>ImageControl.cs</DependentUpon>
+ </Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -54,6 +60,9 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="ImageControl.resx">
+ <DependentUpon>ImageControl.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
diff --git a/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo b/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo
index 0230234..5dcb993 100644
--- a/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo
+++ b/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo
Binary files differ
diff --git a/Native/EmuKeyboardDesigner/ImageControl.Designer.cs b/Native/EmuKeyboardDesigner/ImageControl.Designer.cs
new file mode 100644
index 0000000..b181eb3
--- /dev/null
+++ b/Native/EmuKeyboardDesigner/ImageControl.Designer.cs
@@ -0,0 +1,181 @@
+namespace EmuKeyboardDesigner
+{
+ partial class ImageControl
+ {
+ /// <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);
+ }
+
+ #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()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.xUpDown = new System.Windows.Forms.NumericUpDown();
+ this.yUpDown = new System.Windows.Forms.NumericUpDown();
+ this.heightUpDown = new System.Windows.Forms.NumericUpDown();
+ this.widthUpDown = new System.Windows.Forms.NumericUpDown();
+ this.label2 = new System.Windows.Forms.Label();
+ this.imageBox = new System.Windows.Forms.PictureBox();
+ this.loadButton = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.xUpDown)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.yUpDown)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.heightUpDown)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.widthUpDown)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.imageBox)).BeginInit();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.label1.Location = new System.Drawing.Point(13, 224);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(35, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "X,Y:";
+ //
+ // xUpDown
+ //
+ this.xUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.xUpDown.Location = new System.Drawing.Point(44, 224);
+ this.xUpDown.Maximum = new decimal(new int[] {
+ 1000,
+ 0,
+ 0,
+ 0});
+ this.xUpDown.Name = "xUpDown";
+ this.xUpDown.Size = new System.Drawing.Size(50, 20);
+ this.xUpDown.TabIndex = 1;
+ this.xUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
+ this.xUpDown.ValueChanged += new System.EventHandler(this.OnXChanged);
+ //
+ // yUpDown
+ //
+ this.yUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.yUpDown.Location = new System.Drawing.Point(100, 224);
+ this.yUpDown.Maximum = new decimal(new int[] {
+ 1000,
+ 0,
+ 0,
+ 0});
+ this.yUpDown.Name = "yUpDown";
+ this.yUpDown.Size = new System.Drawing.Size(50, 20);
+ this.yUpDown.TabIndex = 2;
+ this.yUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
+ this.yUpDown.ValueChanged += new System.EventHandler(this.OnYChanged);
+ //
+ // heightUpDown
+ //
+ this.heightUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.heightUpDown.Location = new System.Drawing.Point(243, 224);
+ this.heightUpDown.Maximum = new decimal(new int[] {
+ 1000,
+ 0,
+ 0,
+ 0});
+ this.heightUpDown.Name = "heightUpDown";
+ this.heightUpDown.Size = new System.Drawing.Size(50, 20);
+ this.heightUpDown.TabIndex = 5;
+ this.heightUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
+ this.heightUpDown.ValueChanged += new System.EventHandler(this.OnHeightChanged);
+ //
+ // widthUpDown
+ //
+ this.widthUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.widthUpDown.Location = new System.Drawing.Point(187, 224);
+ this.widthUpDown.Maximum = new decimal(new int[] {
+ 1000,
+ 0,
+ 0,
+ 0});
+ this.widthUpDown.Name = "widthUpDown";
+ this.widthUpDown.Size = new System.Drawing.Size(50, 20);
+ this.widthUpDown.TabIndex = 4;
+ this.widthUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
+ this.widthUpDown.ValueChanged += new System.EventHandler(this.OnWidthChanged);
+ //
+ // label2
+ //
+ this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.label2.Location = new System.Drawing.Point(156, 224);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(35, 13);
+ this.label2.TabIndex = 3;
+ this.label2.Text = "W, H:";
+ //
+ // imageBox
+ //
+ this.imageBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.imageBox.Location = new System.Drawing.Point(0, 0);
+ this.imageBox.Name = "imageBox";
+ this.imageBox.Size = new System.Drawing.Size(416, 212);
+ this.imageBox.TabIndex = 6;
+ this.imageBox.TabStop = false;
+ //
+ // loadButton
+ //
+ this.loadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.loadButton.Location = new System.Drawing.Point(303, 222);
+ this.loadButton.Name = "loadButton";
+ this.loadButton.Size = new System.Drawing.Size(111, 22);
+ this.loadButton.TabIndex = 7;
+ this.loadButton.Text = "Load Image";
+ this.loadButton.UseVisualStyleBackColor = true;
+ this.loadButton.Click += new System.EventHandler(this.OnLoad);
+ //
+ // ImageControl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.loadButton);
+ this.Controls.Add(this.imageBox);
+ this.Controls.Add(this.heightUpDown);
+ this.Controls.Add(this.widthUpDown);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.yUpDown);
+ this.Controls.Add(this.xUpDown);
+ this.Controls.Add(this.label1);
+ this.MinimumSize = new System.Drawing.Size(417, 247);
+ this.Name = "ImageControl";
+ this.Size = new System.Drawing.Size(417, 247);
+ ((System.ComponentModel.ISupportInitialize)(this.xUpDown)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.yUpDown)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.heightUpDown)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.widthUpDown)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.imageBox)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.NumericUpDown xUpDown;
+ private System.Windows.Forms.NumericUpDown yUpDown;
+ private System.Windows.Forms.NumericUpDown heightUpDown;
+ private System.Windows.Forms.NumericUpDown widthUpDown;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.PictureBox imageBox;
+ private System.Windows.Forms.Button loadButton;
+ }
+}
diff --git a/Native/EmuKeyboardDesigner/ImageControl.cs b/Native/EmuKeyboardDesigner/ImageControl.cs
new file mode 100644
index 0000000..06e4c74
--- /dev/null
+++ b/Native/EmuKeyboardDesigner/ImageControl.cs
@@ -0,0 +1,138 @@
+// This file is part of the Noddybox.Emulation C# suite.
+//
+// Noddybox.Emulation is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Noddybox.Emulation is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Noddybox.Emulation. If not, see <http://www.gnu.org/licenses/>.
+//
+// Copyright (c) 2012 Ian Cowburn
+//
+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 EmuKeyboardDesigner
+{
+ public partial class ImageControl : UserControl
+ {
+ private Bitmap image;
+
+ public ImageControl()
+ {
+ InitializeComponent();
+ }
+
+ public int KeyX
+ {
+ get
+ {
+ return Convert.ToInt32(xUpDown.Value);
+ }
+ set
+ {
+ xUpDown.Value = value;
+ }
+ }
+
+ public int KeyY
+ {
+ get
+ {
+ return Convert.ToInt32(yUpDown.Value);
+ }
+ set
+ {
+ yUpDown.Value = value;
+ }
+ }
+
+ public int KeyWidth
+ {
+ get
+ {
+ return Convert.ToInt32(widthUpDown.Value);
+ }
+ set
+ {
+ widthUpDown.Value = value;
+ }
+ }
+
+ public int KeyHeight
+ {
+ get
+ {
+ return Convert.ToInt32(heightUpDown.Value);
+ }
+ set
+ {
+ heightUpDown.Value = value;
+ }
+ }
+
+ private void UpdateKeyOverlay()
+ {
+ if (image != null)
+ {
+ }
+ }
+
+ private void OnXChanged(object sender, EventArgs e)
+ {
+ UpdateKeyOverlay();
+ }
+
+ private void OnYChanged(object sender, EventArgs e)
+ {
+ UpdateKeyOverlay();
+ }
+
+ private void OnWidthChanged(object sender, EventArgs e)
+ {
+ UpdateKeyOverlay();
+ }
+
+ private void OnHeightChanged(object sender, EventArgs e)
+ {
+ UpdateKeyOverlay();
+ }
+
+ private void OnLoad(object sender, EventArgs e)
+ {
+ OpenFileDialog fsel = new OpenFileDialog();
+
+ fsel.Title = "Select image to load";
+ fsel.CheckFileExists = true;
+ fsel.CheckPathExists = true;
+ fsel.Filter = "Image Files(*.PNG;*.JPG;*.BMP)|*.PNG;*.JPG;*.BMP|All files (*.*)|*.*";
+
+ if (fsel.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ image = (Bitmap)Image.FromFile(fsel.FileName);
+ imageBox.Image = image;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Failed to load " + fsel.FileName, ex.GetType().ToString(), MessageBoxButtons.OK);
+ }
+ }
+
+ UpdateKeyOverlay();
+ }
+ }
+}
diff --git a/Native/EmuKeyboardDesigner/ImageControl.resx b/Native/EmuKeyboardDesigner/ImageControl.resx
new file mode 100644
index 0000000..29dcb1b
--- /dev/null
+++ b/Native/EmuKeyboardDesigner/ImageControl.resx
@@ -0,0 +1,120 @@
+<?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>
+</root> \ No newline at end of file
diff --git a/Native/EmuKeyboardDesigner/MainForm.Designer.cs b/Native/EmuKeyboardDesigner/MainForm.Designer.cs
index 6dd8653..a43a21d 100644
--- a/Native/EmuKeyboardDesigner/MainForm.Designer.cs
+++ b/Native/EmuKeyboardDesigner/MainForm.Designer.cs
@@ -45,12 +45,157 @@ namespace EmuKeyboardDesigner
/// </summary>
private void InitializeComponent()
{
- this.components = new System.ComponentModel.Container();
+ this.keyList = new System.Windows.Forms.ListBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.stickyCheckBox = new System.Windows.Forms.CheckBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.keysymTextBox = new System.Windows.Forms.TextBox();
+ this.loadButton = new System.Windows.Forms.Button();
+ this.saveButton = new System.Windows.Forms.Button();
+ this.setButton = new System.Windows.Forms.Button();
+ this.imageControl = new EmuKeyboardDesigner.ImageControl();
+ this.removeButton = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // keyList
+ //
+ this.keyList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.keyList.FormattingEnabled = true;
+ this.keyList.Location = new System.Drawing.Point(500, 27);
+ this.keyList.Name = "keyList";
+ this.keyList.Size = new System.Drawing.Size(192, 394);
+ this.keyList.TabIndex = 0;
+ this.keyList.SelectedIndexChanged += new System.EventHandler(this.OnKeySelected);
+ //
+ // label1
+ //
+ this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(497, 9);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(33, 13);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "Keys:";
+ //
+ // stickyCheckBox
+ //
+ this.stickyCheckBox.AutoSize = true;
+ this.stickyCheckBox.Location = new System.Drawing.Point(241, 11);
+ this.stickyCheckBox.Name = "stickyCheckBox";
+ this.stickyCheckBox.Size = new System.Drawing.Size(55, 17);
+ this.stickyCheckBox.TabIndex = 2;
+ this.stickyCheckBox.Text = "Sticky";
+ this.stickyCheckBox.UseVisualStyleBackColor = true;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(12, 9);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(65, 13);
+ this.label2.TabIndex = 3;
+ this.label2.Text = "Key Symbol:";
+ //
+ // keysymTextBox
+ //
+ this.keysymTextBox.Location = new System.Drawing.Point(83, 9);
+ this.keysymTextBox.Name = "keysymTextBox";
+ this.keysymTextBox.Size = new System.Drawing.Size(152, 20);
+ this.keysymTextBox.TabIndex = 4;
+ //
+ // loadButton
+ //
+ this.loadButton.Location = new System.Drawing.Point(501, 434);
+ this.loadButton.Name = "loadButton";
+ this.loadButton.Size = new System.Drawing.Size(75, 23);
+ this.loadButton.TabIndex = 6;
+ this.loadButton.Text = "Load Keys";
+ this.loadButton.UseVisualStyleBackColor = true;
+ this.loadButton.Click += new System.EventHandler(this.OnLoad);
+ //
+ // saveButton
+ //
+ this.saveButton.Location = new System.Drawing.Point(605, 434);
+ this.saveButton.Name = "saveButton";
+ this.saveButton.Size = new System.Drawing.Size(75, 23);
+ this.saveButton.TabIndex = 7;
+ this.saveButton.Text = "Save Keys";
+ this.saveButton.UseVisualStyleBackColor = true;
+ this.saveButton.Click += new System.EventHandler(this.OnSave);
+ //
+ // setButton
+ //
+ this.setButton.Location = new System.Drawing.Point(406, 9);
+ this.setButton.Name = "setButton";
+ this.setButton.Size = new System.Drawing.Size(85, 23);
+ this.setButton.TabIndex = 8;
+ this.setButton.Text = "Set Key";
+ this.setButton.UseVisualStyleBackColor = true;
+ this.setButton.Click += new System.EventHandler(this.OnSetKey);
+ //
+ // imageControl
+ //
+ this.imageControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.imageControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.imageControl.KeyHeight = 0;
+ this.imageControl.KeyWidth = 0;
+ this.imageControl.KeyX = 0;
+ this.imageControl.KeyY = 0;
+ this.imageControl.Location = new System.Drawing.Point(12, 35);
+ this.imageControl.MinimumSize = new System.Drawing.Size(417, 247);
+ this.imageControl.Name = "imageControl";
+ this.imageControl.Size = new System.Drawing.Size(482, 423);
+ this.imageControl.TabIndex = 5;
+ //
+ // removeButton
+ //
+ this.removeButton.Location = new System.Drawing.Point(322, 9);
+ this.removeButton.Name = "removeButton";
+ this.removeButton.Size = new System.Drawing.Size(78, 23);
+ this.removeButton.TabIndex = 9;
+ this.removeButton.Text = "Remove Key";
+ this.removeButton.UseVisualStyleBackColor = true;
+ this.removeButton.Click += new System.EventHandler(this.OnRemoveKey);
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Text = "Form1";
+ this.ClientSize = new System.Drawing.Size(692, 470);
+ this.Controls.Add(this.removeButton);
+ this.Controls.Add(this.setButton);
+ this.Controls.Add(this.saveButton);
+ this.Controls.Add(this.loadButton);
+ this.Controls.Add(this.imageControl);
+ this.Controls.Add(this.keysymTextBox);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.stickyCheckBox);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.keyList);
+ this.MinimumSize = new System.Drawing.Size(700, 500);
+ this.Name = "MainForm";
+ this.Text = "Emulation Keyboard Designer";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
}
#endregion
+
+ private System.Windows.Forms.ListBox keyList;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.CheckBox stickyCheckBox;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox keysymTextBox;
+ private ImageControl imageControl;
+ private System.Windows.Forms.Button loadButton;
+ private System.Windows.Forms.Button saveButton;
+ private System.Windows.Forms.Button setButton;
+ private System.Windows.Forms.Button removeButton;
}
}
diff --git a/Native/EmuKeyboardDesigner/MainForm.cs b/Native/EmuKeyboardDesigner/MainForm.cs
index 8ea1502..56887ba 100644
--- a/Native/EmuKeyboardDesigner/MainForm.cs
+++ b/Native/EmuKeyboardDesigner/MainForm.cs
@@ -16,6 +16,7 @@
// Copyright (c) 2012 Ian Cowburn
//
using System;
+using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -23,6 +24,8 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
+using Noddybox.Emulation.Keyboard.Schema;
+using System.Xml;
namespace EmuKeyboardDesigner
{
@@ -32,5 +35,129 @@ namespace EmuKeyboardDesigner
{
InitializeComponent();
}
+
+ private void OnSetKey(object sender, EventArgs e)
+ {
+ string sym = keysymTextBox.Text;
+
+ if (!String.IsNullOrWhiteSpace(sym))
+ {
+ int index = keyList.FindStringExact(sym);
+
+ if (index > -1)
+ {
+ KeyboardKey key = (KeyboardKey)keyList.Items[index];
+
+ key.X = imageControl.KeyX;
+ key.Y = imageControl.KeyY;
+ key.Width = imageControl.KeyWidth;
+ key.Height = imageControl.KeyHeight;
+ key.Sticky = stickyCheckBox.Checked;
+
+ keyList.SelectedItem = key;
+ }
+ else
+ {
+ KeyboardKey key = new KeyboardKey()
+ {
+ KeySymbol = sym,
+ X = imageControl.KeyX,
+ Y = imageControl.KeyY,
+ Width = imageControl.KeyWidth,
+ Height = imageControl.KeyHeight,
+ Sticky = stickyCheckBox.Checked
+ };
+
+ keyList.Items.Add(key);
+ keyList.SelectedItem = key;
+ }
+ }
+ }
+
+ private void OnLoad(object sender, EventArgs e)
+ {
+ OpenFileDialog fsel = new OpenFileDialog();
+
+ fsel.Filter = "XML Files(*.XML)|*.XML";
+
+ if (fsel.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ XmlDocument xml = new XmlDocument();
+
+ xml.Load(fsel.FileName);
+
+ KeyboardDefinition def = KeyboardDefinition.CreateFromXML(xml);
+
+ keyList.Items.Clear();
+
+ foreach (KeyboardKey k in def.Definitions)
+ {
+ keyList.Items.Add(k);
+ }
+
+ if (keyList.Items.Count > 0)
+ {
+ keyList.SelectedIndex = 0;
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Failed to load " + fsel.FileName + "\n\n" + ex.Message, ex.GetType().ToString(), MessageBoxButtons.OK);
+ }
+ }
+ }
+
+ private void OnSave(object sender, EventArgs e)
+ {
+ SaveFileDialog fsel = new SaveFileDialog();
+
+ fsel.Filter = "XML Files(*.XML)|*.XML";
+
+ if (fsel.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ KeyboardDefinition def = new KeyboardDefinition();
+
+ foreach (KeyboardKey k in keyList.Items)
+ {
+ def.Definitions.Add(k);
+ }
+
+ XmlDocument doc = def.CreateXML();
+
+ doc.Save(fsel.FileName);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Failed to save " + fsel.FileName + "\n\n" + ex.Message, ex.GetType().ToString(), MessageBoxButtons.OK);
+ }
+ }
+ }
+
+ private void OnKeySelected(object sender, EventArgs e)
+ {
+ if (keyList.SelectedIndex > -1)
+ {
+ KeyboardKey key = (KeyboardKey)keyList.SelectedItem;
+
+ keysymTextBox.Text = key.KeySymbol;
+ imageControl.KeyX = key.X;
+ imageControl.KeyY = key.Y;
+ imageControl.KeyWidth = key.Width;
+ imageControl.KeyHeight = key.Height;
+ stickyCheckBox.Checked = key.Sticky;
+ }
+ }
+
+ private void OnRemoveKey(object sender, EventArgs e)
+ {
+ if (keyList.SelectedIndex > -1)
+ {
+ keyList.Items.RemoveAt(keyList.SelectedIndex);
+ }
+ }
}
}