summaryrefslogtreecommitdiff
path: root/grapher/Form1.cs
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-09-24 02:04:43 -0400
committerGitHub <[email protected]>2021-09-24 02:04:43 -0400
commit2896b8a09ce42e965705c58593b8738adc454f7f (patch)
tree71e4d0cff60b5a1ad11427d78e1f8c7b775e5690 /grapher/Form1.cs
parentMerge pull request #107 from a1xd/1.5.0-fix (diff)
parentmake note clearer (diff)
downloadrawaccel-master.tar.xz
rawaccel-master.zip
Merge pull request #108 from a1xd/1.6r2HEADv1.6.0masterdark-mode
v1.6
Diffstat (limited to 'grapher/Form1.cs')
-rw-r--r--grapher/Form1.cs162
1 files changed, 136 insertions, 26 deletions
diff --git a/grapher/Form1.cs b/grapher/Form1.cs
index ba16a23..b36d511 100644
--- a/grapher/Form1.cs
+++ b/grapher/Form1.cs
@@ -15,6 +15,7 @@ using grapher.Models.Serialized;
using grapher.Models;
using System.Reflection;
using System.Diagnostics;
+using System.IO;
namespace grapher
{
@@ -33,14 +34,18 @@ namespace grapher
ToolStripMenuItem HelpMenuItem = new ToolStripMenuItem("&Help");
HelpMenuItem.DropDownItems.AddRange(new ToolStripItem[] {
- new ToolStripMenuItem("&About", null, (s, e) => new AboutBox(driverVersion).ShowDialog())
+ new ToolStripMenuItem("&About", null, (s, e) => {
+ using (var form = new AboutBox(driverVersion))
+ {
+ form.ShowDialog();
+ }
+ })
});
menuStrip1.Items.AddRange(new ToolStripItem[] { HelpMenuItem });
AccelGUI = AccelGUIFactory.Construct(
this,
- ManagedAccel.GetActive(),
AccelerationChart,
AccelerationChartY,
VelocityChart,
@@ -51,26 +56,40 @@ namespace grapher
accelTypeDropY,
XLutApplyDropdown,
YLutApplyDropdown,
+ CapTypeDropdownXClassic,
+ CapTypeDropdownYClassic,
+ CapTypeDropdownXPower,
+ CapTypeDropdownYPower,
writeButton,
toggleButton,
showVelocityGainToolStripMenuItem,
showLastMouseMoveToolStripMenuItem,
streamingModeToolStripMenuItem,
AutoWriteMenuItem,
- UseSpecificDeviceMenuItem,
+ DeviceMenuItem,
ScaleMenuItem,
DPITextBox,
PollRateTextBox,
DirectionalityPanel,
sensitivityBoxX,
- sensitivityBoxY,
+ VertHorzRatioBox,
rotationBox,
- weightBoxX,
- weightBoxY,
- capBoxX,
- capBoxY,
- offsetBoxX,
- offsetBoxY,
+ inCapBoxXClassic,
+ inCapBoxYClassic,
+ outCapBoxXClassic,
+ outCapBoxYClassic,
+ inCapBoxXPower,
+ inCapBoxYPower,
+ outCapBoxXPower,
+ outCapBoxYPower,
+ inputJumpBoxX,
+ inputJumpBoxY,
+ outputJumpBoxX,
+ outputJumpBoxY,
+ inputOffsetBoxX,
+ inputOffsetBoxY,
+ outputOffsetBoxX,
+ outputOffsetBoxY,
accelerationBoxX,
accelerationBoxY,
decayRateBoxX,
@@ -107,13 +126,28 @@ namespace grapher
YLutPointsBox,
LockXYLabel,
sensitivityLabel,
+ VertHorzRatioLabel,
rotationLabel,
- weightLabelX,
- weightLabelY,
- capLabelX,
- capLabelY,
- offsetLabelX,
- offsetLabelY,
+ inCapLabelXClassic,
+ inCapLabelYClassic,
+ outCapLabelXClassic,
+ outCapLabelYClassic,
+ CapTypeLabelXClassic,
+ CapTypeLabelYClassic,
+ inCapLabelXPower,
+ inCapLabelYPower,
+ outCapLabelXPower,
+ outCapLabelYPower,
+ CapTypeLabelXPower,
+ CapTypeLabelYPower,
+ inputJumpLabelX,
+ inputJumpLabelY,
+ outputJumpLabelX,
+ outputJumpLabelY,
+ inputOffsetLabelX,
+ inputOffsetLabelY,
+ outputOffsetLabelX,
+ outputOffsetLabelY,
constantOneLabelX,
constantOneLabelY,
decayRateLabelX,
@@ -136,15 +170,29 @@ namespace grapher
constantThreeLabelY,
ActiveValueTitle,
ActiveValueTitleY,
- SensitivityActiveXLabel,
- SensitivityActiveYLabel,
+ SensitivityMultiplierActiveLabel,
+ VertHorzRatioActiveLabel,
RotationActiveLabel,
- WeightActiveXLabel,
- WeightActiveYLabel,
- CapActiveXLabel,
- CapActiveYLabel,
- OffsetActiveXLabel,
- OffsetActiveYLabel,
+ InCapActiveXLabelClassic,
+ InCapActiveYLabelClassic,
+ OutCapActiveXLabelClassic,
+ OutCapActiveYLabelClassic,
+ CapTypeActiveXLabelClassic,
+ CapTypeActiveYLabelClassic,
+ InCapActiveXLabelPower,
+ InCapActiveYLabelPower,
+ OutCapActiveXLabelPower,
+ OutCapActiveYLabelPower,
+ CapTypeActiveXLabelPower,
+ CapTypeActiveYLabelPower,
+ InputJumpActiveXLabel,
+ InputJumpActiveYLabel,
+ OutputJumpActiveXLabel,
+ OutputJumpActiveYLabel,
+ InputOffsetActiveXLabel,
+ InputOffsetActiveYLabel,
+ OutputOffsetActiveXLabel,
+ OutputOffsetActiveYLabel,
AccelerationActiveLabelX,
AccelerationActiveLabelY,
DecayRateActiveXLabel,
@@ -210,7 +258,7 @@ namespace grapher
}
else if (m.Msg == 0x00fe) // WM_INPUT_DEVICE_CHANGE
{
- AccelGUI.UpdateInputManagers();
+ AccelGUI.Settings.OnDeviceChangeMessage();
}
}
@@ -243,6 +291,68 @@ namespace grapher
}
- #endregion Method
+ #endregion Method
+
+ static void MakeStartupShortcut(bool gui)
+ {
+ var startupFolder = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
+
+ if (string.IsNullOrEmpty(startupFolder))
+ {
+ throw new Exception("Startup folder does not exist");
+ }
+
+ //Windows Script Host Shell Object
+ Type t = Type.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8"));
+ dynamic shell = Activator.CreateInstance(t);
+
+ try
+ {
+ // Delete any other RA related startup shortcuts
+ var candidates = new[] { "rawaccel", "raw accel", "writer" };
+
+ foreach (string path in Directory.EnumerateFiles(startupFolder, "*.lnk")
+ .Where(f => candidates.Any(f.Substring(startupFolder.Length).ToLower().Contains)))
+ {
+ var link = shell.CreateShortcut(path);
+ try
+ {
+ string targetPath = link.TargetPath;
+
+ if (!(targetPath is null) &&
+ (targetPath.EndsWith("rawaccel.exe") ||
+ targetPath.EndsWith("writer.exe") &&
+ new FileInfo(targetPath).Directory.GetFiles("rawaccel.exe").Any()))
+ {
+ File.Delete(path);
+ }
+ }
+ finally
+ {
+ Marshal.FinalReleaseComObject(link);
+ }
+ }
+
+ var name = gui ? "rawaccel" : "writer";
+
+ var lnk = shell.CreateShortcut($@"{startupFolder}\{name}.lnk");
+
+ try
+ {
+ if (!gui) lnk.Arguments = Constants.DefaultSettingsFileName;
+ lnk.TargetPath = $@"{Application.StartupPath}\{name}.exe";
+ lnk.Save();
+ }
+ finally
+ {
+ Marshal.FinalReleaseComObject(lnk);
+ }
+
+ }
+ finally
+ {
+ Marshal.FinalReleaseComObject(shell);
+ }
+ }
}
}