diff options
| author | Jacob Palecki <[email protected]> | 2020-09-01 02:39:09 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-01 02:39:09 -0700 |
| commit | 4aa2f3ed741dcbd39233e125a34cac8163267d8d (patch) | |
| tree | 59399d8d793e7aa35c3a79fe369d19f7c3935ae4 /grapher/Models/Options | |
| parent | Add constants class and separate classes into regions (diff) | |
| download | rawaccel-4aa2f3ed741dcbd39233e125a34cac8163267d8d.tar.xz rawaccel-4aa2f3ed741dcbd39233e125a34cac8163267d8d.zip | |
Move constants to central class
Diffstat (limited to 'grapher/Models/Options')
| -rw-r--r-- | grapher/Models/Options/AccelOptions.cs | 11 | ||||
| -rw-r--r-- | grapher/Models/Options/ActiveValueLabel.cs | 6 | ||||
| -rw-r--r-- | grapher/Models/Options/ActiveValueLabelXY.cs | 14 | ||||
| -rw-r--r-- | grapher/Models/Options/ApplyOptions.cs | 1 | ||||
| -rw-r--r-- | grapher/Models/Options/CapOptions.cs | 5 |
5 files changed, 13 insertions, 24 deletions
diff --git a/grapher/Models/Options/AccelOptions.cs b/grapher/Models/Options/AccelOptions.cs index 224c5cb..8c01585 100644 --- a/grapher/Models/Options/AccelOptions.cs +++ b/grapher/Models/Options/AccelOptions.cs @@ -11,13 +11,6 @@ namespace grapher { public class AccelOptions { - #region Constants - - public const int PossibleOptionsCount = 4; - public const int PossibleOptionsXYCount = 2; - - #endregion Constants - #region Fields public static readonly Dictionary<string, LayoutBase> AccelerationTypes = new List<LayoutBase> @@ -49,12 +42,12 @@ namespace grapher AccelDropdown.Items.AddRange(AccelerationTypes.Keys.ToArray()); AccelDropdown.SelectedIndexChanged += new System.EventHandler(OnIndexChanged); - if (options.Length > PossibleOptionsCount) + if (options.Length > Constants.PossibleOptionsCount) { throw new Exception("Layout given too many options."); } - if (optionsXY.Length > PossibleOptionsXYCount) + if (optionsXY.Length > Constants.PossibleOptionsXYCount) { throw new Exception("Layout given too many options."); } diff --git a/grapher/Models/Options/ActiveValueLabel.cs b/grapher/Models/Options/ActiveValueLabel.cs index b2355b5..d2b43ab 100644 --- a/grapher/Models/Options/ActiveValueLabel.cs +++ b/grapher/Models/Options/ActiveValueLabel.cs @@ -12,8 +12,6 @@ namespace grapher.Models.Options { #region Constants - public const string DefaultFormatString = "0.######"; - public static readonly Color ActiveValueFontColor = Color.FromArgb(255, 65, 65, 65); #endregion Constants @@ -29,13 +27,13 @@ namespace grapher.Models.Options public ActiveValueLabel(Label valueLabel, Label centeringLabel) { ValueLabel = valueLabel; - ValueLabel.ForeColor = ActiveValueFontColor; + ValueLabel.ForeColor = Constants.ActiveValueFontColor; Left = centeringLabel.Left; Width = centeringLabel.Width; ValueLabel.AutoSize = false; ValueLabel.TextAlign = ContentAlignment.MiddleCenter; - FormatString = DefaultFormatString; + FormatString = Constants.DefaultActiveValueFormatString; Prefix = string.Empty; } diff --git a/grapher/Models/Options/ActiveValueLabelXY.cs b/grapher/Models/Options/ActiveValueLabelXY.cs index 553ce48..c8caddf 100644 --- a/grapher/Models/Options/ActiveValueLabelXY.cs +++ b/grapher/Models/Options/ActiveValueLabelXY.cs @@ -10,8 +10,6 @@ namespace grapher.Models.Options { #region Constants - public const int ActiveLabelXYSeparation = 2; - public const string ShortenedFormatString = "0.###"; #endregion Constants @@ -25,11 +23,11 @@ namespace grapher.Models.Options Y = y; FullWidth = x.Width; - ShortenedWidth = (FullWidth - ActiveLabelXYSeparation) / 2; + ShortenedWidth = (FullWidth - Constants.ActiveLabelXYSeparation) / 2; - Y.Left = X.Left + ShortenedWidth + ActiveLabelXYSeparation; + Y.Left = X.Left + ShortenedWidth + Constants.ActiveLabelXYSeparation; Y.Width = ShortenedWidth; - Y.FormatString = ShortenedFormatString; + Y.FormatString = Constants.ShortenedFormatString; Combined = false; SetCombined(); @@ -72,7 +70,7 @@ namespace grapher.Models.Options { if (!Combined) { - X.FormatString = ActiveValueLabel.DefaultFormatString; + X.FormatString = Constants.DefaultActiveValueFormatString; X.Width = FullWidth; X.Prefix = string.Empty; Y.Hide(); @@ -85,7 +83,7 @@ namespace grapher.Models.Options { if (Combined) { - X.FormatString = ShortenedFormatString; + X.FormatString = Constants.ShortenedFormatString; X.Width = ShortenedWidth; X.Prefix = "X"; Y.Prefix = "Y"; @@ -95,6 +93,6 @@ namespace grapher.Models.Options Combined = false; } - #region Methods + #endregion Methods } } diff --git a/grapher/Models/Options/ApplyOptions.cs b/grapher/Models/Options/ApplyOptions.cs index a269b49..703f0d5 100644 --- a/grapher/Models/Options/ApplyOptions.cs +++ b/grapher/Models/Options/ApplyOptions.cs @@ -31,6 +31,7 @@ namespace grapher.Models.Options #endregion Constructors #region Properties + public ToolStripMenuItem WholeVectorMenuItem { get; } public ToolStripMenuItem ByComponentVectorMenuItem { get; } diff --git a/grapher/Models/Options/CapOptions.cs b/grapher/Models/Options/CapOptions.cs index 9d903ec..62f74a3 100644 --- a/grapher/Models/Options/CapOptions.cs +++ b/grapher/Models/Options/CapOptions.cs @@ -12,7 +12,6 @@ namespace grapher { #region Constants - public const string GainCapFormatString = "0.##"; #endregion Constants @@ -103,7 +102,7 @@ namespace grapher { if (capGainEnabled) { - CapOption.ActiveValueLabels.X.FormatString = GainCapFormatString; + CapOption.ActiveValueLabels.X.FormatString = Constants.GainCapFormatString; CapOption.ActiveValueLabels.X.Prefix = "Gain"; CapOption.SetActiveValues(gainCap, gainCap); SensitivityCapCheck.Checked = true; @@ -111,7 +110,7 @@ namespace grapher } else { - CapOption.ActiveValueLabels.X.FormatString = ActiveValueLabel.DefaultFormatString; + CapOption.ActiveValueLabels.X.FormatString = Constants.DefaultActiveValueFormatString; CapOption.ActiveValueLabels.X.Prefix = string.Empty; CapOption.SetActiveValues(sensCapX, sensCapY); SensitivityCapCheck.Checked = false; |