summaryrefslogtreecommitdiff
path: root/grapher/Models/Options
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2021-09-20 23:08:30 -0700
committera1xd <[email protected]>2021-09-23 22:37:03 -0400
commitc64cc5e1ec3fe60392cafd63b795e5146f6dd159 (patch)
treefbaeed4bc4daaaa5dfe4c0b841b71ab709be3105 /grapher/Models/Options
parentfix input checks (diff)
downloadrawaccel-c64cc5e1ec3fe60392cafd63b795e5146f6dd159.tar.xz
rawaccel-c64cc5e1ec3fe60392cafd63b795e5146f6dd159.zip
Disable output offset when both cap type selected in power
Diffstat (limited to 'grapher/Models/Options')
-rw-r--r--grapher/Models/Options/Cap/CapOptions.cs39
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
}
}