diff options
| author | Jacob Palecki <[email protected]> | 2020-08-20 14:22:14 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-20 14:22:14 -0700 |
| commit | 7dbeae9d4cf108e78072b356d832123f12e42a90 (patch) | |
| tree | 9711fddfb5241a3dc859cd421aa4937d38a8852f | |
| parent | Display active values (diff) | |
| download | rawaccel-7dbeae9d4cf108e78072b356d832123f12e42a90.tar.xz rawaccel-7dbeae9d4cf108e78072b356d832123f12e42a90.zip | |
Add accel type to active values and tweak color
| -rw-r--r-- | grapher/Form1.Designer.cs | 40 | ||||
| -rw-r--r-- | grapher/Form1.cs | 7 | ||||
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 1 | ||||
| -rw-r--r-- | grapher/Models/Options/AccelOptions.cs | 13 | ||||
| -rw-r--r-- | grapher/Models/Options/ActiveValueLabel.cs | 73 | ||||
| -rw-r--r-- | grapher/Models/Options/ActiveValueLabelXY.cs | 22 | ||||
| -rw-r--r-- | grapher/Models/Options/CapOptions.cs | 10 |
7 files changed, 136 insertions, 30 deletions
diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs index bb6b9ee..d9cec5c 100644 --- a/grapher/Form1.Designer.cs +++ b/grapher/Form1.Designer.cs @@ -129,7 +129,7 @@ namespace grapher this.AccelerationChart.ChartAreas.Add(chartArea1); legend1.Name = "Legend1"; this.AccelerationChart.Legends.Add(legend1); - this.AccelerationChart.Location = new System.Drawing.Point(322, 0); + this.AccelerationChart.Location = new System.Drawing.Point(333, 0); this.AccelerationChart.Name = "AccelerationChart"; series1.ChartArea = "ChartArea1"; series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; @@ -370,7 +370,7 @@ namespace grapher this.VelocityChart.ChartAreas.Add(chartArea2); legend2.Name = "Legend1"; this.VelocityChart.Legends.Add(legend2); - this.VelocityChart.Location = new System.Drawing.Point(322, 334); + this.VelocityChart.Location = new System.Drawing.Point(333, 334); this.VelocityChart.Name = "VelocityChart"; series3.ChartArea = "ChartArea1"; series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; @@ -395,7 +395,7 @@ namespace grapher this.GainChart.ChartAreas.Add(chartArea3); legend3.Name = "Legend1"; this.GainChart.Legends.Add(legend3); - this.GainChart.Location = new System.Drawing.Point(322, 647); + this.GainChart.Location = new System.Drawing.Point(333, 647); this.GainChart.Name = "GainChart"; series5.ChartArea = "ChartArea1"; series5.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; @@ -420,7 +420,7 @@ namespace grapher this.advancedToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1773, 24); + this.menuStrip1.Size = new System.Drawing.Size(1786, 24); this.menuStrip1.TabIndex = 30; this.menuStrip1.Text = "menuStrip1"; // @@ -524,7 +524,7 @@ namespace grapher this.AccelerationChartY.ChartAreas.Add(chartArea4); legend4.Name = "Legend1"; this.AccelerationChartY.Legends.Add(legend4); - this.AccelerationChartY.Location = new System.Drawing.Point(1051, 0); + this.AccelerationChartY.Location = new System.Drawing.Point(1062, 0); this.AccelerationChartY.Name = "AccelerationChartY"; series7.ChartArea = "ChartArea1"; series7.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; @@ -549,7 +549,7 @@ namespace grapher this.VelocityChartY.ChartAreas.Add(chartArea5); legend5.Name = "Legend1"; this.VelocityChartY.Legends.Add(legend5); - this.VelocityChartY.Location = new System.Drawing.Point(1051, 334); + this.VelocityChartY.Location = new System.Drawing.Point(1062, 334); this.VelocityChartY.Name = "VelocityChartY"; series9.ChartArea = "ChartArea1"; series9.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; @@ -574,7 +574,7 @@ namespace grapher this.GainChartY.ChartAreas.Add(chartArea6); legend6.Name = "Legend1"; this.GainChartY.Legends.Add(legend6); - this.GainChartY.Location = new System.Drawing.Point(1051, 647); + this.GainChartY.Location = new System.Drawing.Point(1062, 647); this.GainChartY.Name = "GainChartY"; series11.ChartArea = "ChartArea1"; series11.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; @@ -603,7 +603,7 @@ namespace grapher // ActiveValueTitle // this.ActiveValueTitle.AutoSize = true; - this.ActiveValueTitle.Location = new System.Drawing.Point(249, 30); + this.ActiveValueTitle.Location = new System.Drawing.Point(248, 30); this.ActiveValueTitle.Name = "ActiveValueTitle"; this.ActiveValueTitle.Size = new System.Drawing.Size(67, 13); this.ActiveValueTitle.TabIndex = 35; @@ -612,7 +612,7 @@ namespace grapher // SensitivityActiveXLabel // this.SensitivityActiveXLabel.AutoSize = true; - this.SensitivityActiveXLabel.Location = new System.Drawing.Point(259, 49); + this.SensitivityActiveXLabel.Location = new System.Drawing.Point(258, 49); this.SensitivityActiveXLabel.Name = "SensitivityActiveXLabel"; this.SensitivityActiveXLabel.Size = new System.Drawing.Size(14, 13); this.SensitivityActiveXLabel.TabIndex = 36; @@ -621,7 +621,7 @@ namespace grapher // SensitivityActiveYLabel // this.SensitivityActiveYLabel.AutoSize = true; - this.SensitivityActiveYLabel.Location = new System.Drawing.Point(279, 49); + this.SensitivityActiveYLabel.Location = new System.Drawing.Point(286, 50); this.SensitivityActiveYLabel.Name = "SensitivityActiveYLabel"; this.SensitivityActiveYLabel.Size = new System.Drawing.Size(14, 13); this.SensitivityActiveYLabel.TabIndex = 37; @@ -630,7 +630,7 @@ namespace grapher // RotationActiveLabel // this.RotationActiveLabel.AutoSize = true; - this.RotationActiveLabel.Location = new System.Drawing.Point(269, 75); + this.RotationActiveLabel.Location = new System.Drawing.Point(268, 75); this.RotationActiveLabel.Name = "RotationActiveLabel"; this.RotationActiveLabel.Size = new System.Drawing.Size(13, 13); this.RotationActiveLabel.TabIndex = 38; @@ -639,7 +639,7 @@ namespace grapher // AccelTypeActiveLabel // this.AccelTypeActiveLabel.AutoSize = true; - this.AccelTypeActiveLabel.Location = new System.Drawing.Point(252, 98); + 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; @@ -648,7 +648,7 @@ namespace grapher // AccelerationActiveLabel // this.AccelerationActiveLabel.AutoSize = true; - this.AccelerationActiveLabel.Location = new System.Drawing.Point(269, 128); + 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; @@ -657,7 +657,7 @@ namespace grapher // CapActiveXLabel // this.CapActiveXLabel.AutoSize = true; - this.CapActiveXLabel.Location = new System.Drawing.Point(260, 151); + this.CapActiveXLabel.Location = new System.Drawing.Point(259, 151); this.CapActiveXLabel.Name = "CapActiveXLabel"; this.CapActiveXLabel.Size = new System.Drawing.Size(13, 13); this.CapActiveXLabel.TabIndex = 41; @@ -675,7 +675,7 @@ namespace grapher // WeightActiveYLabel // this.WeightActiveYLabel.AutoSize = true; - this.WeightActiveYLabel.Location = new System.Drawing.Point(278, 180); + this.WeightActiveYLabel.Location = new System.Drawing.Point(286, 180); this.WeightActiveYLabel.Name = "WeightActiveYLabel"; this.WeightActiveYLabel.Size = new System.Drawing.Size(13, 13); this.WeightActiveYLabel.TabIndex = 43; @@ -684,7 +684,7 @@ namespace grapher // CapActiveYLabel // this.CapActiveYLabel.AutoSize = true; - this.CapActiveYLabel.Location = new System.Drawing.Point(278, 151); + this.CapActiveYLabel.Location = new System.Drawing.Point(286, 151); this.CapActiveYLabel.Name = "CapActiveYLabel"; this.CapActiveYLabel.Size = new System.Drawing.Size(13, 13); this.CapActiveYLabel.TabIndex = 44; @@ -693,7 +693,7 @@ namespace grapher // OffsetActiveLabel // this.OffsetActiveLabel.AutoSize = true; - this.OffsetActiveLabel.Location = new System.Drawing.Point(269, 206); + 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; @@ -702,7 +702,7 @@ namespace grapher // LimitExpActiveLabel // this.LimitExpActiveLabel.AutoSize = true; - this.LimitExpActiveLabel.Location = new System.Drawing.Point(269, 232); + 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; @@ -711,7 +711,7 @@ namespace grapher // MidpointActiveLabel // this.MidpointActiveLabel.AutoSize = true; - this.MidpointActiveLabel.Location = new System.Drawing.Point(269, 255); + 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; @@ -721,7 +721,7 @@ namespace grapher // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1773, 958); + this.ClientSize = new System.Drawing.Size(1786, 958); this.Controls.Add(this.MidpointActiveLabel); this.Controls.Add(this.LimitExpActiveLabel); this.Controls.Add(this.OffsetActiveLabel); diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 01e7b20..1e38809 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -99,6 +99,10 @@ namespace grapher 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( sensitivityBoxX, @@ -185,7 +189,8 @@ namespace grapher weight, cap, }, - writeButton); + writeButton, + new ActiveValueLabel(AccelTypeActiveLabel, ActiveValueTitle)); var capOptions = new CapOptions( sensitivityToolStripMenuItem, diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index afc3def..e345743 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -109,6 +109,7 @@ namespace grapher { Sensitivity.SetActiveValues(ManagedAcceleration.SensitivityX, ManagedAcceleration.SensitivityY); Rotation.SetActiveValue(ManagedAcceleration.Rotation); + AccelerationOptions.SetActiveValue(ManagedAcceleration.Type); Offset.SetActiveValue(ManagedAcceleration.Offset); Acceleration.SetActiveValue(ManagedAcceleration.Acceleration); Cap.SetActiveValues(ManagedAcceleration.GainCap, ManagedAcceleration.CapX, ManagedAcceleration.CapY, ManagedAcceleration.GainCapEnabled); diff --git a/grapher/Models/Options/AccelOptions.cs b/grapher/Models/Options/AccelOptions.cs index 8da873f..cd7c4e5 100644 --- a/grapher/Models/Options/AccelOptions.cs +++ b/grapher/Models/Options/AccelOptions.cs @@ -1,4 +1,5 @@ using grapher.Layouts; +using grapher.Models.Options; using System; using System.Collections.Generic; using System.Linq; @@ -31,7 +32,8 @@ namespace grapher ComboBox accelDropdown, Option[] options, OptionXY[] optionsXY, - Button writeButton) + Button writeButton, + ActiveValueLabel activeValueLabel) { AccelDropdown = accelDropdown; AccelDropdown.Items.Clear(); @@ -51,6 +53,7 @@ namespace grapher Options = options; OptionsXY = optionsXY; WriteButton = writeButton; + ActiveValueLabel = activeValueLabel; Layout("Default"); } @@ -61,10 +64,18 @@ namespace grapher 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(); diff --git a/grapher/Models/Options/ActiveValueLabel.cs b/grapher/Models/Options/ActiveValueLabel.cs index ecafaba..138775a 100644 --- a/grapher/Models/Options/ActiveValueLabel.cs +++ b/grapher/Models/Options/ActiveValueLabel.cs @@ -11,22 +11,73 @@ namespace grapher.Models.Options public class ActiveValueLabel { public const string DefaultFormatString = "0.######"; + public static readonly Color ActiveValueFontColor = Color.FromArgb(255, 65, 65, 65); + + private string _prefix; + private string _value; public ActiveValueLabel(Label valueLabel, Label centeringLabel) { ValueLabel = valueLabel; - ValueLabel.ForeColor = Color.DarkGray; - ValueLabel.Left = centeringLabel.Left; - ValueLabel.Width = centeringLabel.Width; + ValueLabel.ForeColor = ActiveValueFontColor; + Left = centeringLabel.Left; + Width = centeringLabel.Width; ValueLabel.AutoSize = false; ValueLabel.TextAlign = ContentAlignment.MiddleCenter; + + FormatString = DefaultFormatString; + Prefix = string.Empty; } public Label ValueLabel { get; } - private int Left { get; } + public string FormatString { get; set; } + + public string Prefix + { + get { return _prefix; } + set + { + _prefix = value; + RefreshText(); + } + } + + private string Value + { + get { return _value; } + set + { + _value = value; + RefreshText(); + } + } - private int Width { get; } + public int Left + { + get + { + return ValueLabel.Left; + } + + set + { + ValueLabel.Left = value; + } + } + + public int Width + { + get + { + return ValueLabel.Width; + } + + set + { + ValueLabel.Width = value; + } + } public void Hide() { @@ -40,7 +91,17 @@ namespace grapher.Models.Options public void SetValue(double value) { - ValueLabel.Text = value.ToString(DefaultFormatString); + SetValue(value.ToString(FormatString)); + } + + public void SetValue(string value) + { + Value = value; + } + + public void RefreshText() + { + ValueLabel.Text = string.IsNullOrWhiteSpace(Prefix) ? Value: $"{Prefix}: {Value}"; } } } diff --git a/grapher/Models/Options/ActiveValueLabelXY.cs b/grapher/Models/Options/ActiveValueLabelXY.cs index b3b580f..12506e9 100644 --- a/grapher/Models/Options/ActiveValueLabelXY.cs +++ b/grapher/Models/Options/ActiveValueLabelXY.cs @@ -8,7 +8,8 @@ namespace grapher.Models.Options { public class ActiveValueLabelXY { - public const int ActiveLabelXYSeparation = 4; + public const int ActiveLabelXYSeparation = 2; + public const string ShortenedFormatString = "0.###"; public ActiveValueLabelXY( ActiveValueLabel x, @@ -16,6 +17,14 @@ namespace grapher.Models.Options { X = x; Y = y; + + FullWidth = x.Width; + ShortenedWidth = (FullWidth - ActiveLabelXYSeparation) / 2; + + Y.Left = X.Left + ShortenedWidth + ActiveLabelXYSeparation; + Y.Width = ShortenedWidth; + Y.FormatString = ShortenedFormatString; + Combined = false; SetCombined(); } @@ -26,6 +35,10 @@ namespace grapher.Models.Options public bool Combined { get; private set; } + private int FullWidth { get; } + + private int ShortenedWidth { get; } + public void SetValues(double x, double y) { X.SetValue(x); @@ -45,6 +58,9 @@ namespace grapher.Models.Options { if (!Combined) { + X.FormatString = ActiveValueLabel.DefaultFormatString; + X.Width = FullWidth; + X.Prefix = string.Empty; Y.Hide(); } @@ -55,6 +71,10 @@ namespace grapher.Models.Options { if (Combined) { + X.FormatString = ShortenedFormatString; + X.Width = ShortenedWidth; + X.Prefix = "X"; + Y.Prefix = "Y"; Y.Show(); } diff --git a/grapher/Models/Options/CapOptions.cs b/grapher/Models/Options/CapOptions.cs index fedda08..493561a 100644 --- a/grapher/Models/Options/CapOptions.cs +++ b/grapher/Models/Options/CapOptions.cs @@ -1,4 +1,5 @@ -using System; +using grapher.Models.Options; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -9,6 +10,9 @@ namespace grapher { public class CapOptions { + + public const string GainCapFormatString = "0.##"; + public CapOptions( ToolStripMenuItem sensitivityCapCheck, ToolStripMenuItem velocityGainCapCheck, @@ -86,10 +90,14 @@ namespace grapher { if (capGainEnabled) { + CapOption.ActiveValueLabels.X.FormatString = GainCapFormatString; + CapOption.ActiveValueLabels.X.Prefix = "Gain"; CapOption.SetActiveValues(gainCap, gainCap); } else { + CapOption.ActiveValueLabels.X.FormatString = ActiveValueLabel.DefaultFormatString; + CapOption.ActiveValueLabels.X.Prefix = string.Empty; CapOption.SetActiveValues(sensCapX, sensCapY); } } |