diff options
Diffstat (limited to 'grapher/Models/Options')
| -rw-r--r-- | grapher/Models/Options/Cap/CapOptions.cs | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/grapher/Models/Options/Cap/CapOptions.cs b/grapher/Models/Options/Cap/CapOptions.cs index de0f597..68326e5 100644 --- a/grapher/Models/Options/Cap/CapOptions.cs +++ b/grapher/Models/Options/Cap/CapOptions.cs @@ -25,18 +25,27 @@ namespace grapher.Models.Options.Cap CapTypeOptions capTypeOptions, Option capIn, Option capOut, - Option slope) + Option slope, + Option disableOptionInBoth = null, + CheckBoxOption disableInBoth = null) { CapTypeOptions = capTypeOptions; In = capIn; Out = capOut; Slope = slope; + DisableOptionInBoth = disableOptionInBoth; + DisableInBoth = disableInBoth; ShouldShow = true; _top = Slope.Top; BottomElement = In; CapTypeOptions.OptionsDropdown.SelectedIndexChanged += OnCapTypeDropdownSelectedItemChanged; CapTypeOptions.SelectedCapOption = InCap; + + if (DisableInBoth != null) + { + DisableInBoth.CheckBox.CheckedChanged += OnDisableInBothCheckedChange; + } } #endregion Constructors @@ -51,6 +60,10 @@ namespace grapher.Models.Options.Cap public Option Slope { get; } + private Option DisableOptionInBoth { get; } + + private CheckBoxOption DisableInBoth { get; } + public override int Left { get => In.Left; @@ -189,6 +202,25 @@ namespace grapher.Models.Options.Cap BottomElement = Out; break; } + + DisableBuggedOptionIfApplicable(); + } + + private void DisableBuggedOptionIfApplicable() + { + if (DisableOptionInBoth != null) + { + if (CapTypeOptions.SelectedCapType == CapType.Both && + DisableInBoth != null && + !DisableInBoth.CheckBox.Checked) + { + DisableOptionInBoth.Field.SetToUnavailable(); + } + else + { + DisableOptionInBoth.Field.SetToDefault(); + } + } } private void ShowInCap() @@ -207,6 +239,11 @@ namespace grapher.Models.Options.Cap CapTypeOptions.CheckIfDefault(); } + private void OnDisableInBothCheckedChange(object sender, EventArgs e) + { + DisableBuggedOptionIfApplicable(); + } + #endregion Methods } } |