You can now press a button/axis/touchpad in options to change that control when in options. The icon in the notification area also shows not only when minimized, but when the main window unfocused. Fixed bug where when the tool is shrunken down, the last message of log didn’t show.

This commit is contained in:
jays2kings 2014-05-19 01:55:12 -04:00
parent 00587cdc31
commit 67bf8b061c
7 changed files with 206 additions and 137 deletions

View File

@ -10,7 +10,7 @@ namespace DS4Control
public class Control public class Control
{ {
X360Device x360Bus; X360Device x360Bus;
DS4Device[] DS4Controllers = new DS4Device[4]; public DS4Device[] DS4Controllers = new DS4Device[4];
//TPadModeSwitcher[] modeSwitcher = new TPadModeSwitcher[4]; //TPadModeSwitcher[] modeSwitcher = new TPadModeSwitcher[4];
Mouse[] touchPad = new Mouse[4]; Mouse[] touchPad = new Mouse[4];
private bool running = false; private bool running = false;
@ -85,7 +85,7 @@ namespace DS4Control
string[] profileA = Global.getAProfile(ind).Split('\\'); string[] profileA = Global.getAProfile(ind).Split('\\');
string filename = profileA[profileA.Length - 1]; string filename = profileA[profileA.Length - 1];
ind++; ind++;
if (System.IO.File.Exists(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\" + filename)) if (System.IO.File.Exists(Global.appdatapath + "\\Profiles\\" + filename))
{ {
LogDebug("Controller " + ind + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); LogDebug("Controller " + ind + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\"");
Log.LogToTray("Controller " + ind + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); Log.LogToTray("Controller " + ind + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\"");
@ -168,18 +168,14 @@ namespace DS4Control
device.Removal -= DS4Devices.On_Removal; device.Removal -= DS4Devices.On_Removal;
device.Removal += this.On_DS4Removal; device.Removal += this.On_DS4Removal;
device.Removal += DS4Devices.On_Removal; device.Removal += DS4Devices.On_Removal;
//TPadModeSwitcher m_switcher = new TPadModeSwitcher(device, Index);
//m_switcher.Debug += OnDebug;
//modeSwitcher[Index] = m_switcher;
touchPad[Index] = new Mouse(Index, device); touchPad[Index] = new Mouse(Index, device);
device.LightBarColor = Global.loadColor(Index); device.LightBarColor = Global.loadColor(Index);
device.Report += this.On_Report; device.Report += this.On_Report;
x360Bus.Plugin(Index); x360Bus.Plugin(Index);
//m_switcher.setMode(Global.getInitialMode(Index));
TouchPadOn(Index, device); TouchPadOn(Index, device);
string[] profileA = Global.getAProfile(Index).Split('\\'); string[] profileA = Global.getAProfile(Index).Split('\\');
string filename = profileA[profileA.Length - 1]; string filename = profileA[profileA.Length - 1];
if (System.IO.File.Exists(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\" + filename)) if (System.IO.File.Exists(Global.appdatapath + "\\Profiles\\" + filename))
{ {
LogDebug("Controller " + (Index+1) + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); LogDebug("Controller " + (Index+1) + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\"");
Log.LogToTray("Controller " + (Index + 1) + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); Log.LogToTray("Controller " + (Index + 1) + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\"");
@ -304,15 +300,8 @@ namespace DS4Control
DS4State pState = PreviousState[ind]; DS4State pState = PreviousState[ind];
if (pState.Battery != cState.Battery) if (pState.Battery != cState.Battery)
Global.ControllerStatusChanged(this); Global.ControllerStatusChanged(this);
//bool wasButtonMouse = modeSwitcher[ind].getCurrentMode() is ButtonMouse;
CheckForHotkeys(ind, cState, pState); CheckForHotkeys(ind, cState, pState);
//if (wasButtonMouse && modeSwitcher[ind].getCurrentMode() is ButtonMouse) GetInputkeys(ind);
{
//ButtonMouse mode = (ButtonMouse)modeSwitcher[ind].getCurrentMode();
// XXX so disgusting, need to virtualize this again
// mode.getDS4State().CopyTo(cState);
}
if (Global.getHasCustomKeysorButtons(ind)) if (Global.getHasCustomKeysorButtons(ind))
{ {
@ -344,6 +333,41 @@ namespace DS4Control
} }
} }
public string GetInputkeys(int ind)
{
DS4State cState = CurrentState[ind];
if (Mapping.getBoolMapping(DS4Controls.Cross, cState)) return "Cross";
else if (Mapping.getBoolMapping(DS4Controls.Circle, cState)) return "Circle";
else if (Mapping.getBoolMapping(DS4Controls.Triangle, cState)) return "Triangle";
else if (Mapping.getBoolMapping(DS4Controls.Square, cState)) return "Square";
else if (Mapping.getBoolMapping(DS4Controls.L1, cState)) return "L1";
else if (Mapping.getBoolMapping(DS4Controls.R1, cState)) return "R1";
else if (Mapping.getBoolMapping(DS4Controls.L2, cState)) return "L2";
else if (Mapping.getBoolMapping(DS4Controls.R2, cState)) return "R2";
else if (Mapping.getBoolMapping(DS4Controls.L3, cState)) return "L3";
else if (Mapping.getBoolMapping(DS4Controls.R3, cState)) return "R3";
else if (Mapping.getBoolMapping(DS4Controls.DpadUp, cState)) return "Up";
else if (Mapping.getBoolMapping(DS4Controls.DpadDown, cState)) return "Down";
else if (Mapping.getBoolMapping(DS4Controls.DpadLeft, cState)) return "Left";
else if (Mapping.getBoolMapping(DS4Controls.DpadRight, cState)) return "Right";
else if (Mapping.getBoolMapping(DS4Controls.Share, cState)) return "Share";
else if (Mapping.getBoolMapping(DS4Controls.Options, cState)) return "Options";
else if (Mapping.getBoolMapping(DS4Controls.PS, cState)) return "PS";
else if (Mapping.getBoolMapping(DS4Controls.LXPos, cState)) return "LS Right";
else if (Mapping.getBoolMapping(DS4Controls.LXNeg, cState)) return "LS Left";
else if (Mapping.getBoolMapping(DS4Controls.LYPos, cState)) return "LS Down";
else if (Mapping.getBoolMapping(DS4Controls.LYNeg, cState)) return "LS Up";
else if (Mapping.getBoolMapping(DS4Controls.RXPos, cState)) return "RS Right";
else if (Mapping.getBoolMapping(DS4Controls.RXNeg, cState)) return "RS Left";
else if (Mapping.getBoolMapping(DS4Controls.RYPos, cState)) return "RS Down";
else if (Mapping.getBoolMapping(DS4Controls.RYNeg, cState)) return "RS Up";
else if (Mapping.getBoolMapping(DS4Controls.TouchLeft, cState)) return "Touch Left";
else if (Mapping.getBoolMapping(DS4Controls.TouchRight, cState)) return "Touch Right";
else if (Mapping.getBoolMapping(DS4Controls.TouchMulti, cState)) return "Touch Multi";
else if (Mapping.getBoolMapping(DS4Controls.TouchUpper, cState)) return "Touch Upper";
else return "nothing";
}
bool touchreleased = true; bool touchreleased = true;
byte oldtouchvalue = 0; byte oldtouchvalue = 0;
protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State pState) protected virtual void CheckForHotkeys(int deviceID, DS4State cState, DS4State pState)

View File

@ -11,7 +11,7 @@ namespace DS4Service
{ {
private Control rootHub; private Control rootHub;
StreamWriter logWriter; StreamWriter logWriter;
string logFile = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\DS4Service.log"; string logFile = Global.appdatapath + @"\DS4Service.log";
public DS4Service() public DS4Service()
{ {
InitializeComponent(); InitializeComponent();

View File

@ -62,7 +62,7 @@ namespace ScpServer
else else
keyname = ((Button)sender).Text; keyname = ((Button)sender).Text;
object keytag; object keytag;
if (((Button)sender).Tag == "X360") if (((Button)sender).Tag.ToString() == "X360")
keytag = ((Button)sender).Text; keytag = ((Button)sender).Text;
else else
keytag = ((Button)sender).Tag; keytag = ((Button)sender).Tag;
@ -75,7 +75,7 @@ namespace ScpServer
{ {
ops.Toggle_Repeat(cbRepeat.Checked); ops.Toggle_Repeat(cbRepeat.Checked);
ops.Toggle_ScanCode(cbScanCode.Checked); ops.Toggle_ScanCode(cbScanCode.Checked);
ops.UpdateLists(); ops.UpdateLists();
} }
private void Key_Down_Action(object sender, KeyEventArgs e) private void Key_Down_Action(object sender, KeyEventArgs e)

View File

@ -133,8 +133,8 @@
this.lBProfileTip = new System.Windows.Forms.Label(); this.lBProfileTip = new System.Windows.Forms.Label();
this.tBProfile = new System.Windows.Forms.TextBox(); this.tBProfile = new System.Windows.Forms.TextBox();
this.btnSaveProfile = new System.Windows.Forms.Button(); this.btnSaveProfile = new System.Windows.Forms.Button();
this.advColorDialog = new ScpServer.AdvancedColorDialog();
this.lBSeperator = new System.Windows.Forms.Label(); this.lBSeperator = new System.Windows.Forms.Label();
this.advColorDialog = new ScpServer.AdvancedColorDialog();
this.MainPanel.SuspendLayout(); this.MainPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pBController)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pBController)).BeginInit();
this.SticksPanel.SuspendLayout(); this.SticksPanel.SuspendLayout();
@ -1531,11 +1531,12 @@
// //
// tBMouseSens // tBMouseSens
// //
this.tBMouseSens.AutoSize = false;
this.tBMouseSens.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244))))); this.tBMouseSens.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
this.tBMouseSens.Location = new System.Drawing.Point(151, 215); this.tBMouseSens.Location = new System.Drawing.Point(151, 215);
this.tBMouseSens.Maximum = 117; this.tBMouseSens.Maximum = 117;
this.tBMouseSens.Name = "tBMouseSens"; this.tBMouseSens.Name = "tBMouseSens";
this.tBMouseSens.Size = new System.Drawing.Size(131, 45); this.tBMouseSens.Size = new System.Drawing.Size(131, 26);
this.tBMouseSens.TabIndex = 204; this.tBMouseSens.TabIndex = 204;
this.tBMouseSens.TickStyle = System.Windows.Forms.TickStyle.None; this.tBMouseSens.TickStyle = System.Windows.Forms.TickStyle.None;
this.tBMouseSens.Value = 50; this.tBMouseSens.Value = 50;
@ -1720,12 +1721,6 @@
this.btnSaveProfile.UseVisualStyleBackColor = true; this.btnSaveProfile.UseVisualStyleBackColor = true;
this.btnSaveProfile.Click += new System.EventHandler(this.saveButton_Click); this.btnSaveProfile.Click += new System.EventHandler(this.saveButton_Click);
// //
// advColorDialog
//
this.advColorDialog.AnyColor = true;
this.advColorDialog.Color = System.Drawing.Color.Blue;
this.advColorDialog.FullOpen = true;
//
// lBSeperator // lBSeperator
// //
this.lBSeperator.AutoSize = true; this.lBSeperator.AutoSize = true;
@ -1737,6 +1732,12 @@
this.lBSeperator.TabIndex = 240; this.lBSeperator.TabIndex = 240;
this.lBSeperator.Text = "_______________________________________________________________________"; this.lBSeperator.Text = "_______________________________________________________________________";
// //
// advColorDialog
//
this.advColorDialog.AnyColor = true;
this.advColorDialog.Color = System.Drawing.Color.Blue;
this.advColorDialog.FullOpen = true;
//
// Options // Options
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1878,7 +1879,6 @@
private System.Windows.Forms.Button bnLSDown; private System.Windows.Forms.Button bnLSDown;
private System.Windows.Forms.Button bnR3; private System.Windows.Forms.Button bnR3;
private System.Windows.Forms.Button btnFullView; private System.Windows.Forms.Button btnFullView;
private System.Windows.Forms.Label lBControlTip;
public System.Windows.Forms.ListBox lBControls; public System.Windows.Forms.ListBox lBControls;
private System.Windows.Forms.NumericUpDown numUDRainbow; private System.Windows.Forms.NumericUpDown numUDRainbow;
private System.Windows.Forms.PictureBox pBRainbow; private System.Windows.Forms.PictureBox pBRainbow;
@ -1946,6 +1946,7 @@
private System.Windows.Forms.TextBox tBProfile; private System.Windows.Forms.TextBox tBProfile;
private System.Windows.Forms.Button btnSaveProfile; private System.Windows.Forms.Button btnSaveProfile;
private System.Windows.Forms.Label lBSeperator; private System.Windows.Forms.Label lBSeperator;
private System.Windows.Forms.Label lBControlTip;
} }
} }
 

View File

@ -14,7 +14,7 @@ namespace ScpServer
private int device; private int device;
private string filename; private string filename;
Byte[] oldLedColor, oldLowLedColor; Byte[] oldLedColor, oldLowLedColor;
Timer sixaxisTimer = new Timer(); Timer inputtimer = new Timer(), sixaxisTimer = new Timer();
private List<Button> buttons = new List<Button>(); private List<Button> buttons = new List<Button>();
private Button lastSelected; private Button lastSelected;
private int alphacolor; private int alphacolor;
@ -55,7 +55,7 @@ namespace ScpServer
touchpadJitterCompensation.Checked = Global.getTouchpadJitterCompensation(device); touchpadJitterCompensation.Checked = Global.getTouchpadJitterCompensation(device);
cBlowerRCOn.Checked = Global.getLowerRCOn(device); cBlowerRCOn.Checked = Global.getLowerRCOn(device);
flushHIDQueue.Checked = Global.getFlushHIDQueue(device); flushHIDQueue.Checked = Global.getFlushHIDQueue(device);
idleDisconnectTimeout.Value = Global.getIdleDisconnectTimeout(device); idleDisconnectTimeout.Value = (int)(Global.getIdleDisconnectTimeout(device)/60);
tBMouseSens.Value = Global.getButtonMouseSensitivity(device); tBMouseSens.Value = Global.getButtonMouseSensitivity(device);
lBMouseSens.Text = tBMouseSens.Value.ToString(); lBMouseSens.Text = tBMouseSens.Value.ToString();
// Force update of color choosers // Force update of color choosers
@ -98,7 +98,6 @@ namespace ScpServer
SetDynamicTrackBarValue(tBsixaxisAccelX, (scpDevice.ExposedState[device].AccelX + tBsixaxisAccelX.Value * 2) / 3); SetDynamicTrackBarValue(tBsixaxisAccelX, (scpDevice.ExposedState[device].AccelX + tBsixaxisAccelX.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelY, (scpDevice.ExposedState[device].AccelY + tBsixaxisAccelY.Value * 2) / 3); SetDynamicTrackBarValue(tBsixaxisAccelY, (scpDevice.ExposedState[device].AccelY + tBsixaxisAccelY.Value * 2) / 3);
SetDynamicTrackBarValue(tBsixaxisAccelZ, (scpDevice.ExposedState[device].AccelZ + tBsixaxisAccelZ.Value * 2) / 3); SetDynamicTrackBarValue(tBsixaxisAccelZ, (scpDevice.ExposedState[device].AccelZ + tBsixaxisAccelZ.Value * 2) / 3);
}); });
sixaxisTimer.Interval = 1000 / 60; sixaxisTimer.Interval = 1000 / 60;
#endregion #endregion
@ -117,18 +116,58 @@ namespace ScpServer
ToolTip tp = new ToolTip(); ToolTip tp = new ToolTip();
tp.SetToolTip(cBlowerRCOn, "Use lower right Touchpad as right mouse"); tp.SetToolTip(cBlowerRCOn, "Use lower right Touchpad as right mouse");
tp.SetToolTip(cBDoubleTap, "Tap and hold to drag, slight delay with one tap"); tp.SetToolTip(cBDoubleTap, "Tap and hold to drag, slight delay with one tap");
tp.SetToolTip(btnLightbar, "Click to change color"); tp.SetToolTip(btnLightbar, "Click to change color");
tp.SetToolTip(lBControlTip, "You can also use your controller to change controls");
advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor; advColorDialog.OnUpdateColor += advColorDialog_OnUpdateColor;
btnLeftStick.Enter += btnSticks_Enter; btnLeftStick.Enter += btnSticks_Enter;
btnRightStick.Enter += btnSticks_Enter; btnRightStick.Enter += btnSticks_Enter;
UpdateLists(); UpdateLists();
inputtimer.Start();
inputtimer.Tick += InputDS4;
}
private void InputDS4(object sender, EventArgs e)
{
#region DS4Input
if (Form.ActiveForm == this)
switch (scpDevice.GetInputkeys(device))
{
case ("Cross"): Show_ControlsBn(bnCross, e); break;
case ("Circle"): Show_ControlsBn(bnCircle, e); break;
case ("Square"): Show_ControlsBn(bnSquare, e); break;
case ("Triangle"): Show_ControlsBn(bnTriangle, e); break;
case ("Options"): Show_ControlsBn(bnOptions, e); break;
case ("Share"): Show_ControlsBn(bnShare, e); break;
case ("Up"): Show_ControlsBn(bnUp, e); break;
case ("Down"): Show_ControlsBn(bnDown, e); break;
case ("Left"): Show_ControlsBn(bnLeft, e); break;
case ("Right"): Show_ControlsBn(bnRight, e); break;
case ("PS"): Show_ControlsBn(bnPS, e); break;
case ("L1"): Show_ControlsBn(bnL1, e); break;
case ("R1"): Show_ControlsBn(bnR1, e); break;
case ("L2"): Show_ControlsBn(bnL2, e); break;
case ("R2"): Show_ControlsBn(bnR2, e); break;
case ("L3"): Show_ControlsBn(bnL3, e); break;
case ("R3"): Show_ControlsBn(bnR3, e); break;
case ("Touch Left"): Show_ControlsBn(bnTouchLeft, e); break;
case ("Touch Right"): Show_ControlsBn(bnTouchRight, e); break;
case ("Touch Multi"): Show_ControlsBn(bnTouchMulti, e); break;
case ("Touch Upper"): Show_ControlsBn(bnTouchUpper, e); break;
case ("LS Up"): Show_ControlsBn(bnLSUp, e); break;
case ("LS Down"): Show_ControlsBn(bnLSDown, e); break;
case ("LS Left"): Show_ControlsBn(bnLSLeft, e); break;
case ("LS Right"): Show_ControlsBn(bnLSRight, e); break;
case ("RS Up"): Show_ControlsBn(bnRSUp, e); break;
case ("RS Down"): Show_ControlsBn(bnRSDown, e); break;
case ("RS Left"): Show_ControlsBn(bnRSLeft, e); break;
case ("RS Right"): Show_ControlsBn(bnRSRight, e); break;
}
#endregion
} }
private void button_MouseHover(object sender, EventArgs e) private void button_MouseHover(object sender, EventArgs e)
{ {
switch (((Button)sender).Name) switch (((Button)sender).Name)
{ {
#region #region
case ("bnCross"): lBControls.SelectedIndex = 0; break; case ("bnCross"): lBControls.SelectedIndex = 0; break;
case ("bnCircle"): lBControls.SelectedIndex = 1; break; case ("bnCircle"): lBControls.SelectedIndex = 1; break;
case ("bnSquare"): lBControls.SelectedIndex = 2; break; case ("bnSquare"): lBControls.SelectedIndex = 2; break;
@ -158,7 +197,7 @@ namespace ScpServer
case ("bnRSDown"): lBControls.SelectedIndex = 26; break; case ("bnRSDown"): lBControls.SelectedIndex = 26; break;
case ("bnRSLeft"): lBControls.SelectedIndex = 27; break; case ("bnRSLeft"): lBControls.SelectedIndex = 27; break;
case ("bnRSRight"): lBControls.SelectedIndex = 28; break; case ("bnRSRight"): lBControls.SelectedIndex = 28; break;
#endregion #endregion
} }
} }
@ -185,7 +224,7 @@ namespace ScpServer
Global.setDoubleTap(device, cBDoubleTap.Checked); Global.setDoubleTap(device, cBDoubleTap.Checked);
Global.setButtonMouseSensitivity(device, tBMouseSens.Value); Global.setButtonMouseSensitivity(device, tBMouseSens.Value);
Global.setTapSensitivity(device, (byte)numUDTap.Value); Global.setTapSensitivity(device, (byte)numUDTap.Value);
Global.setIdleDisconnectTimeout(device, (int)idleDisconnectTimeout.Value); Global.setIdleDisconnectTimeout(device, (int)(idleDisconnectTimeout.Value * 60));
Global.setButtonMouseSensitivity(device, tBMouseSens.Value); Global.setButtonMouseSensitivity(device, tBMouseSens.Value);
Global.setRainbow(device, (int)numUDRainbow.Value); Global.setRainbow(device, (int)numUDRainbow.Value);
if (numUDRainbow.Value == 0) pBRainbow.Image = greyscale; if (numUDRainbow.Value == 0) pBRainbow.Image = greyscale;
@ -501,7 +540,7 @@ namespace ScpServer
private void idleDisconnectTimeout_ValueChanged(object sender, EventArgs e) private void idleDisconnectTimeout_ValueChanged(object sender, EventArgs e)
{ {
Global.setIdleDisconnectTimeout(device, (int)(idleDisconnectTimeout.Value * 60));
} }
private void Options_Closed(object sender, FormClosedEventArgs e) private void Options_Closed(object sender, FormClosedEventArgs e)

View File

@ -35,6 +35,8 @@
this.chData = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chData = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tmrUpdate = new System.Windows.Forms.Timer(this.components); this.tmrUpdate = new System.Windows.Forms.Timer(this.components);
this.pnlButton = new System.Windows.Forms.Panel(); this.pnlButton = new System.Windows.Forms.Panel();
this.btnImportProfiles = new System.Windows.Forms.Button();
this.llbHelp = new System.Windows.Forms.LinkLabel();
this.btnStartStop = new System.Windows.Forms.Button(); this.btnStartStop = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button(); this.btnClear = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button(); this.btnStop = new System.Windows.Forms.Button();
@ -76,8 +78,6 @@
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.openProfiles = new System.Windows.Forms.OpenFileDialog(); this.openProfiles = new System.Windows.Forms.OpenFileDialog();
this.llbHelp = new System.Windows.Forms.LinkLabel();
this.btnImportProfiles = new System.Windows.Forms.Button();
this.pnlButton.SuspendLayout(); this.pnlButton.SuspendLayout();
this.pnlDebug.SuspendLayout(); this.pnlDebug.SuspendLayout();
this.pnlStatus.SuspendLayout(); this.pnlStatus.SuspendLayout();
@ -132,6 +132,27 @@
this.pnlButton.Size = new System.Drawing.Size(794, 35); this.pnlButton.Size = new System.Drawing.Size(794, 35);
this.pnlButton.TabIndex = 10; this.pnlButton.TabIndex = 10;
// //
// btnImportProfiles
//
this.btnImportProfiles.Location = new System.Drawing.Point(9, 6);
this.btnImportProfiles.Name = "btnImportProfiles";
this.btnImportProfiles.Size = new System.Drawing.Size(87, 23);
this.btnImportProfiles.TabIndex = 14;
this.btnImportProfiles.Text = "Import Profile(s)";
this.btnImportProfiles.UseVisualStyleBackColor = true;
this.btnImportProfiles.Click += new System.EventHandler(this.btnImportProfiles_Click);
//
// llbHelp
//
this.llbHelp.AutoSize = true;
this.llbHelp.Location = new System.Drawing.Point(102, 11);
this.llbHelp.Name = "llbHelp";
this.llbHelp.Size = new System.Drawing.Size(62, 13);
this.llbHelp.TabIndex = 13;
this.llbHelp.TabStop = true;
this.llbHelp.Text = "Help/About";
this.llbHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbHelp_LinkClicked);
//
// btnStartStop // btnStartStop
// //
this.btnStartStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnStartStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@ -482,7 +503,7 @@
// //
this.lbLastMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.lbLastMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbLastMessage.ForeColor = System.Drawing.SystemColors.GrayText; this.lbLastMessage.ForeColor = System.Drawing.SystemColors.GrayText;
this.lbLastMessage.Location = new System.Drawing.Point(15, 133); this.lbLastMessage.Location = new System.Drawing.Point(12, 106);
this.lbLastMessage.Name = "lbLastMessage"; this.lbLastMessage.Name = "lbLastMessage";
this.lbLastMessage.Size = new System.Drawing.Size(551, 20); this.lbLastMessage.Size = new System.Drawing.Size(551, 20);
this.lbLastMessage.TabIndex = 41; this.lbLastMessage.TabIndex = 41;
@ -572,28 +593,6 @@
// //
this.openProfiles.Filter = "XML Files (*.xml)|*.xml"; this.openProfiles.Filter = "XML Files (*.xml)|*.xml";
this.openProfiles.Multiselect = true; this.openProfiles.Multiselect = true;
this.openProfiles.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialog1_FileOk);
//
// llbHelp
//
this.llbHelp.AutoSize = true;
this.llbHelp.Location = new System.Drawing.Point(102, 11);
this.llbHelp.Name = "llbHelp";
this.llbHelp.Size = new System.Drawing.Size(62, 13);
this.llbHelp.TabIndex = 13;
this.llbHelp.TabStop = true;
this.llbHelp.Text = "Help/About";
this.llbHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbHelp_LinkClicked);
//
// btnImportProfiles
//
this.btnImportProfiles.Location = new System.Drawing.Point(9, 6);
this.btnImportProfiles.Name = "btnImportProfiles";
this.btnImportProfiles.Size = new System.Drawing.Size(87, 23);
this.btnImportProfiles.TabIndex = 14;
this.btnImportProfiles.Text = "Import Profile(s)";
this.btnImportProfiles.UseVisualStyleBackColor = true;
this.btnImportProfiles.Click += new System.EventHandler(this.btnImportProfiles_Click);
// //
// ScpForm // ScpForm
// //
@ -606,9 +605,10 @@
this.MinimumSize = new System.Drawing.Size(560, 192); this.MinimumSize = new System.Drawing.Size(560, 192);
this.Name = "ScpForm"; this.Name = "ScpForm";
this.Text = "DS4Windows 1.0 Beta J2K Build"; this.Text = "DS4Windows 1.0 Beta J2K Build";
this.Activated += new System.EventHandler(this.ScpForm_Activated);
this.Deactivate += new System.EventHandler(this.ScpForm_Deactivate);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Close); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Close);
this.Load += new System.EventHandler(this.Form_Load); this.Load += new System.EventHandler(this.Form_Load);
this.Move += new System.EventHandler(this.ScpForm_Move);
this.Resize += new System.EventHandler(this.Form_Resize); this.Resize += new System.EventHandler(this.Form_Resize);
this.pnlButton.ResumeLayout(false); this.pnlButton.ResumeLayout(false);
this.pnlButton.PerformLayout(); this.pnlButton.PerformLayout();

View File

@ -13,62 +13,7 @@ namespace ScpServer
{ {
private DS4Control.Control rootHub; private DS4Control.Control rootHub;
delegate void LogDebugDelegate(DateTime Time, String Data); delegate void LogDebugDelegate(DateTime Time, String Data);
double version = 6.9; double version = 6.95;
protected void LogDebug(DateTime Time, String Data)
{
if (lvDebug.InvokeRequired)
{
LogDebugDelegate d = new LogDebugDelegate(LogDebug);
try
{
this.Invoke(d, new Object[] { Time, Data });
}
catch { }
}
else
{
String Posted = Time.ToString("O");
lvDebug.Items.Add(new ListViewItem(new String[] { Posted, Data })).EnsureVisible();
//Added alternative
lbLastMessage.Text = Data;
}
}
protected void ShowNotification(object sender, DebugEventArgs args)
{
notifyIcon1.BalloonTipText = args.Data;
notifyIcon1.BalloonTipTitle = "DS4Windows";
notifyIcon1.ShowBalloonTip(1);
}
protected void Form_Resize(object sender, EventArgs e)
{
if (FormWindowState.Minimized == this.WindowState)
{
notifyIcon1.Visible = true;
this.Hide();
this.ShowInTaskbar = false;
}
else if (FormWindowState.Normal == this.WindowState)
{
notifyIcon1.Visible = false;
this.Show();
this.ShowInTaskbar = true;
}
//Added last message alternative
if (this.Height > 220)
lbLastMessage.Visible = false;
else lbLastMessage.Visible = true;
for (int i = 0; i < 4; i++)
if (this.Width > 665)
protexts[i].Visible = true;
else
protexts[i].Visible = false;
}
protected Label[] Pads; protected Label[] Pads;
protected ComboBox[] cbs; protected ComboBox[] cbs;
@ -99,6 +44,7 @@ namespace ScpServer
Directory.CreateDirectory(Global.appdatapath); Directory.CreateDirectory(Global.appdatapath);
wc.DownloadFileAsync(url, Global.appdatapath + "\\version.txt"); wc.DownloadFileAsync(url, Global.appdatapath + "\\version.txt");
wc.DownloadFileCompleted += Check_Version; wc.DownloadFileCompleted += Check_Version;
} }
private void Check_Version(object sender, System.ComponentModel.AsyncCompletedEventArgs e) private void Check_Version(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
@ -197,7 +143,7 @@ namespace ScpServer
} }
else else
{ {
cbs[i].Text = "(No Profile Found)"; cbs[i].Text = "(No Profile Loaded)";
shortcuts[i].Text = "Make Profile for Controller " + (i + 1); shortcuts[i].Text = "Make Profile for Controller " + (i + 1);
ebns[i].Text = "New"; ebns[i].Text = "New";
} }
@ -213,7 +159,7 @@ namespace ScpServer
Directory.CreateDirectory(Global.appdatapath + @"\Profiles\"); Directory.CreateDirectory(Global.appdatapath + @"\Profiles\");
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
cbs[i].Text = "(No Profile Found)"; cbs[i].Text = "(No Profile Loaded)";
shortcuts[i].Text = "Make Profile for Controller " + (i + 1); shortcuts[i].Text = "Make Profile for Controller " + (i + 1);
ebns[i].Text = "New"; ebns[i].Text = "New";
cbs[i].Items.Add("+New Profile"); cbs[i].Items.Add("+New Profile");
@ -222,12 +168,60 @@ namespace ScpServer
} }
} }
} }
protected void Form_Close(object sender, FormClosingEventArgs e)
protected void LogDebug(DateTime Time, String Data)
{ {
Global.setFormWidth(this.Width); if (lvDebug.InvokeRequired)
Global.setFormHeight(this.Height); {
Global.Save(); LogDebugDelegate d = new LogDebugDelegate(LogDebug);
rootHub.Stop(); try
{
this.Invoke(d, new Object[] { Time, Data });
}
catch { }
}
else
{
String Posted = Time.ToString("O");
lvDebug.Items.Add(new ListViewItem(new String[] { Posted, Data })).EnsureVisible();
//Added alternative
lbLastMessage.Text = Data;
}
}
protected void ShowNotification(object sender, DebugEventArgs args)
{
notifyIcon1.BalloonTipText = args.Data;
notifyIcon1.BalloonTipTitle = "DS4Windows";
notifyIcon1.ShowBalloonTip(1);
}
protected void Form_Resize(object sender, EventArgs e)
{
if (FormWindowState.Minimized == this.WindowState)
{
notifyIcon1.Visible = true;
this.Hide();
this.ShowInTaskbar = false;
}
else if (FormWindowState.Normal == this.WindowState)
{
notifyIcon1.Visible = false;
this.Show();
this.ShowInTaskbar = true;
}
//Added last message alternative
if (this.Height > 220)
lbLastMessage.Visible = false;
else lbLastMessage.Visible = true;
for (int i = 0; i < 4; i++)
if (this.Width > 665)
protexts[i].Visible = true;
else
protexts[i].Visible = false;
} }
protected void btnStartStop_Click(object sender, EventArgs e) protected void btnStartStop_Click(object sender, EventArgs e)
@ -351,7 +345,7 @@ namespace ScpServer
{ {
Button bn = (Button)sender; Button bn = (Button)sender;
int i = Int32.Parse(bn.Tag.ToString()); int i = Int32.Parse(bn.Tag.ToString());
if (cbs[i].Text == "(No Profile Found)") if (cbs[i].Text == "(No Profile Loaded)")
ShowOptions(i, ""); ShowOptions(i, "");
else else
ShowOptions(i, cbs[i].Text); ShowOptions(i, cbs[i].Text);
@ -443,7 +437,7 @@ namespace ScpServer
} }
else if (cb.SelectedIndex == cb.Items.Count - 1 && cb.Items.Count > 1) //if +New Profile selected else if (cb.SelectedIndex == cb.Items.Count - 1 && cb.Items.Count > 1) //if +New Profile selected
ShowOptions(tdevice, ""); ShowOptions(tdevice, "");
if (cb.Text == "(No Profile Found)") if (cb.Text == "(No Profile Loaded)")
ebns[tdevice].Text = "New"; ebns[tdevice].Text = "New";
else else
ebns[tdevice].Text = "Edit"; ebns[tdevice].Text = "Edit";
@ -490,12 +484,6 @@ namespace ScpServer
WindowState = FormWindowState.Normal; WindowState = FormWindowState.Normal;
} }
private void ScpForm_Move(object sender, EventArgs e)
{
}
private void linkProfiles_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkProfiles_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
openProfiles.InitialDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\"; openProfiles.InitialDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\";
@ -512,10 +500,6 @@ namespace ScpServer
} }
} }
private void openFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
{
}
private void llbHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void llbHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
Hotkeys hotkeysForm = new Hotkeys(); Hotkeys hotkeysForm = new Hotkeys();
@ -538,6 +522,27 @@ namespace ScpServer
RefreshProfiles(); RefreshProfiles();
} }
} }
protected void Form_Close(object sender, FormClosingEventArgs e)
{
Global.setFormWidth(this.Width);
Global.setFormHeight(this.Height);
Global.Save();
rootHub.Stop();
}
private void ScpForm_Deactivate(object sender, EventArgs e)
{
try { notifyIcon1.Visible = true; }
catch { }
}
private void ScpForm_Activated(object sender, EventArgs e)
{
notifyIcon1.Visible = false;
}
} }
public class ThemeUtil public class ThemeUtil