Change device removal event to only hide one device rather than refresh a list

This commit is contained in:
Travis Nickles 2017-04-26 01:00:05 -07:00
parent 2a20350b6b
commit de0e9a88cb
5 changed files with 150 additions and 53 deletions

View File

@ -276,7 +276,9 @@ namespace DS4Windows
return false; return false;
})()) })())
{
continue; continue;
}
for (Int32 Index = 0, arlength = DS4Controllers.Length; Index < arlength; Index++) for (Int32 Index = 0, arlength = DS4Controllers.Length; Index < arlength; Index++)
{ {
@ -289,7 +291,7 @@ namespace DS4Windows
device.Removal += this.On_DS4Removal; device.Removal += this.On_DS4Removal;
device.Removal += DS4Devices.On_Removal; device.Removal += DS4Devices.On_Removal;
touchPad[Index] = new Mouse(Index, device); touchPad[Index] = new Mouse(Index, device);
device.LightBarColor = MainColor[Index]; device.LightBarColor = getMainColor(Index);
device.Report += this.On_Report; device.Report += this.On_Report;
if (!getDInputOnly(Index)) if (!getDInputOnly(Index))
x360Bus.Plugin(Index); x360Bus.Plugin(Index);
@ -488,8 +490,10 @@ namespace DS4Windows
DS4Device device = (DS4Device)sender; DS4Device device = (DS4Device)sender;
int ind = -1; int ind = -1;
for (int i = 0, arlength = DS4Controllers.Length; ind == -1 && i < arlength; i++) for (int i = 0, arlength = DS4Controllers.Length; ind == -1 && i < arlength; i++)
{
if (DS4Controllers[i] != null && device.getMacAddress() == DS4Controllers[i].getMacAddress()) if (DS4Controllers[i] != null && device.getMacAddress() == DS4Controllers[i].getMacAddress())
ind = i; ind = i;
}
if (ind != -1) if (ind != -1)
{ {
@ -520,7 +524,8 @@ namespace DS4Windows
touchPad[ind] = null; touchPad[ind] = null;
lag[ind] = false; lag[ind] = false;
inWarnMonitor[ind] = false; inWarnMonitor[ind] = false;
ControllerStatusChanged(this); OnControllerRemoved(this, ind);
//ControllerStatusChanged(this);
} }
} }
} }
@ -570,9 +575,6 @@ namespace DS4Windows
device.getPreviousState(PreviousState[ind]); device.getPreviousState(PreviousState[ind]);
DS4State pState = PreviousState[ind]; DS4State pState = PreviousState[ind];
// Change routine to be more specific to a device.
// Currently updates status of all devices in DS4Form when any battery
// state change occurs.
if (pState.Battery != cState.Battery) if (pState.Battery != cState.Battery)
OnBatteryStatusChange(this, ind, cState.Battery); OnBatteryStatusChange(this, ind, cState.Battery);
//ControllerStatusChanged(this); //ControllerStatusChanged(this);
@ -623,7 +625,7 @@ namespace DS4Windows
{ {
lag[ind] = true; lag[ind] = true;
LogDebug(Properties.Resources.LatencyOverTen.Replace("*number*", (ind + 1).ToString()), true); LogDebug(Properties.Resources.LatencyOverTen.Replace("*number*", (ind + 1).ToString()), true);
if (FlashWhenLate) if (getFlashWhenLate())
{ {
DS4Color color = new DS4Color { red = 50, green = 0, blue = 0 }; DS4Color color = new DS4Color { red = 50, green = 0, blue = 0 };
DS4LightBar.forcedColor[ind] = color; DS4LightBar.forcedColor[ind] = color;
@ -1068,7 +1070,7 @@ namespace DS4Windows
//sets the rumble adjusted with rumble boost //sets the rumble adjusted with rumble boost
public virtual void setRumble(byte heavyMotor, byte lightMotor, int deviceNum) public virtual void setRumble(byte heavyMotor, byte lightMotor, int deviceNum)
{ {
byte boost = RumbleBoost[deviceNum]; byte boost = getRumbleBoost(deviceNum);
uint lightBoosted = ((uint)lightMotor * (uint)boost) / 100; uint lightBoosted = ((uint)lightMotor * (uint)boost) / 100;
if (lightBoosted > 255) if (lightBoosted > 255)
lightBoosted = 255; lightBoosted = 255;

View File

@ -142,7 +142,7 @@ namespace DS4Windows
} }
} }
public class BatteryReportArgs: EventArgs public class BatteryReportArgs : EventArgs
{ {
private int index; private int index;
private int level; private int level;
@ -164,6 +164,21 @@ namespace DS4Windows
} }
} }
public class ControllerRemovedArgs : EventArgs
{
private int index;
public ControllerRemovedArgs(int index)
{
this.index = index;
}
public int getIndex()
{
return this.index;
}
}
public class MultiValueDict<Key, Value> : Dictionary<Key, List<Value>> public class MultiValueDict<Key, Value> : Dictionary<Key, List<Value>>
{ {
public void Add(Key key, Value val) public void Add(Key key, Value val)
@ -246,6 +261,16 @@ namespace DS4Windows
} }
} }
public static event EventHandler<ControllerRemovedArgs> ControllerRemoved;
public static void OnControllerRemoved(object sender, int index)
{
if (ControllerRemoved != null)
{
ControllerRemovedArgs args = new ControllerRemovedArgs(index);
ControllerRemoved(sender, args);
}
}
//general values //general values
public static bool UseExclusiveMode public static bool UseExclusiveMode
{ {
@ -332,6 +357,10 @@ namespace DS4Windows
set { m_Config.flashWhenLate = value; } set { m_Config.flashWhenLate = value; }
get { return m_Config.flashWhenLate; } get { return m_Config.flashWhenLate; }
} }
public static bool getFlashWhenLate()
{
return m_Config.flashWhenLate;
}
public static int FlashWhenLateAt public static int FlashWhenLateAt
{ {
set { m_Config.flashWhenLateAt = value; } set { m_Config.flashWhenLateAt = value; }
@ -350,6 +379,10 @@ namespace DS4Windows
//controller/profile specfic values //controller/profile specfic values
public static int[] ButtonMouseSensitivity => m_Config.buttonMouseSensitivity; public static int[] ButtonMouseSensitivity => m_Config.buttonMouseSensitivity;
public static byte[] RumbleBoost => m_Config.rumble; public static byte[] RumbleBoost => m_Config.rumble;
public static byte getRumbleBoost(int index)
{
return m_Config.rumble[index];
}
public static double[] Rainbow => m_Config.rainbow; public static double[] Rainbow => m_Config.rainbow;
public static double getRainbow(int index) public static double getRainbow(int index)
{ {

View File

@ -26,6 +26,7 @@ namespace DS4Windows
delegate void LogDebugDelegate(DateTime Time, String Data, bool warning); delegate void LogDebugDelegate(DateTime Time, String Data, bool warning);
delegate void NotificationDelegate(object sender, DebugEventArgs args); delegate void NotificationDelegate(object sender, DebugEventArgs args);
delegate void BatteryStatusDelegate(object sender, BatteryReportArgs args); delegate void BatteryStatusDelegate(object sender, BatteryReportArgs args);
delegate void ControllerRemovedDelegate(object sender, ControllerRemovedArgs args);
protected Label[] Pads, Batteries; protected Label[] Pads, Batteries;
protected ComboBox[] cbs; protected ComboBox[] cbs;
protected Button[] ebns; protected Button[] ebns;
@ -302,6 +303,7 @@ namespace DS4Windows
LoadP(); LoadP();
Global.ControllerStatusChange += ControllerStatusChange; Global.ControllerStatusChange += ControllerStatusChange;
Global.BatteryStatusChange += BatteryStatusUpdate; Global.BatteryStatusChange += BatteryStatusUpdate;
Global.ControllerRemoved += ControllerRemovedChange;
Enable_Controls(0, false); Enable_Controls(0, false);
Enable_Controls(1, false); Enable_Controls(1, false);
Enable_Controls(2, false); Enable_Controls(2, false);
@ -919,14 +921,6 @@ namespace DS4Windows
catch { } catch { }
} }
protected void ControllerStatusChange(object sender, EventArgs e)
{
if (InvokeRequired)
Invoke(new ControllerStatusChangedDelegate(ControllerStatusChange), new object[] { sender, e });
else
ControllerStatusChanged();
}
protected void BatteryStatusUpdate(object sender, BatteryReportArgs args) protected void BatteryStatusUpdate(object sender, BatteryReportArgs args)
{ {
if (this.InvokeRequired) if (this.InvokeRequired)
@ -951,6 +945,50 @@ namespace DS4Windows
} }
} }
protected void ControllerRemovedChange(object sender, ControllerRemovedArgs args)
{
if (this.InvokeRequired)
{
try
{
ControllerRemovedDelegate d = new ControllerRemovedDelegate(ControllerRemovedChange);
this.BeginInvoke(d, new object[] { sender, args });
}
catch { }
}
else
{
int devIndex = args.getIndex();
Pads[devIndex].Text = Properties.Resources.Disconnected;
Enable_Controls(devIndex, false);
statPB[devIndex].Visible = false;
toolTip1.SetToolTip(statPB[devIndex], "");
DS4Device[] devices = Program.rootHub.DS4Controllers;
int controllerLen = devices.Length;
bool nocontrollers = true;
for (Int32 i = 0, PadsLen = Pads.Length; nocontrollers && i < PadsLen; i++)
{
DS4Device d = devices[i];
if (d != null)
{
nocontrollers = false;
}
}
lbNoControllers.Visible = nocontrollers;
tLPControllers.Visible = !nocontrollers;
}
}
protected void ControllerStatusChange(object sender, EventArgs e)
{
if (InvokeRequired)
Invoke(new ControllerStatusChangedDelegate(ControllerStatusChange), new object[] { sender, e });
else
ControllerStatusChanged();
}
protected void ControllerStatusChanged() protected void ControllerStatusChanged()
{ {
String tooltip = "DS4Windows v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion; String tooltip = "DS4Windows v" + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
@ -1009,7 +1047,6 @@ namespace DS4Windows
lbNoControllers.Visible = nocontrollers; lbNoControllers.Visible = nocontrollers;
tLPControllers.Visible = !nocontrollers; tLPControllers.Visible = !nocontrollers;
btnClear.Enabled = lvDebug.Items.Count > 0;
if (tooltip.Length > 63) if (tooltip.Length > 63)
notifyIcon1.Text = tooltip.Substring(0, 63); notifyIcon1.Text = tooltip.Substring(0, 63);
else else
@ -1214,8 +1251,13 @@ namespace DS4Windows
toolStrip1.Visible = true; toolStrip1.Visible = true;
toolStrip1.Enabled = true; toolStrip1.Enabled = true;
lbLastMessage.ForeColor = SystemColors.GrayText; lbLastMessage.ForeColor = SystemColors.GrayText;
lbLastMessage.Text = lvDebug.Items[lvDebug.Items.Count - 1].SubItems[1].Text; int lvDebugItemCount = lvDebug.Items.Count;
if (lvDebugItemCount > 0)
{
lbLastMessage.Text = lvDebug.Items[lvDebugItemCount - 1].SubItems[1].Text;
} }
}
private void editButtons_Click(object sender, EventArgs e) private void editButtons_Click(object sender, EventArgs e)
{ {
Button bn = (Button)sender; Button bn = (Button)sender;

View File

@ -318,9 +318,6 @@
<data name="btnClear.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> <data name="btnClear.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value> <value>Bottom</value>
</data> </data>
<data name="btnClear.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="btnClear.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> <data name="btnClear.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value> <value>NoControl</value>
</data> </data>
@ -475,10 +472,10 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="bnLight3.Location" type="System.Drawing.Point, System.Drawing"> <data name="bnLight3.Location" type="System.Drawing.Point, System.Drawing">
<value>826, 74</value> <value>822, 74</value>
</data> </data>
<data name="bnLight3.Size" type="System.Drawing.Size, System.Drawing"> <data name="bnLight3.Size" type="System.Drawing.Size, System.Drawing">
<value>67, 22</value> <value>71, 22</value>
</data> </data>
<data name="bnLight3.TabIndex" type="System.Int32, mscorlib"> <data name="bnLight3.TabIndex" type="System.Int32, mscorlib">
<value>50</value> <value>50</value>
@ -502,7 +499,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="pBStatus1.Location" type="System.Drawing.Point, System.Drawing"> <data name="pBStatus1.Location" type="System.Drawing.Point, System.Drawing">
<value>394, 19</value> <value>392, 19</value>
</data> </data>
<data name="pBStatus1.Size" type="System.Drawing.Size, System.Drawing"> <data name="pBStatus1.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 20</value> <value>39, 20</value>
@ -604,7 +601,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="bnEditC3.Location" type="System.Drawing.Point, System.Drawing"> <data name="bnEditC3.Location" type="System.Drawing.Point, System.Drawing">
<value>783, 74</value> <value>779, 74</value>
</data> </data>
<data name="bnEditC3.Size" type="System.Drawing.Size, System.Drawing"> <data name="bnEditC3.Size" type="System.Drawing.Size, System.Drawing">
<value>37, 22</value> <value>37, 22</value>
@ -634,7 +631,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="bnEditC4.Location" type="System.Drawing.Point, System.Drawing"> <data name="bnEditC4.Location" type="System.Drawing.Point, System.Drawing">
<value>783, 102</value> <value>779, 102</value>
</data> </data>
<data name="bnEditC4.Size" type="System.Drawing.Size, System.Drawing"> <data name="bnEditC4.Size" type="System.Drawing.Size, System.Drawing">
<value>37, 22</value> <value>37, 22</value>
@ -733,7 +730,7 @@
<value>None</value> <value>None</value>
</data> </data>
<data name="cBController1.Location" type="System.Drawing.Point, System.Drawing"> <data name="cBController1.Location" type="System.Drawing.Point, System.Drawing">
<value>666, 18</value> <value>662, 18</value>
</data> </data>
<data name="cBController1.Size" type="System.Drawing.Size, System.Drawing"> <data name="cBController1.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 21</value> <value>111, 21</value>
@ -760,7 +757,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="bnEditC2.Location" type="System.Drawing.Point, System.Drawing"> <data name="bnEditC2.Location" type="System.Drawing.Point, System.Drawing">
<value>783, 46</value> <value>779, 46</value>
</data> </data>
<data name="bnEditC2.Size" type="System.Drawing.Size, System.Drawing"> <data name="bnEditC2.Size" type="System.Drawing.Size, System.Drawing">
<value>37, 22</value> <value>37, 22</value>
@ -787,7 +784,7 @@
<value>None</value> <value>None</value>
</data> </data>
<data name="cBController2.Location" type="System.Drawing.Point, System.Drawing"> <data name="cBController2.Location" type="System.Drawing.Point, System.Drawing">
<value>666, 46</value> <value>662, 46</value>
</data> </data>
<data name="cBController2.Size" type="System.Drawing.Size, System.Drawing"> <data name="cBController2.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 21</value> <value>111, 21</value>
@ -811,7 +808,7 @@
<value>None</value> <value>None</value>
</data> </data>
<data name="cBController3.Location" type="System.Drawing.Point, System.Drawing"> <data name="cBController3.Location" type="System.Drawing.Point, System.Drawing">
<value>666, 74</value> <value>662, 74</value>
</data> </data>
<data name="cBController3.Size" type="System.Drawing.Size, System.Drawing"> <data name="cBController3.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 21</value> <value>111, 21</value>
@ -838,7 +835,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="bnEditC1.Location" type="System.Drawing.Point, System.Drawing"> <data name="bnEditC1.Location" type="System.Drawing.Point, System.Drawing">
<value>783, 18</value> <value>779, 18</value>
</data> </data>
<data name="bnEditC1.Size" type="System.Drawing.Size, System.Drawing"> <data name="bnEditC1.Size" type="System.Drawing.Size, System.Drawing">
<value>37, 22</value> <value>37, 22</value>
@ -865,7 +862,7 @@
<value>None</value> <value>None</value>
</data> </data>
<data name="cBController4.Location" type="System.Drawing.Point, System.Drawing"> <data name="cBController4.Location" type="System.Drawing.Point, System.Drawing">
<value>666, 102</value> <value>662, 102</value>
</data> </data>
<data name="cBController4.Size" type="System.Drawing.Size, System.Drawing"> <data name="cBController4.Size" type="System.Drawing.Size, System.Drawing">
<value>111, 21</value> <value>111, 21</value>
@ -898,7 +895,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="lbSelectedProfile.Location" type="System.Drawing.Point, System.Drawing"> <data name="lbSelectedProfile.Location" type="System.Drawing.Point, System.Drawing">
<value>667, 0</value> <value>663, 0</value>
</data> </data>
<data name="lbSelectedProfile.Size" type="System.Drawing.Size, System.Drawing"> <data name="lbSelectedProfile.Size" type="System.Drawing.Size, System.Drawing">
<value>109, 15</value> <value>109, 15</value>
@ -970,7 +967,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="lbStatus.Location" type="System.Drawing.Point, System.Drawing"> <data name="lbStatus.Location" type="System.Drawing.Point, System.Drawing">
<value>390, 0</value> <value>388, 0</value>
</data> </data>
<data name="lbStatus.Size" type="System.Drawing.Size, System.Drawing"> <data name="lbStatus.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 15</value> <value>47, 15</value>
@ -1006,7 +1003,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="lbBattery.Location" type="System.Drawing.Point, System.Drawing"> <data name="lbBattery.Location" type="System.Drawing.Point, System.Drawing">
<value>557, 0</value> <value>554, 0</value>
</data> </data>
<data name="lbBattery.Size" type="System.Drawing.Size, System.Drawing"> <data name="lbBattery.Size" type="System.Drawing.Size, System.Drawing">
<value>51, 15</value> <value>51, 15</value>
@ -1042,7 +1039,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="lbBatt1.Location" type="System.Drawing.Point, System.Drawing"> <data name="lbBatt1.Location" type="System.Drawing.Point, System.Drawing">
<value>563, 21</value> <value>560, 21</value>
</data> </data>
<data name="lbBatt1.Size" type="System.Drawing.Size, System.Drawing"> <data name="lbBatt1.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 15</value> <value>39, 15</value>
@ -1078,7 +1075,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="lbBatt2.Location" type="System.Drawing.Point, System.Drawing"> <data name="lbBatt2.Location" type="System.Drawing.Point, System.Drawing">
<value>563, 49</value> <value>560, 49</value>
</data> </data>
<data name="lbBatt2.Size" type="System.Drawing.Size, System.Drawing"> <data name="lbBatt2.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 15</value> <value>39, 15</value>
@ -1114,7 +1111,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="lbBatt3.Location" type="System.Drawing.Point, System.Drawing"> <data name="lbBatt3.Location" type="System.Drawing.Point, System.Drawing">
<value>563, 77</value> <value>560, 77</value>
</data> </data>
<data name="lbBatt3.Size" type="System.Drawing.Size, System.Drawing"> <data name="lbBatt3.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 15</value> <value>39, 15</value>
@ -1150,7 +1147,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="lbBatt4.Location" type="System.Drawing.Point, System.Drawing"> <data name="lbBatt4.Location" type="System.Drawing.Point, System.Drawing">
<value>563, 105</value> <value>560, 105</value>
</data> </data>
<data name="lbBatt4.Size" type="System.Drawing.Size, System.Drawing"> <data name="lbBatt4.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 15</value> <value>39, 15</value>
@ -1180,7 +1177,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="pBStatus2.Location" type="System.Drawing.Point, System.Drawing"> <data name="pBStatus2.Location" type="System.Drawing.Point, System.Drawing">
<value>394, 47</value> <value>392, 47</value>
</data> </data>
<data name="pBStatus2.Size" type="System.Drawing.Size, System.Drawing"> <data name="pBStatus2.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 20</value> <value>39, 20</value>
@ -1210,7 +1207,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="pBStatus3.Location" type="System.Drawing.Point, System.Drawing"> <data name="pBStatus3.Location" type="System.Drawing.Point, System.Drawing">
<value>394, 75</value> <value>392, 75</value>
</data> </data>
<data name="pBStatus3.Size" type="System.Drawing.Size, System.Drawing"> <data name="pBStatus3.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 20</value> <value>39, 20</value>
@ -1240,7 +1237,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="pBStatus4.Location" type="System.Drawing.Point, System.Drawing"> <data name="pBStatus4.Location" type="System.Drawing.Point, System.Drawing">
<value>394, 103</value> <value>392, 103</value>
</data> </data>
<data name="pBStatus4.Size" type="System.Drawing.Size, System.Drawing"> <data name="pBStatus4.Size" type="System.Drawing.Size, System.Drawing">
<value>39, 20</value> <value>39, 20</value>
@ -1273,10 +1270,10 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="bnLight1.Location" type="System.Drawing.Point, System.Drawing"> <data name="bnLight1.Location" type="System.Drawing.Point, System.Drawing">
<value>826, 18</value> <value>822, 18</value>
</data> </data>
<data name="bnLight1.Size" type="System.Drawing.Size, System.Drawing"> <data name="bnLight1.Size" type="System.Drawing.Size, System.Drawing">
<value>67, 22</value> <value>71, 22</value>
</data> </data>
<data name="bnLight1.TabIndex" type="System.Int32, mscorlib"> <data name="bnLight1.TabIndex" type="System.Int32, mscorlib">
<value>50</value> <value>50</value>
@ -1303,10 +1300,10 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="bnLight2.Location" type="System.Drawing.Point, System.Drawing"> <data name="bnLight2.Location" type="System.Drawing.Point, System.Drawing">
<value>826, 46</value> <value>822, 46</value>
</data> </data>
<data name="bnLight2.Size" type="System.Drawing.Size, System.Drawing"> <data name="bnLight2.Size" type="System.Drawing.Size, System.Drawing">
<value>67, 22</value> <value>71, 22</value>
</data> </data>
<data name="bnLight2.TabIndex" type="System.Int32, mscorlib"> <data name="bnLight2.TabIndex" type="System.Int32, mscorlib">
<value>51</value> <value>51</value>
@ -1333,10 +1330,10 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="bnLight4.Location" type="System.Drawing.Point, System.Drawing"> <data name="bnLight4.Location" type="System.Drawing.Point, System.Drawing">
<value>826, 102</value> <value>822, 102</value>
</data> </data>
<data name="bnLight4.Size" type="System.Drawing.Size, System.Drawing"> <data name="bnLight4.Size" type="System.Drawing.Size, System.Drawing">
<value>67, 22</value> <value>71, 22</value>
</data> </data>
<data name="bnLight4.TabIndex" type="System.Int32, mscorlib"> <data name="bnLight4.TabIndex" type="System.Int32, mscorlib">
<value>52</value> <value>52</value>
@ -1381,7 +1378,7 @@
<value>1</value> <value>1</value>
</data> </data>
<data name="tLPControllers.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms"> <data name="tLPControllers.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="bnLight3" Row="3" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus1" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="lbPad1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbPad2" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC3" Row="3" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC4" Row="4" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="lbPad3" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbPad4" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="cBController1" Row="1" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC2" Row="2" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="cBController2" Row="2" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="cBController3" Row="3" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC1" Row="1" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="cBController4" Row="4" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="lbSelectedProfile" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="lbID" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbStatus" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="lbBattery" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt1" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt2" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt3" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt4" Row="4" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus2" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus3" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus4" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="bnLight1" Row="1" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="bnLight2" Row="2" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="bnLight4" Row="4" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,48.95498,Percent,26.82658,Percent,24.21844,AutoSize,0,AutoSize,0,Absolute,72" /&gt;&lt;Rows Styles="AutoSize,0,Percent,25,Percent,25,Percent,25,Percent,25" /&gt;&lt;/TableLayoutSettings&gt;</value> <value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="bnLight3" Row="3" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus1" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="lbPad1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbPad2" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC3" Row="3" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC4" Row="4" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="lbPad3" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbPad4" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="cBController1" Row="1" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC2" Row="2" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="cBController2" Row="2" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="cBController3" Row="3" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="bnEditC1" Row="1" RowSpan="1" Column="4" ColumnSpan="1" /&gt;&lt;Control Name="cBController4" Row="4" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="lbSelectedProfile" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /&gt;&lt;Control Name="lbID" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="lbStatus" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="lbBattery" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt1" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt2" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt3" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="lbBatt4" Row="4" RowSpan="1" Column="2" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus2" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus3" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="pBStatus4" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;Control Name="bnLight1" Row="1" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="bnLight2" Row="2" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;Control Name="bnLight4" Row="4" RowSpan="1" Column="5" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,48.95498,Percent,26.82658,Percent,24.21844,AutoSize,0,AutoSize,0,Absolute,76" /&gt;&lt;Rows Styles="AutoSize,0,Percent,25,Percent,25,Percent,25,Percent,25" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data> </data>
<data name="lbNoControllers.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> <data name="lbNoControllers.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value> <value>Fill</value>
@ -3205,7 +3202,7 @@
<value>advColorDialog</value> <value>advColorDialog</value>
</data> </data>
<data name="&gt;&gt;advColorDialog.Type" xml:space="preserve"> <data name="&gt;&gt;advColorDialog.Type" xml:space="preserve">
<value>DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.4.63.0, Culture=neutral, PublicKeyToken=null</value> <value>DS4Windows.AdvancedColorDialog, DS4Windows, Version=1.4.64.0, Culture=neutral, PublicKeyToken=null</value>
</data> </data>
<data name="&gt;&gt;$this.Name" xml:space="preserve"> <data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>DS4Form</value> <value>DS4Form</value>

View File

@ -47,18 +47,31 @@ namespace DS4Windows
colored = btnRainbow.Image; colored = btnRainbow.Image;
greyscale = GreyscaleImage((Bitmap)btnRainbow.Image); greyscale = GreyscaleImage((Bitmap)btnRainbow.Image);
fLPSettings.FlowDirection = FlowDirection.TopDown; fLPSettings.FlowDirection = FlowDirection.TopDown;
foreach (Control control in tPControls.Controls) foreach (Control control in tPControls.Controls)
{
if (control is Button && !((Button)control).Name.Contains("btn")) if (control is Button && !((Button)control).Name.Contains("btn"))
buttons.Add((Button)control); buttons.Add((Button)control);
}
foreach (Control control in fLPTouchSwipe.Controls) foreach (Control control in fLPTouchSwipe.Controls)
{
if (control is Button && !((Button)control).Name.Contains("btn")) if (control is Button && !((Button)control).Name.Contains("btn"))
buttons.Add((Button)control); buttons.Add((Button)control);
}
foreach (Control control in fLPTiltControls.Controls) foreach (Control control in fLPTiltControls.Controls)
{
if (control is Button && !((Button)control).Name.Contains("btn")) if (control is Button && !((Button)control).Name.Contains("btn"))
buttons.Add((Button)control); buttons.Add((Button)control);
}
foreach (Control control in pnlController.Controls) foreach (Control control in pnlController.Controls)
{
if (control is Button && !((Button)control).Name.Contains("btn")) if (control is Button && !((Button)control).Name.Contains("btn"))
buttons.Add((Button)control); buttons.Add((Button)control);
}
foreach (Button b in buttons) foreach (Button b in buttons)
{ {
defaults.Add(b.Name, b.Text); defaults.Add(b.Name, b.Text);
@ -68,18 +81,27 @@ namespace DS4Windows
foreach (System.Windows.Forms.Control control in Controls) foreach (System.Windows.Forms.Control control in Controls)
{ {
if (control.HasChildren) if (control.HasChildren)
{
foreach (System.Windows.Forms.Control ctrl in control.Controls) foreach (System.Windows.Forms.Control ctrl in control.Controls)
{ {
if (ctrl.HasChildren) if (ctrl.HasChildren)
{
foreach (System.Windows.Forms.Control ctrl2 in ctrl.Controls) foreach (System.Windows.Forms.Control ctrl2 in ctrl.Controls)
{ {
if (ctrl2.HasChildren) if (ctrl2.HasChildren)
{
foreach (System.Windows.Forms.Control ctrl3 in ctrl2.Controls) foreach (System.Windows.Forms.Control ctrl3 in ctrl2.Controls)
ctrl3.MouseHover += Items_MouseHover; ctrl3.MouseHover += Items_MouseHover;
}
ctrl2.MouseHover += Items_MouseHover; ctrl2.MouseHover += Items_MouseHover;
} }
}
ctrl.MouseHover += Items_MouseHover; ctrl.MouseHover += Items_MouseHover;
} }
}
control.MouseHover += Items_MouseHover; control.MouseHover += Items_MouseHover;
} }
@ -88,6 +110,7 @@ namespace DS4Windows
b.MouseHover += button_MouseHover; b.MouseHover += button_MouseHover;
b.MouseLeave += button_MouseLeave; b.MouseLeave += button_MouseLeave;
} }
advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor; advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor;
inputtimer.Tick += InputDS4; inputtimer.Tick += InputDS4;
sixaxisTimer.Tick += ControllerReadout_Tick; sixaxisTimer.Tick += ControllerReadout_Tick;
@ -357,7 +380,7 @@ namespace DS4Windows
string[] satriggers = SATriggers[device].Split(','); string[] satriggers = SATriggers[device].Split(',');
List<string> s = new List<string>(); List<string> s = new List<string>();
for (int i = 0; i < satriggers.Length; i++) for (int i = 0, satrigLen = satriggers.Length; i < satrigLen; i++)
{ {
int tr; int tr;
if (int.TryParse(satriggers[i], out tr)) if (int.TryParse(satriggers[i], out tr))