diff options
| author | a1xd <[email protected]> | 2020-12-05 21:28:08 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-05 21:28:08 -0500 |
| commit | c8503654da5bc40a129e58914549cd394349d059 (patch) | |
| tree | e4760c579597d0e292c7b03dff95d19bb8f3c750 /grapher | |
| parent | Merge pull request #45 from JacobPalecki/fix (diff) | |
| parent | update signed, add installers (diff) | |
| download | rawaccel-c8503654da5bc40a129e58914549cd394349d059.tar.xz rawaccel-c8503654da5bc40a129e58914549cd394349d059.zip | |
Merge pull request #46 from a1xd/1.3
Diffstat (limited to 'grapher')
| -rw-r--r-- | grapher/AboutBox.Designer.cs | 138 | ||||
| -rw-r--r-- | grapher/AboutBox.cs | 51 | ||||
| -rw-r--r-- | grapher/AboutBox.resx | 225 | ||||
| -rw-r--r-- | grapher/Form1.cs | 21 | ||||
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 5 | ||||
| -rw-r--r-- | grapher/Models/AccelGUIFactory.cs | 7 | ||||
| -rw-r--r-- | grapher/Models/Calculations/AccelChartData.cs | 5 | ||||
| -rw-r--r-- | grapher/Models/Calculations/AccelData.cs | 6 | ||||
| -rw-r--r-- | grapher/Models/Charts/AccelCharts.cs | 2 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartState/ChartState.cs | 2 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartState/CombinedState.cs | 2 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartState/XYOneGraphState.cs | 2 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartState/XYTwoGraphState.cs | 2 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartXY.cs | 33 | ||||
| -rw-r--r-- | grapher/Models/Fields/Field.cs | 20 | ||||
| -rw-r--r-- | grapher/Models/Mouse/MouseWatcher.cs | 53 | ||||
| -rw-r--r-- | grapher/Models/Serialized/RawAccelSettings.cs | 2 | ||||
| -rw-r--r-- | grapher/Models/Serialized/SettingsManager.cs | 33 | ||||
| -rw-r--r-- | grapher/Properties/AssemblyInfo.cs | 10 | ||||
| -rw-r--r-- | grapher/grapher.csproj | 9 |
20 files changed, 531 insertions, 97 deletions
diff --git a/grapher/AboutBox.Designer.cs b/grapher/AboutBox.Designer.cs new file mode 100644 index 0000000..d5ab082 --- /dev/null +++ b/grapher/AboutBox.Designer.cs @@ -0,0 +1,138 @@ + +namespace grapher +{ + partial class AboutBox + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox)); + this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.logoPictureBox = new System.Windows.Forms.PictureBox(); + this.labelVersion = new System.Windows.Forms.Label(); + this.okButton = new System.Windows.Forms.Button(); + this.labelDriverVersion = new System.Windows.Forms.Label(); + this.tableLayoutPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); + this.SuspendLayout(); + // + // tableLayoutPanel + // + this.tableLayoutPanel.ColumnCount = 2; + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0); + this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1); + this.tableLayoutPanel.Controls.Add(this.okButton, 1, 4); + this.tableLayoutPanel.Controls.Add(this.labelDriverVersion, 1, 2); + this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9); + this.tableLayoutPanel.Name = "tableLayoutPanel"; + this.tableLayoutPanel.RowCount = 5; + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel.Size = new System.Drawing.Size(280, 133); + this.tableLayoutPanel.TabIndex = 0; + // + // logoPictureBox + // + this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image"))); + this.logoPictureBox.Location = new System.Drawing.Point(3, 3); + this.logoPictureBox.Name = "logoPictureBox"; + this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 5); + this.logoPictureBox.Size = new System.Drawing.Size(134, 127); + this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.logoPictureBox.TabIndex = 12; + this.logoPictureBox.TabStop = false; + // + // labelVersion + // + this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelVersion.Location = new System.Drawing.Point(146, 26); + this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); + this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17); + this.labelVersion.Name = "labelVersion"; + this.labelVersion.Size = new System.Drawing.Size(131, 17); + this.labelVersion.TabIndex = 0; + this.labelVersion.Text = "GUI Version"; + this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.okButton.Location = new System.Drawing.Point(202, 107); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 23); + this.okButton.TabIndex = 24; + this.okButton.Text = "&OK"; + // + // labelDriverVersion + // + this.labelDriverVersion.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelDriverVersion.Location = new System.Drawing.Point(146, 52); + this.labelDriverVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); + this.labelDriverVersion.MaximumSize = new System.Drawing.Size(0, 17); + this.labelDriverVersion.Name = "labelDriverVersion"; + this.labelDriverVersion.Size = new System.Drawing.Size(131, 17); + this.labelDriverVersion.TabIndex = 25; + this.labelDriverVersion.Text = "Driver Version"; + this.labelDriverVersion.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // AboutBox + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(298, 151); + this.Controls.Add(this.tableLayoutPanel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AboutBox"; + this.Padding = new System.Windows.Forms.Padding(9); + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "AboutBox"; + this.tableLayoutPanel.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; + private System.Windows.Forms.PictureBox logoPictureBox; + private System.Windows.Forms.Label labelVersion; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.Label labelDriverVersion; + } +} diff --git a/grapher/AboutBox.cs b/grapher/AboutBox.cs new file mode 100644 index 0000000..5547c59 --- /dev/null +++ b/grapher/AboutBox.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher +{ + partial class AboutBox : Form + { + public AboutBox(Version driver) + { + InitializeComponent(); + this.Text = String.Format("About {0}", AssemblyTitle); + this.labelVersion.Text = String.Format("GUI Version {0}", AssemblyVersion); + this.labelDriverVersion.Text = String.Format("Driver Version {0}", driver.ToString()); + } + + #region Assembly Attribute Accessors + + public string AssemblyTitle + { + get + { + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); + if (attributes.Length > 0) + { + AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; + if (titleAttribute.Title != "") + { + return titleAttribute.Title; + } + } + return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); + } + } + + public string AssemblyVersion + { + get + { + return Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } + } + + #endregion + } +} diff --git a/grapher/AboutBox.resx b/grapher/AboutBox.resx new file mode 100644 index 0000000..e073ca0 --- /dev/null +++ b/grapher/AboutBox.resx @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <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="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + 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 + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <data name="logoPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAFvZJREFUeF7tnQm8VVPfx3k8M+/zJEqpCKW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t + 2uakk04yr7wSbyc8zwZxoE7/5KIpEXTvSuJhONywYYN9Ib766iv+ikNhaGzXi83cbfkBZWhn8UxxoRhv + DChsHn30UdO/f3/bFfft29fcd999di4fQeF/EefotKtYqsIvCoq7pRifOdBbzZo1y/YIO++8s20ISTMH + dAlHu9tThu55mPt5AWgAzz//vLn22mvNJZdcYu69915fb7hY7K3TcptOlwuUqdoi4/H/xbIaw3vvvWfG + jx9v9ttvP7PXXnuZgQMHmqeeesoWWATdwxBxhU7Trt5VvI3FGaKdwpDuPffcY1q2bGkbwllnnVWgkhTu + CbGRu71YKOzh4pZph0Aa9DKXX365Oeyww+yL8OCDDyZrMt8X++g0/7SYytR/K3MoZDbZ3Ap0kUzRjjvu + OFO3bl3TokULK7UnCWjM3+eL3fQzrW+I4muoeOMNgVkNw1WDBg3Mrrvuai699FLz9ddfc4nn+Ekcp9O/ + u9uLhMI2VljkpMtE3vB4b4jAfOedd5qjjjrKHHDAAeaqq64yH3/8sbtq03pV7Oyiyi8of39V5nqLT4pW + mwdWrVplxo4daxo1amTfwmOOOcY89NBDBaaVCr5WHCPu5KJLCxQfCq6HXDJ2qogeAflgn332MTNnziRt + e01H3tL27tYC0P9VFQR5qIuIlnScyBSY4fD/TYnoFRBCmT3RAJhaR1B4cJOILqWKSyK/oMzVU+au1PFT + m2vhu+++M3fffbc55JBDzE477WSHCHoF5vQRFP5HEWm6uYsqLVDU7RTnklgqxqxcudJ0797d1KxZ0x5R + OQOFQVZhmkdDvkakgtfbiylC4W2FI4ckkv+Tof9oGct1vFhMeSjKGShTfxGPExeJtgQ4LFmyxJx66qmm + Vq1atlc4+eSTzXPPPRcvJMIKFP4R+pmWcVPxMGvgWWyL09E88MADtifo2bOn7b4LA2F5q1evXm2HNgS/ + YcOG2Tz07t3bdOnSxaqpmX0geCIMM+yhqEL+QCY6+OCDTdeuXc3w4cPtlBX1dpIWEywR0Vu01F/5JS8o + U03FW8S4dMTbjwS955572l6hffv2Vmj78ce49peCWSGeqNMy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ydyb2QS9BcYZkIorjFGYKBxH7sW8i/EcQxVkEr66yZ5APYd7ghj0G6eZE8RQ8ZmEynobEadU/xbX29JP + AGMvFjksNuGrEA+gqFXxK8B3CfAbjM8hjtjz03DYfs5GFMzR8CSO08l33nnHqnKVhou5IPQ/Y/sCcaR+ + 4hG1cszbswkqdIaIvcVzxHvFVeKWb9CmAYrvZ/EDcb7I0ms/kQ/tZOabuwFlgypnW7GZKqirjgPFi0S6 + 5tvEaeL0BLJR7k4dqdhxOh8h9td5N7GtznFwYX0dBwQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE + BAQEBAQE5CK22uo/qucXbjOUCEwAAAAASUVORK5CYII= +</value> + </data> +</root>
\ No newline at end of file diff --git a/grapher/Form1.cs b/grapher/Form1.cs index d62ed6d..0c12b86 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -13,6 +13,8 @@ using grapher.Models.Calculations; using grapher.Models.Options; using grapher.Models.Serialized; using grapher.Models; +using System.Reflection; +using System.Diagnostics; namespace grapher { @@ -26,21 +28,30 @@ namespace grapher { InitializeComponent(); - ManagedAccel activeAccel = null; + Version assemVersion = typeof(RawAcceleration).Assembly.GetName().Version; + Version driverVersion = null; try { - activeAccel = ManagedAccel.GetActiveAccel(); + driverVersion = VersionHelper.ValidateAndGetDriverVersion(assemVersion); } - catch (DriverNotInstalledException ex) + catch (VersionException ex) { - MessageBox.Show($"Driver not installed.\n\n {ex.ToString()}"); + MessageBox.Show(ex.Message); throw; } + + ToolStripMenuItem HelpMenuItem = new ToolStripMenuItem("&Help"); + + HelpMenuItem.DropDownItems.AddRange(new ToolStripItem[] { + new ToolStripMenuItem("&About", null, (s, e) => new AboutBox(driverVersion).ShowDialog()) + }); + + menuStrip1.Items.AddRange(new ToolStripItem[] { HelpMenuItem }); AccelGUI = AccelGUIFactory.Construct( this, - activeAccel, + ManagedAccel.GetActiveAccel(), AccelerationChart, AccelerationChartY, VelocityChart, diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index c08313b..c6a2dcc 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -140,7 +140,8 @@ namespace grapher combineMagnitudes = ApplyOptions.IsWhole, modes = ApplyOptions.GetModes(), args = newArgs, - minimumTime = driverSettings.minimumTime + minimumTime = driverSettings.minimumTime, + directionalMultipliers = driverSettings.directionalMultipliers }; ButtonDelay(WriteButton); @@ -153,7 +154,7 @@ namespace grapher } else { - throw new Exception($"Bad arguments: \n {SettingsManager.ErrorStringFrom(errors)}"); + throw new Exception($"Bad arguments:\n\n{errors}"); } } diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs index 3dc2a74..901a1b5 100644 --- a/grapher/Models/AccelGUIFactory.cs +++ b/grapher/Models/AccelGUIFactory.cs @@ -2,6 +2,7 @@ using grapher.Models.Mouse; using grapher.Models.Options; using grapher.Models.Serialized; +using System; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; @@ -104,8 +105,8 @@ namespace grapher.Models Label mouseLabel) { var accelCalculator = new AccelCalculator( - new Field(dpiTextBox.TextBox, form, Constants.DefaultDPI), - new Field(pollRateTextBox.TextBox, form, Constants.DefaultPollRate)); + new Field(dpiTextBox.TextBox, form, Constants.DefaultDPI, 1), + new Field(pollRateTextBox.TextBox, form, Constants.DefaultPollRate, 1)); var accelCharts = new AccelCharts( form, @@ -331,7 +332,7 @@ namespace grapher.Models showLastMouseMoveMenuItem, showVelocityGainToolStripMenuItem); - var mouseWatcher = new MouseWatcher(form, mouseLabel, accelCharts, accelCalculator.PollRate); + var mouseWatcher = new MouseWatcher(form, mouseLabel, accelCharts, settings); return new AccelGUI( form, diff --git a/grapher/Models/Calculations/AccelChartData.cs b/grapher/Models/Calculations/AccelChartData.cs index 60d4c89..71ee927 100644 --- a/grapher/Models/Calculations/AccelChartData.cs +++ b/grapher/Models/Calculations/AccelChartData.cs @@ -80,6 +80,11 @@ namespace grapher.Models.Calculations public int GetVelocityIndex(double outVelocityValue) { + if (outVelocityValue < 0) + { + throw new ArgumentException($"invalid velocity: {outVelocityValue}"); + } + var log = Math.Log10(outVelocityValue); if (log < -2) { diff --git a/grapher/Models/Calculations/AccelData.cs b/grapher/Models/Calculations/AccelData.cs index 67d4f3f..d35217f 100644 --- a/grapher/Models/Calculations/AccelData.cs +++ b/grapher/Models/Calculations/AccelData.cs @@ -56,7 +56,7 @@ namespace grapher.Models.Calculations OutVelocityToPoints.Clear(); } - public void CalculateDots(int x, int y, double timeInMs) + public void CalculateDots(double x, double y, double timeInMs) { var outVelocity = AccelCalculator.Velocity(x, y, timeInMs); @@ -66,7 +66,7 @@ namespace grapher.Models.Calculations Estimated.Gain.Set(inCombVel, combGain); } - public void CalculateDotsXY(int x, int y, double timeInMs) + public void CalculateDotsXY(double x, double y, double timeInMs) { var outX = Math.Abs(x) / timeInMs; var outY = Math.Abs(y) / timeInMs; @@ -82,7 +82,7 @@ namespace grapher.Models.Calculations EstimatedY.Gain.Set(inYVelocity, yGain); } - public void CalculateDotsCombinedDiffSens(int x, int y, double timeInMs, DriverSettings settings) + public void CalculateDotsCombinedDiffSens(double x, double y, double timeInMs, DriverSettings settings) { (var xStripped, var yStripped) = AccelCalculator.StripSens(x, y, settings.sensitivity.x, settings.sensitivity.y); var outVelocity = AccelCalculator.Velocity(xStripped, yStripped, timeInMs); diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index 6247811..b7abb35 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -99,7 +99,7 @@ namespace grapher #region Methods - public void MakeDots(int x, int y, double timeInMs) + public void MakeDots(double x, double y, double timeInMs) { ChartState.MakeDots(x, y, timeInMs); } diff --git a/grapher/Models/Charts/ChartState/ChartState.cs b/grapher/Models/Charts/ChartState/ChartState.cs index 270e212..0bb141e 100644 --- a/grapher/Models/Charts/ChartState/ChartState.cs +++ b/grapher/Models/Charts/ChartState/ChartState.cs @@ -40,7 +40,7 @@ namespace grapher.Models.Charts.ChartState internal bool TwoDotsPerGraph { get; set; } - public abstract void MakeDots(int x, int y, double timeInMs); + public abstract void MakeDots(double x, double y, double timeInMs); public abstract void Bind(); diff --git a/grapher/Models/Charts/ChartState/CombinedState.cs b/grapher/Models/Charts/ChartState/CombinedState.cs index aab8a38..9eadb87 100644 --- a/grapher/Models/Charts/ChartState/CombinedState.cs +++ b/grapher/Models/Charts/ChartState/CombinedState.cs @@ -30,7 +30,7 @@ namespace grapher.Models.Charts.ChartState GainChart.ClearSecondDots(); } - public override void MakeDots(int x, int y, double timeInMs) + public override void MakeDots(double x, double y, double timeInMs) { Data.CalculateDots(x, y, timeInMs); } diff --git a/grapher/Models/Charts/ChartState/XYOneGraphState.cs b/grapher/Models/Charts/ChartState/XYOneGraphState.cs index 92c799f..2b3cd9c 100644 --- a/grapher/Models/Charts/ChartState/XYOneGraphState.cs +++ b/grapher/Models/Charts/ChartState/XYOneGraphState.cs @@ -28,7 +28,7 @@ namespace grapher.Models.Charts.ChartState GainChart.SetCombined(); } - public override void MakeDots(int x, int y, double timeInMs) + public override void MakeDots(double x, double y, double timeInMs) { Data.CalculateDotsCombinedDiffSens(x, y, timeInMs, Settings); } diff --git a/grapher/Models/Charts/ChartState/XYTwoGraphState.cs b/grapher/Models/Charts/ChartState/XYTwoGraphState.cs index d107f87..732ea3c 100644 --- a/grapher/Models/Charts/ChartState/XYTwoGraphState.cs +++ b/grapher/Models/Charts/ChartState/XYTwoGraphState.cs @@ -33,7 +33,7 @@ namespace grapher.Models.Charts.ChartState GainChart.ClearSecondDots(); } - public override void MakeDots(int x, int y, double timeInMs) + public override void MakeDots(double x, double y, double timeInMs) { Data.CalculateDotsXY(x, y, timeInMs); } diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 98ba059..553ab3e 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -1,4 +1,5 @@ using grapher.Models.Mouse; +using System; using System.Collections; using System.Windows.Forms.DataVisualization.Charting; @@ -29,6 +30,8 @@ namespace grapher #endregion Constructors + private const double VerticalMargin = 0.1; + #region Properties public Chart ChartX { get; } @@ -219,28 +222,30 @@ namespace grapher ChartX.Series[2].IsVisibleInLegend = true; } - public void SetMinMax(double min, double max) + private void VerifyRange(double min, double max) { - if (min < max) + if (min > max) { - ChartX.ChartAreas[0].AxisY.Minimum = min * 0.95; - ChartX.ChartAreas[0].AxisY.Maximum = max * 1.05; + throw new ArgumentException($"invalid chart range: ({min}, {max})"); } } + public void SetMinMax(double min, double max) + { + VerifyRange(min, max); + ChartX.ChartAreas[0].AxisY.Minimum = min * (1 - VerticalMargin); + ChartX.ChartAreas[0].AxisY.Maximum = max * (1 + VerticalMargin); + } + public void SetMinMaxXY(double minX, double maxX, double minY, double maxY) { - if (minX < maxX) - { - ChartX.ChartAreas[0].AxisY.Minimum = minX * 0.95; - ChartX.ChartAreas[0].AxisY.Maximum = maxX * 1.05; - } + VerifyRange(minX, maxX); + ChartX.ChartAreas[0].AxisY.Minimum = minX * (1 - VerticalMargin); + ChartX.ChartAreas[0].AxisY.Maximum = maxX * (1 + VerticalMargin); - if (minY < maxY) - { - ChartY.ChartAreas[0].AxisY.Minimum = minY * 0.95; - ChartY.ChartAreas[0].AxisY.Maximum = maxY * 1.05; - } + VerifyRange(minY, maxY); + ChartX.ChartAreas[0].AxisY.Minimum = minY * (1 - VerticalMargin); + ChartX.ChartAreas[0].AxisY.Maximum = maxY * (1 + VerticalMargin); } public void SetCombined() diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs index 541bbe2..345f814 100644 --- a/grapher/Models/Fields/Field.cs +++ b/grapher/Models/Fields/Field.cs @@ -27,12 +27,16 @@ namespace grapher #region Constructors - public Field(TextBox box, Form containingForm, double defaultData) + public Field(TextBox box, Form containingForm, double defaultData, + double minData = double.MinValue, + double maxData = double.MaxValue) { DefaultText = DecimalString(defaultData); Box = box; _data = defaultData; DefaultData = defaultData; + MinData = minData; + MaxData = maxData; State = FieldState.Undefined; ContainingForm = containingForm; FormatString = Constants.DefaultFieldFormatString; @@ -69,7 +73,7 @@ namespace grapher { return DefaultData; } - } + } } public int Top @@ -122,6 +126,10 @@ namespace grapher private double DefaultData { get; set; } + private double MinData { get; } + + private double MaxData { get; } + #endregion Properties #region Methods @@ -268,12 +276,10 @@ namespace grapher private void TextToData() { - try - { - _data = Convert.ToDouble(Box.Text); - } - catch + if (double.TryParse(Box.Text, out double value) && + value <= MaxData && value >= MinData) { + _data = value; } Box.Text = DecimalString(Data); diff --git a/grapher/Models/Mouse/MouseWatcher.cs b/grapher/Models/Mouse/MouseWatcher.cs index 6209445..cbfc119 100644 --- a/grapher/Models/Mouse/MouseWatcher.cs +++ b/grapher/Models/Mouse/MouseWatcher.cs @@ -1,4 +1,5 @@ -using System; +using grapher.Models.Serialized; +using System; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -677,12 +678,12 @@ namespace grapher.Models.Mouse #region Constructors - public MouseWatcher(Form containingForm, Label display, AccelCharts accelCharts, Field pollRate) + public MouseWatcher(Form containingForm, Label display, AccelCharts accelCharts, SettingsManager setMngr) { ContainingForm = containingForm; Display = display; AccelCharts = accelCharts; - PollRateField = pollRate; + SettingsManager = setMngr; MouseData = new MouseData(); RAWINPUTDEVICE device = new RAWINPUTDEVICE(); @@ -694,8 +695,6 @@ namespace grapher.Models.Mouse RAWINPUTDEVICE[] devices = new RAWINPUTDEVICE[1]; devices[0] = device; RegisterRawInputDevices(devices, 1, Marshal.SizeOf(typeof(RAWINPUTDEVICE))); - PollTime = 1; - PollRate = 1000; } #endregion Constructors @@ -708,24 +707,19 @@ namespace grapher.Models.Mouse private AccelCharts AccelCharts { get; } - private Field PollRateField { get; set; } + private SettingsManager SettingsManager { get; } private MouseData MouseData { get; } - private double PollRate { get; set; } - - private double PollTime { get; set; } + private double PollTime + { + get => 1000 / SettingsManager.PollRateField.Data; + } #endregion Properties #region Methods - public void OnMouseMove(int x, int y, double timeInMs) - { - MouseData.Set(x,y); - AccelCharts.MakeDots(x, y, timeInMs); - } - public void UpdateLastMove() { MouseData.Get(out var x, out var y); @@ -740,15 +734,30 @@ namespace grapher.Models.Mouse outSize = GetRawInputData((IntPtr)message.LParam, RawInputCommand.Input, out rawInput, ref size, Marshal.SizeOf(typeof(RAWINPUTHEADER))); - if (PollRateField.Data != PollRate) - { - PollRate = PollRateField.Data; - PollTime = 1000 / PollRate; - } + bool relative = !rawInput.Data.Mouse.Flags.HasFlag(RawMouseFlags.MoveAbsolute); - if (rawInput.Data.Mouse.LastX != 0 || rawInput.Data.Mouse.LastY != 0) + if (relative && (rawInput.Data.Mouse.LastX != 0 || rawInput.Data.Mouse.LastY != 0)) { - OnMouseMove(rawInput.Data.Mouse.LastX, rawInput.Data.Mouse.LastY, PollTime); + double x = rawInput.Data.Mouse.LastX; + double y = rawInput.Data.Mouse.LastY; + + // strip negative directional multipliers, charts calculated from positive input + + Vec2<double> dirMults = SettingsManager.RawAccelSettings + .AccelerationSettings.directionalMultipliers; + + if (dirMults.x > 0 && x < 0) + { + x /= dirMults.x; + } + + if (dirMults.y > 0 && y < 0) + { + y /= dirMults.y; + } + + MouseData.Set(rawInput.Data.Mouse.LastX, rawInput.Data.Mouse.LastY); + AccelCharts.MakeDots(x, y, PollTime); } } diff --git a/grapher/Models/Serialized/RawAccelSettings.cs b/grapher/Models/Serialized/RawAccelSettings.cs index af87a65..dcaf864 100644 --- a/grapher/Models/Serialized/RawAccelSettings.cs +++ b/grapher/Models/Serialized/RawAccelSettings.cs @@ -127,6 +127,8 @@ namespace grapher.Models.Serialized return accelSettings.sensitivity.x == 1 && accelSettings.sensitivity.y == 1 && + accelSettings.directionalMultipliers.x <= 0 && + accelSettings.directionalMultipliers.y <= 0 && accelSettings.rotation == 0 && accelSettings.modes.x == AccelMode.noaccel && wholeOrNoY; diff --git a/grapher/Models/Serialized/SettingsManager.cs b/grapher/Models/Serialized/SettingsManager.cs index f13ba81..41ebcb5 100644 --- a/grapher/Models/Serialized/SettingsManager.cs +++ b/grapher/Models/Serialized/SettingsManager.cs @@ -34,9 +34,9 @@ namespace grapher.Models.Serialized public RawAccelSettings RawAccelSettings { get; private set; } - private Field DpiField { get; set; } + public Field DpiField { get; private set; } - private Field PollRateField { get; set; } + public Field PollRateField { get; private set; } private ToolStripMenuItem AutoWriteMenuItem { get; set; } @@ -47,35 +47,6 @@ namespace grapher.Models.Serialized #endregion Properties #region Methods - - public static string ErrorStringFrom(SettingsErrors errors) - { - StringBuilder builder = new StringBuilder(); - bool yPresent = errors.y?.Count > 0; - - if (yPresent) - { - builder.AppendLine("\nx:"); - } - - foreach (var error in errors.x) - { - builder.AppendLine(error); - } - - if (yPresent) - { - builder.AppendLine("\ny:"); - - foreach (var error in errors.y) - { - builder.AppendLine(error); - } - } - - return builder.ToString(); - } - public SettingsErrors TryUpdateActiveSettings(DriverSettings settings) { var errors = TryUpdateAccel(settings); diff --git a/grapher/Properties/AssemblyInfo.cs b/grapher/Properties/AssemblyInfo.cs index 939f98a..a46d6b3 100644 --- a/grapher/Properties/AssemblyInfo.cs +++ b/grapher/Properties/AssemblyInfo.cs @@ -5,12 +5,12 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("grapher")] +[assembly: AssemblyTitle("Raw Accel GUI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("grapher")] -[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyProduct("Raw Accel")] +[assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion(RawAccelVersion.value)] +[assembly: AssemblyFileVersion(RawAccelVersion.value)] diff --git a/grapher/grapher.csproj b/grapher/grapher.csproj index a3e63ad..f6bdcb9 100644 --- a/grapher/grapher.csproj +++ b/grapher/grapher.csproj @@ -71,6 +71,12 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="AboutBox.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="AboutBox.Designer.cs"> + <DependentUpon>AboutBox.cs</DependentUpon> + </Compile> <Compile Include="Constants\Constants.cs" /> <Compile Include="Layouts\MotivityLayout.cs" /> <Compile Include="Layouts\NaturalGainLayout.cs" /> @@ -122,6 +128,9 @@ <Compile Include="Models\Serialized\SettingsManager.cs" /> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <EmbeddedResource Include="AboutBox.resx"> + <DependentUpon>AboutBox.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Form1.resx"> <DependentUpon>Form1.cs</DependentUpon> </EmbeddedResource> |