2014-04-27 21:32:09 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace ScpServer
|
|
|
|
|
{
|
|
|
|
|
public partial class KBM360 : Form
|
|
|
|
|
{
|
|
|
|
|
private DS4Control.Control scpDevice;
|
|
|
|
|
private int device;
|
|
|
|
|
private Button button;
|
|
|
|
|
private Options ops;
|
2014-06-14 21:14:27 +02:00
|
|
|
|
public List<string> macros = new List<string>();
|
|
|
|
|
public List<int> macrostag = new List<int>();
|
|
|
|
|
public bool macrorepeat;
|
2014-05-12 07:48:50 +02:00
|
|
|
|
public KBM360(DS4Control.Control bus_device, int deviceNum, Options ooo, Button buton)
|
2014-04-27 21:32:09 +02:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
device = deviceNum;
|
|
|
|
|
scpDevice = bus_device;
|
|
|
|
|
ops = ooo;
|
|
|
|
|
button = buton;
|
2014-05-28 04:49:58 +02:00
|
|
|
|
cbToggle.Checked = button.Font.Italic;
|
|
|
|
|
cbScanCode.Checked = button.Font.Bold;
|
2014-06-14 21:14:27 +02:00
|
|
|
|
//cBMacro.Checked = button.Font.Underline;
|
|
|
|
|
lBMacroOn.Visible = button.Font.Underline;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
Text = "Select an action for " + button.Name.Substring(2);
|
2014-05-12 07:48:50 +02:00
|
|
|
|
foreach (System.Windows.Forms.Control control in this.Controls)
|
2014-04-27 21:32:09 +02:00
|
|
|
|
if (control is Button)
|
2014-06-14 21:14:27 +02:00
|
|
|
|
((Button)control).Click += anybtn_Click;
|
2014-04-29 23:56:58 +02:00
|
|
|
|
if (button.Name.Contains("Touch"))
|
|
|
|
|
{
|
|
|
|
|
bnMOUSEDOWN.Visible = false;
|
|
|
|
|
bnMOUSELEFT.Visible = false;
|
|
|
|
|
bnMOUSERIGHT.Visible = false;
|
2014-05-28 04:49:58 +02:00
|
|
|
|
bnMOUSEUP.Visible = false;
|
2014-04-29 23:56:58 +02:00
|
|
|
|
}
|
2014-06-14 21:14:27 +02:00
|
|
|
|
ActiveControl = null;
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
2014-06-14 21:14:27 +02:00
|
|
|
|
|
2014-04-27 21:32:09 +02:00
|
|
|
|
public void anybtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-06-14 21:14:27 +02:00
|
|
|
|
if (sender is Button && ((Button)sender).Name != "btnMacro")
|
2014-04-27 21:32:09 +02:00
|
|
|
|
{
|
2014-05-28 04:49:58 +02:00
|
|
|
|
Button bn = ((Button)sender);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
string keyname;
|
2014-04-29 23:56:58 +02:00
|
|
|
|
if (((Button)sender).Text.Contains('↑') || ((Button)sender).Text.Contains('↓') || ((Button)sender).Text.Contains('→') || ((Button)sender).Text.Contains('←') || ((Button)sender).Text.Contains('Ø'))
|
2014-04-27 21:32:09 +02:00
|
|
|
|
keyname = ((Button)sender).Text.Substring(1);
|
|
|
|
|
else if (((Button)sender).Font.Name == "Webdings")
|
|
|
|
|
{
|
|
|
|
|
if (((Button)sender).Text == "9")
|
|
|
|
|
keyname = "Previous Track";
|
|
|
|
|
else if (((Button)sender).Text == "<")
|
|
|
|
|
keyname = "Stop Track";
|
|
|
|
|
else if (((Button)sender).Text == "4")
|
|
|
|
|
keyname = "Play/Pause";
|
|
|
|
|
else if (((Button)sender).Text == ":")
|
|
|
|
|
keyname = "Next Track";
|
|
|
|
|
else
|
|
|
|
|
keyname = "How did you get here?";
|
|
|
|
|
}
|
2014-06-17 01:43:01 +02:00
|
|
|
|
else if (((Button)sender).Tag.ToString().Contains("X360"))
|
|
|
|
|
keyname = ((Button)sender).Tag.ToString().Substring(4);
|
2014-04-27 21:32:09 +02:00
|
|
|
|
else
|
|
|
|
|
keyname = ((Button)sender).Text;
|
2014-05-28 04:49:58 +02:00
|
|
|
|
|
2014-06-14 21:14:27 +02:00
|
|
|
|
object keytag;
|
2014-06-17 01:43:01 +02:00
|
|
|
|
if (((Button)sender).Tag.ToString().Contains("X360"))
|
|
|
|
|
keytag = ((Button)sender).Tag.ToString().Substring(4);
|
2014-05-12 07:48:50 +02:00
|
|
|
|
else
|
2014-06-14 21:14:27 +02:00
|
|
|
|
keytag = ((Button)sender).Tag;
|
|
|
|
|
lBMacroOn.Visible = false;
|
|
|
|
|
ops.ChangeButtonText(keyname, keytag);
|
|
|
|
|
this.Close();
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void finalMeasure(object sender, FormClosedEventArgs e)
|
|
|
|
|
{
|
2014-06-14 21:14:27 +02:00
|
|
|
|
if (lBMacroOn.Visible)
|
|
|
|
|
ops.ChangeButtonText("Macro", macrostag.ToArray());
|
|
|
|
|
ops.Toggle_Bn(cbScanCode.Checked, cbToggle.Checked, lBMacroOn.Visible, macrorepeat);
|
2014-05-28 04:49:58 +02:00
|
|
|
|
ops.UpdateLists();
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Key_Down_Action(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
2014-06-14 21:14:27 +02:00
|
|
|
|
lBMacroOn.Visible = false;
|
|
|
|
|
ops.ChangeButtonText(e.KeyCode.ToString(), e.KeyValue);
|
|
|
|
|
this.Close();
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-14 21:14:27 +02:00
|
|
|
|
private void Key_Up_Action(object sender, KeyEventArgs e)
|
2014-05-28 04:49:58 +02:00
|
|
|
|
{
|
2014-06-14 21:14:27 +02:00
|
|
|
|
lBMacroOn.Visible = false;
|
|
|
|
|
ops.ChangeButtonText(e.KeyCode.ToString(), e.KeyValue);
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Key_Press_Action(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
lBMacroOn.Visible = false;
|
|
|
|
|
ops.ChangeButtonText(e.KeyCode.ToString(), e.KeyValue);
|
|
|
|
|
this.Close();
|
2014-05-28 04:49:58 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cbToggle_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (cbToggle.Checked)
|
2014-06-14 21:14:27 +02:00
|
|
|
|
lBMacroOn.Visible = false;
|
2014-05-28 04:49:58 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-14 21:14:27 +02:00
|
|
|
|
private void btnMacro_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RecordBox rb = new RecordBox(this);
|
|
|
|
|
rb.StartPosition = FormStartPosition.Manual;
|
|
|
|
|
rb.Location = new Point(this.Location.X + 580, this.Location.Y+ 55);
|
|
|
|
|
rb.ShowDialog();
|
|
|
|
|
}
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
|
2014-06-14 21:14:27 +02:00
|
|
|
|
protected override bool IsInputKey(Keys keyData)
|
|
|
|
|
{
|
|
|
|
|
switch (keyData)
|
|
|
|
|
{
|
|
|
|
|
case Keys.Right:
|
|
|
|
|
case Keys.Left:
|
|
|
|
|
case Keys.Up:
|
|
|
|
|
case Keys.Down:
|
|
|
|
|
return true;
|
|
|
|
|
case Keys.Shift | Keys.Right:
|
|
|
|
|
case Keys.Shift | Keys.Left:
|
|
|
|
|
case Keys.Shift | Keys.Up:
|
|
|
|
|
case Keys.Shift | Keys.Down:
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return base.IsInputKey(keyData);
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
}
|
2014-06-14 21:14:27 +02:00
|
|
|
|
protected override void OnKeyDown(KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnKeyDown(e);
|
|
|
|
|
switch (e.KeyCode)
|
|
|
|
|
{
|
|
|
|
|
case Keys.Left:
|
|
|
|
|
case Keys.Right:
|
|
|
|
|
case Keys.Up:
|
|
|
|
|
case Keys.Down:
|
|
|
|
|
if (e.Shift)
|
|
|
|
|
{
|
Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...
Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
2014-06-10 21:45:09 +02:00
|
|
|
|
|
2014-06-14 21:14:27 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-04-27 21:32:09 +02:00
|
|
|
|
}
|
|
|
|
|
}
|