summaryrefslogtreecommitdiff
path: root/grapher
diff options
context:
space:
mode:
authorJacobPalecki <[email protected]>2020-09-08 16:00:05 -0700
committerGitHub <[email protected]>2020-09-08 16:00:05 -0700
commite5461fa84e65d78823d0022339fa2d8864f7e63c (patch)
treeb486ef524c93bfeb29a86403114b6805bf9decf1 /grapher
parentMerge pull request #19 from JacobPalecki/gainOffset (diff)
parentSave show last mouse value (diff)
downloadrawaccel-e5461fa84e65d78823d0022339fa2d8864f7e63c.tar.xz
rawaccel-e5461fa84e65d78823d0022339fa2d8864f7e63c.zip
Merge pull request #20 from JacobPalecki/GUI
GUI: Add By Component & Anisotropy; Remove Logarithm and Sigmoid; Delete Console; Some Refactoring
Diffstat (limited to 'grapher')
-rw-r--r--grapher/Constants/Constants.cs104
-rw-r--r--grapher/Form1.Designer.cs794
-rw-r--r--grapher/Form1.cs220
-rw-r--r--grapher/Layouts/ClassicLayout.cs14
-rw-r--r--grapher/Layouts/DefaultLayout.cs16
-rw-r--r--grapher/Layouts/LayoutBase.cs102
-rw-r--r--grapher/Layouts/LinearLayout.cs14
-rw-r--r--grapher/Layouts/LogLayout.cs21
-rw-r--r--grapher/Layouts/NaturalGainLayout.cs14
-rw-r--r--grapher/Layouts/NaturalLayout.cs14
-rw-r--r--grapher/Layouts/OffLayout.cs15
-rw-r--r--grapher/Layouts/OptionLayout.cs41
-rw-r--r--grapher/Layouts/PowerLayout.cs14
-rw-r--r--grapher/Layouts/SigmoidGainLayout.cs14
-rw-r--r--grapher/Layouts/SigmoidLayout.cs21
-rw-r--r--grapher/Models/AccelGUI.cs170
-rw-r--r--grapher/Models/AccelGUIFactory.cs303
-rw-r--r--grapher/Models/Calculations/AccelCalculator.cs28
-rw-r--r--grapher/Models/Calculations/AccelChartData.cs14
-rw-r--r--grapher/Models/Calculations/AccelData.cs15
-rw-r--r--grapher/Models/Charts/AccelCharts.cs99
-rw-r--r--grapher/Models/Charts/ChartXY.cs88
-rw-r--r--grapher/Models/Charts/EstimatedPoints.cs13
-rw-r--r--grapher/Models/Fields/Field.cs93
-rw-r--r--grapher/Models/Fields/FieldXY.cs88
-rw-r--r--grapher/Models/Mouse/MouseWatcher.cs20
-rw-r--r--grapher/Models/Mouse/PointData.cs16
-rw-r--r--grapher/Models/Options/AccelOptionSet.cs117
-rw-r--r--grapher/Models/Options/AccelOptions.cs91
-rw-r--r--grapher/Models/Options/AccelTypeOptions.cs281
-rw-r--r--grapher/Models/Options/ActiveValueLabel.cs71
-rw-r--r--grapher/Models/Options/ActiveValueLabelXY.cs95
-rw-r--r--grapher/Models/Options/ApplyOptions.cs255
-rw-r--r--grapher/Models/Options/CapOptions.cs146
-rw-r--r--grapher/Models/Options/IOption.cs23
-rw-r--r--grapher/Models/Options/OffsetOptions.cs78
-rw-r--r--grapher/Models/Options/Option.cs99
-rw-r--r--grapher/Models/Options/OptionBase.cs33
-rw-r--r--grapher/Models/Options/OptionXY.cs84
-rw-r--r--grapher/Models/Serialized/DriverSettings.cs18
-rw-r--r--grapher/Models/Serialized/GUISettings.cs17
-rw-r--r--grapher/Models/Serialized/RawAccelSettings.cs25
-rw-r--r--grapher/Models/Serialized/SettingsManager.cs25
-rw-r--r--grapher/Program.cs3
-rw-r--r--grapher/grapher.csproj11
45 files changed, 2863 insertions, 974 deletions
diff --git a/grapher/Constants/Constants.cs b/grapher/Constants/Constants.cs
new file mode 100644
index 0000000..aaf8bb9
--- /dev/null
+++ b/grapher/Constants/Constants.cs
@@ -0,0 +1,104 @@
+using System.Drawing;
+
+namespace grapher
+{
+ public static class Constants
+ {
+ #region Constants
+
+ /// <summary> DPI by which charts are scaled if none is set by user. </summary>
+ public const int DefaultDPI = 1200;
+
+ /// <summary> Poll rate by which charts are scaled if none is set by user. </summary>
+ public const int DefaultPollRate = 1000;
+
+ /// <summary> Resolution of chart calulation. </summary>
+ public const int Resolution = 100;
+
+ /// <summary> Multiplied by DPI over poll rate to find rough max expected velocity. </summary>
+ public const double MaxMultiplier = 85;
+
+ /// <summary> Ratio of max (X, Y) used in "by component" calulations to those used in "whole vector" calculations. </summary>
+ public const double XYToCombinedRatio = 1.4;
+
+ /// <summary> Possible options to display in a layout. </summary>
+ public const int PossibleOptionsCount = 6;
+
+ /// <summary> Separation between X and Y active value labels, in pixels. </summary>
+ public const int ActiveLabelXYSeparation = 2;
+
+ /// <summary> Vertical separation between charts, in pixels. </summary>
+ public const int ChartSeparationVertical = 10;
+
+ /// <summary> Needed to show full contents in form. Unsure why. </summary>
+ public const int FormHeightPadding = 35;
+
+ /// <summary> Horizontal separation between charts, in pixels. </summary>
+ public const int ChartSeparationHorizontal = 10;
+
+ /// <summary> Default horizontal separation between x and y fields, in pixels. </summary>
+ public const int DefaultFieldSeparation = 4;
+
+ /// <summary> Default horizontal separation between an option's label and box, in pixels. </summary>
+ public const int OptionLabelBoxSeperation = 10;
+
+ /// <summary> Default horizontal separation between an option's label and box, in pixels. </summary>
+ public const int OptionVerticalSeperation = 4;
+
+ /// <summary> Horizontal separation between left side of single dropdown and left side of labels beneath dropdown </summary>
+ public const int DropDownLeftSeparation = 10;
+
+ /// <summary> Width of charts when widened </summary>
+ public const int WideChartWidth = 723;
+
+ /// <summary> Left placement of charts when widened </summary>
+ public const int WideChartLeft = 333;
+
+ /// <summary> Width of charts when narrowed </summary>
+ public const int NarrowChartWidth = 698;
+
+ /// <summary> Left placement of charts when narrowed </summary>
+ public const int NarrowChartLeft = 482;
+
+ public const int WriteButtonVerticalOffset = 50;
+
+ /// <summary> Format string for shortened x and y textboxes. </summary>
+ public const string ShortenedFormatString = "0.###";
+
+ /// <summary> Format string for default active value labels. </summary>
+ public const string DefaultActiveValueFormatString = "0.######";
+
+ /// <summary> Format string for default textboxes. </summary>
+ public const string DefaultFieldFormatString = "0.#########";
+
+ /// <summary> Format string for shortened x and y fields. </summary>
+ public const string ShortenedFieldFormatString = "0.###";
+
+ /// <summary> Format string for gain cap active value label. </summary>
+ public const string GainCapFormatString = "0.##";
+
+ /// <summary> Format string for shortened x and y dropdowns. </summary>
+ public const string AccelDropDownDefaultFullText = "Acceleration Type";
+
+ /// <summary> Format string for default dropdowns. </summary>
+ public const string AccelDropDownDefaultShortText = "Accel Type";
+
+ /// <summary> Default text to be displayed on write button. </summary>
+ public const string WriteButtonDefaultText = "Write To Driver";
+
+ /// <summary> Default text to be displayed on write button. </summary>
+ public const string WriteButtonDelayText = "Delay";
+
+ /// <summary> Default name of settings file. </summary>
+ public const string DefaultSettingsFileName = @"settings.json";
+
+ #endregion Constants
+
+ #region ReadOnly
+
+ /// <summary> Color of font in active value labels. </summary>
+ public static readonly Color ActiveValueFontColor = Color.FromArgb(255, 65, 65, 65);
+
+ #endregion ReadOnly
+ }
+}
diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs
index a7a3e16..f8a6578 100644
--- a/grapher/Form1.Designer.cs
+++ b/grapher/Form1.Designer.cs
@@ -55,30 +55,28 @@ namespace grapher
System.Windows.Forms.DataVisualization.Charting.Series series11 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Series series12 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.AccelerationChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.accelTypeDrop = new System.Windows.Forms.ComboBox();
+ this.accelTypeDropX = new System.Windows.Forms.ComboBox();
this.sensitivityBoxX = new System.Windows.Forms.TextBox();
this.sensitivityLabel = new System.Windows.Forms.Label();
this.rotationBox = new System.Windows.Forms.TextBox();
this.rotationLabel = new System.Windows.Forms.Label();
- this.accelerationBox = new System.Windows.Forms.TextBox();
- this.constantOneLabel = new System.Windows.Forms.Label();
+ this.accelerationBoxX = new System.Windows.Forms.TextBox();
+ this.constantOneLabelX = new System.Windows.Forms.Label();
this.capBoxX = new System.Windows.Forms.TextBox();
- this.capLabel = new System.Windows.Forms.Label();
- this.weightBoxFirst = new System.Windows.Forms.TextBox();
- this.weightLabel = new System.Windows.Forms.Label();
- this.weightBoxSecond = new System.Windows.Forms.TextBox();
- this.limitBox = new System.Windows.Forms.TextBox();
- this.constantTwoLabel = new System.Windows.Forms.Label();
- this.midpointBox = new System.Windows.Forms.TextBox();
- this.constantThreeLabel = new System.Windows.Forms.Label();
- this.offsetBox = new System.Windows.Forms.TextBox();
- this.offsetLabel = new System.Windows.Forms.Label();
+ this.capLabelX = new System.Windows.Forms.Label();
+ this.weightBoxX = new System.Windows.Forms.TextBox();
+ this.weightLabelX = new System.Windows.Forms.Label();
+ this.weightBoxY = new System.Windows.Forms.TextBox();
+ this.limitBoxX = new System.Windows.Forms.TextBox();
+ this.constantTwoLabelX = new System.Windows.Forms.Label();
+ this.midpointBoxX = new System.Windows.Forms.TextBox();
+ this.constantThreeLabelX = new System.Windows.Forms.Label();
+ this.offsetBoxX = new System.Windows.Forms.TextBox();
+ this.offsetLabelX = new System.Windows.Forms.Label();
this.writeButton = new System.Windows.Forms.Button();
this.sensitivityBoxY = new System.Windows.Forms.TextBox();
this.capBoxY = new System.Windows.Forms.TextBox();
this.sensXYLock = new System.Windows.Forms.CheckBox();
- this.capXYLock = new System.Windows.Forms.CheckBox();
- this.weightXYLock = new System.Windows.Forms.CheckBox();
this.LockXYLabel = new System.Windows.Forms.Label();
this.VelocityChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.GainChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
@@ -95,6 +93,12 @@ namespace grapher
this.capStyleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.gainCapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.legacyCapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.offsetStyleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.gainOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.legacyOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.wholeVectorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.byVectorComponentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.startupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AutoWriteMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AccelerationChartY = new System.Windows.Forms.DataVisualization.Charting.Chart();
@@ -105,18 +109,36 @@ namespace grapher
this.SensitivityActiveXLabel = new System.Windows.Forms.Label();
this.SensitivityActiveYLabel = new System.Windows.Forms.Label();
this.RotationActiveLabel = new System.Windows.Forms.Label();
- this.AccelTypeActiveLabel = new System.Windows.Forms.Label();
- this.AccelerationActiveLabel = new System.Windows.Forms.Label();
+ this.AccelTypeActiveLabelX = new System.Windows.Forms.Label();
+ this.AccelerationActiveLabelX = new System.Windows.Forms.Label();
this.CapActiveXLabel = new System.Windows.Forms.Label();
this.WeightActiveXLabel = new System.Windows.Forms.Label();
this.WeightActiveYLabel = new System.Windows.Forms.Label();
this.CapActiveYLabel = new System.Windows.Forms.Label();
- this.OffsetActiveLabel = new System.Windows.Forms.Label();
- this.LimitExpActiveLabel = new System.Windows.Forms.Label();
- this.MidpointActiveLabel = new System.Windows.Forms.Label();
- this.offsetStyleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.gainOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.legacyOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.OffsetActiveXLabel = new System.Windows.Forms.Label();
+ this.LimitExpActiveXLabel = new System.Windows.Forms.Label();
+ this.MidpointActiveXLabel = new System.Windows.Forms.Label();
+ this.accelerationBoxY = new System.Windows.Forms.TextBox();
+ this.offsetBoxY = new System.Windows.Forms.TextBox();
+ this.limitBoxY = new System.Windows.Forms.TextBox();
+ this.midpointBoxY = new System.Windows.Forms.TextBox();
+ this.accelTypeDropY = new System.Windows.Forms.ComboBox();
+ this.AccelerationActiveLabelY = new System.Windows.Forms.Label();
+ this.OffsetActiveYLabel = new System.Windows.Forms.Label();
+ this.LimitExpActiveYLabel = new System.Windows.Forms.Label();
+ this.MidpointActiveYLabel = new System.Windows.Forms.Label();
+ this.ByComponentXYLock = new System.Windows.Forms.CheckBox();
+ this.constantOneLabelY = new System.Windows.Forms.Label();
+ this.capLabelY = new System.Windows.Forms.Label();
+ this.weightLabelY = new System.Windows.Forms.Label();
+ this.offsetLabelY = new System.Windows.Forms.Label();
+ this.constantTwoLabelY = new System.Windows.Forms.Label();
+ this.constantThreeLabelY = new System.Windows.Forms.Label();
+ this.OptionSetXTitle = new System.Windows.Forms.Label();
+ this.OptionSetYTitle = new System.Windows.Forms.Label();
+ this.AccelTypeActiveLabelY = new System.Windows.Forms.Label();
+ this.ActiveValueTitleY = new System.Windows.Forms.Label();
+ this.showLastMouseMoveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.AccelerationChart)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.VelocityChart)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.GainChart)).BeginInit();
@@ -134,7 +156,7 @@ namespace grapher
this.AccelerationChart.ChartAreas.Add(chartArea1);
legend1.Name = "Legend1";
this.AccelerationChart.Legends.Add(legend1);
- this.AccelerationChart.Location = new System.Drawing.Point(333, 0);
+ this.AccelerationChart.Location = new System.Drawing.Point(482, 0);
this.AccelerationChart.Name = "AccelerationChart";
series1.ChartArea = "ChartArea1";
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
@@ -147,24 +169,24 @@ namespace grapher
series2.Name = "LastAccelVal";
this.AccelerationChart.Series.Add(series1);
this.AccelerationChart.Series.Add(series2);
- this.AccelerationChart.Size = new System.Drawing.Size(723, 328);
+ this.AccelerationChart.Size = new System.Drawing.Size(698, 328);
this.AccelerationChart.TabIndex = 0;
- this.AccelerationChart.Text = "chart1";
+ this.AccelerationChart.Text = "Sensitivity";
//
- // accelTypeDrop
+ // accelTypeDropX
//
- this.accelTypeDrop.FormattingEnabled = true;
- this.accelTypeDrop.Location = new System.Drawing.Point(24, 98);
- this.accelTypeDrop.Name = "accelTypeDrop";
- this.accelTypeDrop.Size = new System.Drawing.Size(151, 21);
- this.accelTypeDrop.TabIndex = 2;
- this.accelTypeDrop.Text = "Acceleration Type";
+ this.accelTypeDropX.FormattingEnabled = true;
+ this.accelTypeDropX.Location = new System.Drawing.Point(105, 110);
+ this.accelTypeDropX.Name = "accelTypeDropX";
+ this.accelTypeDropX.Size = new System.Drawing.Size(76, 21);
+ this.accelTypeDropX.TabIndex = 2;
+ this.accelTypeDropX.Text = "Accel Type";
//
// sensitivityBoxX
//
this.sensitivityBoxX.Location = new System.Drawing.Point(105, 46);
this.sensitivityBoxX.Name = "sensitivityBoxX";
- this.sensitivityBoxX.Size = new System.Drawing.Size(32, 20);
+ this.sensitivityBoxX.Size = new System.Drawing.Size(34, 20);
this.sensitivityBoxX.TabIndex = 3;
//
// sensitivityLabel
@@ -180,7 +202,7 @@ namespace grapher
//
this.rotationBox.Location = new System.Drawing.Point(105, 72);
this.rotationBox.Name = "rotationBox";
- this.rotationBox.Size = new System.Drawing.Size(70, 20);
+ this.rotationBox.Size = new System.Drawing.Size(76, 20);
this.rotationBox.TabIndex = 5;
//
// rotationLabel
@@ -192,137 +214,136 @@ namespace grapher
this.rotationLabel.TabIndex = 6;
this.rotationLabel.Text = "Rotation";
//
- // accelerationBox
+ // accelerationBoxX
//
- this.accelerationBox.Location = new System.Drawing.Point(105, 125);
- this.accelerationBox.Name = "accelerationBox";
- this.accelerationBox.Size = new System.Drawing.Size(69, 20);
- this.accelerationBox.TabIndex = 7;
+ this.accelerationBoxX.Location = new System.Drawing.Point(105, 137);
+ this.accelerationBoxX.Name = "accelerationBoxX";
+ this.accelerationBoxX.Size = new System.Drawing.Size(76, 20);
+ this.accelerationBoxX.TabIndex = 7;
//
- // constantOneLabel
+ // constantOneLabelX
//
- this.constantOneLabel.AutoSize = true;
- this.constantOneLabel.Location = new System.Drawing.Point(24, 128);
- this.constantOneLabel.Name = "constantOneLabel";
- this.constantOneLabel.Size = new System.Drawing.Size(66, 13);
- this.constantOneLabel.TabIndex = 9;
- this.constantOneLabel.Text = "Acceleration";
- this.constantOneLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.constantOneLabelX.AutoSize = true;
+ this.constantOneLabelX.Location = new System.Drawing.Point(24, 140);
+ this.constantOneLabelX.Name = "constantOneLabelX";
+ this.constantOneLabelX.Size = new System.Drawing.Size(66, 13);
+ this.constantOneLabelX.TabIndex = 9;
+ this.constantOneLabelX.Text = "Acceleration";
+ this.constantOneLabelX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// capBoxX
//
- this.capBoxX.Location = new System.Drawing.Point(105, 151);
+ this.capBoxX.Location = new System.Drawing.Point(105, 163);
this.capBoxX.Name = "capBoxX";
- this.capBoxX.Size = new System.Drawing.Size(32, 20);
+ this.capBoxX.Size = new System.Drawing.Size(76, 20);
this.capBoxX.TabIndex = 10;
//
- // capLabel
+ // capLabelX
//
- this.capLabel.AutoSize = true;
- this.capLabel.Location = new System.Drawing.Point(34, 155);
- this.capLabel.Name = "capLabel";
- this.capLabel.Size = new System.Drawing.Size(26, 13);
- this.capLabel.TabIndex = 11;
- this.capLabel.Text = "Cap";
- this.capLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.capLabelX.AutoSize = true;
+ this.capLabelX.Location = new System.Drawing.Point(43, 166);
+ this.capLabelX.Name = "capLabelX";
+ this.capLabelX.Size = new System.Drawing.Size(26, 13);
+ this.capLabelX.TabIndex = 11;
+ this.capLabelX.Text = "Cap";
+ this.capLabelX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
- // weightBoxFirst
+ // weightBoxX
//
- this.weightBoxFirst.Location = new System.Drawing.Point(105, 177);
- this.weightBoxFirst.Name = "weightBoxFirst";
- this.weightBoxFirst.Size = new System.Drawing.Size(32, 20);
- this.weightBoxFirst.TabIndex = 12;
+ this.weightBoxX.Location = new System.Drawing.Point(105, 189);
+ this.weightBoxX.Name = "weightBoxX";
+ this.weightBoxX.Size = new System.Drawing.Size(76, 20);
+ this.weightBoxX.TabIndex = 12;
//
- // weightLabel
+ // weightLabelX
//
- this.weightLabel.AutoSize = true;
- this.weightLabel.Location = new System.Drawing.Point(34, 180);
- this.weightLabel.Name = "weightLabel";
- this.weightLabel.Size = new System.Drawing.Size(41, 13);
- this.weightLabel.TabIndex = 13;
- this.weightLabel.Text = "Weight";
- this.weightLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.weightLabelX.AutoSize = true;
+ this.weightLabelX.Location = new System.Drawing.Point(40, 192);
+ this.weightLabelX.Name = "weightLabelX";
+ this.weightLabelX.Size = new System.Drawing.Size(41, 13);
+ this.weightLabelX.TabIndex = 13;
+ this.weightLabelX.Text = "Weight";
+ this.weightLabelX.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
- // weightBoxSecond
+ // weightBoxY
//
- this.weightBoxSecond.Location = new System.Drawing.Point(144, 177);
- this.weightBoxSecond.Name = "weightBoxSecond";
- this.weightBoxSecond.Size = new System.Drawing.Size(31, 20);
- this.weightBoxSecond.TabIndex = 14;
+ this.weightBoxY.Location = new System.Drawing.Point(331, 189);
+ this.weightBoxY.Name = "weightBoxY";
+ this.weightBoxY.Size = new System.Drawing.Size(76, 20);
+ this.weightBoxY.TabIndex = 14;
//
- // limitBox
+ // limitBoxX
//
- this.limitBox.Location = new System.Drawing.Point(105, 229);
- this.limitBox.Name = "limitBox";
- this.limitBox.Size = new System.Drawing.Size(70, 20);
- this.limitBox.TabIndex = 15;
+ this.limitBoxX.Location = new System.Drawing.Point(105, 241);
+ this.limitBoxX.Name = "limitBoxX";
+ this.limitBoxX.Size = new System.Drawing.Size(76, 20);
+ this.limitBoxX.TabIndex = 15;
//
- // constantTwoLabel
+ // constantTwoLabelX
//
- this.constantTwoLabel.AutoSize = true;
- this.constantTwoLabel.Location = new System.Drawing.Point(24, 232);
- this.constantTwoLabel.Name = "constantTwoLabel";
- this.constantTwoLabel.Size = new System.Drawing.Size(78, 13);
- this.constantTwoLabel.TabIndex = 16;
- this.constantTwoLabel.Text = "Limit/Exponent";
- this.constantTwoLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.constantTwoLabelX.AutoSize = true;
+ this.constantTwoLabelX.Location = new System.Drawing.Point(24, 244);
+ this.constantTwoLabelX.Name = "constantTwoLabelX";
+ this.constantTwoLabelX.Size = new System.Drawing.Size(78, 13);
+ this.constantTwoLabelX.TabIndex = 16;
+ this.constantTwoLabelX.Text = "Limit/Exponent";
+ this.constantTwoLabelX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
- // midpointBox
+ // midpointBoxX
//
- this.midpointBox.Location = new System.Drawing.Point(105, 255);
- this.midpointBox.Name = "midpointBox";
- this.midpointBox.Size = new System.Drawing.Size(70, 20);
- this.midpointBox.TabIndex = 17;
+ this.midpointBoxX.Location = new System.Drawing.Point(105, 267);
+ this.midpointBoxX.Name = "midpointBoxX";
+ this.midpointBoxX.Size = new System.Drawing.Size(76, 20);
+ this.midpointBoxX.TabIndex = 17;
//
- // constantThreeLabel
+ // constantThreeLabelX
//
- this.constantThreeLabel.AutoSize = true;
- this.constantThreeLabel.Location = new System.Drawing.Point(31, 258);
- this.constantThreeLabel.Name = "constantThreeLabel";
- this.constantThreeLabel.Size = new System.Drawing.Size(47, 13);
- this.constantThreeLabel.TabIndex = 18;
- this.constantThreeLabel.Text = "Midpoint";
- this.constantThreeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.constantThreeLabelX.AutoSize = true;
+ this.constantThreeLabelX.Location = new System.Drawing.Point(34, 270);
+ this.constantThreeLabelX.Name = "constantThreeLabelX";
+ this.constantThreeLabelX.Size = new System.Drawing.Size(47, 13);
+ this.constantThreeLabelX.TabIndex = 18;
+ this.constantThreeLabelX.Text = "Midpoint";
+ this.constantThreeLabelX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
- // offsetBox
+ // offsetBoxX
//
- this.offsetBox.Location = new System.Drawing.Point(105, 203);
- this.offsetBox.Name = "offsetBox";
- this.offsetBox.Size = new System.Drawing.Size(70, 20);
- this.offsetBox.TabIndex = 19;
+ this.offsetBoxX.Location = new System.Drawing.Point(105, 215);
+ this.offsetBoxX.Name = "offsetBoxX";
+ this.offsetBoxX.Size = new System.Drawing.Size(76, 20);
+ this.offsetBoxX.TabIndex = 19;
//
- // offsetLabel
+ // offsetLabelX
//
- this.offsetLabel.AutoSize = true;
- this.offsetLabel.Location = new System.Drawing.Point(34, 206);
- this.offsetLabel.Name = "offsetLabel";
- this.offsetLabel.Size = new System.Drawing.Size(35, 13);
- this.offsetLabel.TabIndex = 20;
- this.offsetLabel.Text = "Offset";
- this.offsetLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.offsetLabelX.AutoSize = true;
+ this.offsetLabelX.Location = new System.Drawing.Point(43, 218);
+ this.offsetLabelX.Name = "offsetLabelX";
+ this.offsetLabelX.Size = new System.Drawing.Size(35, 13);
+ this.offsetLabelX.TabIndex = 20;
+ this.offsetLabelX.Text = "Offset";
+ this.offsetLabelX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// writeButton
//
- this.writeButton.Location = new System.Drawing.Point(57, 281);
+ this.writeButton.Location = new System.Drawing.Point(153, 293);
this.writeButton.Name = "writeButton";
this.writeButton.Size = new System.Drawing.Size(102, 23);
this.writeButton.TabIndex = 21;
this.writeButton.Text = "Write To Driver";
this.writeButton.UseVisualStyleBackColor = true;
- this.writeButton.Click += new System.EventHandler(this.writeButton_Click);
//
// sensitivityBoxY
//
- this.sensitivityBoxY.Location = new System.Drawing.Point(143, 46);
+ this.sensitivityBoxY.Location = new System.Drawing.Point(147, 46);
this.sensitivityBoxY.Name = "sensitivityBoxY";
- this.sensitivityBoxY.Size = new System.Drawing.Size(32, 20);
+ this.sensitivityBoxY.Size = new System.Drawing.Size(34, 20);
this.sensitivityBoxY.TabIndex = 22;
//
// capBoxY
//
- this.capBoxY.Location = new System.Drawing.Point(144, 151);
+ this.capBoxY.Location = new System.Drawing.Point(331, 163);
this.capBoxY.Name = "capBoxY";
- this.capBoxY.Size = new System.Drawing.Size(31, 20);
+ this.capBoxY.Size = new System.Drawing.Size(76, 20);
this.capBoxY.TabIndex = 23;
//
// sensXYLock
@@ -330,38 +351,16 @@ namespace grapher
this.sensXYLock.AutoSize = true;
this.sensXYLock.Checked = true;
this.sensXYLock.CheckState = System.Windows.Forms.CheckState.Checked;
- this.sensXYLock.Location = new System.Drawing.Point(198, 49);
+ this.sensXYLock.Location = new System.Drawing.Point(282, 46);
this.sensXYLock.Name = "sensXYLock";
this.sensXYLock.Size = new System.Drawing.Size(15, 14);
this.sensXYLock.TabIndex = 24;
this.sensXYLock.UseVisualStyleBackColor = true;
//
- // capXYLock
- //
- this.capXYLock.AutoSize = true;
- this.capXYLock.Checked = true;
- this.capXYLock.CheckState = System.Windows.Forms.CheckState.Checked;
- this.capXYLock.Location = new System.Drawing.Point(198, 154);
- this.capXYLock.Name = "capXYLock";
- this.capXYLock.Size = new System.Drawing.Size(15, 14);
- this.capXYLock.TabIndex = 25;
- this.capXYLock.UseVisualStyleBackColor = true;
- //
- // weightXYLock
- //
- this.weightXYLock.AutoSize = true;
- this.weightXYLock.Checked = true;
- this.weightXYLock.CheckState = System.Windows.Forms.CheckState.Checked;
- this.weightXYLock.Location = new System.Drawing.Point(198, 180);
- this.weightXYLock.Name = "weightXYLock";
- this.weightXYLock.Size = new System.Drawing.Size(15, 14);
- this.weightXYLock.TabIndex = 26;
- this.weightXYLock.UseVisualStyleBackColor = true;
- //
// LockXYLabel
//
this.LockXYLabel.AutoSize = true;
- this.LockXYLabel.Location = new System.Drawing.Point(174, 30);
+ this.LockXYLabel.Location = new System.Drawing.Point(255, 30);
this.LockXYLabel.Name = "LockXYLabel";
this.LockXYLabel.Size = new System.Drawing.Size(60, 13);
this.LockXYLabel.TabIndex = 27;
@@ -375,7 +374,7 @@ namespace grapher
this.VelocityChart.ChartAreas.Add(chartArea2);
legend2.Name = "Legend1";
this.VelocityChart.Legends.Add(legend2);
- this.VelocityChart.Location = new System.Drawing.Point(333, 334);
+ this.VelocityChart.Location = new System.Drawing.Point(482, 334);
this.VelocityChart.Name = "VelocityChart";
series3.ChartArea = "ChartArea1";
series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
@@ -388,7 +387,7 @@ namespace grapher
series4.Name = "LastVelocityVal";
this.VelocityChart.Series.Add(series3);
this.VelocityChart.Series.Add(series4);
- this.VelocityChart.Size = new System.Drawing.Size(723, 307);
+ this.VelocityChart.Size = new System.Drawing.Size(698, 307);
this.VelocityChart.TabIndex = 28;
this.VelocityChart.Text = "chart1";
//
@@ -400,7 +399,7 @@ namespace grapher
this.GainChart.ChartAreas.Add(chartArea3);
legend3.Name = "Legend1";
this.GainChart.Legends.Add(legend3);
- this.GainChart.Location = new System.Drawing.Point(333, 647);
+ this.GainChart.Location = new System.Drawing.Point(482, 647);
this.GainChart.Name = "GainChart";
series5.ChartArea = "ChartArea1";
series5.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
@@ -413,7 +412,7 @@ namespace grapher
series6.Name = "LastGainVal";
this.GainChart.Series.Add(series5);
this.GainChart.Series.Add(series6);
- this.GainChart.Size = new System.Drawing.Size(723, 309);
+ this.GainChart.Size = new System.Drawing.Size(698, 309);
this.GainChart.TabIndex = 29;
this.GainChart.Text = "chart1";
//
@@ -426,7 +425,7 @@ namespace grapher
this.startupToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(1786, 24);
+ this.menuStrip1.Size = new System.Drawing.Size(1884, 24);
this.menuStrip1.TabIndex = 30;
this.menuStrip1.Text = "menuStrip1";
//
@@ -435,7 +434,8 @@ namespace grapher
this.graphsToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.graphsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.showVelocityGainToolStripMenuItem,
- this.scaleByDPIToolStripMenuItem});
+ this.scaleByDPIToolStripMenuItem,
+ this.showLastMouseMoveToolStripMenuItem});
this.graphsToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.graphsToolStripMenuItem.Name = "graphsToolStripMenuItem";
this.graphsToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
@@ -444,7 +444,7 @@ namespace grapher
// showVelocityGainToolStripMenuItem
//
this.showVelocityGainToolStripMenuItem.Name = "showVelocityGainToolStripMenuItem";
- this.showVelocityGainToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
+ this.showVelocityGainToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
this.showVelocityGainToolStripMenuItem.Text = "Show Velocity && Gain";
//
// scaleByDPIToolStripMenuItem
@@ -454,7 +454,7 @@ namespace grapher
this.pollRateToolStripMenuItem,
this.ScaleMenuItem});
this.scaleByDPIToolStripMenuItem.Name = "scaleByDPIToolStripMenuItem";
- this.scaleByDPIToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
+ this.scaleByDPIToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
this.scaleByDPIToolStripMenuItem.Text = "Scale by Mouse Settngs";
//
// dPIToolStripMenuItem
@@ -495,7 +495,8 @@ namespace grapher
//
this.advancedToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.capStyleToolStripMenuItem,
- this.offsetStyleToolStripMenuItem});
+ this.offsetStyleToolStripMenuItem,
+ this.toolStripMenuItem1});
this.advancedToolStripMenuItem.Name = "advancedToolStripMenuItem";
this.advancedToolStripMenuItem.Size = new System.Drawing.Size(72, 20);
this.advancedToolStripMenuItem.Text = "Advanced";
@@ -514,15 +515,60 @@ namespace grapher
this.gainCapToolStripMenuItem.Checked = true;
this.gainCapToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.gainCapToolStripMenuItem.Name = "gainCapToolStripMenuItem";
- this.gainCapToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.gainCapToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
this.gainCapToolStripMenuItem.Text = "Gain (Default)";
//
// legacyCapToolStripMenuItem
//
this.legacyCapToolStripMenuItem.Name = "legacyCapToolStripMenuItem";
- this.legacyCapToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.legacyCapToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
this.legacyCapToolStripMenuItem.Text = "Legacy";
//
+ // offsetStyleToolStripMenuItem
+ //
+ this.offsetStyleToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.gainOffsetToolStripMenuItem,
+ this.legacyOffsetToolStripMenuItem});
+ this.offsetStyleToolStripMenuItem.Name = "offsetStyleToolStripMenuItem";
+ this.offsetStyleToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.offsetStyleToolStripMenuItem.Text = "Offset Style";
+ //
+ // gainOffsetToolStripMenuItem
+ //
+ this.gainOffsetToolStripMenuItem.Name = "gainOffsetToolStripMenuItem";
+ this.gainOffsetToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+ this.gainOffsetToolStripMenuItem.Text = "Gain (Default)";
+ //
+ // legacyOffsetToolStripMenuItem
+ //
+ this.legacyOffsetToolStripMenuItem.Name = "legacyOffsetToolStripMenuItem";
+ this.legacyOffsetToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
+ this.legacyOffsetToolStripMenuItem.Text = "Legacy";
+ //
+ // toolStripMenuItem1
+ //
+ this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.wholeVectorToolStripMenuItem,
+ this.byVectorComponentToolStripMenuItem});
+ this.toolStripMenuItem1.Name = "toolStripMenuItem1";
+ this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
+ this.toolStripMenuItem1.Text = "Application Style";
+ //
+ // wholeVectorToolStripMenuItem
+ //
+ this.wholeVectorToolStripMenuItem.Checked = true;
+ this.wholeVectorToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.wholeVectorToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.wholeVectorToolStripMenuItem.Name = "wholeVectorToolStripMenuItem";
+ this.wholeVectorToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
+ this.wholeVectorToolStripMenuItem.Text = "Whole";
+ //
+ // byVectorComponentToolStripMenuItem
+ //
+ this.byVectorComponentToolStripMenuItem.Name = "byVectorComponentToolStripMenuItem";
+ this.byVectorComponentToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
+ this.byVectorComponentToolStripMenuItem.Text = "By Component";
+ //
// startupToolStripMenuItem
//
this.startupToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -548,7 +594,7 @@ namespace grapher
this.AccelerationChartY.ChartAreas.Add(chartArea4);
legend4.Name = "Legend1";
this.AccelerationChartY.Legends.Add(legend4);
- this.AccelerationChartY.Location = new System.Drawing.Point(1062, 0);
+ this.AccelerationChartY.Location = new System.Drawing.Point(1186, 0);
this.AccelerationChartY.Name = "AccelerationChartY";
series7.ChartArea = "ChartArea1";
series7.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
@@ -561,7 +607,7 @@ namespace grapher
series8.Name = "LastAccelVal";
this.AccelerationChartY.Series.Add(series7);
this.AccelerationChartY.Series.Add(series8);
- this.AccelerationChartY.Size = new System.Drawing.Size(723, 328);
+ this.AccelerationChartY.Size = new System.Drawing.Size(698, 328);
this.AccelerationChartY.TabIndex = 31;
this.AccelerationChartY.Text = "chart1";
//
@@ -573,7 +619,7 @@ namespace grapher
this.VelocityChartY.ChartAreas.Add(chartArea5);
legend5.Name = "Legend1";
this.VelocityChartY.Legends.Add(legend5);
- this.VelocityChartY.Location = new System.Drawing.Point(1062, 334);
+ this.VelocityChartY.Location = new System.Drawing.Point(1186, 334);
this.VelocityChartY.Name = "VelocityChartY";
series9.ChartArea = "ChartArea1";
series9.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
@@ -586,7 +632,7 @@ namespace grapher
series10.Name = "LastVelocityVal";
this.VelocityChartY.Series.Add(series9);
this.VelocityChartY.Series.Add(series10);
- this.VelocityChartY.Size = new System.Drawing.Size(723, 307);
+ this.VelocityChartY.Size = new System.Drawing.Size(698, 307);
this.VelocityChartY.TabIndex = 32;
this.VelocityChartY.Text = "chart1";
//
@@ -598,7 +644,7 @@ namespace grapher
this.GainChartY.ChartAreas.Add(chartArea6);
legend6.Name = "Legend1";
this.GainChartY.Legends.Add(legend6);
- this.GainChartY.Location = new System.Drawing.Point(1062, 647);
+ this.GainChartY.Location = new System.Drawing.Point(1186, 647);
this.GainChartY.Name = "GainChartY";
series11.ChartArea = "ChartArea1";
series11.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
@@ -611,7 +657,7 @@ namespace grapher
series12.Name = "LastGainVal";
this.GainChartY.Series.Add(series11);
this.GainChartY.Series.Add(series12);
- this.GainChartY.Size = new System.Drawing.Size(723, 309);
+ this.GainChartY.Size = new System.Drawing.Size(698, 309);
this.GainChartY.TabIndex = 33;
this.GainChartY.Text = "chart1";
//
@@ -627,16 +673,16 @@ namespace grapher
// ActiveValueTitle
//
this.ActiveValueTitle.AutoSize = true;
- this.ActiveValueTitle.Location = new System.Drawing.Point(248, 30);
+ this.ActiveValueTitle.Location = new System.Drawing.Point(187, 30);
this.ActiveValueTitle.Name = "ActiveValueTitle";
- this.ActiveValueTitle.Size = new System.Drawing.Size(67, 13);
+ this.ActiveValueTitle.Size = new System.Drawing.Size(37, 13);
this.ActiveValueTitle.TabIndex = 35;
- this.ActiveValueTitle.Text = "Active Value";
+ this.ActiveValueTitle.Text = "Active";
//
// SensitivityActiveXLabel
//
this.SensitivityActiveXLabel.AutoSize = true;
- this.SensitivityActiveXLabel.Location = new System.Drawing.Point(258, 49);
+ this.SensitivityActiveXLabel.Location = new System.Drawing.Point(187, 49);
this.SensitivityActiveXLabel.Name = "SensitivityActiveXLabel";
this.SensitivityActiveXLabel.Size = new System.Drawing.Size(14, 13);
this.SensitivityActiveXLabel.TabIndex = 36;
@@ -645,7 +691,7 @@ namespace grapher
// SensitivityActiveYLabel
//
this.SensitivityActiveYLabel.AutoSize = true;
- this.SensitivityActiveYLabel.Location = new System.Drawing.Point(286, 50);
+ this.SensitivityActiveYLabel.Location = new System.Drawing.Point(216, 49);
this.SensitivityActiveYLabel.Name = "SensitivityActiveYLabel";
this.SensitivityActiveYLabel.Size = new System.Drawing.Size(14, 13);
this.SensitivityActiveYLabel.TabIndex = 37;
@@ -654,34 +700,34 @@ namespace grapher
// RotationActiveLabel
//
this.RotationActiveLabel.AutoSize = true;
- this.RotationActiveLabel.Location = new System.Drawing.Point(268, 75);
+ this.RotationActiveLabel.Location = new System.Drawing.Point(196, 75);
this.RotationActiveLabel.Name = "RotationActiveLabel";
this.RotationActiveLabel.Size = new System.Drawing.Size(13, 13);
this.RotationActiveLabel.TabIndex = 38;
this.RotationActiveLabel.Text = "0";
//
- // AccelTypeActiveLabel
+ // AccelTypeActiveLabelX
//
- this.AccelTypeActiveLabel.AutoSize = true;
- this.AccelTypeActiveLabel.Location = new System.Drawing.Point(258, 98);
- this.AccelTypeActiveLabel.Name = "AccelTypeActiveLabel";
- this.AccelTypeActiveLabel.Size = new System.Drawing.Size(41, 13);
- this.AccelTypeActiveLabel.TabIndex = 39;
- this.AccelTypeActiveLabel.Text = "Default";
+ this.AccelTypeActiveLabelX.AutoSize = true;
+ this.AccelTypeActiveLabelX.Location = new System.Drawing.Point(196, 113);
+ this.AccelTypeActiveLabelX.Name = "AccelTypeActiveLabelX";
+ this.AccelTypeActiveLabelX.Size = new System.Drawing.Size(66, 13);
+ this.AccelTypeActiveLabelX.TabIndex = 39;
+ this.AccelTypeActiveLabelX.Text = "SigmoidGain";
//
- // AccelerationActiveLabel
+ // AccelerationActiveLabelX
//
- this.AccelerationActiveLabel.AutoSize = true;
- this.AccelerationActiveLabel.Location = new System.Drawing.Point(268, 128);
- this.AccelerationActiveLabel.Name = "AccelerationActiveLabel";
- this.AccelerationActiveLabel.Size = new System.Drawing.Size(13, 13);
- this.AccelerationActiveLabel.TabIndex = 40;
- this.AccelerationActiveLabel.Text = "0";
+ this.AccelerationActiveLabelX.AutoSize = true;
+ this.AccelerationActiveLabelX.Location = new System.Drawing.Point(196, 140);
+ this.AccelerationActiveLabelX.Name = "AccelerationActiveLabelX";
+ this.AccelerationActiveLabelX.Size = new System.Drawing.Size(13, 13);
+ this.AccelerationActiveLabelX.TabIndex = 40;
+ this.AccelerationActiveLabelX.Text = "0";
//
// CapActiveXLabel
//
this.CapActiveXLabel.AutoSize = true;
- this.CapActiveXLabel.Location = new System.Drawing.Point(259, 151);
+ this.CapActiveXLabel.Location = new System.Drawing.Point(196, 166);
this.CapActiveXLabel.Name = "CapActiveXLabel";
this.CapActiveXLabel.Size = new System.Drawing.Size(13, 13);
this.CapActiveXLabel.TabIndex = 41;
@@ -690,7 +736,7 @@ namespace grapher
// WeightActiveXLabel
//
this.WeightActiveXLabel.AutoSize = true;
- this.WeightActiveXLabel.Location = new System.Drawing.Point(259, 180);
+ this.WeightActiveXLabel.Location = new System.Drawing.Point(196, 192);
this.WeightActiveXLabel.Name = "WeightActiveXLabel";
this.WeightActiveXLabel.Size = new System.Drawing.Size(13, 13);
this.WeightActiveXLabel.TabIndex = 42;
@@ -699,7 +745,7 @@ namespace grapher
// WeightActiveYLabel
//
this.WeightActiveYLabel.AutoSize = true;
- this.WeightActiveYLabel.Location = new System.Drawing.Point(286, 180);
+ this.WeightActiveYLabel.Location = new System.Drawing.Point(413, 192);
this.WeightActiveYLabel.Name = "WeightActiveYLabel";
this.WeightActiveYLabel.Size = new System.Drawing.Size(13, 13);
this.WeightActiveYLabel.TabIndex = 43;
@@ -708,74 +754,256 @@ namespace grapher
// CapActiveYLabel
//
this.CapActiveYLabel.AutoSize = true;
- this.CapActiveYLabel.Location = new System.Drawing.Point(286, 151);
+ this.CapActiveYLabel.Location = new System.Drawing.Point(413, 166);
this.CapActiveYLabel.Name = "CapActiveYLabel";
this.CapActiveYLabel.Size = new System.Drawing.Size(13, 13);
this.CapActiveYLabel.TabIndex = 44;
this.CapActiveYLabel.Text = "0";
//
- // OffsetActiveLabel
- //
- this.OffsetActiveLabel.AutoSize = true;
- this.OffsetActiveLabel.Location = new System.Drawing.Point(268, 206);
- this.OffsetActiveLabel.Name = "OffsetActiveLabel";
- this.OffsetActiveLabel.Size = new System.Drawing.Size(13, 13);
- this.OffsetActiveLabel.TabIndex = 45;
- this.OffsetActiveLabel.Text = "0";
- //
- // LimitExpActiveLabel
+ // OffsetActiveXLabel
//
- this.LimitExpActiveLabel.AutoSize = true;
- this.LimitExpActiveLabel.Location = new System.Drawing.Point(268, 232);
- this.LimitExpActiveLabel.Name = "LimitExpActiveLabel";
- this.LimitExpActiveLabel.Size = new System.Drawing.Size(13, 13);
- this.LimitExpActiveLabel.TabIndex = 46;
- this.LimitExpActiveLabel.Text = "0";
- //
- // MidpointActiveLabel
- //
- this.MidpointActiveLabel.AutoSize = true;
- this.MidpointActiveLabel.Location = new System.Drawing.Point(268, 255);
- this.MidpointActiveLabel.Name = "MidpointActiveLabel";
- this.MidpointActiveLabel.Size = new System.Drawing.Size(13, 13);
- this.MidpointActiveLabel.TabIndex = 47;
- this.MidpointActiveLabel.Text = "0";
- //
- // offsetStyleToolStripMenuItem
- //
- this.offsetStyleToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.gainOffsetToolStripMenuItem,
- this.legacyOffsetToolStripMenuItem});
- this.offsetStyleToolStripMenuItem.Name = "offsetStyleToolStripMenuItem";
- this.offsetStyleToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.offsetStyleToolStripMenuItem.Text = "Offset Style";
- //
- // gainOffsetToolStripMenuItem
- //
- this.gainOffsetToolStripMenuItem.Name = "gainOffsetToolStripMenuItem";
- this.gainOffsetToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.gainOffsetToolStripMenuItem.Text = "Gain (Default)";
- //
- // legacyOffsetToolStripMenuItem
- //
- this.legacyOffsetToolStripMenuItem.Name = "legacyOffsetToolStripMenuItem";
- this.legacyOffsetToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.legacyOffsetToolStripMenuItem.Text = "Legacy";
+ this.OffsetActiveXLabel.AutoSize = true;
+ this.OffsetActiveXLabel.Location = new System.Drawing.Point(196, 218);
+ this.OffsetActiveXLabel.Name = "OffsetActiveXLabel";
+ this.OffsetActiveXLabel.Size = new System.Drawing.Size(13, 13);
+ this.OffsetActiveXLabel.TabIndex = 45;
+ this.OffsetActiveXLabel.Text = "0";
+ //
+ // LimitExpActiveXLabel
+ //
+ this.LimitExpActiveXLabel.AutoSize = true;
+ this.LimitExpActiveXLabel.Location = new System.Drawing.Point(196, 244);
+ this.LimitExpActiveXLabel.Name = "LimitExpActiveXLabel";
+ this.LimitExpActiveXLabel.Size = new System.Drawing.Size(13, 13);
+ this.LimitExpActiveXLabel.TabIndex = 46;
+ this.LimitExpActiveXLabel.Text = "0";
+ //
+ // MidpointActiveXLabel
+ //
+ this.MidpointActiveXLabel.AutoSize = true;
+ this.MidpointActiveXLabel.Location = new System.Drawing.Point(196, 270);
+ this.MidpointActiveXLabel.Name = "MidpointActiveXLabel";
+ this.MidpointActiveXLabel.Size = new System.Drawing.Size(13, 13);
+ this.MidpointActiveXLabel.TabIndex = 47;
+ this.MidpointActiveXLabel.Text = "0";
+ //
+ // accelerationBoxY
+ //
+ this.accelerationBoxY.Location = new System.Drawing.Point(331, 137);
+ this.accelerationBoxY.Name = "accelerationBoxY";
+ this.accelerationBoxY.Size = new System.Drawing.Size(76, 20);
+ this.accelerationBoxY.TabIndex = 48;
+ //
+ // offsetBoxY
+ //
+ this.offsetBoxY.Location = new System.Drawing.Point(331, 215);
+ this.offsetBoxY.Name = "offsetBoxY";
+ this.offsetBoxY.Size = new System.Drawing.Size(76, 20);
+ this.offsetBoxY.TabIndex = 49;
+ //
+ // limitBoxY
+ //
+ this.limitBoxY.Location = new System.Drawing.Point(331, 241);
+ this.limitBoxY.Name = "limitBoxY";
+ this.limitBoxY.Size = new System.Drawing.Size(76, 20);
+ this.limitBoxY.TabIndex = 50;
+ //
+ // midpointBoxY
+ //
+ this.midpointBoxY.Location = new System.Drawing.Point(331, 267);
+ this.midpointBoxY.Name = "midpointBoxY";
+ this.midpointBoxY.Size = new System.Drawing.Size(76, 20);
+ this.midpointBoxY.TabIndex = 51;
+ //
+ // accelTypeDropY
+ //
+ this.accelTypeDropY.FormattingEnabled = true;
+ this.accelTypeDropY.Location = new System.Drawing.Point(331, 110);
+ this.accelTypeDropY.Name = "accelTypeDropY";
+ this.accelTypeDropY.Size = new System.Drawing.Size(76, 21);
+ this.accelTypeDropY.TabIndex = 52;
+ this.accelTypeDropY.Text = "Accel Type";
+ //
+ // AccelerationActiveLabelY
+ //
+ this.AccelerationActiveLabelY.AutoSize = true;
+ this.AccelerationActiveLabelY.Location = new System.Drawing.Point(413, 140);
+ this.AccelerationActiveLabelY.Name = "AccelerationActiveLabelY";
+ this.AccelerationActiveLabelY.Size = new System.Drawing.Size(13, 13);
+ this.AccelerationActiveLabelY.TabIndex = 53;
+ this.AccelerationActiveLabelY.Text = "0";
+ //
+ // OffsetActiveYLabel
+ //
+ this.OffsetActiveYLabel.AutoSize = true;
+ this.OffsetActiveYLabel.Location = new System.Drawing.Point(413, 218);
+ this.OffsetActiveYLabel.Name = "OffsetActiveYLabel";
+ this.OffsetActiveYLabel.Size = new System.Drawing.Size(13, 13);
+ this.OffsetActiveYLabel.TabIndex = 54;
+ this.OffsetActiveYLabel.Text = "0";
+ //
+ // LimitExpActiveYLabel
+ //
+ this.LimitExpActiveYLabel.AutoSize = true;
+ this.LimitExpActiveYLabel.Location = new System.Drawing.Point(413, 244);
+ this.LimitExpActiveYLabel.Name = "LimitExpActiveYLabel";
+ this.LimitExpActiveYLabel.Size = new System.Drawing.Size(13, 13);
+ this.LimitExpActiveYLabel.TabIndex = 55;
+ this.LimitExpActiveYLabel.Text = "0";
+ //
+ // MidpointActiveYLabel
+ //
+ this.MidpointActiveYLabel.AutoSize = true;
+ this.MidpointActiveYLabel.Location = new System.Drawing.Point(413, 270);
+ this.MidpointActiveYLabel.Name = "MidpointActiveYLabel";
+ this.MidpointActiveYLabel.Size = new System.Drawing.Size(13, 13);
+ this.MidpointActiveYLabel.TabIndex = 56;
+ this.MidpointActiveYLabel.Text = "0";
+ //
+ // ByComponentXYLock
+ //
+ this.ByComponentXYLock.AutoSize = true;
+ this.ByComponentXYLock.Checked = true;
+ this.ByComponentXYLock.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.ByComponentXYLock.Location = new System.Drawing.Point(282, 93);
+ this.ByComponentXYLock.Name = "ByComponentXYLock";
+ this.ByComponentXYLock.Size = new System.Drawing.Size(15, 14);
+ this.ByComponentXYLock.TabIndex = 57;
+ this.ByComponentXYLock.UseVisualStyleBackColor = true;
+ //
+ // constantOneLabelY
+ //
+ this.constantOneLabelY.AutoSize = true;
+ this.constantOneLabelY.Location = new System.Drawing.Point(258, 140);
+ this.constantOneLabelY.Name = "constantOneLabelY";
+ this.constantOneLabelY.Size = new System.Drawing.Size(66, 13);
+ this.constantOneLabelY.TabIndex = 58;
+ this.constantOneLabelY.Text = "Acceleration";
+ //
+ // capLabelY
+ //
+ this.capLabelY.AutoSize = true;
+ this.capLabelY.Location = new System.Drawing.Point(279, 166);
+ this.capLabelY.Name = "capLabelY";
+ this.capLabelY.Size = new System.Drawing.Size(26, 13);
+ this.capLabelY.TabIndex = 59;
+ this.capLabelY.Text = "Cap";
+ //
+ // weightLabelY
+ //
+ this.weightLabelY.AutoSize = true;
+ this.weightLabelY.Location = new System.Drawing.Point(264, 192);
+ this.weightLabelY.Name = "weightLabelY";
+ this.weightLabelY.Size = new System.Drawing.Size(41, 13);
+ this.weightLabelY.TabIndex = 60;
+ this.weightLabelY.Text = "Weight";
+ //
+ // offsetLabelY
+ //
+ this.offsetLabelY.AutoSize = true;
+ this.offsetLabelY.Location = new System.Drawing.Point(270, 218);
+ this.offsetLabelY.Name = "offsetLabelY";
+ this.offsetLabelY.Size = new System.Drawing.Size(35, 13);
+ this.offsetLabelY.TabIndex = 61;
+ this.offsetLabelY.Text = "Offset";
+ //
+ // constantTwoLabelY
+ //
+ this.constantTwoLabelY.AutoSize = true;
+ this.constantTwoLabelY.Location = new System.Drawing.Point(264, 244);
+ this.constantTwoLabelY.Name = "constantTwoLabelY";
+ this.constantTwoLabelY.Size = new System.Drawing.Size(51, 13);
+ this.constantTwoLabelY.TabIndex = 62;
+ this.constantTwoLabelY.Text = "Limit/Exp";
+ //
+ // constantThreeLabelY
+ //
+ this.constantThreeLabelY.AutoSize = true;
+ this.constantThreeLabelY.Location = new System.Drawing.Point(264, 270);
+ this.constantThreeLabelY.Name = "constantThreeLabelY";
+ this.constantThreeLabelY.Size = new System.Drawing.Size(47, 13);
+ this.constantThreeLabelY.TabIndex = 63;
+ this.constantThreeLabelY.Text = "Midpoint";
+ //
+ // OptionSetXTitle
+ //
+ this.OptionSetXTitle.AutoSize = true;
+ this.OptionSetXTitle.Location = new System.Drawing.Point(142, 94);
+ this.OptionSetXTitle.Name = "OptionSetXTitle";
+ this.OptionSetXTitle.Size = new System.Drawing.Size(14, 13);
+ this.OptionSetXTitle.TabIndex = 64;
+ this.OptionSetXTitle.Text = "X";
+ //
+ // OptionSetYTitle
+ //
+ this.OptionSetYTitle.AutoSize = true;
+ this.OptionSetYTitle.Location = new System.Drawing.Point(359, 94);
+ this.OptionSetYTitle.Name = "OptionSetYTitle";
+ this.OptionSetYTitle.Size = new System.Drawing.Size(14, 13);
+ this.OptionSetYTitle.TabIndex = 65;
+ this.OptionSetYTitle.Text = "Y";
+ //
+ // AccelTypeActiveLabelY
+ //
+ this.AccelTypeActiveLabelY.AutoSize = true;
+ this.AccelTypeActiveLabelY.Location = new System.Drawing.Point(413, 113);
+ this.AccelTypeActiveLabelY.Name = "AccelTypeActiveLabelY";
+ this.AccelTypeActiveLabelY.Size = new System.Drawing.Size(66, 13);
+ this.AccelTypeActiveLabelY.TabIndex = 66;
+ this.AccelTypeActiveLabelY.Text = "SigmoidGain";
+ //
+ // ActiveValueTitleY
+ //
+ this.ActiveValueTitleY.AutoSize = true;
+ this.ActiveValueTitleY.Location = new System.Drawing.Point(428, 30);
+ this.ActiveValueTitleY.Name = "ActiveValueTitleY";
+ this.ActiveValueTitleY.Size = new System.Drawing.Size(37, 13);
+ this.ActiveValueTitleY.TabIndex = 67;
+ this.ActiveValueTitleY.Text = "Active";
+ //
+ // showLastMouseMoveToolStripMenuItem
+ //
+ this.showLastMouseMoveToolStripMenuItem.Checked = true;
+ this.showLastMouseMoveToolStripMenuItem.CheckOnClick = true;
+ this.showLastMouseMoveToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.showLastMouseMoveToolStripMenuItem.Name = "showLastMouseMoveToolStripMenuItem";
+ this.showLastMouseMoveToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
+ this.showLastMouseMoveToolStripMenuItem.Text = "Show Last Mouse Move";
//
// RawAcceleration
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1786, 958);
- this.Controls.Add(this.MidpointActiveLabel);
- this.Controls.Add(this.LimitExpActiveLabel);
- this.Controls.Add(this.OffsetActiveLabel);
+ this.ClientSize = new System.Drawing.Size(1884, 956);
+ this.Controls.Add(this.ActiveValueTitleY);
+ this.Controls.Add(this.AccelTypeActiveLabelY);
+ this.Controls.Add(this.OptionSetYTitle);
+ this.Controls.Add(this.OptionSetXTitle);
+ this.Controls.Add(this.constantThreeLabelY);
+ this.Controls.Add(this.constantTwoLabelY);
+ this.Controls.Add(this.offsetLabelY);
+ this.Controls.Add(this.weightLabelY);
+ this.Controls.Add(this.capLabelY);
+ this.Controls.Add(this.constantOneLabelY);
+ this.Controls.Add(this.ByComponentXYLock);
+ this.Controls.Add(this.MidpointActiveYLabel);
+ this.Controls.Add(this.LimitExpActiveYLabel);
+ this.Controls.Add(this.OffsetActiveYLabel);
+ this.Controls.Add(this.AccelerationActiveLabelY);
+ this.Controls.Add(this.accelTypeDropY);
+ this.Controls.Add(this.midpointBoxY);
+ this.Controls.Add(this.limitBoxY);
+ this.Controls.Add(this.offsetBoxY);
+ this.Controls.Add(this.accelerationBoxY);
+ this.Controls.Add(this.MidpointActiveXLabel);
+ this.Controls.Add(this.LimitExpActiveXLabel);
+ this.Controls.Add(this.OffsetActiveXLabel);
this.Controls.Add(this.CapActiveYLabel);
this.Controls.Add(this.WeightActiveYLabel);
this.Controls.Add(this.WeightActiveXLabel);
this.Controls.Add(this.CapActiveXLabel);
- this.Controls.Add(this.AccelerationActiveLabel);
- this.Controls.Add(this.AccelTypeActiveLabel);
+ this.Controls.Add(this.AccelerationActiveLabelX);
+ this.Controls.Add(this.AccelTypeActiveLabelX);
this.Controls.Add(this.RotationActiveLabel);
this.Controls.Add(this.SensitivityActiveYLabel);
this.Controls.Add(this.SensitivityActiveXLabel);
@@ -787,30 +1015,28 @@ namespace grapher
this.Controls.Add(this.GainChart);
this.Controls.Add(this.VelocityChart);
this.Controls.Add(this.LockXYLabel);
- this.Controls.Add(this.weightXYLock);
- this.Controls.Add(this.capXYLock);
this.Controls.Add(this.sensXYLock);
this.Controls.Add(this.capBoxY);
this.Controls.Add(this.sensitivityBoxY);
this.Controls.Add(this.writeButton);
- this.Controls.Add(this.offsetLabel);
- this.Controls.Add(this.offsetBox);
- this.Controls.Add(this.constantThreeLabel);
- this.Controls.Add(this.midpointBox);
- this.Controls.Add(this.constantTwoLabel);
- this.Controls.Add(this.limitBox);
- this.Controls.Add(this.weightBoxSecond);
- this.Controls.Add(this.weightLabel);
- this.Controls.Add(this.weightBoxFirst);
- this.Controls.Add(this.capLabel);
+ this.Controls.Add(this.offsetLabelX);
+ this.Controls.Add(this.offsetBoxX);
+ this.Controls.Add(this.constantThreeLabelX);
+ this.Controls.Add(this.midpointBoxX);
+ this.Controls.Add(this.constantTwoLabelX);
+ this.Controls.Add(this.limitBoxX);
+ this.Controls.Add(this.weightBoxY);
+ this.Controls.Add(this.weightLabelX);
+ this.Controls.Add(this.weightBoxX);
+ this.Controls.Add(this.capLabelX);
this.Controls.Add(this.capBoxX);
- this.Controls.Add(this.constantOneLabel);
- this.Controls.Add(this.accelerationBox);
+ this.Controls.Add(this.constantOneLabelX);
+ this.Controls.Add(this.accelerationBoxX);
this.Controls.Add(this.rotationLabel);
this.Controls.Add(this.rotationBox);
this.Controls.Add(this.sensitivityLabel);
this.Controls.Add(this.sensitivityBoxX);
- this.Controls.Add(this.accelTypeDrop);
+ this.Controls.Add(this.accelTypeDropX);
this.Controls.Add(this.AccelerationChart);
this.Controls.Add(this.menuStrip1);
this.Name = "RawAcceleration";
@@ -833,30 +1059,28 @@ namespace grapher
#endregion
private System.Windows.Forms.DataVisualization.Charting.Chart AccelerationChart;
- private System.Windows.Forms.ComboBox accelTypeDrop;
+ private System.Windows.Forms.ComboBox accelTypeDropX;
private System.Windows.Forms.TextBox sensitivityBoxX;
private System.Windows.Forms.Label sensitivityLabel;
private System.Windows.Forms.TextBox rotationBox;
private System.Windows.Forms.Label rotationLabel;
- private System.Windows.Forms.TextBox accelerationBox;
- private System.Windows.Forms.Label constantOneLabel;
+ private System.Windows.Forms.TextBox accelerationBoxX;
+ private System.Windows.Forms.Label constantOneLabelX;
private System.Windows.Forms.TextBox capBoxX;
- private System.Windows.Forms.Label capLabel;
- private System.Windows.Forms.TextBox weightBoxFirst;
- private System.Windows.Forms.Label weightLabel;
- private System.Windows.Forms.TextBox weightBoxSecond;
- private System.Windows.Forms.TextBox limitBox;
- private System.Windows.Forms.Label constantTwoLabel;
- private System.Windows.Forms.TextBox midpointBox;
- private System.Windows.Forms.Label constantThreeLabel;
- private System.Windows.Forms.TextBox offsetBox;
- private System.Windows.Forms.Label offsetLabel;
+ private System.Windows.Forms.Label capLabelX;
+ private System.Windows.Forms.TextBox weightBoxX;
+ private System.Windows.Forms.Label weightLabelX;
+ private System.Windows.Forms.TextBox weightBoxY;
+ private System.Windows.Forms.TextBox limitBoxX;
+ private System.Windows.Forms.Label constantTwoLabelX;
+ private System.Windows.Forms.TextBox midpointBoxX;
+ private System.Windows.Forms.Label constantThreeLabelX;
+ private System.Windows.Forms.TextBox offsetBoxX;
+ private System.Windows.Forms.Label offsetLabelX;
private System.Windows.Forms.Button writeButton;
private System.Windows.Forms.TextBox sensitivityBoxY;
private System.Windows.Forms.TextBox capBoxY;
private System.Windows.Forms.CheckBox sensXYLock;
- private System.Windows.Forms.CheckBox capXYLock;
- private System.Windows.Forms.CheckBox weightXYLock;
private System.Windows.Forms.Label LockXYLabel;
private System.Windows.Forms.DataVisualization.Charting.Chart VelocityChart;
private System.Windows.Forms.DataVisualization.Charting.Chart GainChart;
@@ -881,20 +1105,44 @@ namespace grapher
private System.Windows.Forms.Label SensitivityActiveXLabel;
private System.Windows.Forms.Label SensitivityActiveYLabel;
private System.Windows.Forms.Label RotationActiveLabel;
- private System.Windows.Forms.Label AccelTypeActiveLabel;
- private System.Windows.Forms.Label AccelerationActiveLabel;
+ private System.Windows.Forms.Label AccelTypeActiveLabelX;
+ private System.Windows.Forms.Label AccelerationActiveLabelX;
private System.Windows.Forms.Label CapActiveXLabel;
private System.Windows.Forms.Label WeightActiveXLabel;
private System.Windows.Forms.Label WeightActiveYLabel;
private System.Windows.Forms.Label CapActiveYLabel;
- private System.Windows.Forms.Label OffsetActiveLabel;
- private System.Windows.Forms.Label LimitExpActiveLabel;
- private System.Windows.Forms.Label MidpointActiveLabel;
+ private System.Windows.Forms.Label OffsetActiveXLabel;
+ private System.Windows.Forms.Label LimitExpActiveXLabel;
+ private System.Windows.Forms.Label MidpointActiveXLabel;
private System.Windows.Forms.ToolStripMenuItem startupToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem AutoWriteMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem wholeVectorToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem byVectorComponentToolStripMenuItem;
+ private System.Windows.Forms.TextBox accelerationBoxY;
+ private System.Windows.Forms.TextBox offsetBoxY;
+ private System.Windows.Forms.TextBox limitBoxY;
+ private System.Windows.Forms.TextBox midpointBoxY;
+ private System.Windows.Forms.ComboBox accelTypeDropY;
+ private System.Windows.Forms.Label AccelerationActiveLabelY;
+ private System.Windows.Forms.Label OffsetActiveYLabel;
+ private System.Windows.Forms.Label LimitExpActiveYLabel;
+ private System.Windows.Forms.Label MidpointActiveYLabel;
+ private System.Windows.Forms.CheckBox ByComponentXYLock;
+ private System.Windows.Forms.Label constantOneLabelY;
+ private System.Windows.Forms.Label capLabelY;
+ private System.Windows.Forms.Label weightLabelY;
+ private System.Windows.Forms.Label offsetLabelY;
+ private System.Windows.Forms.Label constantTwoLabelY;
+ private System.Windows.Forms.Label constantThreeLabelY;
+ private System.Windows.Forms.Label OptionSetXTitle;
+ private System.Windows.Forms.Label OptionSetYTitle;
+ private System.Windows.Forms.Label AccelTypeActiveLabelY;
private System.Windows.Forms.ToolStripMenuItem offsetStyleToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem gainOffsetToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem legacyOffsetToolStripMenuItem;
+ private System.Windows.Forms.Label ActiveValueTitleY;
+ private System.Windows.Forms.ToolStripMenuItem showLastMouseMoveToolStripMenuItem;
}
}
diff --git a/grapher/Form1.cs b/grapher/Form1.cs
index ba0730c..103f239 100644
--- a/grapher/Form1.cs
+++ b/grapher/Form1.cs
@@ -12,6 +12,7 @@ using System.Runtime.InteropServices;
using grapher.Models.Calculations;
using grapher.Models.Options;
using grapher.Models.Serialized;
+using grapher.Models;
namespace grapher
{
@@ -36,146 +37,84 @@ namespace grapher
throw;
}
- var accelCharts = new AccelCharts(
- this,
- new ChartXY(AccelerationChart, AccelerationChartY),
- new ChartXY(VelocityChart, VelocityChartY),
- new ChartXY(GainChart, GainChartY),
- showVelocityGainToolStripMenuItem,
- new CheckBox[] { sensXYLock, weightXYLock, capXYLock });
-
- ActiveValueTitle.AutoSize = false;
- ActiveValueTitle.Left = LockXYLabel.Left + LockXYLabel.Width;
- ActiveValueTitle.Width = AccelerationChart.Left - ActiveValueTitle.Left;
- ActiveValueTitle.TextAlign = ContentAlignment.MiddleCenter;
-
- var sensitivity = new OptionXY(
+ AccelGUI = AccelGUIFactory.Construct(
+ this,
+ activeAccel,
+ AccelerationChart,
+ AccelerationChartY,
+ VelocityChart,
+ VelocityChartY,
+ GainChart,
+ GainChartY,
+ accelTypeDropX,
+ accelTypeDropY,
+ writeButton,
+ showVelocityGainToolStripMenuItem,
+ showLastMouseMoveToolStripMenuItem,
+ wholeVectorToolStripMenuItem,
+ byVectorComponentToolStripMenuItem,
+ gainCapToolStripMenuItem,
+ legacyCapToolStripMenuItem,
+ gainOffsetToolStripMenuItem,
+ legacyOffsetToolStripMenuItem,
+ AutoWriteMenuItem,
+ scaleByDPIToolStripMenuItem,
+ DPITextBox,
+ PollRateTextBox,
sensitivityBoxX,
sensitivityBoxY,
- sensXYLock,
- this,
- 1,
- sensitivityLabel,
- new ActiveValueLabelXY(
- new ActiveValueLabel(SensitivityActiveXLabel, ActiveValueTitle),
- new ActiveValueLabel(SensitivityActiveYLabel, ActiveValueTitle)),
- "Sensitivity",
- accelCharts);
-
- var rotation = new Option(
rotationBox,
- this,
- 0,
- rotationLabel,
- new ActiveValueLabel(RotationActiveLabel, ActiveValueTitle),
- "Rotation");
-
- var weight = new OptionXY(
- weightBoxFirst,
- weightBoxSecond,
- weightXYLock,
- this,
- 1,
- weightLabel,
- new ActiveValueLabelXY(
- new ActiveValueLabel(WeightActiveXLabel, ActiveValueTitle),
- new ActiveValueLabel(WeightActiveYLabel, ActiveValueTitle)),
- "Weight",
- accelCharts);
-
- var cap = new OptionXY(
+ weightBoxX,
+ weightBoxY,
capBoxX,
capBoxY,
- capXYLock,
- this,
- 0,
- capLabel,
- new ActiveValueLabelXY(
- new ActiveValueLabel(CapActiveXLabel, ActiveValueTitle),
- new ActiveValueLabel(CapActiveYLabel, ActiveValueTitle)),
- "Cap",
- accelCharts);
-
- var offset = new Option(
- offsetBox,
- this,
- 0,
- offsetLabel,
- new ActiveValueLabel(OffsetActiveLabel, ActiveValueTitle),
- "Offset");
-
- var offsetOptions = new OffsetOptions(
- gainOffsetToolStripMenuItem,
- legacyOffsetToolStripMenuItem,
- offset);
-
- // The name and layout of these options is handled by AccelerationOptions object.
- var acceleration = new Option(
- new Field(accelerationBox, this, 0),
- constantOneLabel,
- new ActiveValueLabel(AccelerationActiveLabel, ActiveValueTitle));
-
- var limitOrExponent = new Option(
- new Field(limitBox, this, 2),
- constantTwoLabel,
- new ActiveValueLabel(LimitExpActiveLabel, ActiveValueTitle));
-
- var midpoint = new Option(
- new Field(midpointBox, this, 0),
- constantThreeLabel,
- new ActiveValueLabel(MidpointActiveLabel, ActiveValueTitle));
-
- var accelerationOptions = new AccelOptions(
- accelTypeDrop,
- new Option[]
- {
- offset,
- acceleration,
- limitOrExponent,
- midpoint,
- },
- new OptionXY[]
- {
- weight,
- cap,
- },
- writeButton,
- new ActiveValueLabel(AccelTypeActiveLabel, ActiveValueTitle));
-
- var capOptions = new CapOptions(
- gainCapToolStripMenuItem,
- legacyCapToolStripMenuItem,
- cap,
- weight);
-
- var accelCalculator = new AccelCalculator(
- new Field(DPITextBox.TextBox, this, AccelCalculator.DefaultDPI),
- new Field(PollRateTextBox.TextBox, this, AccelCalculator.DefaultPollRate));
-
- var settings = new SettingsManager(
- activeAccel,
- accelCalculator.DPI,
- accelCalculator.PollRate,
- AutoWriteMenuItem);
-
- AccelGUI = new AccelGUI(
- this,
- accelCalculator,
- accelCharts,
- settings,
- accelerationOptions,
- sensitivity,
- rotation,
- weight,
- capOptions,
- offsetOptions,
- acceleration,
- limitOrExponent,
- midpoint,
- writeButton,
- MouseLabel,
- ScaleMenuItem,
- AutoWriteMenuItem);
+ offsetBoxX,
+ offsetBoxY,
+ accelerationBoxX,
+ accelerationBoxY,
+ limitBoxX,
+ limitBoxY,
+ midpointBoxX,
+ midpointBoxY,
+ sensXYLock,
+ ByComponentXYLock,
+ LockXYLabel,
+ sensitivityLabel,
+ rotationLabel,
+ weightLabelX,
+ weightLabelY,
+ capLabelX,
+ capLabelY,
+ offsetLabelX,
+ offsetLabelY,
+ constantOneLabelX,
+ constantOneLabelY,
+ constantTwoLabelX,
+ constantTwoLabelY,
+ constantThreeLabelX,
+ constantThreeLabelY,
+ ActiveValueTitle,
+ ActiveValueTitleY,
+ SensitivityActiveXLabel,
+ SensitivityActiveYLabel,
+ RotationActiveLabel,
+ WeightActiveXLabel,
+ WeightActiveYLabel,
+ CapActiveXLabel,
+ CapActiveYLabel,
+ OffsetActiveXLabel,
+ OffsetActiveYLabel,
+ AccelerationActiveLabelX,
+ AccelerationActiveLabelY,
+ LimitExpActiveXLabel,
+ LimitExpActiveYLabel,
+ MidpointActiveXLabel,
+ MidpointActiveYLabel,
+ AccelTypeActiveLabelX,
+ AccelTypeActiveLabelY,
+ OptionSetXTitle,
+ OptionSetYTitle,
+ MouseLabel);
}
#endregion Constructor
@@ -203,16 +142,11 @@ namespace grapher
}
- private void writeButton_Click(object sender, EventArgs e)
- {
- AccelGUI.UpdateActiveSettingsFromFields();
- }
-
- #endregion Methods
-
private void RawAcceleration_Paint(object sender, PaintEventArgs e)
{
- AccelGUI.AccelCharts.DrawPoints();
+ AccelGUI.AccelCharts.DrawLastMovement();
}
+
+ #endregion Method
}
}
diff --git a/grapher/Layouts/ClassicLayout.cs b/grapher/Layouts/ClassicLayout.cs
index 05f6c82..572566f 100644
--- a/grapher/Layouts/ClassicLayout.cs
+++ b/grapher/Layouts/ClassicLayout.cs
@@ -1,9 +1,4 @@
using grapher.Models.Serialized;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace grapher.Layouts
{
@@ -14,8 +9,13 @@ namespace grapher.Layouts
{
Name = "Classic";
Index = (int)AccelMode.classic;
- ShowOptions = new bool[] { true, true, true, false };
- OptionNames = new string[] { Offset, Acceleration, Exponent, string.Empty };
+
+ AccelLayout = new OptionLayout(true, Acceleration);
+ CapLayout = new OptionLayout(true, Cap);
+ WeightLayout = new OptionLayout(true, Weight);
+ OffsetLayout = new OptionLayout(true, Offset);
+ LimExpLayout = new OptionLayout(true, Exponent);
+ MidpointLayout = new OptionLayout(false, string.Empty);
}
}
}
diff --git a/grapher/Layouts/DefaultLayout.cs b/grapher/Layouts/DefaultLayout.cs
index 42841d5..83535c2 100644
--- a/grapher/Layouts/DefaultLayout.cs
+++ b/grapher/Layouts/DefaultLayout.cs
@@ -1,11 +1,4 @@
using grapher.Models.Serialized;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
namespace grapher.Layouts
{
@@ -16,9 +9,14 @@ namespace grapher.Layouts
{
Name = "Default";
Index = (int)AccelMode.noaccel;
- ShowOptions = new bool[] { true, true, true, true };
- OptionNames = new string[] { Offset, Acceleration, $"{Limit}\\{Exponent}", Midpoint };
ButtonEnabled = false;
+
+ AccelLayout = new OptionLayout(true, Acceleration);
+ CapLayout = new OptionLayout(true, Cap);
+ WeightLayout = new OptionLayout(true, Weight);
+ OffsetLayout = new OptionLayout(true, Offset);
+ LimExpLayout = new OptionLayout(true, $"{Limit}\\{Exponent}");
+ MidpointLayout = new OptionLayout(true, Midpoint);
}
}
}
diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs
index eed1716..6ed8fee 100644
--- a/grapher/Layouts/LayoutBase.cs
+++ b/grapher/Layouts/LayoutBase.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using grapher.Models.Options;
using System.Windows.Forms;
namespace grapher.Layouts
@@ -15,12 +11,18 @@ namespace grapher.Layouts
public const string Limit = "Limit";
public const string Midpoint = "Midpoint";
public const string Offset = "Offset";
+ public const string Cap = "Cap";
+ public const string Weight = "Weight";
public LayoutBase()
{
- ShowOptions = new bool[] { false, false, false, false };
- ShowOptionsXY = new bool[] { true, true };
- OptionNames = new string[] { string.Empty, string.Empty, string.Empty, string.Empty };
+ AccelLayout = new OptionLayout(false, string.Empty);
+ CapLayout = new OptionLayout(false, string.Empty);
+ WeightLayout = new OptionLayout(false, string.Empty);
+ OffsetLayout = new OptionLayout(false, string.Empty);
+ LimExpLayout = new OptionLayout(false, string.Empty);
+ MidpointLayout = new OptionLayout(false, string.Empty);
+
ButtonEnabled = true;
}
@@ -32,43 +34,75 @@ namespace grapher.Layouts
public string Name { get; internal set; }
- internal bool[] ShowOptions { get; set; }
+ protected bool ButtonEnabled { get; set; }
+
+ protected OptionLayout AccelLayout { get; set; }
+
+ protected OptionLayout CapLayout { get; set; }
- internal bool[] ShowOptionsXY { get; set; }
+ protected OptionLayout WeightLayout { get; set; }
- internal string[] OptionNames { get; set; }
+ protected OptionLayout OffsetLayout { get; set; }
- internal bool ButtonEnabled { get; set; }
+ protected OptionLayout LimExpLayout { get; set; }
- public void Layout(Option[] options, OptionXY[] optionsXY, Button button)
+ protected OptionLayout MidpointLayout { get; set; }
+
+ public void Layout(
+ IOption accelOption,
+ IOption capOption,
+ IOption weightOption,
+ IOption offsetOption,
+ IOption limExpOption,
+ IOption midpointOption,
+ Button button,
+ int top)
{
- // Relies on AccelOptions to keep lengths correct.
- for (int i = 0; i < options.Length; i++)
- {
- if (ShowOptions[i])
- {
- options[i].Show(OptionNames[i]);
- }
- else
- {
- options[i].Hide();
- }
- }
+ AccelLayout.Layout(accelOption);
+ CapLayout.Layout(capOption);
+ WeightLayout.Layout(weightOption);
+ OffsetLayout.Layout(offsetOption);
+ LimExpLayout.Layout(limExpOption);
+ MidpointLayout.Layout(midpointOption);
+
+ button.Enabled = ButtonEnabled;
- // Relies on AccelOptions to keep lengths correct.
- for (int i = 0; i< optionsXY.Length; i++)
+ IOption previous = null;
+ foreach (var option in new IOption[] { accelOption, capOption, weightOption, offsetOption, limExpOption, midpointOption})
{
- if (ShowOptionsXY[i])
- {
- optionsXY[i].Show();
- }
- else
+ if (option.Visible)
{
- optionsXY[i].Hide();
+ if (previous != null)
+ {
+ option.SnapTo(previous);
+ }
+ else
+ {
+ option.Top = top;
+ }
+
+ previous = option;
}
}
+ }
- button.Enabled = ButtonEnabled;
+ public void Layout(
+ IOption accelOption,
+ IOption capOption,
+ IOption weightOption,
+ IOption offsetOption,
+ IOption limExpOption,
+ IOption midpointOption,
+ Button button)
+ {
+ Layout(accelOption,
+ capOption,
+ weightOption,
+ offsetOption,
+ limExpOption,
+ midpointOption,
+ button,
+ accelOption.Top);
}
}
}
diff --git a/grapher/Layouts/LinearLayout.cs b/grapher/Layouts/LinearLayout.cs
index 0a79a64..fded8c7 100644
--- a/grapher/Layouts/LinearLayout.cs
+++ b/grapher/Layouts/LinearLayout.cs
@@ -1,9 +1,4 @@
using grapher.Models.Serialized;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace grapher.Layouts
{
@@ -14,8 +9,13 @@ namespace grapher.Layouts
{
Name = "Linear";
Index = (int)AccelMode.linear;
- ShowOptions = new bool[] { true, true, false, false };
- OptionNames = new string[] { Offset, Acceleration, string.Empty, string.Empty };
+
+ AccelLayout = new OptionLayout(true, Acceleration);
+ CapLayout = new OptionLayout(true, Cap);
+ WeightLayout = new OptionLayout(false, string.Empty);
+ OffsetLayout = new OptionLayout(true, Offset);
+ LimExpLayout = new OptionLayout(false, string.Empty);
+ MidpointLayout = new OptionLayout(false, string.Empty);
}
}
}
diff --git a/grapher/Layouts/LogLayout.cs b/grapher/Layouts/LogLayout.cs
deleted file mode 100644
index 1206fb3..0000000
--- a/grapher/Layouts/LogLayout.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using grapher.Models.Serialized;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace grapher.Layouts
-{
- public class LogLayout : LayoutBase
- {
- public LogLayout()
- : base()
- {
- Name = "Logarithmic";
- Index = (int)AccelMode.logarithmic;
- ShowOptions = new bool[] { true, true, false, false };
- OptionNames = new string[] { Offset, Acceleration, string.Empty, string.Empty };
- }
- }
-}
diff --git a/grapher/Layouts/NaturalGainLayout.cs b/grapher/Layouts/NaturalGainLayout.cs
index 9bb1ec8..b982b91 100644
--- a/grapher/Layouts/NaturalGainLayout.cs
+++ b/grapher/Layouts/NaturalGainLayout.cs
@@ -1,9 +1,4 @@
using grapher.Models.Serialized;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace grapher.Layouts
{
@@ -14,8 +9,13 @@ namespace grapher.Layouts
{
Name = "NaturalGain";
Index = (int)AccelMode.naturalgain;
- ShowOptions = new bool[] { true, true, true, false };
- OptionNames = new string[] { Offset, Acceleration, Limit, string.Empty };
+
+ AccelLayout = new OptionLayout(true, Acceleration);
+ CapLayout = new OptionLayout(false, string.Empty);
+ WeightLayout = new OptionLayout(false, string.Empty);
+ OffsetLayout = new OptionLayout(true, Offset);
+ LimExpLayout = new OptionLayout(true, Limit);
+ MidpointLayout = new OptionLayout(false, string.Empty);
}
}
}
diff --git a/grapher/Layouts/NaturalLayout.cs b/grapher/Layouts/NaturalLayout.cs
index 44c6c18..aa5c22c 100644
--- a/grapher/Layouts/NaturalLayout.cs
+++ b/grapher/Layouts/NaturalLayout.cs
@@ -1,9 +1,4 @@
using grapher.Models.Serialized;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace grapher.Layouts
{
@@ -14,8 +9,13 @@ namespace grapher.Layouts
{
Name = "Natural";
Index = (int)AccelMode.natural;
- ShowOptions = new bool[] { true, true, true, false };
- OptionNames = new string[] { Offset, Acceleration, Limit, string.Empty };
+
+ AccelLayout = new OptionLayout(true, Acceleration);
+ CapLayout = new OptionLayout(false, string.Empty);
+ WeightLayout = new OptionLayout(false, string.Empty);
+ OffsetLayout = new OptionLayout(true, Offset);
+ LimExpLayout = new OptionLayout(true, Limit);
+ MidpointLayout = new OptionLayout(false, string.Empty);
}
}
}
diff --git a/grapher/Layouts/OffLayout.cs b/grapher/Layouts/OffLayout.cs
index ce7c149..85c8d3f 100644
--- a/grapher/Layouts/OffLayout.cs
+++ b/grapher/Layouts/OffLayout.cs
@@ -1,9 +1,4 @@
using grapher.Models.Serialized;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace grapher.Layouts
{
@@ -14,10 +9,14 @@ namespace grapher.Layouts
{
Name = "Off";
Index = (int)AccelMode.noaccel;
- ShowOptions = new bool[] { false, false, false, false };
- OptionNames = new string[] { string.Empty, string.Empty, string.Empty, string.Empty };
- ShowOptionsXY = new bool[] { false, false };
ButtonEnabled = true;
+
+ AccelLayout = new OptionLayout(false, string.Empty);
+ CapLayout = new OptionLayout(false, string.Empty);
+ WeightLayout = new OptionLayout(false, string.Empty);
+ OffsetLayout = new OptionLayout(false, string.Empty);
+ LimExpLayout = new OptionLayout(false, string.Empty);
+ MidpointLayout = new OptionLayout(false, string.Empty);
}
}
}
diff --git a/grapher/Layouts/OptionLayout.cs b/grapher/Layouts/OptionLayout.cs
new file mode 100644
index 0000000..2f29706
--- /dev/null
+++ b/grapher/Layouts/OptionLayout.cs
@@ -0,0 +1,41 @@
+using grapher.Models.Options;
+
+namespace grapher.Layouts
+{
+ public class OptionLayout
+ {
+ #region Constructors
+
+ public OptionLayout(bool show, string name)
+ {
+ Show = show;
+ Name = name;
+ }
+
+ #endregion Constructors
+
+ #region Properties
+
+ private bool Show { get; }
+
+ private string Name { get; }
+
+ #endregion Properties
+
+ #region Methods
+
+ public void Layout(IOption option)
+ {
+ if (Show)
+ {
+ option.Show(Name);
+ }
+ else
+ {
+ option.Hide();
+ }
+ }
+
+ #endregion Methods
+ }
+}
diff --git a/grapher/Layouts/PowerLayout.cs b/grapher/Layouts/PowerLayout.cs
index c14083a..e0dcaf8 100644
--- a/grapher/Layouts/PowerLayout.cs
+++ b/grapher/Layouts/PowerLayout.cs
@@ -1,9 +1,4 @@
using grapher.Models.Serialized;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace grapher.Layouts
{
@@ -14,8 +9,13 @@ namespace grapher.Layouts
{
Name = "Power";
Index = (int)AccelMode.power;
- ShowOptions = new bool[] { true, true, true, false };
- OptionNames = new string[] { Offset, Scale, Exponent, string.Empty };
+
+ AccelLayout = new OptionLayout(true, Acceleration);
+ CapLayout = new OptionLayout(true, Cap);
+ WeightLayout = new OptionLayout(true, Weight);
+ OffsetLayout = new OptionLayout(true, Offset);
+ LimExpLayout = new OptionLayout(true, Limit);
+ MidpointLayout = new OptionLayout(false, string.Empty);
}
}
}
diff --git a/grapher/Layouts/SigmoidGainLayout.cs b/grapher/Layouts/SigmoidGainLayout.cs
index 93214ec..183e31f 100644
--- a/grapher/Layouts/SigmoidGainLayout.cs
+++ b/grapher/Layouts/SigmoidGainLayout.cs
@@ -1,9 +1,4 @@
using grapher.Models.Serialized;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace grapher.Layouts
{
@@ -14,8 +9,13 @@ namespace grapher.Layouts
{
Name = "SigmoidGain";
Index = (int)AccelMode.sigmoidgain;
- ShowOptions = new bool[] { true, true, true, true };
- OptionNames = new string[] { Offset, Acceleration, Limit, Midpoint };
+
+ AccelLayout = new OptionLayout(true, Acceleration);
+ CapLayout = new OptionLayout(false, string.Empty);
+ WeightLayout = new OptionLayout(false, string.Empty);
+ OffsetLayout = new OptionLayout(true, Offset);
+ LimExpLayout = new OptionLayout(true, Limit);
+ MidpointLayout = new OptionLayout(true, Midpoint);
}
}
}
diff --git a/grapher/Layouts/SigmoidLayout.cs b/grapher/Layouts/SigmoidLayout.cs
deleted file mode 100644
index 1c7f0b9..0000000
--- a/grapher/Layouts/SigmoidLayout.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using grapher.Models.Serialized;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace grapher.Layouts
-{
- public class SigmoidLayout : LayoutBase
- {
- public SigmoidLayout()
- : base()
- {
- Name = "Sigmoid";
- Index = (int)AccelMode.sigmoid;
- ShowOptions = new bool[] { true, true, true, true };
- OptionNames = new string[] { Offset, Acceleration, Limit, Midpoint };
- }
- }
-}
diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs
index a7d5d49..3acb943 100644
--- a/grapher/Models/AccelGUI.cs
+++ b/grapher/Models/AccelGUI.cs
@@ -3,67 +3,47 @@ using grapher.Models.Mouse;
using grapher.Models.Options;
using grapher.Models.Serialized;
using System;
-using System.CodeDom;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
-using System.Windows.Forms.DataVisualization.Charting;
namespace grapher
{
public class AccelGUI
{
- #region constructors
+ #region Constructors
public AccelGUI(
RawAcceleration accelForm,
AccelCalculator accelCalculator,
AccelCharts accelCharts,
SettingsManager settings,
- AccelOptions accelOptions,
- OptionXY sensitivity,
- Option rotation,
- OptionXY weight,
- CapOptions cap,
- OffsetOptions offset,
- Option acceleration,
- Option limtOrExp,
- Option midpoint,
+ ApplyOptions applyOptions,
Button writeButton,
Label mouseMoveLabel,
- ToolStripMenuItem scaleMenuItem,
- ToolStripMenuItem autoWriteMenuItem)
+ ToolStripMenuItem scaleMenuItem)
{
AccelForm = accelForm;
AccelCalculator = accelCalculator;
AccelCharts = accelCharts;
- AccelerationOptions = accelOptions;
- Sensitivity = sensitivity;
- Rotation = rotation;
- Weight = weight;
- Cap = cap;
- Offset = offset;
- Acceleration = acceleration;
- LimitOrExponent = limtOrExp;
- Midpoint = midpoint;
+ ApplyOptions = applyOptions;
WriteButton = writeButton;
ScaleMenuItem = scaleMenuItem;
Settings = settings;
Settings.Startup();
- UpdateGraph();
+ RefreshOnRead();
MouseWatcher = new MouseWatcher(AccelForm, mouseMoveLabel, AccelCharts);
ScaleMenuItem.Click += new System.EventHandler(OnScaleMenuItemClick);
+ WriteButton.Click += new System.EventHandler(OnWriteButtonClick);
+
+ ButtonTimer = SetupButtonTimer();
+ SetupWriteButton();
}
- #endregion constructors
+ #endregion Constructors
- #region properties
+ #region Properties
public RawAcceleration AccelForm { get; }
@@ -73,67 +53,33 @@ namespace grapher
public SettingsManager Settings { get; }
- public AccelOptions AccelerationOptions { get; }
-
- public OptionXY Sensitivity { get; }
-
- public Option Rotation { get; }
-
- public OptionXY Weight { get; }
-
- public CapOptions Cap { get; }
-
- public OffsetOptions Offset { get; }
-
- public Option Acceleration { get; }
-
- public Option LimitOrExponent { get; }
-
- public Option Midpoint { get; }
+ public ApplyOptions ApplyOptions { get; }
public Button WriteButton { get; }
+ public Timer ButtonTimer { get; }
+
public MouseWatcher MouseWatcher { get; }
public ToolStripMenuItem ScaleMenuItem { get; }
- #endregion properties
+ #endregion Properties
- #region methods
+ #region Methods
public void UpdateActiveSettingsFromFields()
{
var settings = new DriverSettings
{
- rotation = Rotation.Field.Data,
+ rotation = ApplyOptions.Rotation.Field.Data,
sensitivity = new Vec2<double>
{
- x = Sensitivity.Fields.X,
- y = Sensitivity.Fields.Y
- },
- combineMagnitudes = true,
- modes = new Vec2<AccelMode>
- {
- x = (AccelMode)AccelerationOptions.AccelerationIndex
- },
- args = new Vec2<AccelArgs>
- {
- x = new AccelArgs
- {
- offset = Offset.Offset,
- legacy_offset = Offset.LegacyOffset,
- weight = Weight.Fields.X,
- gainCap = Cap.VelocityGainCap,
- scaleCap = Cap.SensitivityCapX,
- accel = Acceleration.Field.Data,
- rate = Acceleration.Field.Data,
- powerScale = Acceleration.Field.Data,
- limit = LimitOrExponent.Field.Data,
- exponent = LimitOrExponent.Field.Data,
- powerExponent = LimitOrExponent.Field.Data,
- midpoint = Midpoint.Field.Data
- }
+ x = ApplyOptions.Sensitivity.Fields.X,
+ y = ApplyOptions.Sensitivity.Fields.Y
},
+ combineMagnitudes = ApplyOptions.IsWhole,
+ modes = ApplyOptions.GetModes(),
+ args = ApplyOptions.GetArgs(),
minimumTime = .4
};
@@ -141,10 +87,17 @@ namespace grapher
{
AccelForm.Invoke((MethodInvoker)delegate
{
+ WriteButtonDelay();
UpdateGraph();
});
});
-
+ RefreshOnRead();
+ }
+
+ public void RefreshOnRead()
+ {
+ UpdateGraph();
+ UpdateShownActiveValues();
}
public void UpdateGraph()
@@ -154,29 +107,66 @@ namespace grapher
Settings.ActiveAccel,
Settings.RawAccelSettings.AccelerationSettings);
AccelCharts.Bind();
- UpdateActiveValueLabels();
}
- public void UpdateActiveValueLabels()
+ public void UpdateShownActiveValues()
{
var settings = Settings.RawAccelSettings.AccelerationSettings;
-
- Sensitivity.SetActiveValues(settings.sensitivity.x, settings.sensitivity.y);
- Rotation.SetActiveValue(settings.rotation);
- AccelerationOptions.SetActiveValue((int)settings.modes.x);
- Offset.SetActiveValue(settings.args.x.offset, settings.args.y.offset);
- Weight.SetActiveValues(settings.args.x.weight, settings.args.x.weight);
- Acceleration.SetActiveValue(settings.args.x.accel); // rate, powerscale
- LimitOrExponent.SetActiveValue(settings.args.x.limit); //exp, powerexp
- Midpoint.SetActiveValue(settings.args.x.midpoint);
- //Cap.SetActiveValues(Settings.ActiveAccel.GainCap, Settings.ActiveAccel.CapX, Settings.ActiveAccel.CapY, Settings.ActiveAccel.GainCapEnabled);
+
+ AccelCharts.ShowActive(settings);
+ ApplyOptions.SetActiveValues(settings);
+ }
+
+ private Timer SetupButtonTimer()
+ {
+ Timer buttonTimer = new Timer();
+ buttonTimer.Enabled = true;
+ buttonTimer.Interval = Convert.ToInt32(ManagedAccel.WriteDelay);
+ buttonTimer.Tick += new System.EventHandler(OnButtonTimerTick);
+ return buttonTimer;
+ }
+
+ private void SetupWriteButton()
+ {
+ WriteButton.Top = AccelCharts.SensitivityChart.Top + AccelCharts.SensitivityChart.Height - Constants.WriteButtonVerticalOffset;
+ SetWriteButtonDefault();
+ }
+
+ private void SetWriteButtonDefault()
+ {
+ WriteButton.Text = Constants.WriteButtonDefaultText;
+ WriteButton.Enabled = true;
+ }
+
+ private void SetWriteButtonDelay()
+ {
+ WriteButton.Enabled = false;
+ WriteButton.Text = $"{Constants.WriteButtonDelayText} : {ButtonTimer.Interval} ms";
}
private void OnScaleMenuItemClick(object sender, EventArgs e)
{
UpdateGraph();
}
- #endregion methods
+
+ private void OnWriteButtonClick(object sender, EventArgs e)
+ {
+ UpdateActiveSettingsFromFields();
+ }
+
+ private void OnButtonTimerTick(object sender, EventArgs e)
+ {
+ ButtonTimer.Stop();
+ SetWriteButtonDefault();
+ }
+
+ private void WriteButtonDelay()
+ {
+ SetWriteButtonDelay();
+ ButtonTimer.Start();
+ }
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs
new file mode 100644
index 0000000..42a7b83
--- /dev/null
+++ b/grapher/Models/AccelGUIFactory.cs
@@ -0,0 +1,303 @@
+using grapher.Models.Calculations;
+using grapher.Models.Options;
+using grapher.Models.Serialized;
+using System.Windows.Forms;
+using System.Windows.Forms.DataVisualization.Charting;
+
+namespace grapher.Models
+{
+ public static class AccelGUIFactory
+ {
+ #region Methods
+
+ public static AccelGUI Construct(
+ RawAcceleration form,
+ ManagedAccel activeAccel,
+ Chart accelerationChart,
+ Chart accelerationChartY,
+ Chart velocityChart,
+ Chart velocityChartY,
+ Chart gainChart,
+ Chart gainChartY,
+ ComboBox accelTypeDropX,
+ ComboBox accelTypeDropY,
+ Button writeButton,
+ ToolStripMenuItem showVelocityGainToolStripMenuItem,
+ ToolStripMenuItem showLastMouseMoveMenuItem,
+ ToolStripMenuItem wholeVectorToolStripMenuItem,
+ ToolStripMenuItem byVectorComponentToolStripMenuItem,
+ ToolStripMenuItem velocityGainCapToolStripMenuItem,
+ ToolStripMenuItem legacyCapToolStripMenuItem,
+ ToolStripMenuItem gainOffsetToolStripMenuItem,
+ ToolStripMenuItem legacyOffsetToolStripMenuItem,
+ ToolStripMenuItem autoWriteMenuItem,
+ ToolStripMenuItem scaleMenuItem,
+ ToolStripTextBox dpiTextBox,
+ ToolStripTextBox pollRateTextBox,
+ TextBox sensitivityBoxX,
+ TextBox sensitivityBoxY,
+ TextBox rotationBox,
+ TextBox weightBoxX,
+ TextBox weightBoxY,
+ TextBox capBoxX,
+ TextBox capBoxY,
+ TextBox offsetBoxX,
+ TextBox offsetBoxY,
+ TextBox accelerationBoxX,
+ TextBox accelerationBoxY,
+ TextBox limitBoxX,
+ TextBox limitBoxY,
+ TextBox midpointBoxX,
+ TextBox midpointBoxY,
+ CheckBox sensXYLock,
+ CheckBox byComponentXYLock,
+ Label lockXYLabel,
+ Label sensitivityLabel,
+ Label rotationLabel,
+ Label weightLabelX,
+ Label weightLabelY,
+ Label capLabelX,
+ Label capLabelY,
+ Label offsetLabelX,
+ Label offsetLabelY,
+ Label constantOneLabelX,
+ Label constantOneLabelY,
+ Label constantTwoLabelX,
+ Label constantTwoLabelY,
+ Label constantThreeLabelX,
+ Label constantThreeLabelY,
+ Label activeValueTitleX,
+ Label activeValueTitleY,
+ Label sensitivityActiveXLabel,
+ Label sensitivityActiveYLabel,
+ Label rotationActiveLabel,
+ Label weightActiveXLabel,
+ Label weightActiveYLabel,
+ Label capActiveXLabel,
+ Label capActiveYLabel,
+ Label offsetActiveLabelX,
+ Label offsetActiveLabelY,
+ Label accelerationActiveLabelX,
+ Label accelerationActiveLabelY,
+ Label limitExpActiveLabelX,
+ Label limitExpActiveLabelY,
+ Label midpointActiveLabelX,
+ Label midpointActiveLabelY,
+ Label accelTypeActiveLabelX,
+ Label accelTypeActiveLabelY,
+ Label optionSetXTitle,
+ Label optionSetYTitle,
+ Label mouseLabel)
+ {
+ var accelCharts = new AccelCharts(
+ form,
+ new ChartXY(accelerationChart, accelerationChartY),
+ new ChartXY(velocityChart, velocityChartY),
+ new ChartXY(gainChart, gainChartY),
+ showVelocityGainToolStripMenuItem,
+ showLastMouseMoveMenuItem,
+ writeButton);
+
+ var sensitivity = new OptionXY(
+ sensitivityBoxX,
+ sensitivityBoxY,
+ sensXYLock,
+ form,
+ 1,
+ sensitivityLabel,
+ new ActiveValueLabelXY(
+ new ActiveValueLabel(sensitivityActiveXLabel, activeValueTitleX),
+ new ActiveValueLabel(sensitivityActiveYLabel, activeValueTitleX)),
+ "Sensitivity");
+
+ var rotation = new Option(
+ rotationBox,
+ form,
+ 0,
+ rotationLabel,
+ 0,
+ new ActiveValueLabel(rotationActiveLabel, activeValueTitleX),
+ "Rotation");
+
+ var optionSetYLeft = rotation.Left + rotation.Width;
+
+ var weightX = new Option(
+ weightBoxX,
+ form,
+ 1,
+ weightLabelX,
+ 0,
+ new ActiveValueLabel(weightActiveXLabel, activeValueTitleX),
+ "Weight");
+
+ var weightY = new Option(
+ weightBoxY,
+ form,
+ 1,
+ weightLabelY,
+ optionSetYLeft,
+ new ActiveValueLabel(weightActiveYLabel, activeValueTitleY),
+ "Weight");
+
+ var capX = new Option(
+ capBoxX,
+ form,
+ 0,
+ capLabelX,
+ 0,
+ new ActiveValueLabel(capActiveXLabel, activeValueTitleX),
+ "Cap");
+
+ var capY = new Option(
+ capBoxY,
+ form,
+ 0,
+ capLabelY,
+ optionSetYLeft,
+ new ActiveValueLabel(capActiveYLabel, activeValueTitleY),
+ "Cap");
+
+ var offsetX = new Option(
+ offsetBoxX,
+ form,
+ 0,
+ offsetLabelX,
+ 0,
+ new ActiveValueLabel(offsetActiveLabelX, activeValueTitleX),
+ "Offset");
+
+ var offsetY = new Option(
+ offsetBoxY,
+ form,
+ 0,
+ offsetLabelY,
+ optionSetYLeft,
+ new ActiveValueLabel(offsetActiveLabelY, activeValueTitleY),
+ "Offset");
+
+ var offsetOptionsX = new OffsetOptions(
+ gainOffsetToolStripMenuItem,
+ legacyOffsetToolStripMenuItem,
+ offsetX);
+
+ var offsetOptionsY = new OffsetOptions(
+ gainOffsetToolStripMenuItem,
+ legacyOffsetToolStripMenuItem,
+ offsetY);
+
+ var accelerationX = new Option(
+ new Field(accelerationBoxX, form, 0),
+ constantOneLabelX,
+ new ActiveValueLabel(accelerationActiveLabelX, activeValueTitleX),
+ 0);
+
+ var accelerationY = new Option(
+ new Field(accelerationBoxY, form, 0),
+ constantOneLabelY,
+ new ActiveValueLabel(accelerationActiveLabelY, activeValueTitleY),
+ optionSetYLeft);
+
+ var limitOrExponentX = new Option(
+ new Field(limitBoxX, form, 2),
+ constantTwoLabelX,
+ new ActiveValueLabel(limitExpActiveLabelX, activeValueTitleX),
+ 0);
+
+ var limitOrExponentY = new Option(
+ new Field(limitBoxY, form, 2),
+ constantTwoLabelY,
+ new ActiveValueLabel(limitExpActiveLabelY, activeValueTitleY),
+ optionSetYLeft);
+
+ var midpointX = new Option(
+ new Field(midpointBoxX, form, 0),
+ constantThreeLabelX,
+ new ActiveValueLabel(midpointActiveLabelX, activeValueTitleY),
+ 0);
+
+ var midpointY = new Option(
+ new Field(midpointBoxY, form, 0),
+ constantThreeLabelY,
+ new ActiveValueLabel(midpointActiveLabelY, activeValueTitleY),
+ optionSetYLeft);
+
+ var capOptionsX = new CapOptions(
+ velocityGainCapToolStripMenuItem,
+ legacyCapToolStripMenuItem,
+ capX);
+
+ var capOptionsY = new CapOptions(
+ velocityGainCapToolStripMenuItem,
+ legacyCapToolStripMenuItem,
+ capY);
+
+ var accelerationOptionsX = new AccelTypeOptions(
+ accelTypeDropX,
+ accelerationX,
+ capOptionsX,
+ weightX,
+ offsetOptionsX,
+ limitOrExponentX,
+ midpointX,
+ writeButton,
+ new ActiveValueLabel(accelTypeActiveLabelX, activeValueTitleX));
+
+ var accelerationOptionsY = new AccelTypeOptions(
+ accelTypeDropY,
+ accelerationY,
+ capOptionsY,
+ weightY,
+ offsetOptionsY,
+ limitOrExponentY,
+ midpointY,
+ writeButton,
+ new ActiveValueLabel(accelTypeActiveLabelY, activeValueTitleY));
+
+ var optionsSetX = new AccelOptionSet(
+ optionSetXTitle,
+ activeValueTitleX,
+ rotationBox.Top + rotationBox.Height + Constants.OptionVerticalSeperation,
+ accelerationOptionsX);
+
+ var optionsSetY = new AccelOptionSet(
+ optionSetYTitle,
+ activeValueTitleY,
+ rotationBox.Top + rotationBox.Height + Constants.OptionVerticalSeperation,
+ accelerationOptionsY);
+
+ var applyOptions = new ApplyOptions(
+ wholeVectorToolStripMenuItem,
+ byVectorComponentToolStripMenuItem,
+ byComponentXYLock,
+ optionsSetX,
+ optionsSetY,
+ sensitivity,
+ rotation,
+ lockXYLabel,
+ accelCharts);
+
+ var accelCalculator = new AccelCalculator(
+ new Field(dpiTextBox.TextBox, form, Constants.DefaultDPI),
+ new Field(pollRateTextBox.TextBox, form, Constants.DefaultPollRate));
+
+ var settings = new SettingsManager(
+ activeAccel,
+ accelCalculator.DPI,
+ accelCalculator.PollRate,
+ autoWriteMenuItem,
+ showLastMouseMoveMenuItem);
+
+ return new AccelGUI(
+ form,
+ accelCalculator,
+ accelCharts,
+ settings,
+ applyOptions,
+ writeButton,
+ mouseLabel,
+ scaleMenuItem);
+ }
+
+ #endregion Methods
+ }
+}
diff --git a/grapher/Models/Calculations/AccelCalculator.cs b/grapher/Models/Calculations/AccelCalculator.cs
index 102de8d..092a7aa 100644
--- a/grapher/Models/Calculations/AccelCalculator.cs
+++ b/grapher/Models/Calculations/AccelCalculator.cs
@@ -3,19 +3,12 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
namespace grapher.Models.Calculations
{
public class AccelCalculator
{
- public const int DefaultDPI = 1200;
- public const int DefaultPollRate = 1000;
- public const int Resolution = 100;
- public const double MaxMultiplier = 85;
- public const double XYToCombinedRatio = 1.3;
+ #region Structs
public struct MagnitudeData
{
@@ -24,6 +17,9 @@ namespace grapher.Models.Calculations
public int y;
}
+ #endregion Structs
+
+ #region Constructors
public AccelCalculator(Field dpi, Field pollRate)
{
@@ -31,6 +27,10 @@ namespace grapher.Models.Calculations
PollRate = pollRate;
}
+ #endregion Constructors
+
+ #region Properties
+
public ReadOnlyCollection<MagnitudeData> MagnitudesCombined { get; private set; }
public ReadOnlyCollection<MagnitudeData> MagnitudesX { get; private set; }
@@ -47,6 +47,10 @@ namespace grapher.Models.Calculations
private int Increment { get; set; }
+ #endregion Fields
+
+ #region Methods
+
public void Calculate(AccelData data, ManagedAccel accel, DriverSettings settings)
{
ScaleByMouseSettings();
@@ -171,12 +175,14 @@ namespace grapher.Models.Calculations
public void ScaleByMouseSettings()
{
var dpiPollFactor = DPI.Data / PollRate.Data;
- CombinedMaxVelocity = dpiPollFactor * MaxMultiplier;
- Increment = (int) Math.Floor(CombinedMaxVelocity / Resolution);
- XYMaxVelocity = CombinedMaxVelocity * 1.5;
+ CombinedMaxVelocity = dpiPollFactor * Constants.MaxMultiplier;
+ Increment = (int)Math.Floor(CombinedMaxVelocity / Constants.Resolution);
+ XYMaxVelocity = CombinedMaxVelocity * Constants.XYToCombinedRatio;
MagnitudesCombined = GetMagnitudes();
MagnitudesX = GetMagnitudesX();
MagnitudesY = GetMagnitudesY();
}
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Calculations/AccelChartData.cs b/grapher/Models/Calculations/AccelChartData.cs
index 20142a7..8c0c8ea 100644
--- a/grapher/Models/Calculations/AccelChartData.cs
+++ b/grapher/Models/Calculations/AccelChartData.cs
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace grapher.Models.Calculations
{
public class AccelChartData
{
+ #region Constructors
+
public AccelChartData()
{
AccelPoints = new SortedDictionary<double, double>();
@@ -17,6 +17,10 @@ namespace grapher.Models.Calculations
OutVelocityToPoints = new Dictionary<double, (double, double, double)>();
}
+ #endregion Constructors
+
+ #region Properties
+
public SortedDictionary<double, double> AccelPoints { get; }
public SortedDictionary<double, double> VelocityPoints { get; }
@@ -27,6 +31,10 @@ namespace grapher.Models.Calculations
public Dictionary<double, (double, double, double)> OutVelocityToPoints { get; }
+ #endregion Properties
+
+ #region Methods
+
public void Clear()
{
AccelPoints.Clear();
@@ -57,5 +65,7 @@ namespace grapher.Models.Calculations
return values;
}
}
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Calculations/AccelData.cs b/grapher/Models/Calculations/AccelData.cs
index 683c67e..eef4d01 100644
--- a/grapher/Models/Calculations/AccelData.cs
+++ b/grapher/Models/Calculations/AccelData.cs
@@ -1,15 +1,11 @@
using grapher.Models.Charts;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using static grapher.AccelCharts;
namespace grapher.Models.Calculations
{
public class AccelData
{
+ #region Constructors
public AccelData(
EstimatedPoints combined,
@@ -25,6 +21,10 @@ namespace grapher.Models.Calculations
EstimatedY = y;
}
+ #endregion Constructors
+
+ #region Properties
+
public AccelChartData Combined { get; }
public AccelChartData X { get; }
@@ -37,6 +37,10 @@ namespace grapher.Models.Calculations
private EstimatedPoints EstimatedY { get; }
+ #endregion Properties
+
+ #region Methods
+
public void Clear()
{
Combined.Clear();
@@ -70,5 +74,6 @@ namespace grapher.Models.Calculations
EstimatedY.Gain.Set(inYVelocity, yGain);
}
+ #endregion Methods
}
}
diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs
index 1aa3909..3f228c3 100644
--- a/grapher/Models/Charts/AccelCharts.cs
+++ b/grapher/Models/Charts/AccelCharts.cs
@@ -1,23 +1,15 @@
using grapher.Models.Calculations;
using grapher.Models.Charts;
+using grapher.Models.Serialized;
using System;
-using System.Collections.Generic;
using System.Drawing;
-using System.Linq;
-using System.Security.Permissions;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
-using System.Windows.Forms.DataVisualization.Charting;
namespace grapher
{
public class AccelCharts
{
- public const int ChartSeparationVertical = 10;
-
- /// <summary> Needed to show full contents in form. Unsure why. </summary>
- public const int FormHeightPadding = 35;
+ #region Constructors
public AccelCharts(
Form form,
@@ -25,7 +17,8 @@ namespace grapher
ChartXY velocityChart,
ChartXY gainChart,
ToolStripMenuItem enableVelocityAndGain,
- ICollection<CheckBox> checkBoxesXY)
+ ToolStripMenuItem enableLastMouseMove,
+ Button writeButton)
{
Estimated = new EstimatedPoints();
EstimatedX = new EstimatedPoints();
@@ -37,7 +30,8 @@ namespace grapher
VelocityChart = velocityChart;
GainChart = gainChart;
EnableVelocityAndGain = enableVelocityAndGain;
- CheckBoxesXY = checkBoxesXY;
+ EnableLastValue = enableLastMouseMove;
+ WriteButton = writeButton;
SensitivityChart.SetPointBinds(Estimated.Sensitivity, EstimatedX.Sensitivity, EstimatedY.Sensitivity);
VelocityChart.SetPointBinds(Estimated.Velocity, EstimatedX.Velocity, EstimatedY.Velocity);
@@ -45,21 +39,28 @@ namespace grapher
SensitivityChart.SetTop(0);
VelocityChart.SetHeight(SensitivityChart.Height);
- VelocityChart.SetTop(SensitivityChart.Height + ChartSeparationVertical);
+ VelocityChart.SetTop(SensitivityChart.Height + Constants.ChartSeparationVertical);
GainChart.SetHeight(SensitivityChart.Height);
- GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + ChartSeparationVertical);
+ GainChart.SetTop(VelocityChart.Top + VelocityChart.Height + Constants.ChartSeparationVertical);
Rectangle screenRectangle = ContaingForm.RectangleToScreen(ContaingForm.ClientRectangle);
FormBorderHeight = screenRectangle.Top - ContaingForm.Top;
EnableVelocityAndGain.Click += new System.EventHandler(OnEnableClick);
- EnableVelocityAndGain.CheckedChanged += new System.EventHandler(OnEnableCheckStateChange);
+ EnableVelocityAndGain.CheckedChanged += new System.EventHandler(OnEnableVelocityGainCheckStateChange);
+
+ EnableLastValue.CheckedChanged += new System.EventHandler(OnEnableLastMouseMoveCheckStateChange);
HideVelocityAndGain();
+ SensitivityChart.Show();
Combined = false;
ShowCombined();
}
+ #endregion Constructors
+
+ #region Properties
+
public Form ContaingForm { get; }
public ChartXY SensitivityChart { get; }
@@ -70,6 +71,10 @@ namespace grapher
public ToolStripMenuItem EnableVelocityAndGain { get; }
+ private ToolStripMenuItem EnableLastValue { get; }
+
+ private Button WriteButton { get; }
+
public AccelData AccelData { get; }
private EstimatedPoints Estimated { get; }
@@ -78,12 +83,14 @@ namespace grapher
private EstimatedPoints EstimatedY { get; }
- private ICollection<CheckBox> CheckBoxesXY { get; }
-
private bool Combined { get; set; }
private int FormBorderHeight { get; }
+ #endregion Properties
+
+ #region Methods
+
public void MakeDots(int x, int y, double timeInMs)
{
if (Combined)
@@ -96,11 +103,14 @@ namespace grapher
}
}
- public void DrawPoints()
+ public void DrawLastMovement()
{
- SensitivityChart.DrawPoints();
- VelocityChart.DrawPoints();
- GainChart.DrawPoints();
+ if (EnableLastValue.Checked)
+ {
+ SensitivityChart.DrawLastMovementValue();
+ VelocityChart.DrawLastMovementValue();
+ GainChart.DrawLastMovementValue();
+ }
}
public void Bind()
@@ -119,9 +129,9 @@ namespace grapher
}
}
- public void RefreshXY()
+ public void ShowActive(DriverSettings driverSettings)
{
- if (CheckBoxesXY.All(box => box.Checked))
+ if (driverSettings.combineMagnitudes)
{
ShowCombined();
}
@@ -131,12 +141,30 @@ namespace grapher
}
}
+ public void SetWidened()
+ {
+ SensitivityChart.SetWidened();
+ VelocityChart.SetWidened();
+ GainChart.SetWidened();
+ UpdateFormWidth();
+ AlignWriteButton();
+ }
+
+ public void SetNarrowed()
+ {
+ SensitivityChart.SetNarrowed();
+ VelocityChart.SetNarrowed();
+ GainChart.SetNarrowed();
+ UpdateFormWidth();
+ AlignWriteButton();
+ }
+
private void OnEnableClick(object sender, EventArgs e)
{
EnableVelocityAndGain.Checked = !EnableVelocityAndGain.Checked;
}
- private void OnEnableCheckStateChange(object sender, EventArgs e)
+ private void OnEnableVelocityGainCheckStateChange(object sender, EventArgs e)
{
if (EnableVelocityAndGain.Checked)
{
@@ -148,14 +176,24 @@ namespace grapher
}
}
+ private void OnEnableLastMouseMoveCheckStateChange(object sender, EventArgs e)
+ {
+ if (!EnableLastValue.Checked)
+ {
+ SensitivityChart.ClearLastValue();
+ VelocityChart.ClearLastValue();
+ GainChart.ClearLastValue();
+ }
+ }
+
private void ShowVelocityAndGain()
{
VelocityChart.Show();
GainChart.Show();
- ContaingForm.Height = SensitivityChart.Height +
- ChartSeparationVertical +
+ ContaingForm.Height = SensitivityChart.Height +
+ Constants.ChartSeparationVertical +
VelocityChart.Height +
- ChartSeparationVertical +
+ Constants.ChartSeparationVertical +
GainChart.Height +
FormBorderHeight;
}
@@ -199,5 +237,12 @@ namespace grapher
{
ContaingForm.Width = SensitivityChart.Left + SensitivityChart.Width;
}
+
+ private void AlignWriteButton()
+ {
+ WriteButton.Left = SensitivityChart.Left / 2 - WriteButton.Width / 2;
+ }
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs
index 81874a2..30be229 100644
--- a/grapher/Models/Charts/ChartXY.cs
+++ b/grapher/Models/Charts/ChartXY.cs
@@ -1,26 +1,11 @@
-using grapher.Models.Charts;
-using grapher.Models.Mouse;
-using System;
+using grapher.Models.Mouse;
using System.Collections;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
-using static grapher.AccelCharts;
namespace grapher
{
public class ChartXY
{
- #region Consts
-
- public const int ChartSeparationHorizontal = 10;
-
- #endregion Consts
-
#region Constructors
public ChartXY(Chart chartX, Chart chartY)
@@ -31,10 +16,16 @@ namespace grapher
ChartY.Top = ChartX.Top;
ChartY.Height = ChartX.Height;
ChartY.Width = ChartX.Width;
- ChartY.Left = ChartX.Left + ChartX.Width + ChartSeparationHorizontal;
+ ChartY.Left = ChartX.Left + ChartX.Width + Constants.ChartSeparationHorizontal;
SetupChart(ChartX);
SetupChart(ChartY);
+
+ Combined = false;
+ SetCombined();
+
+ Widened = false;
+ SetWidened();
}
#endregion Constructors
@@ -82,6 +73,10 @@ namespace grapher
public bool Combined { get; private set; }
+ public bool Widened { get; private set; }
+
+ public bool Visible { get; private set; }
+
private PointData CombinedPointData { get; set; }
private PointData XPointData { get; set; }
@@ -134,7 +129,7 @@ namespace grapher
YPointData = y;
}
- public void DrawPoints()
+ public void DrawLastMovementValue()
{
if(Combined)
{
@@ -147,6 +142,12 @@ namespace grapher
}
}
+ public void ClearLastValue()
+ {
+ ChartX.Series[1].Points.Clear();
+ ChartY.Series[1].Points.Clear();
+ }
+
public void Bind(IDictionary data)
{
ChartX.Series[0].Points.DataBindXY(data.Keys, data.Values);
@@ -171,7 +172,7 @@ namespace grapher
{
if (Combined)
{
- if (ChartX.Visible)
+ if (Visible)
{
ChartY.Show();
}
@@ -180,19 +181,56 @@ namespace grapher
}
}
+ public void SetWidened()
+ {
+ if (!Widened)
+ {
+ ChartX.Width = Constants.WideChartWidth;
+ ChartY.Width = Constants.WideChartWidth;
+
+ ChartX.Left = Constants.WideChartLeft;
+ ChartY.Left = ChartX.Left + ChartX.Width + Constants.ChartSeparationHorizontal;
+
+ Widened = true;
+ }
+ }
+
+ public void SetNarrowed()
+ {
+ if (Widened)
+ {
+ ChartX.Width = Constants.NarrowChartWidth;
+ ChartY.Width = Constants.NarrowChartWidth;
+
+ ChartX.Left = Constants.NarrowChartLeft;
+ ChartY.Left = ChartX.Left + ChartX.Width + Constants.ChartSeparationHorizontal;
+
+ Widened = false;
+ }
+ }
+
public void Hide()
{
- ChartX.Hide();
- ChartY.Hide();
+ if (Visible)
+ {
+ ChartX.Hide();
+ ChartY.Hide();
+ Visible = false;
+ }
}
public void Show()
{
- ChartX.Show();
-
- if (!Combined)
+ if (!Visible)
{
- ChartY.Show();
+ ChartX.Show();
+
+ if (!Combined)
+ {
+ ChartY.Show();
+ }
+
+ Visible = true;
}
}
diff --git a/grapher/Models/Charts/EstimatedPoints.cs b/grapher/Models/Charts/EstimatedPoints.cs
index fa0718b..f7ba3ce 100644
--- a/grapher/Models/Charts/EstimatedPoints.cs
+++ b/grapher/Models/Charts/EstimatedPoints.cs
@@ -1,14 +1,11 @@
using grapher.Models.Mouse;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace grapher.Models.Charts
{
public class EstimatedPoints
{
+ #region Constructors
+
public EstimatedPoints()
{
Sensitivity = new PointData();
@@ -16,10 +13,16 @@ namespace grapher.Models.Charts
Gain = new PointData();
}
+ #endregion Constructors
+
+ #region Properties
+
public PointData Sensitivity { get; }
public PointData Velocity { get; }
public PointData Gain { get; }
+
+ #endregion Properties
}
}
diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs
index 1810081..0d1813e 100644
--- a/grapher/Models/Fields/Field.cs
+++ b/grapher/Models/Fields/Field.cs
@@ -1,22 +1,12 @@
using System;
-using System.Collections.Generic;
using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher
{
public class Field
{
- #region Constants
-
- public const string DefaultFormatString = "0.#########";
-
- #endregion Constants
-
- #region Enums
+ #region Enumerations
public enum FieldState
{
@@ -27,8 +17,13 @@ namespace grapher
Unavailable,
}
- #endregion Enums
+ #endregion Enumerations
+
+ #region Fields
+
+ private double _data;
+ #endregion Fields
#region Constructors
@@ -36,11 +31,11 @@ namespace grapher
{
DefaultText = DecimalString(defaultData);
Box = box;
- Data = defaultData;
+ _data = defaultData;
DefaultData = defaultData;
State = FieldState.Undefined;
ContainingForm = containingForm;
- FormatString = DefaultFormatString;
+ FormatString = Constants.DefaultFieldFormatString;
box.KeyDown += new System.Windows.Forms.KeyEventHandler(KeyDown);
box.Leave += new System.EventHandler(FocusLeave);
@@ -55,8 +50,6 @@ namespace grapher
private Form ContainingForm { get; }
- public double Data { get; private set; }
-
public string FormatString { get; set; }
public string DefaultText { get; }
@@ -65,6 +58,68 @@ namespace grapher
public FieldState PreviousState { get; private set; }
+ public double Data {
+ get
+ {
+ if (Box.Visible)
+ {
+ return _data;
+ }
+ else
+ {
+ return DefaultData;
+ }
+ }
+ }
+
+ public int Top
+ {
+ get
+ {
+ return Box.Top;
+ }
+ set
+ {
+ Box.Top = value;
+ }
+ }
+
+ public int Height
+ {
+ get
+ {
+ return Box.Height;
+ }
+ set
+ {
+ Box.Height = value;
+ }
+ }
+
+ public int Left
+ {
+ get
+ {
+ return Box.Left;
+ }
+ set
+ {
+ Box.Left = value;
+ }
+ }
+
+ public int Width
+ {
+ get
+ {
+ return Box.Width;
+ }
+ set
+ {
+ Box.Width = value;
+ }
+ }
+
private double DefaultData { get; }
#endregion Properties
@@ -81,7 +136,7 @@ namespace grapher
PreviousState = FieldState.Default;
}
- Data = DefaultData;
+ _data = DefaultData;
Box.Text = DefaultText;
ContainingForm.ActiveControl = null;
}
@@ -118,7 +173,7 @@ namespace grapher
{
SetToEntered();
- Data = value;
+ _data = value;
Box.Text = DecimalString(Data);
}
@@ -197,7 +252,7 @@ namespace grapher
{
try
{
- Data = Convert.ToDouble(Box.Text);
+ _data = Convert.ToDouble(Box.Text);
}
catch
{
diff --git a/grapher/Models/Fields/FieldXY.cs b/grapher/Models/Fields/FieldXY.cs
index 609af9d..15e6800 100644
--- a/grapher/Models/Fields/FieldXY.cs
+++ b/grapher/Models/Fields/FieldXY.cs
@@ -1,38 +1,36 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher
{
public class FieldXY
{
- public const int DefaultSeparation = 4;
+ #region Constructors
- public const string ShortenedFormatString = "0.###";
-
- public FieldXY(TextBox xBox, TextBox yBox, CheckBox lockCheckBox, Form containingForm, double defaultData, AccelCharts accelCharts)
+ public FieldXY(TextBox xBox, TextBox yBox, CheckBox lockCheckBox, Form containingForm, double defaultData)
{
XField = new Field(xBox, containingForm, defaultData);
YField = new Field(yBox, containingForm, defaultData);
- YField.FormatString = ShortenedFormatString;
+ YField.FormatString = Constants.ShortenedFormatString;
LockCheckBox = lockCheckBox;
LockCheckBox.CheckedChanged += new System.EventHandler(CheckChanged);
- AccelCharts = accelCharts;
- XField.Box.Width = (YField.Box.Left + YField.Box.Width - XField.Box.Left - DefaultSeparation) / 2;
+ XField.Box.Width = (YField.Box.Left + YField.Box.Width - XField.Box.Left - Constants.DefaultFieldSeparation) / 2;
YField.Box.Width = XField.Box.Width;
DefaultWidthX = XField.Box.Width;
DefaultWidthY = YField.Box.Width;
- YField.Box.Left = XField.Box.Left + XField.Box.Width + DefaultSeparation;
+ YField.Box.Left = XField.Box.Left + XField.Box.Width + Constants.DefaultFieldSeparation;
CombinedWidth = DefaultWidthX + DefaultWidthY + YField.Box.Left - (XField.Box.Left + DefaultWidthX);
SetCombined();
}
+
+ #endregion Constructors
+
+ #region Properties
+
public double X
{
get => XField.Data;
@@ -59,7 +57,58 @@ namespace grapher
public Field YField { get; }
- private AccelCharts AccelCharts { get; }
+ public int CombinedWidth { get; }
+
+ public int Left {
+ get
+ {
+ return XField.Left;
+ }
+ set
+ {
+ }
+ }
+
+ public int Width
+ {
+ get
+ {
+ return CombinedWidth;
+ }
+ set
+ {
+ }
+ }
+
+ public int Top
+ {
+ get
+ {
+ return XField.Top;
+ }
+ set
+ {
+ }
+ }
+
+ public int Height
+ {
+ get
+ {
+ return XField.Height;
+ }
+ set
+ {
+ }
+ }
+
+ public bool Visible
+ {
+ get
+ {
+ return XField.Box.Visible;
+ }
+ }
private bool Combined { get; set; }
@@ -67,7 +116,10 @@ namespace grapher
private int DefaultWidthY { get; }
- private int CombinedWidth { get; }
+
+ #endregion Properties
+
+ #region Methods
private void CheckChanged(object sender, EventArgs e)
{
@@ -79,8 +131,6 @@ namespace grapher
{
SetSeparate();
}
-
- AccelCharts.RefreshXY();
}
public void SetCombined()
@@ -89,7 +139,7 @@ namespace grapher
YField.SetToUnavailable();
YField.Box.Hide();
XField.Box.Width = CombinedWidth;
- XField.FormatString = Field.DefaultFormatString;
+ XField.FormatString = Constants.DefaultFieldFormatString;
}
public void SetSeparate()
@@ -99,7 +149,7 @@ namespace grapher
XField.Box.Width = DefaultWidthX;
YField.Box.Width = DefaultWidthY;
- XField.FormatString = ShortenedFormatString;
+ XField.FormatString = Constants.ShortenedFormatString;
if (XField.State == Field.FieldState.Default)
{
@@ -131,5 +181,7 @@ namespace grapher
XField.Box.Hide();
YField.Box.Hide();
}
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Mouse/MouseWatcher.cs b/grapher/Models/Mouse/MouseWatcher.cs
index fea4e2d..405110e 100644
--- a/grapher/Models/Mouse/MouseWatcher.cs
+++ b/grapher/Models/Mouse/MouseWatcher.cs
@@ -1,16 +1,12 @@
using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher.Models.Mouse
{
public class MouseWatcher
{
+ #region External
/// <summary>
/// Enumeration containing HID usage page flags.
/// </summary>
@@ -677,6 +673,10 @@ namespace grapher.Models.Mouse
[DllImport("user32.dll")]
public static extern int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, out RawInput pData, ref int pcbSize, int cbSizeHeader);
+ #endregion External
+
+ #region Constructors
+
public MouseWatcher(Form containingForm, Label display, AccelCharts accelCharts)
{
ContainingForm = containingForm;
@@ -695,6 +695,10 @@ namespace grapher.Models.Mouse
PollTime = 1;
}
+ #endregion Constructors
+
+ #region Properties
+
private Form ContainingForm { get; }
private Label Display { get; }
@@ -703,6 +707,10 @@ namespace grapher.Models.Mouse
private double PollTime { get; }
+ #endregion Properties
+
+ #region Methods
+
public void OnMouseMove(int x, int y, double timeInMs)
{
Display.Text = $"Last (x, y): ({x}, {y})";
@@ -723,5 +731,7 @@ namespace grapher.Models.Mouse
}
}
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Mouse/PointData.cs b/grapher/Models/Mouse/PointData.cs
index 12a6e73..374c52e 100644
--- a/grapher/Models/Mouse/PointData.cs
+++ b/grapher/Models/Mouse/PointData.cs
@@ -1,13 +1,11 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace grapher.Models.Mouse
{
public class PointData
{
+ #region Constructors
+
public PointData()
{
Lock = new Object();
@@ -15,6 +13,10 @@ namespace grapher.Models.Mouse
Y = new double[] { 0 };
}
+ #endregion Constructors
+
+ #region Properties
+
public Object Lock { get; }
private double[] X { get; set; }
@@ -29,6 +31,10 @@ namespace grapher.Models.Mouse
}
}
+ #endregion Properties
+
+ #region Methods
+
public void Get(out double[] x, out double[] y)
{
lock(Lock)
@@ -37,5 +43,7 @@ namespace grapher.Models.Mouse
y = Y;
}
}
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Options/AccelOptionSet.cs b/grapher/Models/Options/AccelOptionSet.cs
new file mode 100644
index 0000000..bc0d368
--- /dev/null
+++ b/grapher/Models/Options/AccelOptionSet.cs
@@ -0,0 +1,117 @@
+using grapher.Models.Serialized;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace grapher.Models.Options
+{
+ public class AccelOptionSet
+ {
+ public AccelOptionSet(
+ Label title,
+ Label activeValuesTitle,
+ int topAnchor,
+ AccelTypeOptions accelTypeOptions)
+ {
+ OptionsTitle = title;
+ ActiveValuesTitle = activeValuesTitle;
+ TopAnchor = topAnchor;
+ Options = accelTypeOptions;
+
+ ActiveValuesTitle.AutoSize = false;
+ ActiveValuesTitle.TextAlign = ContentAlignment.MiddleCenter;
+
+ Options.ShowFull();
+
+ OptionsTitle.Top = TopAnchor;
+ IsTitleMode = true;
+ SetRegularMode();
+ }
+
+ public int TopAnchor { get; }
+
+ public Label OptionsTitle { get; }
+
+ public Label ActiveValuesTitle { get; }
+
+ public AccelTypeOptions Options { get; }
+
+
+ public bool IsTitleMode { get; private set; }
+
+ public void SetRegularMode()
+ {
+ if (IsTitleMode)
+ {
+ IsTitleMode = false;
+
+ HideTitle();
+ Options.ShowFull();
+ }
+ }
+
+ public void SetTitleMode(string title)
+ {
+ OptionsTitle.Text = title;
+
+ if (!IsTitleMode)
+ {
+ IsTitleMode = true;
+
+ Options.ShowShortened();
+ DisplayTitle();
+ }
+ }
+
+ public void Hide()
+ {
+ OptionsTitle.Hide();
+ ActiveValuesTitle.Hide();
+ Options.Hide();
+ }
+
+ public void Show()
+ {
+ if (IsTitleMode)
+ {
+ OptionsTitle.Show();
+ }
+
+ ActiveValuesTitle.Show();
+ Options.Show();
+ }
+
+ public void DisplayTitle()
+ {
+ OptionsTitle.Show();
+
+ Options.Top = OptionsTitle.Top + OptionsTitle.Height + Constants.OptionVerticalSeperation;
+ }
+
+ public void HideTitle()
+ {
+ OptionsTitle.Hide();
+
+ Options.Top = TopAnchor;
+ }
+
+ public void SetArgs(ref AccelArgs args)
+ {
+ Options.SetArgs(ref args);
+ }
+
+ public AccelArgs GenerateArgs()
+ {
+ return Options.GenerateArgs();
+ }
+
+ public void SetActiveValues(int mode, AccelArgs args)
+ {
+ Options.SetActiveValues(mode, args);
+ }
+
+ public void AlignActiveValues()
+ {
+ Options.AlignActiveValues();
+ }
+ }
+}
diff --git a/grapher/Models/Options/AccelOptions.cs b/grapher/Models/Options/AccelOptions.cs
deleted file mode 100644
index 6b98274..0000000
--- a/grapher/Models/Options/AccelOptions.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using grapher.Layouts;
-using grapher.Models.Options;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace grapher
-{
- public class AccelOptions
- {
- public const int PossibleOptionsCount = 4;
- public const int PossibleOptionsXYCount = 2;
-
- public static readonly Dictionary<string, LayoutBase> AccelerationTypes = new List<LayoutBase>
- {
- new LinearLayout(),
- new ClassicLayout(),
- new NaturalLayout(),
- new LogLayout(),
- new SigmoidLayout(),
- new PowerLayout(),
- new NaturalGainLayout(),
- new SigmoidGainLayout(),
- new OffLayout()
- }.ToDictionary(k => k.Name);
-
- public AccelOptions(
- ComboBox accelDropdown,
- Option[] options,
- OptionXY[] optionsXY,
- Button writeButton,
- ActiveValueLabel activeValueLabel)
- {
- AccelDropdown = accelDropdown;
- AccelDropdown.Items.Clear();
- AccelDropdown.Items.AddRange(AccelerationTypes.Keys.ToArray());
- AccelDropdown.SelectedIndexChanged += new System.EventHandler(OnIndexChanged);
-
- if (options.Length > PossibleOptionsCount)
- {
- throw new Exception("Layout given too many options.");
- }
-
- if (optionsXY.Length > PossibleOptionsXYCount)
- {
- throw new Exception("Layout given too many options.");
- }
-
- Options = options;
- OptionsXY = optionsXY;
- WriteButton = writeButton;
- ActiveValueLabel = activeValueLabel;
-
- Layout("Off");
- }
-
- public Button WriteButton { get; }
-
- public ComboBox AccelDropdown { get; }
-
- public int AccelerationIndex { get; private set; }
-
- public ActiveValueLabel ActiveValueLabel { get; }
-
- public Option[] Options { get; }
-
- public OptionXY[] OptionsXY { get; }
-
- public void SetActiveValue(int index)
- {
- var name = AccelerationTypes.Where(t => t.Value.Index == index).FirstOrDefault().Value.Name;
- ActiveValueLabel.SetValue(name);
- }
-
- private void OnIndexChanged(object sender, EventArgs e)
- {
- var accelerationTypeString = AccelDropdown.SelectedItem.ToString();
- Layout(accelerationTypeString);
- }
-
- private void Layout(string type)
- {
- var accelerationType = AccelerationTypes[type];
- AccelerationIndex = accelerationType.Index;
- accelerationType.Layout(Options, OptionsXY, WriteButton);
- }
- }
-}
diff --git a/grapher/Models/Options/AccelTypeOptions.cs b/grapher/Models/Options/AccelTypeOptions.cs
new file mode 100644
index 0000000..14c2019
--- /dev/null
+++ b/grapher/Models/Options/AccelTypeOptions.cs
@@ -0,0 +1,281 @@
+using grapher.Layouts;
+using grapher.Models.Options;
+using grapher.Models.Serialized;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace grapher
+{
+ public class AccelTypeOptions : OptionBase
+ {
+ #region Fields
+
+ public static readonly Dictionary<string, LayoutBase> AccelerationTypes = new List<LayoutBase>
+ {
+ new LinearLayout(),
+ new ClassicLayout(),
+ new NaturalLayout(),
+ new PowerLayout(),
+ new NaturalGainLayout(),
+ new SigmoidGainLayout(),
+ new OffLayout()
+ }.ToDictionary(k => k.Name);
+
+ #endregion Fields
+
+ #region Constructors
+
+ public AccelTypeOptions(
+ ComboBox accelDropdown,
+ Option acceleration,
+ CapOptions cap,
+ Option weight,
+ OffsetOptions offset,
+ Option limitOrExponent,
+ Option midpoint,
+ Button writeButton,
+ ActiveValueLabel accelTypeActiveValue)
+ {
+ AccelDropdown = accelDropdown;
+ AccelDropdown.Items.Clear();
+ AccelDropdown.Items.AddRange(AccelerationTypes.Keys.ToArray());
+ AccelDropdown.SelectedIndexChanged += new System.EventHandler(OnIndexChanged);
+
+ Acceleration = acceleration;
+ Cap = cap;
+ Weight = weight;
+ Offset = offset;
+ LimitOrExponent = limitOrExponent;
+ Midpoint = midpoint;
+ WriteButton = writeButton;
+ AccelTypeActiveValue = accelTypeActiveValue;
+
+ AccelTypeActiveValue.Left = AccelDropdown.Left + AccelDropdown.Width;
+ AccelTypeActiveValue.Height = AccelDropdown.Height;
+
+ Layout("Off");
+ ShowingDefault = true;
+ }
+
+ #endregion Constructors
+
+ #region Properties
+
+ public Button WriteButton { get; }
+
+ public ComboBox AccelDropdown { get; }
+
+ public int AccelerationIndex
+ {
+ get
+ {
+ return AccelerationType.Index;
+ }
+ }
+
+ public LayoutBase AccelerationType { get; private set; }
+
+ public ActiveValueLabel AccelTypeActiveValue { get; }
+
+ public Option Acceleration { get; }
+
+ public CapOptions Cap { get; }
+
+ public Option Weight { get; }
+
+ public OffsetOptions Offset { get; }
+
+ public Option LimitOrExponent { get; }
+
+ public Option Midpoint { get; }
+
+ public override int Top
+ {
+ get
+ {
+ return AccelDropdown.Top;
+ }
+ set
+ {
+ AccelDropdown.Top = value;
+ AccelTypeActiveValue.Top = value;
+ Layout(value + AccelDropdown.Height + Constants.OptionVerticalSeperation);
+ }
+ }
+
+ public override int Height
+ {
+ get
+ {
+ return AccelDropdown.Height;
+ }
+ }
+
+ public override int Left
+ {
+ get
+ {
+ return AccelDropdown.Left;
+ }
+ set
+ {
+ AccelDropdown.Left = value;
+ }
+ }
+
+ public override int Width
+ {
+ get
+ {
+ return AccelDropdown.Width;
+ }
+ set
+ {
+ AccelDropdown.Width = value;
+ }
+ }
+
+ public override bool Visible
+ {
+ get
+ {
+ return AccelDropdown.Visible;
+ }
+ }
+
+ private bool ShowingDefault { get; set; }
+
+ #endregion Properties
+
+ #region Methods
+
+ public override void Hide()
+ {
+ AccelDropdown.Hide();
+ AccelTypeActiveValue.Hide();
+
+ Acceleration.Hide();
+ Cap.Hide();
+ Weight.Hide();
+ Offset.Hide();
+ LimitOrExponent.Hide();
+ Midpoint.Hide();
+ }
+
+ public void Show()
+ {
+ AccelDropdown.Show();
+ AccelTypeActiveValue.Show();
+ Layout();
+ }
+
+ public override void Show(string name)
+ {
+ Show();
+ }
+
+ public void SetActiveValues(int index, AccelArgs args)
+ {
+ var name = AccelerationTypes.Where(t => t.Value.Index == index).FirstOrDefault().Value.Name;
+ AccelTypeActiveValue.SetValue(name);
+
+ Weight.SetActiveValue(args.weight);
+ Cap.SetActiveValues(args.gainCap, args.scaleCap, args.gainCap > 0);
+ Offset.SetActiveValue(args.offset, args.legacy_offset);
+ Acceleration.SetActiveValue(args.accel);
+ LimitOrExponent.SetActiveValue(args.exponent);
+ Midpoint.SetActiveValue(args.midpoint);
+ }
+
+ public void ShowFull()
+ {
+ if (ShowingDefault)
+ {
+ AccelDropdown.Text = Constants.AccelDropDownDefaultFullText;
+ }
+
+ Left = Acceleration.Left + Constants.DropDownLeftSeparation;
+ Width = Acceleration.Width - Constants.DropDownLeftSeparation;
+ }
+
+ public void ShowShortened()
+ {
+ if (ShowingDefault)
+ {
+ AccelDropdown.Text = Constants.AccelDropDownDefaultShortText;
+ }
+
+ Left = Acceleration.Field.Left;
+ Width = Acceleration.Field.Width;
+ }
+
+ public void SetArgs(ref AccelArgs args)
+ {
+ args.accel = Acceleration.Field.Data;
+ args.rate = Acceleration.Field.Data;
+ args.powerScale = Acceleration.Field.Data;
+ args.gainCap = Cap.VelocityGainCap;
+ args.scaleCap = Cap.SensitivityCap;
+ args.limit = LimitOrExponent.Field.Data;
+ args.exponent = LimitOrExponent.Field.Data;
+ args.powerExponent = LimitOrExponent.Field.Data;
+ args.offset = Offset.Offset;
+ args.legacy_offset = Offset.LegacyOffset;
+ args.midpoint = Midpoint.Field.Data;
+ args.weight = Weight.Field.Data;
+ }
+
+ public AccelArgs GenerateArgs()
+ {
+ AccelArgs args = new AccelArgs();
+ SetArgs(ref args);
+ return args;
+ }
+
+ public override void AlignActiveValues()
+ {
+ AccelTypeActiveValue.Align();
+ Acceleration.AlignActiveValues();
+ Cap.AlignActiveValues();
+ Offset.AlignActiveValues();
+ Weight.AlignActiveValues();
+ LimitOrExponent.AlignActiveValues();
+ Midpoint.AlignActiveValues();
+ }
+
+ private void OnIndexChanged(object sender, EventArgs e)
+ {
+ var accelerationTypeString = AccelDropdown.SelectedItem.ToString();
+ Layout(accelerationTypeString, Beneath);
+ ShowingDefault = false;
+ }
+
+ private void Layout(string type, int top = -1)
+ {
+ AccelerationType = AccelerationTypes[type];
+ Layout(top);
+ }
+
+ private void Layout(int top = -1)
+ {
+ if (top < 0)
+ {
+ top = Acceleration.Top;
+ }
+
+ AccelerationType.Layout(
+ Acceleration,
+ Cap,
+ Weight,
+ Offset,
+ LimitOrExponent,
+ Midpoint,
+ WriteButton,
+ top);
+ }
+
+ #endregion Methods
+ }
+}
diff --git a/grapher/Models/Options/ActiveValueLabel.cs b/grapher/Models/Options/ActiveValueLabel.cs
index 138775a..18a4400 100644
--- a/grapher/Models/Options/ActiveValueLabel.cs
+++ b/grapher/Models/Options/ActiveValueLabel.cs
@@ -1,34 +1,42 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Drawing;
using System.Windows.Forms;
namespace grapher.Models.Options
{
public class ActiveValueLabel
{
- public const string DefaultFormatString = "0.######";
- public static readonly Color ActiveValueFontColor = Color.FromArgb(255, 65, 65, 65);
+ #region Constants
+
+
+ #endregion Constants
+
+ #region Fields
private string _prefix;
private string _value;
+ #endregion Fields
+
+ #region Constructors
+
public ActiveValueLabel(Label valueLabel, Label centeringLabel)
{
ValueLabel = valueLabel;
- ValueLabel.ForeColor = ActiveValueFontColor;
- Left = centeringLabel.Left;
- Width = centeringLabel.Width;
ValueLabel.AutoSize = false;
ValueLabel.TextAlign = ContentAlignment.MiddleCenter;
+ ValueLabel.ForeColor = Constants.ActiveValueFontColor;
- FormatString = DefaultFormatString;
+ CenteringLabel = centeringLabel;
+ Align();
+
+ FormatString = Constants.DefaultActiveValueFormatString;
Prefix = string.Empty;
}
+ #endregion Constructors
+
+ #region Properties
+
public Label ValueLabel { get; }
public string FormatString { get; set; }
@@ -79,6 +87,37 @@ namespace grapher.Models.Options
}
}
+ public int Top
+ {
+ get
+ {
+ return ValueLabel.Top;
+ }
+ set
+ {
+ ValueLabel.Top = value;
+ }
+ }
+
+ public int Height
+ {
+ get
+ {
+ return ValueLabel.Height;
+ }
+
+ set
+ {
+ ValueLabel.Height = value;
+ }
+ }
+
+ public Label CenteringLabel { get; }
+
+ #endregion Properties
+
+ #region Methods
+
public void Hide()
{
ValueLabel.Hide();
@@ -103,5 +142,13 @@ namespace grapher.Models.Options
{
ValueLabel.Text = string.IsNullOrWhiteSpace(Prefix) ? Value: $"{Prefix}: {Value}";
}
+
+ public void Align()
+ {
+ Left = CenteringLabel.Left;
+ Width = CenteringLabel.Width;
+ }
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Options/ActiveValueLabelXY.cs b/grapher/Models/Options/ActiveValueLabelXY.cs
index 12506e9..9498c66 100644
--- a/grapher/Models/Options/ActiveValueLabelXY.cs
+++ b/grapher/Models/Options/ActiveValueLabelXY.cs
@@ -1,15 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace grapher.Models.Options
+namespace grapher.Models.Options
{
public class ActiveValueLabelXY
{
- public const int ActiveLabelXYSeparation = 2;
- public const string ShortenedFormatString = "0.###";
+ #region Constants
+
+
+ #endregion Constants
+
+ #region Constructors
public ActiveValueLabelXY(
ActiveValueLabel x,
@@ -18,26 +16,57 @@ namespace grapher.Models.Options
X = x;
Y = y;
- FullWidth = x.Width;
- ShortenedWidth = (FullWidth - ActiveLabelXYSeparation) / 2;
-
- Y.Left = X.Left + ShortenedWidth + ActiveLabelXYSeparation;
+ Align(x.Width);
Y.Width = ShortenedWidth;
- Y.FormatString = ShortenedFormatString;
+ Y.FormatString = Constants.ShortenedFormatString;
Combined = false;
SetCombined();
}
+ #endregion Constructors
+
+ #region Properties
+
public ActiveValueLabel X { get; }
public ActiveValueLabel Y { get; }
public bool Combined { get; private set; }
- private int FullWidth { get; }
+ public int Left
+ {
+ get
+ {
+ return X.Left;
+ }
+ set
+ {
+ X.Left = value;
+ SetYLeft();
+ }
+ }
+
+ public int Height
+ {
+ get
+ {
+ return X.Height;
+ }
+ set
+ {
+ X.Height = value;
+ Y.Height = value;
+ }
+ }
+
+ private int FullWidth { get; set; }
+
+ private int ShortenedWidth { get; set; }
- private int ShortenedWidth { get; }
+ #endregion Properties
+
+ #region Methods
public void SetValues(double x, double y)
{
@@ -58,7 +87,7 @@ namespace grapher.Models.Options
{
if (!Combined)
{
- X.FormatString = ActiveValueLabel.DefaultFormatString;
+ X.FormatString = Constants.DefaultActiveValueFormatString;
X.Width = FullWidth;
X.Prefix = string.Empty;
Y.Hide();
@@ -71,7 +100,7 @@ namespace grapher.Models.Options
{
if (Combined)
{
- X.FormatString = ShortenedFormatString;
+ X.FormatString = Constants.ShortenedFormatString;
X.Width = ShortenedWidth;
X.Prefix = "X";
Y.Prefix = "Y";
@@ -80,5 +109,35 @@ namespace grapher.Models.Options
Combined = false;
}
+
+ public void AlignActiveValues()
+ {
+ Align(X.CenteringLabel.Width);
+
+ if (Combined)
+ {
+ X.Width = FullWidth;
+ }
+ else
+ {
+ X.Width = ShortenedWidth;
+ }
+ }
+
+ private void Align (int width)
+ {
+ FullWidth = width;
+ ShortenedWidth = (FullWidth - Constants.ActiveLabelXYSeparation) / 2;
+
+ SetYLeft();
+ Y.Width = ShortenedWidth;
+ }
+
+ private void SetYLeft()
+ {
+ Y.Left = X.Left + ShortenedWidth + Constants.ActiveLabelXYSeparation;
+ }
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Options/ApplyOptions.cs b/grapher/Models/Options/ApplyOptions.cs
new file mode 100644
index 0000000..241fe50
--- /dev/null
+++ b/grapher/Models/Options/ApplyOptions.cs
@@ -0,0 +1,255 @@
+using grapher.Models.Serialized;
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace grapher.Models.Options
+{
+ public class ApplyOptions
+ {
+ #region Constructors
+
+ public ApplyOptions(
+ ToolStripMenuItem wholeVectorMenuItem,
+ ToolStripMenuItem byComponentMenuItem,
+ CheckBox byComponentVectorXYLock,
+ AccelOptionSet optionSetX,
+ AccelOptionSet optionSetY,
+ OptionXY sensitivity,
+ Option rotation,
+ Label lockXYLabel,
+ AccelCharts accelCharts)
+ {
+ WholeVectorMenuItem = wholeVectorMenuItem;
+ ByComponentVectorMenuItem = byComponentMenuItem;
+
+ WholeVectorMenuItem.Click += new System.EventHandler(OnWholeClicked);
+ ByComponentVectorMenuItem.Click += new System.EventHandler(OnByComponentClicked);
+
+ WholeVectorMenuItem.CheckedChanged += new System.EventHandler(OnWholeCheckedChange);
+ ByComponentVectorMenuItem.CheckedChanged += new System.EventHandler(OnByComponentCheckedChange);
+
+ ByComponentVectorXYLock = byComponentVectorXYLock;
+ OptionSetX = optionSetX;
+ OptionSetY = optionSetY;
+ Sensitivity = sensitivity;
+ Rotation = rotation;
+ LockXYLabel = lockXYLabel;
+ AccelCharts = accelCharts;
+
+ LockXYLabel.AutoSize = false;
+ LockXYLabel.TextAlign = ContentAlignment.MiddleCenter;
+
+ ByComponentVectorXYLock.CheckedChanged += new System.EventHandler(OnByComponentXYLockChecked);
+ ByComponentVectorXYLock.Checked = true;
+
+ Rotation.SnapTo(Sensitivity);
+
+ EnableWholeApplication();
+ }
+
+ #endregion Constructors
+
+ #region Properties
+
+ public ToolStripMenuItem WholeVectorMenuItem { get; }
+
+ public ToolStripMenuItem ByComponentVectorMenuItem { get; }
+
+ public CheckBox ByComponentVectorXYLock { get; }
+
+ public AccelOptionSet OptionSetX { get; }
+
+ public AccelOptionSet OptionSetY { get; }
+
+ public OptionXY Sensitivity { get; }
+
+ public Option Rotation { get; }
+
+ public AccelCharts AccelCharts { get; }
+
+ public Label ActiveValueTitleY { get; }
+
+ public Label LockXYLabel { get; }
+
+ public bool IsWhole { get; private set; }
+
+ #endregion Properties
+
+ #region Methods
+
+ public Vec2<AccelMode> GetModes()
+ {
+ var xMode = (AccelMode)OptionSetX.Options.AccelerationIndex;
+
+ return new Vec2<AccelMode>
+ {
+ x = xMode,
+ y = ByComponentVectorXYLock.Checked ? xMode : (AccelMode)OptionSetY.Options.AccelerationIndex
+ };
+ }
+
+ public Vec2<AccelArgs> GetArgs()
+ {
+ var xArgs = OptionSetX.GenerateArgs();
+
+ return new Vec2<AccelArgs>
+ {
+ x = xArgs,
+ y = ByComponentVectorXYLock.Checked ? xArgs : OptionSetY.GenerateArgs()
+ };
+
+ }
+
+ public void SetActiveValues(
+ double xSens,
+ double ySens,
+ double rotation,
+ int xMode,
+ int yMode,
+ AccelArgs xArgs,
+ AccelArgs yArgs,
+ bool isWhole)
+ {
+ Sensitivity.SetActiveValues(xSens, ySens);
+ Rotation.SetActiveValue(rotation);
+ OptionSetX.SetActiveValues(xMode, xArgs);
+ OptionSetY.SetActiveValues(yMode, yArgs);
+ WholeVectorMenuItem.Checked = isWhole;
+ ByComponentVectorMenuItem.Checked = !isWhole;
+ }
+
+ public void SetActiveValues(DriverSettings settings)
+ {
+ SetActiveValues(
+ settings.sensitivity.x,
+ settings.sensitivity.x,
+ settings.rotation,
+ (int)settings.modes.x,
+ (int)settings.modes.y,
+ settings.args.x,
+ settings.args.y,
+ settings.combineMagnitudes);
+ }
+
+ public void OnWholeClicked(object sender, EventArgs e)
+ {
+ if (!WholeVectorMenuItem.Checked)
+ {
+ WholeVectorMenuItem.Checked = true;
+ ByComponentVectorMenuItem.Checked = false;
+ }
+ }
+
+ public void OnByComponentClicked(object sender, EventArgs e)
+ {
+ if (!ByComponentVectorMenuItem.Checked)
+ {
+ WholeVectorMenuItem.Checked = false;
+ ByComponentVectorMenuItem.Checked = true;
+ }
+ }
+
+ public void OnWholeCheckedChange(object sender, EventArgs e)
+ {
+ if (WholeVectorMenuItem.Checked)
+ {
+ EnableWholeApplication();
+ }
+ }
+
+ public void OnByComponentCheckedChange(object sender, EventArgs e)
+ {
+ if (ByComponentVectorMenuItem.Checked)
+ {
+ EnableByComponentApplication();
+ }
+ }
+
+ public void ShowWholeSet()
+ {
+ OptionSetX.SetRegularMode();
+ OptionSetY.Hide();
+ AccelCharts.SetWidened();
+ SetActiveTitlesWhole();
+ }
+
+ public void ShowByComponentAsOneSet()
+ {
+ OptionSetX.SetTitleMode("X = Y");
+ OptionSetY.Hide();
+ AccelCharts.SetWidened();
+ SetActiveTitlesByComponents();
+ }
+
+ public void ShowByComponentAsTwoSets()
+ {
+ OptionSetX.SetTitleMode("X");
+ OptionSetY.SetTitleMode("Y");
+ OptionSetY.Show();
+ AccelCharts.SetNarrowed();
+ }
+
+ public void ShowByComponentSet()
+ {
+ if (ByComponentVectorXYLock.Checked)
+ {
+ ShowByComponentAsOneSet();
+ }
+ else
+ {
+ ShowByComponentAsTwoSets();
+ }
+ }
+
+ private void OnByComponentXYLockChecked(object sender, EventArgs e)
+ {
+ if (!IsWhole)
+ {
+ ShowByComponentSet();
+ }
+ }
+
+ public void EnableWholeApplication()
+ {
+ IsWhole = true;
+ ByComponentVectorXYLock.Hide();
+ ShowWholeSet();
+ }
+
+ public void EnableByComponentApplication()
+ {
+ IsWhole = false;
+ ByComponentVectorXYLock.Show();
+ ShowByComponentSet();
+ }
+
+ private void SetActiveTitlesWhole()
+ {
+ OptionSetX.ActiveValuesTitle.Left = OptionSetX.Options.Left + OptionSetX.Options.Width;
+ LockXYLabel.Width = (AccelCharts.SensitivityChart.Left - OptionSetX.ActiveValuesTitle.Left) / 2;
+ OptionSetX.ActiveValuesTitle.Width = LockXYLabel.Width;
+ LockXYLabel.Left = OptionSetX.ActiveValuesTitle.Left + OptionSetX.ActiveValuesTitle.Width;
+ Sensitivity.Fields.LockCheckBox.Left = LockXYLabel.Left + LockXYLabel.Width / 2 - Sensitivity.Fields.LockCheckBox.Width / 2;
+ ByComponentVectorXYLock.Left = Sensitivity.Fields.LockCheckBox.Left;
+ AlignActiveValues();
+ }
+
+ private void SetActiveTitlesByComponents()
+ {
+ OptionSetY.ActiveValuesTitle.Left = OptionSetY.Options.Left + OptionSetY.Options.Width;
+ OptionSetY.ActiveValuesTitle.Width = Constants.NarrowChartLeft - OptionSetY.ActiveValuesTitle.Left;
+ AlignActiveValues();
+ }
+
+ private void AlignActiveValues()
+ {
+ OptionSetX.AlignActiveValues();
+ OptionSetY.AlignActiveValues();
+ Sensitivity.AlignActiveValues();
+ Rotation.AlignActiveValues();
+ }
+
+ #endregion Methods
+ }
+}
diff --git a/grapher/Models/Options/CapOptions.cs b/grapher/Models/Options/CapOptions.cs
index 87bac88..5e47d7b 100644
--- a/grapher/Models/Options/CapOptions.cs
+++ b/grapher/Models/Options/CapOptions.cs
@@ -1,29 +1,27 @@
using grapher.Models.Options;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher
{
- public class CapOptions
+ public class CapOptions : OptionBase
{
+ #region Constants
- public const string GainCapFormatString = "0.##";
+
+ #endregion Constants
+
+ #region Constructors
public CapOptions(
ToolStripMenuItem velocityGainCapCheck,
ToolStripMenuItem legacyCapCheck,
- OptionXY capOption,
- OptionXY weightOption)
+ Option capOption)
{
VelocityGainCapCheck = velocityGainCapCheck;
LegacyCapCheck = legacyCapCheck;
CapOption = capOption;
- WeightOption = weightOption;
LegacyCapCheck.Click += new System.EventHandler(OnSensitivityCapCheckClick);
VelocityGainCapCheck.Click += new System.EventHandler(OnVelocityGainCapCheckClick);
@@ -34,20 +32,24 @@ namespace grapher
EnableVelocityGainCap();
}
+ #endregion Constructors
+
+ #region Properties
+
public ToolStripMenuItem LegacyCapCheck { get; }
public ToolStripMenuItem VelocityGainCapCheck { get; }
- public OptionXY CapOption { get; }
+ public Option CapOption { get; }
- public OptionXY WeightOption { get; }
+ public bool IsSensitivityGain { get; private set; }
- public double SensitivityCapX {
+ public double SensitivityCap {
get
{
if (IsSensitivityGain)
{
- return CapOption.Fields.X;
+ return CapOption.Field.Data;
}
else
{
@@ -56,52 +58,122 @@ namespace grapher
}
}
- public double SensitivityCapY {
+ public double VelocityGainCap {
get
{
if (IsSensitivityGain)
{
- return CapOption.Fields.Y;
+ return 0;
}
else
{
- return 0;
+ return CapOption.Field.Data;
}
}
}
- public double VelocityGainCap {
+ public override int Top
+ {
+ get
+ {
+ return CapOption.Top;
+ }
+ set
+ {
+ CapOption.Top = value;
+ }
+ }
+
+ public override int Height
+ {
get
{
- if (IsSensitivityGain)
- {
- return 0;
- }
- else
- {
- return CapOption.Fields.X;
- }
+ return CapOption.Height;
}
}
- public bool IsSensitivityGain { get; private set; }
+ public override int Left
+ {
+ get
+ {
+ return CapOption.Left;
+ }
+ set
+ {
+ CapOption.Left = value;
+ }
+ }
+
+ public override int Width
+ {
+ get
+ {
+ return CapOption.Width;
+ }
+ set
+ {
+ CapOption.Width = value;
+ }
+ }
- public void SetActiveValues(double gainCap, double sensCapX, double sensCapY, bool capGainEnabled)
+ public override bool Visible
+ {
+ get
+ {
+ return CapOption.Visible;
+ }
+ }
+
+ #endregion Properties
+
+ #region Methods
+
+ public override void Hide()
+ {
+ CapOption.Hide();
+ }
+
+ public void Show()
+ {
+ CapOption.Show();
+ }
+
+ public override void Show(string name)
+ {
+ CapOption.Show(name);
+ }
+
+ public void SnapTo(Option option)
+ {
+ Top = option.Top + option.Height + Constants.OptionVerticalSeperation;
+ }
+
+
+ public void SetActiveValues(double gainCap, double sensCap, bool capGainEnabled)
{
if (capGainEnabled)
{
- CapOption.ActiveValueLabels.X.FormatString = GainCapFormatString;
- CapOption.ActiveValueLabels.X.Prefix = "Gain";
- CapOption.SetActiveValues(gainCap, gainCap);
+ CapOption.ActiveValueLabel.FormatString = Constants.GainCapFormatString;
+ CapOption.ActiveValueLabel.Prefix = "Gain";
+ CapOption.SetActiveValue(gainCap);
+ LegacyCapCheck.Checked = true;
+ VelocityGainCapCheck.Checked = false;
}
else
{
- CapOption.ActiveValueLabels.X.FormatString = ActiveValueLabel.DefaultFormatString;
- CapOption.ActiveValueLabels.X.Prefix = string.Empty;
- CapOption.SetActiveValues(sensCapX, sensCapY);
+ CapOption.ActiveValueLabel.FormatString = Constants.DefaultActiveValueFormatString;
+ CapOption.ActiveValueLabel.Prefix = string.Empty;
+ CapOption.SetActiveValue(sensCap);
+ LegacyCapCheck.Checked = false;
+ VelocityGainCapCheck.Checked = true;
}
}
+ public override void AlignActiveValues()
+ {
+ CapOption.AlignActiveValues();
+ }
+
void OnSensitivityCapCheckClick(object sender, EventArgs e)
{
if (!LegacyCapCheck.Checked)
@@ -139,19 +211,15 @@ namespace grapher
void EnableSensitivityCap()
{
IsSensitivityGain = true;
- CapOption.Fields.LockCheckBox.Enabled = true;
- WeightOption.Fields.LockCheckBox.Enabled = true;
CapOption.SetName("Sensitivity Cap");
}
void EnableVelocityGainCap()
{
IsSensitivityGain = false;
- CapOption.Fields.LockCheckBox.Checked = true;
- CapOption.Fields.LockCheckBox.Enabled = false;
- WeightOption.Fields.LockCheckBox.Checked = true;
- WeightOption.Fields.LockCheckBox.Enabled = false;
CapOption.SetName("Velocity Gain Cap");
}
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Options/IOption.cs b/grapher/Models/Options/IOption.cs
new file mode 100644
index 0000000..fff1623
--- /dev/null
+++ b/grapher/Models/Options/IOption.cs
@@ -0,0 +1,23 @@
+namespace grapher.Models.Options
+{
+ public interface IOption
+ {
+ int Top { get; set; }
+
+ int Height { get; }
+
+ int Left { get; }
+
+ int Width { get; }
+
+ int Beneath { get; }
+
+ bool Visible { get; }
+
+ void Show(string name);
+
+ void Hide();
+
+ void SnapTo(IOption option);
+ }
+}
diff --git a/grapher/Models/Options/OffsetOptions.cs b/grapher/Models/Options/OffsetOptions.cs
index 0b01ab9..b351ab5 100644
--- a/grapher/Models/Options/OffsetOptions.cs
+++ b/grapher/Models/Options/OffsetOptions.cs
@@ -1,13 +1,9 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher.Models.Options
{
- public class OffsetOptions
+ public class OffsetOptions : OptionBase
{
public OffsetOptions(
ToolStripMenuItem velocityGainOffsetCheck,
@@ -65,6 +61,73 @@ namespace grapher.Models.Options
}
}
+ public override int Top
+ {
+ get
+ {
+ return OffsetOption.Top;
+ }
+ set
+ {
+ OffsetOption.Top = value;
+ }
+ }
+
+ public override int Height
+ {
+ get
+ {
+ return OffsetOption.Height;
+ }
+ }
+
+ public override int Left
+ {
+ get
+ {
+ return OffsetOption.Left;
+ }
+ set
+ {
+ OffsetOption.Left = value;
+ }
+ }
+
+ public override int Width
+ {
+ get
+ {
+ return OffsetOption.Width;
+ }
+ set
+ {
+ OffsetOption.Width = value;
+ }
+ }
+
+ public override bool Visible
+ {
+ get
+ {
+ return OffsetOption.Visible;
+ }
+ }
+
+ public override void Hide()
+ {
+ OffsetOption.Hide();
+ }
+
+ public void Show()
+ {
+ OffsetOption.Show();
+ }
+
+ public override void Show(string name)
+ {
+ OffsetOption.Show(name);
+ }
+
public void SetActiveValue(double offset, double legacyOffset)
{
if (offset > 0)
@@ -77,6 +140,11 @@ namespace grapher.Models.Options
}
}
+ public override void AlignActiveValues()
+ {
+ OffsetOption.AlignActiveValues();
+ }
+
public void OnVelocityGainOffsetClick(object sender, EventArgs e)
{
if (!VelocityGainOffsetCheck.Checked)
diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs
index b0ef374..5dc022b 100644
--- a/grapher/Models/Options/Option.cs
+++ b/grapher/Models/Options/Option.cs
@@ -1,23 +1,30 @@
using grapher.Models.Options;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher
{
- public class Option
+ public class Option : OptionBase
{
+ #region Constructors
+
public Option(
Field field,
Label label,
- ActiveValueLabel activeValueLabel)
+ ActiveValueLabel activeValueLabel,
+ int left)
{
Field = field;
Label = label;
ActiveValueLabel = activeValueLabel;
+ Left = left;
+
+ label.AutoSize = false;
+ label.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ label.Width = Field.Left - left - Constants.OptionLabelBoxSeperation;
+ label.Height = Field.Height;
+
+ ActiveValueLabel.Left = Field.Left + Field.Width;
+ ActiveValueLabel.Height = Field.Height;
}
public Option(
@@ -25,11 +32,13 @@ namespace grapher
Form containingForm,
double defaultData,
Label label,
+ int left,
ActiveValueLabel activeValueLabel)
: this(
new Field(box, containingForm, defaultData),
label,
- activeValueLabel)
+ activeValueLabel,
+ left)
{
}
@@ -38,6 +47,7 @@ namespace grapher
Form containingForm,
double defaultData,
Label label,
+ int left,
ActiveValueLabel activeValueLabel,
string startingName)
: this(
@@ -45,22 +55,82 @@ namespace grapher
containingForm,
defaultData,
label,
+ left,
activeValueLabel)
{
SetName(startingName);
}
+ #endregion Constructors
+
+ #region Properties
+
public Field Field { get; }
public Label Label { get; }
public ActiveValueLabel ActiveValueLabel { get; }
+ public override int Top
+ {
+ get
+ {
+ return Field.Top;
+ }
+ set
+ {
+ Field.Top = value;
+ Label.Top = value;
+ ActiveValueLabel.Top = value;
+ }
+ }
+
+ public override int Height
+ {
+ get
+ {
+ return Field.Height;
+ }
+ }
+
+ public override int Left
+ {
+ get
+ {
+ return Label.Left;
+ }
+ set
+ {
+ Label.Left = value;
+ }
+ }
+ public override int Width
+ {
+ get
+ {
+ return Field.Left + Field.Width - Label.Left;
+ }
+ set
+ {
+ }
+ }
+
+ public override bool Visible
+ {
+ get
+ {
+ return Field.Box.Visible;
+ }
+ }
+
+ #endregion Properties
+
+ #region Methods
+
public void SetName(string name)
{
Label.Text = name;
//Label.Left = Convert.ToInt32((Field.Box.Left / 2.0) - (Label.Width / 2.0)); //Centered
- Label.Left = Convert.ToInt32(Field.Box.Left - Label.Width - 10); //Right-aligned
}
public void SetActiveValue(double value)
@@ -68,7 +138,7 @@ namespace grapher
ActiveValueLabel.SetValue(value);
}
- public void Hide()
+ public override void Hide()
{
Field.Box.Hide();
Label.Hide();
@@ -87,11 +157,18 @@ namespace grapher
ActiveValueLabel.SetValue(value);
}
- public void Show(string name)
+ public override void Show(string name)
{
SetName(name);
Show();
}
+
+ public override void AlignActiveValues()
+ {
+ ActiveValueLabel.Align();
+ }
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Options/OptionBase.cs b/grapher/Models/Options/OptionBase.cs
new file mode 100644
index 0000000..5f6dca1
--- /dev/null
+++ b/grapher/Models/Options/OptionBase.cs
@@ -0,0 +1,33 @@
+namespace grapher.Models.Options
+{
+ public abstract class OptionBase : IOption
+ {
+ public abstract int Top { get; set; }
+
+ public abstract int Height { get; }
+
+ public abstract int Left { get; set; }
+
+ public abstract int Width { get; set; }
+
+ public int Beneath {
+ get
+ {
+ return Top + Height + Constants.OptionVerticalSeperation;
+ }
+ }
+
+ public abstract bool Visible { get; }
+
+ public abstract void Show(string Name);
+
+ public abstract void Hide();
+
+ public abstract void AlignActiveValues();
+
+ public virtual void SnapTo(IOption option)
+ {
+ Top = option.Beneath;
+ }
+ }
+}
diff --git a/grapher/Models/Options/OptionXY.cs b/grapher/Models/Options/OptionXY.cs
index 8e22617..6d6129a 100644
--- a/grapher/Models/Options/OptionXY.cs
+++ b/grapher/Models/Options/OptionXY.cs
@@ -1,20 +1,18 @@
using grapher.Models.Options;
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher
{
- public class OptionXY
+ public class OptionXY : OptionBase
{
+ #region Constructors
public OptionXY(FieldXY fields, Label label, ActiveValueLabelXY activeValueLabels)
{
Fields = fields;
Label = label;
ActiveValueLabels = activeValueLabels;
+ ActiveValueLabels.Left = fields.CombinedWidth + fields.Left;
}
public OptionXY(
@@ -24,9 +22,8 @@ namespace grapher
Form containingForm,
double defaultData,
Label label,
- AccelCharts accelCharts,
ActiveValueLabelXY activeValueLabels)
- : this(new FieldXY(xBox, yBox, lockCheckBox, containingForm, defaultData, accelCharts), label, activeValueLabels)
+ : this(new FieldXY(xBox, yBox, lockCheckBox, containingForm, defaultData), label, activeValueLabels)
{
}
@@ -38,8 +35,7 @@ namespace grapher
double defaultData,
Label label,
ActiveValueLabelXY activeValueLabels,
- string startingName,
- AccelCharts accelCharts):
+ string startingName):
this(
xBox,
yBox,
@@ -47,18 +43,76 @@ namespace grapher
containingForm,
defaultData,
label,
- accelCharts,
activeValueLabels)
{
SetName(startingName);
}
+ #endregion Constructors
+
+ #region Properties
+
public FieldXY Fields { get; }
public Label Label { get; }
public ActiveValueLabelXY ActiveValueLabels { get; }
+ public override int Top
+ {
+ get
+ {
+ return Fields.Top;
+ }
+ set
+ {
+ Fields.Top = value;
+ }
+ }
+
+ public override int Height
+ {
+ get
+ {
+ return Fields.Height;
+ }
+ }
+
+ public override int Left
+ {
+ get
+ {
+ return Fields.Left;
+ }
+ set
+ {
+ Fields.Left = value;
+ }
+ }
+
+ public override int Width
+ {
+ get
+ {
+ return Fields.Width;
+ }
+ set
+ {
+ Fields.Width = value;
+ }
+ }
+
+ public override bool Visible
+ {
+ get
+ {
+ return Fields.Visible;
+ }
+ }
+ #endregion Properties
+
+ #region Methods
+
public void SetName(string name)
{
Label.Text = name;
@@ -71,7 +125,12 @@ namespace grapher
ActiveValueLabels.SetValues(x, y);
}
- public void Hide()
+ public override void AlignActiveValues()
+ {
+ ActiveValueLabels.AlignActiveValues();
+ }
+
+ public override void Hide()
{
Fields.Hide();
Fields.LockCheckBox.Hide();
@@ -85,12 +144,13 @@ namespace grapher
Label.Show();
}
- public void Show(string name)
+ public override void Show(string name)
{
SetName(name);
Show();
}
+ #endregion Methods
}
}
diff --git a/grapher/Models/Serialized/DriverSettings.cs b/grapher/Models/Serialized/DriverSettings.cs
index cdccf88..d7c9444 100644
--- a/grapher/Models/Serialized/DriverSettings.cs
+++ b/grapher/Models/Serialized/DriverSettings.cs
@@ -4,11 +4,17 @@ using System.Threading;
namespace grapher.Models.Serialized
{
+ #region Enumerations
+
public enum AccelMode
{
- linear, classic, natural, logarithmic, sigmoid, naturalgain, sigmoidgain, power, noaccel
+ linear, classic, natural, naturalgain, sigmoidgain, power, noaccel
}
+ #endregion Enumerations
+
+ #region Structs
+
[StructLayout(LayoutKind.Sequential)]
public struct AccelArgs
{
@@ -33,10 +39,14 @@ namespace grapher.Models.Serialized
public T y;
}
+ #endregion Structs
+
[StructLayout(LayoutKind.Sequential)]
[Serializable]
public class DriverSettings
{
+ #region Fields
+
private static readonly IntPtr UnmanagedSettingsHandle =
Marshal.AllocHGlobal(Marshal.SizeOf<DriverSettings>());
private static object UnmanagedSettingsLock = new object();
@@ -48,6 +58,10 @@ namespace grapher.Models.Serialized
public Vec2<double> sensitivity;
public double minimumTime;
+ #endregion Fields
+
+ #region Methods
+
public static DriverSettings GetActive()
{
DriverInterop.GetActiveSettings(UnmanagedSettingsHandle);
@@ -97,5 +111,7 @@ namespace grapher.Models.Serialized
*/
return true;
}
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Serialized/GUISettings.cs b/grapher/Models/Serialized/GUISettings.cs
index 7c8e9a4..2543104 100644
--- a/grapher/Models/Serialized/GUISettings.cs
+++ b/grapher/Models/Serialized/GUISettings.cs
@@ -1,17 +1,13 @@
using Newtonsoft.Json;
using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
namespace grapher.Models.Serialized
{
[Serializable]
public class GUISettings
{
+ #region Constructors
+
public GUISettings() {}
public GUISettings(bool autoWrite, int dpi, int pollRate)
@@ -21,6 +17,10 @@ namespace grapher.Models.Serialized
PollRate = pollRate;
}
+ #endregion Constructors
+
+ #region Properties
+
[JsonProperty(Order = 1)]
public bool AutoWriteToDriverOnStartup { get; set; }
@@ -29,5 +29,10 @@ namespace grapher.Models.Serialized
[JsonProperty(Order = 3)]
public int PollRate { get; set; }
+
+ [JsonProperty(Order = 4)]
+ public bool ShowLastMouseMove { get; set; }
+
+ #endregion Properties
}
}
diff --git a/grapher/Models/Serialized/RawAccelSettings.cs b/grapher/Models/Serialized/RawAccelSettings.cs
index 7aed917..3f5aebc 100644
--- a/grapher/Models/Serialized/RawAccelSettings.cs
+++ b/grapher/Models/Serialized/RawAccelSettings.cs
@@ -1,26 +1,25 @@
using Newtonsoft.Json;
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
namespace grapher.Models.Serialized
{
[Serializable]
public class RawAccelSettings
{
- public const string DefaultSettingsFileName = @"settings.json";
+ #region Fields
+
public static readonly string ExecutingDirectory = AppDomain.CurrentDomain.BaseDirectory;
- public static readonly string DefaultSettingsFile = Path.Combine(ExecutingDirectory, DefaultSettingsFileName);
+ public static readonly string DefaultSettingsFile = Path.Combine(ExecutingDirectory, Constants.DefaultSettingsFileName);
public static readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings
{
MissingMemberHandling = MissingMemberHandling.Error,
};
+ #endregion Fields
+
+ #region Constructors
+
public RawAccelSettings() { }
public RawAccelSettings(
@@ -31,10 +30,18 @@ namespace grapher.Models.Serialized
GUISettings = guiSettings;
}
+ #endregion Constructors
+
+ #region Properties
+
public GUISettings GUISettings { get; set; }
public DriverSettings AccelerationSettings { get; set; }
+ #endregion Properties
+
+ #region Methods
+
public static RawAccelSettings Load()
{
return Load(DefaultSettingsFile);
@@ -75,5 +82,7 @@ namespace grapher.Models.Serialized
{
File.WriteAllText(file, JsonConvert.SerializeObject(this, Formatting.Indented));
}
+
+ #endregion Methods
}
}
diff --git a/grapher/Models/Serialized/SettingsManager.cs b/grapher/Models/Serialized/SettingsManager.cs
index c300bde..ccffc3f 100644
--- a/grapher/Models/Serialized/SettingsManager.cs
+++ b/grapher/Models/Serialized/SettingsManager.cs
@@ -6,18 +6,26 @@ namespace grapher.Models.Serialized
{
public class SettingsManager
{
+ #region Constructors
+
public SettingsManager(
ManagedAccel activeAccel,
Field dpiField,
Field pollRateField,
- ToolStripMenuItem autoWrite)
+ ToolStripMenuItem autoWrite,
+ ToolStripMenuItem showLastMouseMove)
{
ActiveAccel = activeAccel;
DpiField = dpiField;
PollRateField = pollRateField;
AutoWriteMenuItem = autoWrite;
+ ShowLastMouseMoveMenuItem = showLastMouseMove;
}
+ #endregion Constructors
+
+ #region Properties
+
public ManagedAccel ActiveAccel { get; }
public RawAccelSettings RawAccelSettings { get; private set; }
@@ -28,6 +36,12 @@ namespace grapher.Models.Serialized
private ToolStripMenuItem AutoWriteMenuItem { get; set; }
+ private ToolStripMenuItem ShowLastMouseMoveMenuItem { get; set; }
+
+ #endregion Properties
+
+ #region Methods
+
public void UpdateActiveSettings(DriverSettings settings, Action afterAccelSettingsUpdate = null)
{
settings.SendToDriverAndUpdate(ActiveAccel, () =>
@@ -37,7 +51,8 @@ namespace grapher.Models.Serialized
{
AutoWriteToDriverOnStartup = AutoWriteMenuItem.Checked,
DPI = (int)DpiField.Data,
- PollRate = (int)PollRateField.Data
+ PollRate = (int)PollRateField.Data,
+ ShowLastMouseMove = ShowLastMouseMoveMenuItem.Checked,
};
RawAccelSettings.Save();
@@ -53,6 +68,7 @@ namespace grapher.Models.Serialized
DpiField.SetToEntered(RawAccelSettings.GUISettings.DPI);
PollRateField.SetToEntered(RawAccelSettings.GUISettings.PollRate);
AutoWriteMenuItem.Checked = RawAccelSettings.GUISettings.AutoWriteToDriverOnStartup;
+ ShowLastMouseMoveMenuItem.Checked = RawAccelSettings.GUISettings.ShowLastMouseMove;
}
public void Startup()
@@ -80,9 +96,12 @@ namespace grapher.Models.Serialized
{
AutoWriteToDriverOnStartup = AutoWriteMenuItem.Checked,
DPI = (int)DpiField.Data,
- PollRate = (int)PollRateField.Data
+ PollRate = (int)PollRateField.Data,
+ ShowLastMouseMove = ShowLastMouseMoveMenuItem.Checked,
});
RawAccelSettings.Save();
}
+
+ #endregion Methods
}
}
diff --git a/grapher/Program.cs b/grapher/Program.cs
index b36ece3..85fd040 100644
--- a/grapher/Program.cs
+++ b/grapher/Program.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher
diff --git a/grapher/grapher.csproj b/grapher/grapher.csproj
index 28322bb..74e2959 100644
--- a/grapher/grapher.csproj
+++ b/grapher/grapher.csproj
@@ -53,8 +53,10 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Constants\Constants.cs" />
<Compile Include="Layouts\NaturalGainLayout.cs" />
<Compile Include="Layouts\SigmoidGainLayout.cs" />
+ <Compile Include="Models\AccelGUIFactory.cs" />
<Compile Include="Models\Calculations\AccelCalculator.cs" />
<Compile Include="Models\Calculations\AccelChartData.cs" />
<Compile Include="Models\Calculations\AccelData.cs" />
@@ -63,9 +65,11 @@
<Compile Include="Models\Charts\EstimatedPoints.cs" />
<Compile Include="Models\Mouse\MouseWatcher.cs" />
<Compile Include="Models\Mouse\PointData.cs" />
- <Compile Include="Models\Options\AccelOptions.cs" />
+ <Compile Include="Models\Options\AccelTypeOptions.cs" />
+ <Compile Include="Models\Options\AccelOptionSet.cs" />
<Compile Include="Models\Options\ActiveValueLabel.cs" />
<Compile Include="Models\Options\ActiveValueLabelXY.cs" />
+ <Compile Include="Models\Options\ApplyOptions.cs" />
<Compile Include="Models\Options\CapOptions.cs" />
<Compile Include="Models\Charts\ChartXY.cs" />
<Compile Include="Models\Fields\Field.cs" />
@@ -80,13 +84,14 @@
<Compile Include="Layouts\DefaultLayout.cs" />
<Compile Include="Layouts\LayoutBase.cs" />
<Compile Include="Layouts\LinearLayout.cs" />
- <Compile Include="Layouts\LogLayout.cs" />
<Compile Include="Layouts\NaturalLayout.cs" />
<Compile Include="Layouts\OffLayout.cs" />
<Compile Include="Layouts\PowerLayout.cs" />
- <Compile Include="Layouts\SigmoidLayout.cs" />
+ <Compile Include="Models\Options\IOption.cs" />
<Compile Include="Models\Options\OffsetOptions.cs" />
<Compile Include="Models\Options\Option.cs" />
+ <Compile Include="Layouts\OptionLayout.cs" />
+ <Compile Include="Models\Options\OptionBase.cs" />
<Compile Include="Models\Options\OptionXY.cs" />
<Compile Include="Models\Serialized\GUISettings.cs" />
<Compile Include="Models\Serialized\DriverSettings.cs" />