diff options
| author | Jacob Palecki <[email protected]> | 2021-09-15 23:16:43 -0700 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-09-23 22:34:51 -0400 |
| commit | 8878091a2cab77b0433daea7a47033e1c35e42c1 (patch) | |
| tree | 58dd2c7ee901acd809230a1bc86d6fd5b569593a /grapher/Models/Options | |
| parent | Mostly working cap type in GUI (diff) | |
| download | rawaccel-8878091a2cab77b0433daea7a47033e1c35e42c1.tar.xz rawaccel-8878091a2cab77b0433daea7a47033e1c35e42c1.zip | |
Cap type options now fully working
Diffstat (limited to 'grapher/Models/Options')
| -rw-r--r-- | grapher/Models/Options/AccelTypeOptions.cs | 3 | ||||
| -rw-r--r-- | grapher/Models/Options/Cap/CapOptions.cs | 62 | ||||
| -rw-r--r-- | grapher/Models/Options/Cap/CapTypeOptions.cs | 27 | ||||
| -rw-r--r-- | grapher/Models/Options/ComboBoxOptionsBase.cs | 11 |
4 files changed, 70 insertions, 33 deletions
diff --git a/grapher/Models/Options/AccelTypeOptions.cs b/grapher/Models/Options/AccelTypeOptions.cs index 9086b41..3d2f840 100644 --- a/grapher/Models/Options/AccelTypeOptions.cs +++ b/grapher/Models/Options/AccelTypeOptions.cs @@ -2,10 +2,7 @@ using grapher.Models.Options; using grapher.Models.Options.Cap; using grapher.Models.Options.LUT; -using grapher.Models.Serialized; using System; -using System.Collections.Generic; -using System.Linq; using System.Windows.Forms; namespace grapher diff --git a/grapher/Models/Options/Cap/CapOptions.cs b/grapher/Models/Options/Cap/CapOptions.cs index e959dee..ac34abf 100644 --- a/grapher/Models/Options/Cap/CapOptions.cs +++ b/grapher/Models/Options/Cap/CapOptions.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; using static grapher.Models.Options.Cap.CapTypeOptions; @@ -10,6 +6,20 @@ namespace grapher.Models.Options.Cap { public class CapOptions : OptionBase { + #region Constants + + public const string InCapLabel = "Cap: Input"; + public const string OutCapLabel = "Cap: Output"; + + #endregion Constants + + #region Fields + + private int _top; + + #endregion Fields + + #region Constructors public CapOptions( CapTypeOptions capTypeOptions, @@ -23,11 +33,16 @@ namespace grapher.Models.Options.Cap Slope = slope; ShouldShow = true; - TopElement = Slope; + _top = Slope.Top; BottomElement = In; CapTypeOptions.OptionsDropdown.SelectedIndexChanged += OnCapTypeDropdownSelectedItemChanged; + CapTypeOptions.SelectedCapOption = InCap; } + #endregion Constructors + + #region Properties + public CapTypeOptions CapTypeOptions { get; } public Option In { get; } @@ -50,16 +65,17 @@ namespace grapher.Models.Options.Cap public override int Top { - get => TopElement.Top; + get => _top; set { + _top = value; Layout(value); } } public override int Height { - get => BottomElement.Top + BottomElement.Height - TopElement.Top; + get => BottomElement.Top + BottomElement.Height - Top; } public override int Width @@ -84,7 +100,9 @@ namespace grapher.Models.Options.Cap private IOption BottomElement { get; set; } - private IOption TopElement { get; set; } + #endregion Properties + + #region Methods public override void AlignActiveValues() { @@ -130,7 +148,7 @@ namespace grapher.Models.Options.Cap { Slope.Show(); CapTypeOptions.Show(name); - In.Show(); + ShowInCap(); Out.Hide(); } @@ -138,7 +156,6 @@ namespace grapher.Models.Options.Cap CapTypeOptions.SnapTo(Slope); In.SnapTo(CapTypeOptions); - TopElement = CapTypeOptions; BottomElement = In; break; case CapType.Output: @@ -147,14 +164,13 @@ namespace grapher.Models.Options.Cap Slope.Show(); CapTypeOptions.Show(name); In.Hide(); - Out.Show(); + ShowOutCap(); } Slope.Top = top; CapTypeOptions.SnapTo(Slope); Out.SnapTo(CapTypeOptions); - TopElement = CapTypeOptions; BottomElement = Out; break; case CapType.Both: @@ -162,29 +178,35 @@ namespace grapher.Models.Options.Cap { CapTypeOptions.Show(name); Slope.Hide(); - In.Show(); - Out.Show(); + ShowInCap(); + ShowOutCap(); } CapTypeOptions.Top = top; In.SnapTo(CapTypeOptions); Out.SnapTo(In); - TopElement = In; BottomElement = Out; break; } } - private void OnCapTypeDropdownSelectedItemChanged(object sender, EventArgs e) + private void ShowInCap() { - Layout(Top); + In.Show(InCapLabel); + } + + private void ShowOutCap() + { + Out.Show(OutCapLabel); } - private void SetupCapTypeDropdown(ComboBox capTypeDropDown) + private void OnCapTypeDropdownSelectedItemChanged(object sender, EventArgs e) { - capTypeDropDown.Items.Clear(); - capTypeDropDown.DataSource = Enum.GetValues(typeof(CapType)); + Layout(Top); + CapTypeOptions.CheckIfDefault(); } + + #endregion Methods } } diff --git a/grapher/Models/Options/Cap/CapTypeOptions.cs b/grapher/Models/Options/Cap/CapTypeOptions.cs index f0c5617..1e7bd58 100644 --- a/grapher/Models/Options/Cap/CapTypeOptions.cs +++ b/grapher/Models/Options/Cap/CapTypeOptions.cs @@ -64,7 +64,8 @@ namespace grapher.Models.Options.Cap public CapTypeOptions( Label label, ComboBox dropdown, - ActiveValueLabel activeValueLabel) + ActiveValueLabel activeValueLabel, + int left) : base( label, dropdown, @@ -77,6 +78,13 @@ namespace grapher.Models.Options.Cap OutCap, BothCap }); + + Default = OutCap; + + label.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + label.Left = left; + label.Width = OptionsDropdown.Left - left - Constants.OptionLabelBoxSeperation; + label.Height = OptionsDropdown.Height; } #endregion Constructors @@ -97,6 +105,8 @@ namespace grapher.Models.Options.Cap } } + private CapTypeOption Default { get; set; } + public ClassicCapMode GetSelectedCapMode() { switch(SelectedCapType) @@ -128,10 +138,23 @@ namespace grapher.Models.Options.Cap public void SetActiveValue(ClassicCapMode capMode) { - SelectedCapOption = CapTypeOptionFromSettings(capMode); + Default = CapTypeOptionFromSettings(capMode); + SelectedCapOption = Default; ActiveValueLabel.SetValue(SelectedCapOption.Name); } + public void CheckIfDefault() + { + if (SelectedCapOption.Equals(Default)) + { + OptionsDropdown.ForeColor = System.Drawing.Color.Gray; + } + else + { + OptionsDropdown.ForeColor = System.Drawing.Color.Black; + } + } + #endregion Methods } } diff --git a/grapher/Models/Options/ComboBoxOptionsBase.cs b/grapher/Models/Options/ComboBoxOptionsBase.cs index 64e0092..6999e99 100644 --- a/grapher/Models/Options/ComboBoxOptionsBase.cs +++ b/grapher/Models/Options/ComboBoxOptionsBase.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; +using System.Windows.Forms; namespace grapher.Models.Options { @@ -61,7 +56,7 @@ namespace grapher.Models.Options { get { - return Label.Height; + return OptionsDropdown.Height; } } @@ -69,7 +64,7 @@ namespace grapher.Models.Options { get { - return Label.Top; + return OptionsDropdown.Top; } set { |