summaryrefslogtreecommitdiff
path: root/grapher
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
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')
-rw-r--r--grapher/Models/AccelGUIFactory.cs28
-rw-r--r--grapher/Models/Options/Cap/CapOptions.cs39
2 files changed, 54 insertions, 13 deletions
diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs
index e7ae672..5fc7b8b 100644
--- a/grapher/Models/AccelGUIFactory.cs
+++ b/grapher/Models/AccelGUIFactory.cs
@@ -547,18 +547,6 @@ namespace grapher.Models
new ActiveValueLabel(capTypeActiveYLabelPower, activeValueTitleY),
optionSetYLeft);
- var powerCapOptionsX = new CapOptions(
- capTypeXPower,
- inCapXPower,
- outCapXPower,
- scaleX);
-
- var powerCapOptionsY = new CapOptions(
- capTypeYPower,
- inCapYPower,
- outCapYPower,
- scaleY);
-
var lpNorm = new Option(
new Field(lpNormBox, form, 2),
lpNormLabel,
@@ -599,6 +587,22 @@ namespace grapher.Models
gainSwitchY,
new ActiveValueLabel(gainSwitchActiveLabelY, activeValueTitleY));
+ var powerCapOptionsX = new CapOptions(
+ capTypeXPower,
+ inCapXPower,
+ outCapXPower,
+ scaleX,
+ outputOffsetX,
+ gainSwitchOptionX);
+
+ var powerCapOptionsY = new CapOptions(
+ capTypeYPower,
+ inCapYPower,
+ outCapYPower,
+ scaleY,
+ outputOffsetY,
+ gainSwitchOptionY);
+
var accelerationOptionsX = new AccelTypeOptions(
accelTypeDropX,
gainSwitchOptionX,
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
}
}