diff options
| author | a1xd <[email protected]> | 2021-09-24 02:04:43 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-09-24 02:04:43 -0400 |
| commit | 2896b8a09ce42e965705c58593b8738adc454f7f (patch) | |
| tree | 71e4d0cff60b5a1ad11427d78e1f8c7b775e5690 /grapher/Models/Options/LUT/LutApplyOptions.cs | |
| parent | Merge pull request #107 from a1xd/1.5.0-fix (diff) | |
| parent | make note clearer (diff) | |
| download | rawaccel-1.6.0.tar.xz rawaccel-1.6.0.zip | |
v1.6
Diffstat (limited to 'grapher/Models/Options/LUT/LutApplyOptions.cs')
| -rw-r--r-- | grapher/Models/Options/LUT/LutApplyOptions.cs | 138 |
1 files changed, 32 insertions, 106 deletions
diff --git a/grapher/Models/Options/LUT/LutApplyOptions.cs b/grapher/Models/Options/LUT/LutApplyOptions.cs index 7d8c737..61cae61 100644 --- a/grapher/Models/Options/LUT/LutApplyOptions.cs +++ b/grapher/Models/Options/LUT/LutApplyOptions.cs @@ -7,10 +7,9 @@ using System.Windows.Forms; namespace grapher.Models.Options.LUT { - public class LutApplyOptions : OptionBase + public class LutApplyOptions : ComboBoxOptionsBase { - public const string LUTApplyOptionsLabelText = "Apply as:"; - public const int LUTApplyLabelDropdownSeparation = 4; + #region Enum public enum LutApplyType { @@ -18,6 +17,10 @@ namespace grapher.Models.Options.LUT Velocity } + #endregion Enum + + #region Classes + public class LutApplyOption { public LutApplyType Type { get; set; } @@ -27,6 +30,10 @@ namespace grapher.Models.Options.LUT public override string ToString() => Name; } + #endregion Classes + + #region Static + public static readonly LutApplyOption Sensitivity = new LutApplyOption { Type = LutApplyType.Sensitivity, @@ -37,129 +44,58 @@ namespace grapher.Models.Options.LUT Type = LutApplyType.Velocity, }; + #endregion Static + + #region Constructors + public LutApplyOptions( Label label, ComboBox applyOptionsDropdown, ActiveValueLabel lutApplyActiveValue) + : base( + label, + applyOptionsDropdown, + lutApplyActiveValue) { - ApplyOptions = applyOptionsDropdown; - ApplyOptions.Items.Clear(); - ApplyOptions.Items.AddRange( + OptionsDropdown.Items.AddRange( new LutApplyOption[] { Sensitivity, Velocity, }); + } - Label = label; - Label.Text = LUTApplyOptionsLabelText; - Label.AutoSize = false; - Label.Width = 50; + #endregion Constructors - ActiveValueLabel = lutApplyActiveValue; - } + #region Properties public LutApplyType ApplyType { get => ApplyOption.Type; } public LutApplyOption ApplyOption { get { - return ApplyOptions.SelectedItem as LutApplyOption; - } - set - { - ApplyOptions.SelectedItem = value; - } - } - - public Label Label { get; } - - public ActiveValueLabel ActiveValueLabel { get; } - - public ComboBox ApplyOptions { get; } - - public override bool Visible - { - get - { - return Label.Visible || ShouldShow; - } - } - - public override int Left - { - get - { - return Label.Left; + return OptionsDropdown.SelectedItem as LutApplyOption; } set { - Label.Left = value; - ApplyOptions.Left = Label.Left + Label.Width + LUTApplyLabelDropdownSeparation; + OptionsDropdown.SelectedItem = value; } } - public override int Height - { - get - { - return Label.Height; - } - } + #endregion Properties - public override int Top - { - get - { - return Label.Top; - } - set - { - ApplyOptions.Top = value; - Label.Top = (ApplyOptions.Height - Label.Height) / 2 + ApplyOptions.Top; - ActiveValueLabel.Top = value; - } - } + #region Methods - public override int Width + public static LutApplyOption ApplyOptionFromSettings(bool applyAsVelocity) { - get - { - return Label.Width; - } - set + if (applyAsVelocity) { - ApplyOptions.Width = value - Label.Width - Constants.OptionLabelBoxSeperation; + return Velocity; } - } - - private bool ShouldShow { get; set; } - - public override void Hide() - { - Label.Hide(); - ApplyOptions.Hide(); - ActiveValueLabel.Hide(); - ShouldShow = false; - } - - public override void Show(string labelText) - { - Label.Show(); - - if (!string.IsNullOrWhiteSpace(labelText)) + else { - Label.Text = labelText; + return Sensitivity; } - - ApplyOptions.Show(); - ActiveValueLabel.Show(); - ShouldShow = true; - } - - public override void AlignActiveValues() - { - ActiveValueLabel.Align(); } public void SetActiveValue(bool applyAsVelocity) @@ -168,16 +104,6 @@ namespace grapher.Models.Options.LUT ActiveValueLabel.SetValue(ApplyOption.Name); } - public LutApplyOption ApplyOptionFromSettings(bool applyAsVelocity) - { - if (applyAsVelocity) - { - return Velocity; - } - else - { - return Sensitivity; - } - } + #endregion Methods } } |