diff options
| author | Jacob Palecki <[email protected]> | 2021-09-11 17:38:59 -0700 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-09-23 22:33:13 -0400 |
| commit | affc97b1ef41437e7caba31be8e9b9212805182e (patch) | |
| tree | beca60d2bb5e139b7346a8bcad3e9346b05e7331 /grapher/Models | |
| parent | Add lp norm new info to doc (diff) | |
| download | rawaccel-affc97b1ef41437e7caba31be8e9b9212805182e.tar.xz rawaccel-affc97b1ef41437e7caba31be8e9b9212805182e.zip | |
YToXRatio fully works
Diffstat (limited to 'grapher/Models')
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 2 | ||||
| -rw-r--r-- | grapher/Models/AccelGUIFactory.cs | 27 | ||||
| -rw-r--r-- | grapher/Models/Options/ApplyOptions.cs | 13 | ||||
| -rw-r--r-- | grapher/Models/Options/LockableOption.cs | 48 |
4 files changed, 76 insertions, 14 deletions
diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index 801fd8d..e15aba9 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -116,7 +116,7 @@ namespace grapher settings.sensitivity = ApplyOptions.Sensitivity.Field.Data; // TODO - separate sensitivity fields, add new label for ratio - settings.yxSensRatio = ApplyOptions.Sensitivity.Fields.Y; + settings.yxSensRatio = ApplyOptions.YToXRatio.Value; settings.combineMagnitudes = ApplyOptions.IsWhole; ApplyOptions.SetArgsFromActiveValues(ref settings.argsX, ref settings.argsY); diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs index cc43aeb..20040fb 100644 --- a/grapher/Models/AccelGUIFactory.cs +++ b/grapher/Models/AccelGUIFactory.cs @@ -83,6 +83,7 @@ namespace grapher.Models RichTextBox yLutPointsBox, Label lockXYLabel, Label sensitivityLabel, + Label yxRatioLabel, Label rotationLabel, Label weightLabelX, Label weightLabelY, @@ -112,8 +113,8 @@ namespace grapher.Models Label constantThreeLabelY, Label activeValueTitleX, Label activeValueTitleY, - Label sensitivityActiveXLabel, - Label sensitivityActiveYLabel, + Label sensitivityActiveLabel, + Label yxRatioActiveLabel, Label rotationActiveLabel, Label weightActiveXLabel, Label weightActiveYLabel, @@ -181,18 +182,27 @@ namespace grapher.Models writeButton, accelCalculator); - var sensitivity = new OptionXY( + var sensitivity = new Option( sensitivityBoxX, - sensitivityBoxY, - sensXYLock, form, 1, sensitivityLabel, - new ActiveValueLabelXY( - new ActiveValueLabel(sensitivityActiveXLabel, activeValueTitleX), - new ActiveValueLabel(sensitivityActiveYLabel, activeValueTitleX)), + 0, + new ActiveValueLabel(sensitivityActiveLabel, activeValueTitleX), "Sens Multiplier"); + var yxRatio = new LockableOption( + new Option( + sensitivityBoxY, + form, + 1, + yxRatioLabel, + 0, + new ActiveValueLabel(yxRatioActiveLabel, activeValueTitleX), + "Y/X Ratio"), + sensXYLock, + 1); + var rotation = new Option( rotationBox, form, @@ -487,6 +497,7 @@ namespace grapher.Models optionsSetY, directionalOptions, sensitivity, + yxRatio, rotation, lockXYLabel, accelCharts); diff --git a/grapher/Models/Options/ApplyOptions.cs b/grapher/Models/Options/ApplyOptions.cs index 5c3494c..4946414 100644 --- a/grapher/Models/Options/ApplyOptions.cs +++ b/grapher/Models/Options/ApplyOptions.cs @@ -15,7 +15,8 @@ namespace grapher.Models.Options AccelOptionSet optionSetX, AccelOptionSet optionSetY, DirectionalityOptions directionalityOptions, - OptionXY sensitivity, + Option sensitivity, + LockableOption yxRatio, Option rotation, Label lockXYLabel, AccelCharts accelCharts) @@ -34,6 +35,7 @@ namespace grapher.Models.Options OptionSetX = optionSetX; OptionSetY = optionSetY; Sensitivity = sensitivity; + YToXRatio = yxRatio; Rotation = rotation; LockXYLabel = lockXYLabel; AccelCharts = accelCharts; @@ -44,7 +46,8 @@ namespace grapher.Models.Options ByComponentVectorXYLock.CheckedChanged += new System.EventHandler(OnByComponentXYLockChecked); ByComponentVectorXYLock.Checked = true; - Rotation.SnapTo(Sensitivity); + YToXRatio.SnapTo(Sensitivity); + Rotation.SnapTo(YToXRatio); EnableWholeApplication(); } @@ -67,7 +70,7 @@ namespace grapher.Models.Options public Option Sensitivity { get; } - public Option YToXRatio { get; } + public LockableOption YToXRatio { get; } public Option Rotation { get; } @@ -213,8 +216,8 @@ namespace grapher.Models.Options LockXYLabel.Width = (AccelCharts.Left - OptionSetX.ActiveValuesTitle.Left) / 2; OptionSetX.ActiveValuesTitle.Width = LockXYLabel.Width; LockXYLabel.Left = OptionSetX.ActiveValuesTitle.Left + OptionSetX.ActiveValuesTitle.Width; - Sensitivity.Fields.LockCheckBox.Left = LockXYLabel.Left + LockXYLabel.Width / 2 - Sensitivity.Fields.LockCheckBox.Width / 2; - ByComponentVectorXYLock.Left = Sensitivity.Fields.LockCheckBox.Left; + YToXRatio.LockBox.Left = LockXYLabel.Left + LockXYLabel.Width / 2 - YToXRatio.LockBox.Width / 2; + ByComponentVectorXYLock.Left = YToXRatio.LockBox.Left; AlignActiveValues(); } diff --git a/grapher/Models/Options/LockableOption.cs b/grapher/Models/Options/LockableOption.cs index bf77520..6e78783 100644 --- a/grapher/Models/Options/LockableOption.cs +++ b/grapher/Models/Options/LockableOption.cs @@ -20,6 +20,12 @@ namespace grapher.Models.Options Option = option; LockBox = checkBox; LockedValue = lockedvalue; + + LockBox.Click += OnLockedBoxClicked; + LockBox.AutoCheck = false; + + Option.Field.SetNewDefault(LockedValue); + SetLocked(); } public Option Option { get; } @@ -69,6 +75,25 @@ namespace grapher.Models.Options get => Option.Visible; } + public double Value + { + get => LockBox.Checked ? LockedValue : Option.Field.Data; + } + + public void SetActiveValue(double activeValue) + { + Option.SetActiveValue(activeValue); + + if (activeValue == LockedValue) + { + SetLocked(); + } + else + { + SetUnlocked(); + } + } + public override void AlignActiveValues() { Option.AlignActiveValues(); @@ -85,5 +110,28 @@ namespace grapher.Models.Options Option.Show(Name); LockBox.Show(); } + private void SetLocked() + { + LockBox.Checked = true; + Option.Field.SetToUnavailable(); + } + + private void SetUnlocked() + { + LockBox.Checked = false; + Option.Field.SetToDefault(); + } + + private void OnLockedBoxClicked(object sender, EventArgs e) + { + if (LockBox.Checked) + { + SetUnlocked(); + } + else + { + SetLocked(); + } + } } } |