Skip to content

Fixing MouseButtonMapper by adding VirtualKeyMaps to the MouseButtons. Adding Manual key entry form to not require recording inputs. Upgrading project to .NET 8.0 #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/RSoft.MacroPad.BLL/Infrasturture/Model/MouseButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
public enum MouseButton
{
[MouseValues(1,0)]
[VirtualKeyMap(VirtualKey.LButton)]
Left,

[MouseValues(4, 0)]
[VirtualKeyMap(VirtualKey.MButton)]
Middle,

[MouseValues(2, 0)]
[VirtualKeyMap(VirtualKey.RButton)]
Right,

[MouseValues(0, 1)]
[VirtualKeyMap(VirtualKey.Up)]
ScrollUp,

[MouseValues(0, 255)]
[VirtualKeyMap(VirtualKey.Down)]
ScrollDown
}
}
8 changes: 7 additions & 1 deletion src/RSoft.MacroPad.BLL/RSoft.MacroPad.BLL.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyTitle>RSoft.MacroPad.BLL</AssemblyTitle>
Expand All @@ -9,6 +9,12 @@
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningLevel>9999</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<WarningLevel>9999</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
Expand Down
53 changes: 35 additions & 18 deletions src/RSoft.MacroPad/Controls/Compound/KeyRecorderTextBox.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions src/RSoft.MacroPad/Controls/Compound/KeyRecorderTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
using RSoft.MacroPad.BLL.Infrasturture.Model;
using RSoft.MacroPad.BLL.Infrasturture.Protocol.Mappers;
using RSoft.MacroPad.Controls.Simple;
using RSoft.MacroPad.Forms;
using RSoft.MacroPad.Infrastructure;
using RSoft.MacroPad.Model;
using Windows.Win32;
using Windows.Win32.UI.Input.KeyboardAndMouse;

namespace RSoft.MacroPad.Controls.Compound
{
Expand Down Expand Up @@ -242,5 +245,29 @@ private bool IsModifier(Keys k)
k == Keys.LControlKey || k == Keys.RControlKey ||
k == Keys.LWin || k == Keys.RWin;
}

private void button3_Click(object sender, EventArgs e)
{
var manualKeyForm = new ManualKeyForm();
manualKeyForm.ShowDialog();
if (manualKeyForm.DialogResult == DialogResult.OK && manualKeyForm.keySelected != VirtualKey.None)
{
var newModStroke = new KeyStroke
{
Key = (Keys)manualKeyForm.keySelected,
ScanCode = PInvoke.MapVirtualKey((uint)manualKeyForm.keySelected, MAP_VIRTUAL_KEY_TYPE.MAPVK_VK_TO_VSC),
Operation = KeyStrokeOperation.Release,
AltL = (manualKeyForm.modifier & Modifier.LeftAlt) != Modifier.None,
AltR = (manualKeyForm.modifier & Modifier.RightAlt) != Modifier.None,
CtrlL = (manualKeyForm.modifier & Modifier.LeftCtrl) != Modifier.None,
CtrlR = (manualKeyForm.modifier & Modifier.RightCtrl) != Modifier.None,
ShiftL = (manualKeyForm.modifier & Modifier.LeftShift) != Modifier.None,
ShiftR = (manualKeyForm.modifier & Modifier.RightShift) != Modifier.None,
WinL = (manualKeyForm.modifier & Modifier.LeftWin) != Modifier.None,
WinR = (manualKeyForm.modifier & Modifier.RightWin) != Modifier.None,
};
_sequence.Add(newModStroke);
}
}
}
}
6 changes: 3 additions & 3 deletions src/RSoft.MacroPad/Controls/Compound/KeyRecorderTextBox.resx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Microsoft ResX Schema

Version 2.0

Expand All @@ -18,7 +18,7 @@
<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="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>
Expand Down Expand Up @@ -48,7 +48,7 @@
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
Expand Down
Loading