diff --git a/Installer/version.txt b/Installer/version.txt index cb5d7f6..dfa5016 100644 --- a/Installer/version.txt +++ b/Installer/version.txt @@ -1 +1 @@ -2.2.5.19 \ No newline at end of file +2.2.6.1 \ No newline at end of file diff --git a/src/Commands/MouseCommand.cs b/src/Commands/MouseCommand.cs index fb0a5ae..bcff2cd 100644 --- a/src/Commands/MouseCommand.cs +++ b/src/Commands/MouseCommand.cs @@ -30,10 +30,14 @@ public class MouseCommand : Command { new MouseCommand{ Cmd = $"{CmdPrefix }rbdc" }, new MouseCommand{ Cmd = $"{CmdPrefix }rbd" }, new MouseCommand{ Cmd = $"{CmdPrefix }rbu" }, - new MouseCommand{ Cmd = $"{CmdPrefix }xbc,3" }, - new MouseCommand{ Cmd = $"{CmdPrefix }xbcd,3" }, - new MouseCommand{ Cmd = $"{CmdPrefix }xbd,3" }, - new MouseCommand{ Cmd = $"{CmdPrefix }xbu,3" }, + new MouseCommand{ Cmd = $"{CmdPrefix }mbc" }, + new MouseCommand{ Cmd = $"{CmdPrefix }mbdc" }, + new MouseCommand{ Cmd = $"{CmdPrefix }mbd" }, + new MouseCommand{ Cmd = $"{CmdPrefix }mbu" }, + new MouseCommand{ Cmd = $"{CmdPrefix }xbc,n" }, + new MouseCommand{ Cmd = $"{CmdPrefix }xbcd,n" }, + new MouseCommand{ Cmd = $"{CmdPrefix }xbd,n" }, + new MouseCommand{ Cmd = $"{CmdPrefix }xbu,n" }, new MouseCommand{ Cmd = $"{CmdPrefix }mm,x,y" }, new MouseCommand{ Cmd = $"{CmdPrefix }mt,x,y" }, new MouseCommand{ Cmd = $"{CmdPrefix }hs,x" }, @@ -70,22 +74,89 @@ public override bool Execute() { return true; } + int mb = 0; + switch (param[0]) { - case "lbc": sim.Mouse.LeftButtonClick(); break; - case "lbdc": sim.Mouse.LeftButtonDoubleClick(); break; - case "lbd": sim.Mouse.LeftButtonDown(); break; - case "lbu": sim.Mouse.LeftButtonUp(); break; - - case "rbc": sim.Mouse.RightButtonClick(); break; - case "rbdc": sim.Mouse.RightButtonDoubleClick(); break; - case "rbd": sim.Mouse.RightButtonDown(); break; - case "rbu": sim.Mouse.RightButtonUp(); break; - - // "mouse:xbc,3" - Mouse button 3 click - case "xbc": sim.Mouse.XButtonClick(GetIntOrZero(param, 1)); break; - case "xbdc": sim.Mouse.XButtonDoubleClick(GetIntOrZero(param, 1)); break; - case "xbd": sim.Mouse.XButtonDown(GetIntOrZero(param, 1)); break; - case "xbu": sim.Mouse.XButtonUp(GetIntOrZero(param, 1)); break; + case "lbc": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Left Button Click"); + sim.Mouse.LeftButtonClick(); + break; + + case "lbdc": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Left Button Double Click"); + sim.Mouse.LeftButtonDoubleClick(); + break; + + case "lbd": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Left Button Down"); + sim.Mouse.LeftButtonDown(); + break; + + case "lbu": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Left Button Up"); + sim.Mouse.LeftButtonUp(); + break; + + case "rbc": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Right Button Click"); + sim.Mouse.RightButtonClick(); + break; + case "rbdc": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Right Button Double Click"); + sim.Mouse.RightButtonDoubleClick(); + break; + case "rbd": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Right Button Down"); + sim.Mouse.RightButtonDown(); + break; + case "rbu": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Right Button Up"); + sim.Mouse.RightButtonUp(); + break; + + case "mbc": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Middle Button Click"); + sim.Mouse.MiddleButtonClick(); + break; + + case "mbdc": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Middle Button Double Click"); + sim.Mouse.MiddleButtonDoubleClick(); + break; + + case "mbd": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Middle Button Down"); + sim.Mouse.MiddleButtonDown(); + break; + case "mbu": + Logger.Instance.Log4.Info($"{this.GetType().Name}: Middle Button Up"); + sim.Mouse.MiddleButtonUp(); + break; + + // "mouse:xbc,3" - Mouse X button 3 click + case "xbc": + mb = GetIntOrZero(param, 1); + Logger.Instance.Log4.Info($"{this.GetType().Name}: XButton {mb} click"); + sim.Mouse.XButtonClick(mb); + break; + + case "xbdc": + mb = GetIntOrZero(param, 1); + Logger.Instance.Log4.Info($"{this.GetType().Name}: XButton {mb} doubleclick"); + sim.Mouse.XButtonDoubleClick(mb); + break; + + case "xbd": + mb = GetIntOrZero(param, 1); + Logger.Instance.Log4.Info($"{this.GetType().Name}: XButton {mb} down"); + sim.Mouse.XButtonDown(mb); + break; + + case "xbu": + mb = GetIntOrZero(param, 1); + Logger.Instance.Log4.Info($"{this.GetType().Name}: Xbutton {mb} up"); + sim.Mouse.XButtonUp(mb); + break; // "mouse:mb,15,20" - Move mouse 15 in X direction, and 20 in Y direction case "mm": sim.Mouse.MoveMouseBy(GetIntOrZero(param, 1), GetIntOrZero(param, 2)); break; diff --git a/src/Dialogs/CommandWindow.Designer.cs b/src/Dialogs/CommandWindow.Designer.cs index 1d25f7c..f23e844 100644 --- a/src/Dialogs/CommandWindow.Designer.cs +++ b/src/Dialogs/CommandWindow.Designer.cs @@ -55,10 +55,11 @@ private void InitializeComponent() this.listCmds.FullRowSelect = true; this.listCmds.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.listCmds.HideSelection = false; - this.listCmds.Location = new System.Drawing.Point(12, 55); + this.listCmds.Location = new System.Drawing.Point(18, 85); + this.listCmds.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.listCmds.MultiSelect = false; this.listCmds.Name = "listCmds"; - this.listCmds.Size = new System.Drawing.Size(508, 388); + this.listCmds.Size = new System.Drawing.Size(760, 595); this.listCmds.TabIndex = 6; this.listCmds.UseCompatibleStateImageBehavior = false; this.listCmds.View = System.Windows.Forms.View.Details; @@ -85,9 +86,10 @@ private void InitializeComponent() // this.labelSendAnyChars.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelSendAnyChars.AutoSize = true; - this.labelSendAnyChars.Location = new System.Drawing.Point(535, 55); + this.labelSendAnyChars.Location = new System.Drawing.Point(802, 85); + this.labelSendAnyChars.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.labelSendAnyChars.Name = "labelSendAnyChars"; - this.labelSendAnyChars.Size = new System.Drawing.Size(119, 13); + this.labelSendAnyChars.Size = new System.Drawing.Size(178, 20); this.labelSendAnyChars.TabIndex = 7; this.labelSendAnyChars.Text = "Send list of commands:"; // @@ -95,23 +97,26 @@ private void InitializeComponent() // this.textBoxSendCommand.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); - this.textBoxSendCommand.Location = new System.Drawing.Point(538, 71); + this.textBoxSendCommand.Location = new System.Drawing.Point(807, 109); + this.textBoxSendCommand.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.textBoxSendCommand.Multiline = true; this.textBoxSendCommand.Name = "textBoxSendCommand"; this.textBoxSendCommand.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBoxSendCommand.Size = new System.Drawing.Size(226, 372); + this.textBoxSendCommand.Size = new System.Drawing.Size(337, 570); this.textBoxSendCommand.TabIndex = 8; // // buttonSend // this.buttonSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonSend.Location = new System.Drawing.Point(680, 449); - this.buttonSend.MaximumSize = new System.Drawing.Size(84, 23); - this.buttonSend.MinimumSize = new System.Drawing.Size(84, 23); + this.buttonSend.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonSend.Location = new System.Drawing.Point(1020, 691); + this.buttonSend.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.buttonSend.MaximumSize = new System.Drawing.Size(126, 35); + this.buttonSend.MinimumSize = new System.Drawing.Size(126, 35); this.buttonSend.Name = "buttonSend"; - this.buttonSend.Size = new System.Drawing.Size(84, 23); + this.buttonSend.Size = new System.Drawing.Size(126, 35); this.buttonSend.TabIndex = 9; - this.buttonSend.Text = "Send"; + this.buttonSend.Text = "&Send"; this.buttonSend.UseVisualStyleBackColor = true; this.buttonSend.Click += new System.EventHandler(this.buttonSend_Click); // @@ -120,9 +125,10 @@ private void InitializeComponent() this.saveChangesBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.saveChangesBtn.DialogResult = System.Windows.Forms.DialogResult.OK; this.saveChangesBtn.Enabled = false; - this.saveChangesBtn.Location = new System.Drawing.Point(299, 449); + this.saveChangesBtn.Location = new System.Drawing.Point(448, 691); + this.saveChangesBtn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.saveChangesBtn.Name = "saveChangesBtn"; - this.saveChangesBtn.Size = new System.Drawing.Size(221, 23); + this.saveChangesBtn.Size = new System.Drawing.Size(332, 35); this.saveChangesBtn.TabIndex = 10; this.saveChangesBtn.Text = "Save MCECommands.commands file"; this.saveChangesBtn.UseVisualStyleBackColor = true; @@ -131,9 +137,10 @@ private void InitializeComponent() // testRadio // this.testRadio.AutoSize = true; - this.testRadio.Location = new System.Drawing.Point(13, 13); + this.testRadio.Location = new System.Drawing.Point(20, 20); + this.testRadio.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.testRadio.Name = "testRadio"; - this.testRadio.Size = new System.Drawing.Size(244, 17); + this.testRadio.Size = new System.Drawing.Size(362, 24); this.testRadio.TabIndex = 11; this.testRadio.TabStop = true; this.testRadio.Text = "&Test Sending Commands (doule-click to send)."; @@ -143,9 +150,10 @@ private void InitializeComponent() // editRadio // this.editRadio.AutoSize = true; - this.editRadio.Location = new System.Drawing.Point(13, 32); + this.editRadio.Location = new System.Drawing.Point(20, 49); + this.editRadio.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.editRadio.Name = "editRadio"; - this.editRadio.Size = new System.Drawing.Size(153, 17); + this.editRadio.Size = new System.Drawing.Size(226, 24); this.editRadio.TabIndex = 11; this.editRadio.TabStop = true; this.editRadio.Text = "&Enable/Disable Commands"; @@ -153,9 +161,9 @@ private void InitializeComponent() // // CommandWindow // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(776, 484); + this.ClientSize = new System.Drawing.Size(1164, 745); this.Controls.Add(this.editRadio); this.Controls.Add(this.testRadio); this.Controls.Add(this.saveChangesBtn); @@ -163,6 +171,7 @@ private void InitializeComponent() this.Controls.Add(this.textBoxSendCommand); this.Controls.Add(this.labelSendAnyChars); this.Controls.Add(this.listCmds); + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.Name = "CommandWindow"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; this.Text = "Commands"; diff --git a/src/WindowsInput/IMouseSimulator.cs b/src/WindowsInput/IMouseSimulator.cs index fa19434..0df7ced 100644 --- a/src/WindowsInput/IMouseSimulator.cs +++ b/src/WindowsInput/IMouseSimulator.cs @@ -62,7 +62,27 @@ public interface IMouseSimulator { /// /// Simulates a mouse right button double-click gesture. /// - void RightButtonDoubleClick(); + void RightButtonDoubleClick(); + + /// + /// Simulates a mouse middle button down gesture. + /// + void MiddleButtonDown(); + + /// + /// Simulates a mouse middle button up gesture. + /// + void MiddleButtonUp(); + + /// + /// Simulates a mouse middle button click gesture. + /// + void MiddleButtonClick(); + + /// + /// Simulates a mouse middle button double-click gesture. + /// + void MiddleButtonDoubleClick(); /// /// Simulates a mouse X button down gesture. @@ -100,4 +120,4 @@ public interface IMouseSimulator { /// The amount to scroll in clicks. A positive value indicates that the wheel was rotated to the right; a negative value indicates that the wheel was rotated to the left. void HorizontalScroll(int scrollAmountInClicks); } -} \ No newline at end of file +} diff --git a/src/WindowsInput/MouseSimulator.cs b/src/WindowsInput/MouseSimulator.cs index a1eee30..e46670e 100644 --- a/src/WindowsInput/MouseSimulator.cs +++ b/src/WindowsInput/MouseSimulator.cs @@ -131,10 +131,43 @@ public void RightButtonUp() { public void RightButtonClick() { var inputList = new InputBuilder().AddMouseButtonClick(MouseButton.RightButton).ToArray(); SendSimulatedInput(inputList); + } + + /// + /// Simulates a mouse middle button down gesture. + /// + public void MiddleButtonDown() { + var inputList = new InputBuilder().AddMouseButtonDown(MouseButton.MiddleButton).ToArray(); + SendSimulatedInput(inputList); + } + + /// + /// Simulates a mouse middle button up gesture. + /// + public void MiddleButtonUp() { + var inputList = new InputBuilder().AddMouseButtonUp(MouseButton.MiddleButton).ToArray(); + SendSimulatedInput(inputList); + } + + /// + /// Simulates a mouse middle button click gesture. + /// + public void MiddleButtonClick() { + var inputList = new InputBuilder().AddMouseButtonClick(MouseButton.MiddleButton).ToArray(); + SendSimulatedInput(inputList); + } + + /// + /// Simulates a mouse middle button double-click gesture. + /// + public void MiddleButtonDoubleClick() { + var inputList = new InputBuilder().AddMouseButtonDoubleClick(MouseButton.MiddleButton).ToArray(); + SendSimulatedInput(inputList); } + /// - /// Simulates a mouse right button double-click gesture. + /// Simulates a mouse middle button double-click gesture. /// public void RightButtonDoubleClick() { var inputList = new InputBuilder().AddMouseButtonDoubleClick(MouseButton.RightButton).ToArray();