Added output mouse speed text next to mouse sensitivity. Actually added mouse sensitivity binding

Been wantintg the output display for a while
This commit is contained in:
Travis Nickles 2020-01-29 15:00:58 -06:00
parent 0b2ea9454a
commit 1881c223ba
3 changed files with 44 additions and 2 deletions

View File

@ -274,7 +274,7 @@ namespace DS4Windows
public static int mouseaccel = 0;
public static int prevmouseaccel = 0;
private static double horizontalRemainder = 0.0, verticalRemainder = 0.0;
private const int MOUSESPEEDFACTOR = 48;
public const int MOUSESPEEDFACTOR = 48;
private const double MOUSESTICKOFFSET = 0.26;
public static void Commit(int device)

View File

@ -952,8 +952,11 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Height="40" Margin="0,4,0,0">
<Label Content="Mouse Sensitivity" VerticalAlignment="Center" />
<xctk:IntegerUpDown d:IsHidden="True" MinWidth="50" Height="20" Value="25"
<xctk:IntegerUpDown d:IsHidden="True" MinWidth="50" Height="20"
Value="{Binding ButtonMouseSensitivity,FallbackValue=25}"
Minimum="0" Maximum="255" Increment="1" Margin="10,0,0,0" />
<TextBlock Text="{Binding OutputMouseSpeed,StringFormat='\{0} pps'}"
MinWidth="50" VerticalAlignment="Center" Margin="10,0,0,0" />
</StackPanel>
<CheckBox Content="Mouse Acceleration" IsChecked="{Binding MouseAcceleration}" Margin="0,6,0,0" />
<CheckBox Content="Enable Touchpad Toggle" IsChecked="{Binding EnableTouchpadToggle}" Margin="0,6,0,0" />

View File

@ -379,6 +379,32 @@ namespace DS4WinWPF.DS4Forms.ViewModels
set => Global.DS4Mapping = value;
}
public int ButtonMouseSensitivity
{
get => Global.ButtonMouseSensitivity[device];
set
{
int temp = Global.ButtonMouseSensitivity[device];
if (temp == value) return;
Global.ButtonMouseSensitivity[device] = value;
ButtonMouseSensitivityChanged?.Invoke(this, EventArgs.Empty);
}
}
public event EventHandler ButtonMouseSensitivityChanged;
private int outputMouseSpeed;
public int OutputMouseSpeed
{
get => outputMouseSpeed;
set
{
if (value == outputMouseSpeed) return;
outputMouseSpeed = value;
OutputMouseSpeedChanged?.Invoke(this, EventArgs.Empty);
}
}
public event EventHandler OutputMouseSpeedChanged;
public bool MouseAcceleration
{
get => Global.MouseAccel[device];
@ -1433,6 +1459,8 @@ namespace DS4WinWPF.DS4Forms.ViewModels
Global.outDevTypeTemp[device] = OutContType.X360;
tempBtPollRate = Global.BTPollRate[device];
outputMouseSpeed = CalculateOutputMouseSpeed(ButtonMouseSensitivity);
ImageSourceConverter sourceConverter = new ImageSourceConverter();
ImageSource temp = sourceConverter.
ConvertFromString("pack://application:,,,/DS4Windows;component/Resources/rainbowCCrop.png") as ImageSource;
@ -1462,6 +1490,11 @@ namespace DS4WinWPF.DS4Forms.ViewModels
{
LightbarBrushChanged?.Invoke(this, EventArgs.Empty);
};
ButtonMouseSensitivityChanged += (sender, args) =>
{
OutputMouseSpeed = CalculateOutputMouseSpeed(ButtonMouseSensitivity);
};
}
private void ProfileSettingsViewModel_MainColorChanged(object sender, EventArgs e)
@ -1765,6 +1798,12 @@ namespace DS4WinWPF.DS4Forms.ViewModels
GyroMouseStickTrigDisplay = string.Join(", ", triggerName.ToArray());
}
private int CalculateOutputMouseSpeed(int mouseSpeed)
{
int result = mouseSpeed * Mapping.MOUSESPEEDFACTOR;
return result;
}
public void LaunchCurveEditor(string customDefinition)
{
// Custom curve editor web link clicked. Open the bezier curve editor web app usign the default browser app and pass on current custom definition as a query string parameter.