diff options
| author | Jacob Palecki <[email protected]> | 2020-09-01 21:45:42 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-01 21:45:42 -0700 |
| commit | 95cc3ed0a0bf66f5535b873f245bc1c35a145478 (patch) | |
| tree | de1a9f20dee0239cf7a2204945249b497deb8f9e | |
| parent | Add X Y labels for by component (diff) | |
| download | rawaccel-95cc3ed0a0bf66f5535b873f245bc1c35a145478.tar.xz rawaccel-95cc3ed0a0bf66f5535b873f245bc1c35a145478.zip | |
intermittent commit - large commit halfway done
| -rw-r--r-- | grapher/Constants/Constants.cs | 14 | ||||
| -rw-r--r-- | grapher/Form1.Designer.cs | 294 | ||||
| -rw-r--r-- | grapher/Form1.cs | 2 | ||||
| -rw-r--r-- | grapher/Layouts/LayoutBase.cs | 15 | ||||
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 69 | ||||
| -rw-r--r-- | grapher/Models/AccelGUIFactory.cs | 208 | ||||
| -rw-r--r-- | grapher/Models/Fields/Field.cs | 48 | ||||
| -rw-r--r-- | grapher/Models/Options/AccelOptionSet.cs | 169 | ||||
| -rw-r--r-- | grapher/Models/Options/AccelTypeOptions.cs (renamed from grapher/Models/Options/AccelOptions.cs) | 91 | ||||
| -rw-r--r-- | grapher/Models/Options/CapOptions.cs | 58 | ||||
| -rw-r--r-- | grapher/Models/Options/Option.cs | 48 | ||||
| -rw-r--r-- | grapher/grapher.csproj | 3 |
12 files changed, 690 insertions, 329 deletions
diff --git a/grapher/Constants/Constants.cs b/grapher/Constants/Constants.cs index 61fa663..833512b 100644 --- a/grapher/Constants/Constants.cs +++ b/grapher/Constants/Constants.cs @@ -54,7 +54,7 @@ namespace grapher public const int PossibleOptionsCount = 4; /// <summary> Possible x/y options to display in a layout. </summary> - public const int PossibleOptionsXYCount = 2; + public const int PossibleOptionsXYCount = 0; /// <summary> Horizontal separation between charts, in pixels. </summary> public const int ChartSeparationHorizontal = 10; @@ -62,8 +62,20 @@ namespace grapher /// <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> Format string for shortened x and y fields. </summary> public const string ShortenedFieldFormatString = "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"; #endregion Constants #region ReadOnly diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs index 18a4c32..15f2d04 100644 --- a/grapher/Form1.Designer.cs +++ b/grapher/Form1.Designer.cs @@ -30,30 +30,30 @@ namespace grapher /// </summary> private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea13 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend13 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series25 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.Series series26 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea14 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend14 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series27 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.Series series28 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea15 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend15 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series29 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.Series series30 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea16 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend16 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series31 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.Series series32 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea17 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend17 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series33 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.Series series34 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea18 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend18 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series35 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.Series series36 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea7 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend7 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series13 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Series series14 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea8 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend8 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series15 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Series series16 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea9 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend9 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series17 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Series series18 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea10 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend10 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series19 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Series series20 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea11 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend11 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series21 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Series series22 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea12 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend12 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series23 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Series series24 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.AccelerationChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.accelTypeDrop = new System.Windows.Forms.ComboBox(); this.sensitivityBoxX = new System.Windows.Forms.TextBox(); @@ -131,8 +131,8 @@ namespace grapher this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this.label12 = new System.Windows.Forms.Label(); + this.OptionSetXTitle = new System.Windows.Forms.Label(); + this.OptionSetYTitle = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.AccelerationChart)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.VelocityChart)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.GainChart)).BeginInit(); @@ -144,25 +144,25 @@ namespace grapher // // AccelerationChart // - chartArea13.AxisX.Title = "Speed (counts/ms)"; - chartArea13.AxisY.Title = "Sensitivity (magnitude ratio)"; - chartArea13.Name = "ChartArea1"; - this.AccelerationChart.ChartAreas.Add(chartArea13); - legend13.Name = "Legend1"; - this.AccelerationChart.Legends.Add(legend13); + chartArea7.AxisX.Title = "Speed (counts/ms)"; + chartArea7.AxisY.Title = "Sensitivity (magnitude ratio)"; + chartArea7.Name = "ChartArea1"; + this.AccelerationChart.ChartAreas.Add(chartArea7); + legend7.Name = "Legend1"; + this.AccelerationChart.Legends.Add(legend7); this.AccelerationChart.Location = new System.Drawing.Point(432, 0); this.AccelerationChart.Name = "AccelerationChart"; - series25.ChartArea = "ChartArea1"; - series25.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; - series25.Legend = "Legend1"; - series25.Name = "Accelerated Sensitivity"; - series26.ChartArea = "ChartArea1"; - series26.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; - series26.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - series26.Legend = "Legend1"; - series26.Name = "LastAccelVal"; - this.AccelerationChart.Series.Add(series25); - this.AccelerationChart.Series.Add(series26); + series13.ChartArea = "ChartArea1"; + series13.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; + series13.Legend = "Legend1"; + series13.Name = "Accelerated Sensitivity"; + series14.ChartArea = "ChartArea1"; + series14.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; + series14.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + series14.Legend = "Legend1"; + series14.Name = "LastAccelVal"; + this.AccelerationChart.Series.Add(series13); + this.AccelerationChart.Series.Add(series14); this.AccelerationChart.Size = new System.Drawing.Size(723, 328); this.AccelerationChart.TabIndex = 0; this.AccelerationChart.Text = "Sensitivity"; @@ -329,7 +329,7 @@ namespace grapher // // sensitivityBoxY // - this.sensitivityBoxY.Location = new System.Drawing.Point(145, 46); + this.sensitivityBoxY.Location = new System.Drawing.Point(147, 46); this.sensitivityBoxY.Name = "sensitivityBoxY"; this.sensitivityBoxY.Size = new System.Drawing.Size(34, 20); this.sensitivityBoxY.TabIndex = 22; @@ -363,50 +363,50 @@ namespace grapher // // VelocityChart // - chartArea14.AxisX.Title = "Speed (count/ms)"; - chartArea14.AxisY.Title = "Output Speed (counts/ms)"; - chartArea14.Name = "ChartArea1"; - this.VelocityChart.ChartAreas.Add(chartArea14); - legend14.Name = "Legend1"; - this.VelocityChart.Legends.Add(legend14); + chartArea8.AxisX.Title = "Speed (count/ms)"; + chartArea8.AxisY.Title = "Output Speed (counts/ms)"; + chartArea8.Name = "ChartArea1"; + this.VelocityChart.ChartAreas.Add(chartArea8); + legend8.Name = "Legend1"; + this.VelocityChart.Legends.Add(legend8); this.VelocityChart.Location = new System.Drawing.Point(432, 334); this.VelocityChart.Name = "VelocityChart"; - series27.ChartArea = "ChartArea1"; - series27.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; - series27.Legend = "Legend1"; - series27.Name = "Mouse Velocity"; - series28.ChartArea = "ChartArea1"; - series28.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; - series28.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - series28.Legend = "Legend1"; - series28.Name = "LastVelocityVal"; - this.VelocityChart.Series.Add(series27); - this.VelocityChart.Series.Add(series28); + series15.ChartArea = "ChartArea1"; + series15.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; + series15.Legend = "Legend1"; + series15.Name = "Mouse Velocity"; + series16.ChartArea = "ChartArea1"; + series16.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; + series16.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + series16.Legend = "Legend1"; + series16.Name = "LastVelocityVal"; + this.VelocityChart.Series.Add(series15); + this.VelocityChart.Series.Add(series16); this.VelocityChart.Size = new System.Drawing.Size(723, 307); this.VelocityChart.TabIndex = 28; this.VelocityChart.Text = "chart1"; // // GainChart // - chartArea15.AxisX.Title = "Speed (counts/ms)"; - chartArea15.AxisY.Title = "Slope of Velocity Chart"; - chartArea15.Name = "ChartArea1"; - this.GainChart.ChartAreas.Add(chartArea15); - legend15.Name = "Legend1"; - this.GainChart.Legends.Add(legend15); + chartArea9.AxisX.Title = "Speed (counts/ms)"; + chartArea9.AxisY.Title = "Slope of Velocity Chart"; + chartArea9.Name = "ChartArea1"; + this.GainChart.ChartAreas.Add(chartArea9); + legend9.Name = "Legend1"; + this.GainChart.Legends.Add(legend9); this.GainChart.Location = new System.Drawing.Point(432, 647); this.GainChart.Name = "GainChart"; - series29.ChartArea = "ChartArea1"; - series29.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; - series29.Legend = "Legend1"; - series29.Name = "Velocity Gain"; - series30.ChartArea = "ChartArea1"; - series30.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; - series30.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - series30.Legend = "Legend1"; - series30.Name = "LastGainVal"; - this.GainChart.Series.Add(series29); - this.GainChart.Series.Add(series30); + series17.ChartArea = "ChartArea1"; + series17.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; + series17.Legend = "Legend1"; + series17.Name = "Velocity Gain"; + series18.ChartArea = "ChartArea1"; + series18.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; + series18.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + series18.Legend = "Legend1"; + series18.Name = "LastGainVal"; + this.GainChart.Series.Add(series17); + this.GainChart.Series.Add(series18); this.GainChart.Size = new System.Drawing.Size(723, 309); this.GainChart.TabIndex = 29; this.GainChart.Text = "chart1"; @@ -560,75 +560,75 @@ namespace grapher // // AccelerationChartY // - chartArea16.AxisX.Title = "Speed (counts/ms)"; - chartArea16.AxisY.Title = "Sensitivity (magnitude ratio)"; - chartArea16.Name = "ChartArea1"; - this.AccelerationChartY.ChartAreas.Add(chartArea16); - legend16.Name = "Legend1"; - this.AccelerationChartY.Legends.Add(legend16); + chartArea10.AxisX.Title = "Speed (counts/ms)"; + chartArea10.AxisY.Title = "Sensitivity (magnitude ratio)"; + chartArea10.Name = "ChartArea1"; + this.AccelerationChartY.ChartAreas.Add(chartArea10); + legend10.Name = "Legend1"; + this.AccelerationChartY.Legends.Add(legend10); this.AccelerationChartY.Location = new System.Drawing.Point(1161, 0); this.AccelerationChartY.Name = "AccelerationChartY"; - series31.ChartArea = "ChartArea1"; - series31.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; - series31.Legend = "Legend1"; - series31.Name = "Accelerated Sensitivity"; - series32.ChartArea = "ChartArea1"; - series32.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; - series32.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - series32.Legend = "Legend1"; - series32.Name = "LastAccelVal"; - this.AccelerationChartY.Series.Add(series31); - this.AccelerationChartY.Series.Add(series32); + series19.ChartArea = "ChartArea1"; + series19.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; + series19.Legend = "Legend1"; + series19.Name = "Accelerated Sensitivity"; + series20.ChartArea = "ChartArea1"; + series20.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; + series20.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + series20.Legend = "Legend1"; + series20.Name = "LastAccelVal"; + this.AccelerationChartY.Series.Add(series19); + this.AccelerationChartY.Series.Add(series20); this.AccelerationChartY.Size = new System.Drawing.Size(723, 328); this.AccelerationChartY.TabIndex = 31; this.AccelerationChartY.Text = "chart1"; // // VelocityChartY // - chartArea17.AxisX.Title = "Speed (count/ms)"; - chartArea17.AxisY.Title = "Output Speed (counts/ms)"; - chartArea17.Name = "ChartArea1"; - this.VelocityChartY.ChartAreas.Add(chartArea17); - legend17.Name = "Legend1"; - this.VelocityChartY.Legends.Add(legend17); + chartArea11.AxisX.Title = "Speed (count/ms)"; + chartArea11.AxisY.Title = "Output Speed (counts/ms)"; + chartArea11.Name = "ChartArea1"; + this.VelocityChartY.ChartAreas.Add(chartArea11); + legend11.Name = "Legend1"; + this.VelocityChartY.Legends.Add(legend11); this.VelocityChartY.Location = new System.Drawing.Point(1161, 334); this.VelocityChartY.Name = "VelocityChartY"; - series33.ChartArea = "ChartArea1"; - series33.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; - series33.Legend = "Legend1"; - series33.Name = "Mouse Velocity"; - series34.ChartArea = "ChartArea1"; - series34.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; - series34.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - series34.Legend = "Legend1"; - series34.Name = "LastVelocityVal"; - this.VelocityChartY.Series.Add(series33); - this.VelocityChartY.Series.Add(series34); + series21.ChartArea = "ChartArea1"; + series21.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; + series21.Legend = "Legend1"; + series21.Name = "Mouse Velocity"; + series22.ChartArea = "ChartArea1"; + series22.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; + series22.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + series22.Legend = "Legend1"; + series22.Name = "LastVelocityVal"; + this.VelocityChartY.Series.Add(series21); + this.VelocityChartY.Series.Add(series22); this.VelocityChartY.Size = new System.Drawing.Size(723, 307); this.VelocityChartY.TabIndex = 32; this.VelocityChartY.Text = "chart1"; // // GainChartY // - chartArea18.AxisX.Title = "Speed (counts/ms)"; - chartArea18.AxisY.Title = "Slope of Velocity Chart"; - chartArea18.Name = "ChartArea1"; - this.GainChartY.ChartAreas.Add(chartArea18); - legend18.Name = "Legend1"; - this.GainChartY.Legends.Add(legend18); + chartArea12.AxisX.Title = "Speed (counts/ms)"; + chartArea12.AxisY.Title = "Slope of Velocity Chart"; + chartArea12.Name = "ChartArea1"; + this.GainChartY.ChartAreas.Add(chartArea12); + legend12.Name = "Legend1"; + this.GainChartY.Legends.Add(legend12); this.GainChartY.Location = new System.Drawing.Point(1161, 647); this.GainChartY.Name = "GainChartY"; - series35.ChartArea = "ChartArea1"; - series35.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; - series35.Legend = "Legend1"; - series35.Name = "Velocity Gain"; - series36.ChartArea = "ChartArea1"; - series36.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; - series36.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - series36.Legend = "Legend1"; - series36.Name = "LastGainVal"; - this.GainChartY.Series.Add(series35); - this.GainChartY.Series.Add(series36); + series23.ChartArea = "ChartArea1"; + series23.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; + series23.Legend = "Legend1"; + series23.Name = "Velocity Gain"; + series24.ChartArea = "ChartArea1"; + series24.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; + series24.Color = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + series24.Legend = "Legend1"; + series24.Name = "LastGainVal"; + this.GainChartY.Series.Add(series23); + this.GainChartY.Series.Add(series24); this.GainChartY.Size = new System.Drawing.Size(723, 309); this.GainChartY.TabIndex = 33; this.GainChartY.Text = "chart1"; @@ -897,31 +897,31 @@ namespace grapher this.label10.TabIndex = 63; this.label10.Text = "Midpoint"; // - // label11 + // OptionSetXTitle // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(142, 94); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(14, 13); - this.label11.TabIndex = 64; - this.label11.Text = "X"; + 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"; // - // label12 + // OptionSetYTitle // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(300, 94); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(14, 13); - this.label12.TabIndex = 65; - this.label12.Text = "Y"; + this.OptionSetYTitle.AutoSize = true; + this.OptionSetYTitle.Location = new System.Drawing.Point(300, 94); + this.OptionSetYTitle.Name = "OptionSetYTitle"; + this.OptionSetYTitle.Size = new System.Drawing.Size(14, 13); + this.OptionSetYTitle.TabIndex = 65; + this.OptionSetYTitle.Text = "Y"; // // RawAcceleration // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1884, 956); - this.Controls.Add(this.label12); - this.Controls.Add(this.label11); + this.Controls.Add(this.OptionSetYTitle); + this.Controls.Add(this.OptionSetXTitle); this.Controls.Add(this.label10); this.Controls.Add(this.label9); this.Controls.Add(this.label8); @@ -1078,8 +1078,8 @@ namespace grapher private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label OptionSetXTitle; + private System.Windows.Forms.Label OptionSetYTitle; } } diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 20768ef..0b1b76c 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -74,8 +74,6 @@ namespace grapher limitBox, midpointBox, sensXYLock, - weightXYLock, - capXYLock, sensitivityLabel, rotationLabel, weightLabel, diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs index eed1716..0ad855a 100644 --- a/grapher/Layouts/LayoutBase.cs +++ b/grapher/Layouts/LayoutBase.cs @@ -40,7 +40,7 @@ namespace grapher.Layouts internal bool ButtonEnabled { get; set; } - public void Layout(Option[] options, OptionXY[] optionsXY, Button button) + public void Layout(Option[] options, Button button) { // Relies on AccelOptions to keep lengths correct. for (int i = 0; i < options.Length; i++) @@ -55,19 +55,6 @@ namespace grapher.Layouts } } - // Relies on AccelOptions to keep lengths correct. - for (int i = 0; i< optionsXY.Length; i++) - { - if (ShowOptionsXY[i]) - { - optionsXY[i].Show(); - } - else - { - optionsXY[i].Hide(); - } - } - button.Enabled = ButtonEnabled; } } diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index b9a578f..5ea3595 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -25,15 +25,10 @@ namespace grapher AccelCharts accelCharts, SettingsManager settings, ApplyOptions applyOptions, - AccelOptions accelOptions, OptionXY sensitivity, Option rotation, - OptionXY weight, - CapOptions cap, - Option offset, - Option acceleration, - Option limtOrExp, - Option midpoint, + AccelOptionSet optionSetX, + AccelOptionSet optionSetY, Button writeButton, Label mouseMoveLabel, ToolStripMenuItem scaleMenuItem) @@ -41,21 +36,14 @@ namespace grapher AccelForm = accelForm; AccelCalculator = accelCalculator; AccelCharts = accelCharts; - AccelerationOptions = accelOptions; ApplyOptions = applyOptions; Sensitivity = sensitivity; Rotation = rotation; - Weight = weight; - Cap = cap; - Offset = offset; - Acceleration = acceleration; - LimitOrExponent = limtOrExp; - Midpoint = midpoint; WriteButton = writeButton; ScaleMenuItem = scaleMenuItem; Settings = settings; Settings.Startup(); - UpdateGraph(); + RefreshOnRead(); MouseWatcher = new MouseWatcher(AccelForm, mouseMoveLabel, AccelCharts); @@ -76,23 +64,13 @@ namespace grapher public ApplyOptions ApplyOptions { get; } - public AccelOptions AccelerationOptions { get; } - public OptionXY Sensitivity { get; } public Option Rotation { get; } - public OptionXY Weight { get; } - - public CapOptions Cap { get; } - - public Option Offset { get; } - - public Option Acceleration { get; } - - public Option LimitOrExponent { get; } + public AccelOptionSet OptionSetX { get; } - public Option Midpoint { get; } + public AccelOptionSet OptionSetY { get; } public Button WriteButton { get; } @@ -117,28 +95,23 @@ namespace grapher combineMagnitudes = ApplyOptions.IsWhole, modes = new Vec2<AccelMode> { - x = (AccelMode)AccelerationOptions.AccelerationIndex + x = (AccelMode)OptionSetX.AccelTypeOptions.AccelerationIndex, + y = (AccelMode)OptionSetY.AccelTypeOptions.AccelerationIndex }, args = new Vec2<AccelArgs> { - x = new AccelArgs - { - offset = Offset.Field.Data, - 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 = OptionSetX.GenerateArgs(), + y = OptionSetY.GenerateArgs() }, minimumTime = .4 }); + RefreshOnRead(); + } + + public void RefreshOnRead() + { UpdateGraph(); + UpdateShownActiveValues(); } public void UpdateGraph() @@ -148,23 +121,17 @@ namespace grapher Settings.ActiveAccel, Settings.RawAccelSettings.AccelerationSettings); AccelCharts.Bind(); - UpdateShownActiveValues(); } 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); - 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); ApplyOptions.SetActive(settings.combineMagnitudes); - Cap.SetActiveValues(settings.args.x.gainCap, settings.args.x.scaleCap, settings.args.y.scaleCap, settings.args.x.gainCap > 0); + OptionSetX.SetActiveValues((int)settings.modes.x, settings.args.x); + OptionSetY.SetActiveValues((int)settings.modes.y, settings.args.y); AccelCharts.RefreshXY(settings.combineMagnitudes); } diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs index e7167e9..e4637ec 100644 --- a/grapher/Models/AccelGUIFactory.cs +++ b/grapher/Models/AccelGUIFactory.cs @@ -24,7 +24,8 @@ namespace grapher.Models Chart velocityChartY, Chart gainChart, Chart gainChartY, - ComboBox accelTypeDrop, + ComboBox accelTypeDropX, + ComboBox accelTypeDropY, Button writeButton, ToolStripMenuItem showVelocityGainToolStripMenuItem, ToolStripMenuItem wholeVectorToolStripMenuItem, @@ -42,21 +43,31 @@ namespace grapher.Models TextBox weightBoxY, TextBox capBoxX, TextBox capBoxY, - TextBox offsetBox, - TextBox accelerationBox, - TextBox limitBox, - TextBox midpointBox, + TextBox offsetBoxX, + TextBox offsetBoxY, + TextBox accelerationBoxX, + TextBox accelerationBoxY, + TextBox limitBoxX, + TextBox limitBoxY, + TextBox midpointBoxX, + TextBox midpointBoxY, CheckBox sensXYLock, CheckBox weightXYLock, CheckBox capXYLock, Label sensitivityLabel, Label rotationLabel, - Label weightLabel, - Label capLabel, - Label offsetLabel, - Label constantOneLabel, - Label constantTwoLabel, - Label constantThreeLabel, + 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 activeValueTitle, Label sensitivityActiveXLabel, Label sensitivityActiveYLabel, @@ -65,11 +76,17 @@ namespace grapher.Models Label weightActiveYLabel, Label capActiveXLabel, Label capActiveYLabel, - Label offsetActiveLabel, - Label accelerationActiveLabel, - Label limitExpActiveLabel, - Label midpointActiveLabel, + Label offsetActiveLabelX, + Label offsetActiveLabelY, + Label accelerationActiveLabelX, + Label accelerationActiveLabelY, + Label limitExpActiveLabelX, + Label limitExpActiveLabelY, + Label midpointActiveLabelX, + Label midpointActiveLabelY, Label accelTypeActiveLabel, + Label optionSetXTitle, + Label optionSetYTitle, Label mouseLabel) { var accelCharts = new AccelCharts( @@ -101,76 +118,142 @@ namespace grapher.Models new ActiveValueLabel(rotationActiveLabel, activeValueTitle), "Rotation"); - var weight = new OptionXY( + var weightX = new Option( weightBoxX, + form, + 1, + weightLabelX, + new ActiveValueLabel(weightActiveXLabel, activeValueTitle), + "Weight"); + + var weightY = new Option( weightBoxY, - weightXYLock, form, 1, - weightLabel, - new ActiveValueLabelXY( - new ActiveValueLabel(weightActiveXLabel, activeValueTitle), - new ActiveValueLabel(weightActiveYLabel, activeValueTitle)), + weightLabelY, + new ActiveValueLabel(weightActiveYLabel, activeValueTitle), "Weight"); - var cap = new OptionXY( + var capX = new Option( capBoxX, + form, + 0, + capLabelX, + new ActiveValueLabel(capActiveXLabel, activeValueTitle), + "Cap"); + + var capY = new Option( capBoxY, - capXYLock, form, 0, - capLabel, - new ActiveValueLabelXY( - new ActiveValueLabel(capActiveXLabel, activeValueTitle), - new ActiveValueLabel(capActiveYLabel, activeValueTitle)), + capLabelY, + new ActiveValueLabel(capActiveYLabel, activeValueTitle), "Cap"); - var offset = new Option( - offsetBox, + var offsetX = new Option( + offsetBoxX, form, 0, - offsetLabel, - new ActiveValueLabel(offsetActiveLabel, activeValueTitle), + offsetLabelX, + new ActiveValueLabel(offsetActiveLabelX, activeValueTitle), + "Offset"); + + var offsetY = new Option( + offsetBoxY, + form, + 0, + offsetLabelY, + new ActiveValueLabel(offsetActiveLabelY, activeValueTitle), "Offset"); // The name and layout of these options is handled by AccelerationOptions object. - var acceleration = new Option( - new Field(accelerationBox, form, 0), - constantOneLabel, - new ActiveValueLabel(accelerationActiveLabel, activeValueTitle)); - - var limitOrExponent = new Option( - new Field(limitBox, form, 2), - constantTwoLabel, - new ActiveValueLabel(limitExpActiveLabel, activeValueTitle)); - - var midpoint = new Option( - new Field(midpointBox, form, 0), - constantThreeLabel, - new ActiveValueLabel(midpointActiveLabel, activeValueTitle)); - - var accelerationOptions = new AccelOptions( - accelTypeDrop, + var accelerationX = new Option( + new Field(accelerationBoxX, form, 0), + constantOneLabelX, + new ActiveValueLabel(accelerationActiveLabelX, activeValueTitle)); + + var accelerationY = new Option( + new Field(accelerationBoxY, form, 0), + constantOneLabelY, + new ActiveValueLabel(accelerationActiveLabelY, activeValueTitle)); + + var limitOrExponentX = new Option( + new Field(limitBoxX, form, 2), + constantTwoLabelX, + new ActiveValueLabel(limitExpActiveLabelX, activeValueTitle)); + + var limitOrExponentY = new Option( + new Field(limitBoxY, form, 2), + constantTwoLabelY, + new ActiveValueLabel(limitExpActiveLabelY, activeValueTitle)); + + var midpointX = new Option( + new Field(midpointBoxX, form, 0), + constantThreeLabelX, + new ActiveValueLabel(midpointActiveLabelX, activeValueTitle)); + + var midpointY = new Option( + new Field(midpointBoxY, form, 0), + constantThreeLabelY, + new ActiveValueLabel(midpointActiveLabelY, activeValueTitle)); + + var accelerationOptionsX = new AccelTypeOptions( + accelTypeDropX, new Option[] { - offset, - acceleration, - limitOrExponent, - midpoint, + offsetX, + accelerationX, + limitOrExponentX, + midpointX, + capX, + weightX }, - new OptionXY[] + writeButton, + new ActiveValueLabel(accelTypeActiveLabel, activeValueTitle)); + + var accelerationOptionsY = new AccelTypeOptions( + accelTypeDropY, + new Option[] { - weight, - cap, + offsetY, + accelerationY, + limitOrExponentY, + midpointY, + capY, + weightY }, writeButton, new ActiveValueLabel(accelTypeActiveLabel, activeValueTitle)); - var capOptions = new CapOptions( + var capOptionsX = new CapOptions( sensitivityToolStripMenuItem, velocityGainToolStripMenuItem, - cap, - weight); + capX); + + var capOptionsY = new CapOptions( + sensitivityToolStripMenuItem, + velocityGainToolStripMenuItem, + capY); + + var optionsSetX = new AccelOptionSet( + optionSetXTitle, + accelerationOptionsX, + accelerationX, + capOptionsX, + weightX, + offsetX, + limitOrExponentX, + midpointX); + + var optionsSetY = new AccelOptionSet( + optionSetYTitle, + accelerationOptionsY, + accelerationY, + capOptionsY, + weightY, + offsetY, + limitOrExponentY, + midpointY); var accelCalculator = new AccelCalculator( new Field(dpiTextBox.TextBox, form, Constants.DefaultDPI), @@ -188,15 +271,10 @@ namespace grapher.Models accelCharts, settings, applyOptions, - accelerationOptions, sensitivity, rotation, - weight, - capOptions, - offset, - acceleration, - limitOrExponent, - midpoint, + optionsSetX, + optionsSetY, writeButton, mouseLabel, scaleMenuItem); diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs index 7651a37..6f38314 100644 --- a/grapher/Models/Fields/Field.cs +++ b/grapher/Models/Fields/Field.cs @@ -58,6 +58,54 @@ namespace grapher public FieldState PreviousState { get; private set; } + 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 diff --git a/grapher/Models/Options/AccelOptionSet.cs b/grapher/Models/Options/AccelOptionSet.cs new file mode 100644 index 0000000..2d15ad6 --- /dev/null +++ b/grapher/Models/Options/AccelOptionSet.cs @@ -0,0 +1,169 @@ +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.Models.Options +{ + public class AccelOptionSet + { + public AccelOptionSet( + Label titleLabel, + AccelTypeOptions accelTypeOptions, + Option acceleration, + CapOptions cap, + Option weight, + Option offset, + Option limitOrExp, + Option midpoint) + { + TitleLabel = titleLabel; + AccelTypeOptions = accelTypeOptions; + Acceleration = acceleration; + Cap = cap; + Weight = weight; + Offset = offset; + LimitOrExponent = limitOrExp; + Midpoint = midpoint; + + AccelTypeOptions.ShowFullText(); + + TitleLabel.Top = TopAnchor; + } + + public int TopAnchor { get; } + + public Label TitleLabel { get; } + + public AccelTypeOptions AccelTypeOptions { get; } + + public Option Acceleration { get; } + + public CapOptions Cap { get; } + + public Option Weight { get; } + + public Option Offset { get; } + + public Option LimitOrExponent { get; } + + public Option Midpoint { get; } + + public bool IsTitleMode { get; private set; } + + public void SetRegularMode() + { + if (IsTitleMode) + { + IsTitleMode = false; + + HideTitle(); + AccelTypeOptions.Left = Acceleration.Left; + AccelTypeOptions.Width = Acceleration.Width; + AccelTypeOptions.ShowFullText(); + } + } + + public void SetTitleMode() + { + if (!IsTitleMode) + { + IsTitleMode = true; + + AccelTypeOptions.Left = Acceleration.Field.Left; + AccelTypeOptions.Width = Acceleration.Field.Width; + AccelTypeOptions.ShowFullText(); + DisplayTitle(); + } + } + + public void Hide() + { + TitleLabel.Hide(); + AccelTypeOptions.Hide(); + Acceleration.Hide(); + Cap.Hide(); + Weight.Hide(); + Offset.Hide(); + LimitOrExponent.Hide(); + Midpoint.Hide(); + } + + public void Show() + { + if (IsTitleMode) + { + TitleLabel.Show(); + } + + AccelTypeOptions.Show(); + Acceleration.Show(); + Cap.Show(); + Weight.Show(); + Offset.Show(); + LimitOrExponent.Show(); + Midpoint.Show(); + } + + public void DisplayTitle() + { + TitleLabel.Show(); + + SetOptionsTop(TitleLabel.Top + TitleLabel.Height + Constants.OptionVerticalSeperation); + } + + public void HideTitle() + { + TitleLabel.Hide(); + + SetOptionsTop(TopAnchor); + } + + public void SetArgs(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.Field.Data; + args.midpoint = Midpoint.Field.Data; + args.weight = Weight.Field.Data; + } + + public AccelArgs GenerateArgs() + { + AccelArgs args = new AccelArgs(); + SetArgs(args); + return args; + } + + public void SetActiveValues(int mode, AccelArgs args) + { + AccelTypeOptions.SetActiveValue(mode); + Weight.SetActiveValue(args.weight); + Cap.SetActiveValues(args.gainCap, args.scaleCap, args.gainCap > 0); + Offset.SetActiveValue(args.offset); + Acceleration.SetActiveValue(args.accel); + LimitOrExponent.SetActiveValue(args.exponent); + Midpoint.SetActiveValue(args.midpoint); + } + + private void SetOptionsTop(int top) + { + AccelTypeOptions.Top = top; + Acceleration.Top = AccelTypeOptions.Top+ AccelTypeOptions.Height + Constants.OptionVerticalSeperation; + Cap.SnapTo(Acceleration); + Weight.SnapTo(Cap); + Offset.SnapTo(Weight); + LimitOrExponent.SnapTo(Offset); + Midpoint.SnapTo(LimitOrExponent); + } + } +} diff --git a/grapher/Models/Options/AccelOptions.cs b/grapher/Models/Options/AccelTypeOptions.cs index 8c01585..2359b8d 100644 --- a/grapher/Models/Options/AccelOptions.cs +++ b/grapher/Models/Options/AccelTypeOptions.cs @@ -9,7 +9,7 @@ using System.Windows.Forms; namespace grapher { - public class AccelOptions + public class AccelTypeOptions { #region Fields @@ -30,10 +30,9 @@ namespace grapher #region Constructors - public AccelOptions( + public AccelTypeOptions( ComboBox accelDropdown, Option[] options, - OptionXY[] optionsXY, Button writeButton, ActiveValueLabel activeValueLabel) { @@ -47,17 +46,12 @@ namespace grapher throw new Exception("Layout given too many options."); } - if (optionsXY.Length > Constants.PossibleOptionsXYCount) - { - throw new Exception("Layout given too many options."); - } - Options = options; - OptionsXY = optionsXY; WriteButton = writeButton; ActiveValueLabel = activeValueLabel; Layout("Off"); + ShowingDefault = true; } #endregion Constructors @@ -74,29 +68,104 @@ namespace grapher public Option[] Options { get; } - public OptionXY[] OptionsXY { get; } + public int Top + { + get + { + return AccelDropdown.Top; + } + set + { + AccelDropdown.Top = value; + } + } + + public int Height + { + get + { + return AccelDropdown.Height; + } + set + { + AccelDropdown.Height = value; + } + } + + public int Left + { + get + { + return AccelDropdown.Left; + } + set + { + AccelDropdown.Left = value; + } + } + + public int Width + { + get + { + return AccelDropdown.Width; + } + set + { + AccelDropdown.Width = value; + } + } + + private bool ShowingDefault { get; set; } #endregion Properties #region Methods + public void Hide() + { + AccelDropdown.Hide(); + } + + public void Show() + { + AccelDropdown.Show(); + } + public void SetActiveValue(int index) { var name = AccelerationTypes.Where(t => t.Value.Index == index).FirstOrDefault().Value.Name; ActiveValueLabel.SetValue(name); } + public void ShowFullText() + { + if (ShowingDefault) + { + AccelDropdown.Text = Constants.AccelDropDownDefaultFullText; + } + } + + public void ShowShortenedText() + { + if (ShowingDefault) + { + AccelDropdown.Text = Constants.AccelDropDownDefaultShortText; + } + } + private void OnIndexChanged(object sender, EventArgs e) { var accelerationTypeString = AccelDropdown.SelectedItem.ToString(); Layout(accelerationTypeString); + ShowingDefault = false; } private void Layout(string type) { var accelerationType = AccelerationTypes[type]; AccelerationIndex = accelerationType.Index; - accelerationType.Layout(Options, OptionsXY, WriteButton); + accelerationType.Layout(Options, WriteButton); } #endregion Methods diff --git a/grapher/Models/Options/CapOptions.cs b/grapher/Models/Options/CapOptions.cs index 62f74a3..6768a85 100644 --- a/grapher/Models/Options/CapOptions.cs +++ b/grapher/Models/Options/CapOptions.cs @@ -20,14 +20,12 @@ namespace grapher public CapOptions( ToolStripMenuItem sensitivityCapCheck, ToolStripMenuItem velocityGainCapCheck, - OptionXY capOption, - OptionXY weightOption) + Option capOption) { SensitivityCapCheck = sensitivityCapCheck; VelocityGainCapCheck = velocityGainCapCheck; CapOption = capOption; - WeightOption = weightOption; SensitivityCapCheck.Click += new System.EventHandler(OnSensitivityCapCheckClick); VelocityGainCapCheck.Click += new System.EventHandler(OnVelocityGainCapCheckClick); @@ -46,32 +44,16 @@ namespace grapher public ToolStripMenuItem VelocityGainCapCheck { get; } - public OptionXY CapOption { get; } - - public OptionXY WeightOption { get; } + public Option CapOption { get; } public bool IsSensitivityGain { get; private set; } - public double SensitivityCapX { + public double SensitivityCap { get { if (IsSensitivityGain) { - return CapOption.Fields.X; - } - else - { - return 0; - } - } - } - - public double SensitivityCapY { - get - { - if (IsSensitivityGain) - { - return CapOption.Fields.Y; + return CapOption.Field.Data; } else { @@ -89,7 +71,7 @@ namespace grapher } else { - return CapOption.Fields.X; + return CapOption.Field.Data; } } } @@ -98,21 +80,31 @@ namespace grapher #region Methods - public void SetActiveValues(double gainCap, double sensCapX, double sensCapY, bool capGainEnabled) + public void Hide() + { + CapOption.Hide(); + } + + public void Show() + { + CapOption.Show(); + } + + public void SetActiveValues(double gainCap, double sensCap, bool capGainEnabled) { if (capGainEnabled) { - CapOption.ActiveValueLabels.X.FormatString = Constants.GainCapFormatString; - CapOption.ActiveValueLabels.X.Prefix = "Gain"; - CapOption.SetActiveValues(gainCap, gainCap); + CapOption.ActiveValueLabel.FormatString = Constants.GainCapFormatString; + CapOption.ActiveValueLabel.Prefix = "Gain"; + CapOption.SetActiveValue(gainCap); SensitivityCapCheck.Checked = true; VelocityGainCapCheck.Checked = false; } else { - CapOption.ActiveValueLabels.X.FormatString = Constants.DefaultActiveValueFormatString; - CapOption.ActiveValueLabels.X.Prefix = string.Empty; - CapOption.SetActiveValues(sensCapX, sensCapY); + CapOption.ActiveValueLabel.FormatString = Constants.DefaultActiveValueFormatString; + CapOption.ActiveValueLabel.Prefix = string.Empty; + CapOption.SetActiveValue(sensCap); SensitivityCapCheck.Checked = false; VelocityGainCapCheck.Checked = true; } @@ -155,18 +147,12 @@ 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"); } diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index c5336a6..bd2c9a1 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -62,6 +62,47 @@ namespace grapher public ActiveValueLabel ActiveValueLabel { get; } + public int Top + { + get + { + return Field.Top; + } + set + { + Field.Top = value; + Label.Top = value; + } + } + + public int Height + { + get + { + return Field.Height; + } + } + + public int Left + { + get + { + return Label.Left; + } + set + { + Label.Left = value; + Field.Left = value + Label.Width + Constants.OptionLabelBoxSeperation; + } + } + public int Width + { + get + { + return Field.Left + Field.Width - Label.Left; + } + } + #endregion Properties #region Methods @@ -70,7 +111,7 @@ namespace grapher { 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 + Left = Label.Left; } public void SetActiveValue(double value) @@ -103,6 +144,11 @@ namespace grapher Show(); } + + public void SnapTo(Option option) + { + Top = option.Top + option.Height + Constants.OptionVerticalSeperation; + } #endregion Methods } diff --git a/grapher/grapher.csproj b/grapher/grapher.csproj index d382041..8481e75 100644 --- a/grapher/grapher.csproj +++ b/grapher/grapher.csproj @@ -65,7 +65,8 @@ <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" /> |