summaryrefslogtreecommitdiff
path: root/grapher/Models/Options/ApplyOptions.cs
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2020-09-02 01:02:51 -0700
committerJacob Palecki <[email protected]>2020-09-02 01:02:51 -0700
commit5b9b8ed308e7a8cefbd27b2db72d33d7b002e223 (patch)
tree0d66b20cb15f95ac795247da90d3eb1d85a54d58 /grapher/Models/Options/ApplyOptions.cs
parentSmall fixes, correctly align labels and boxes (diff)
downloadrawaccel-5b9b8ed308e7a8cefbd27b2db72d33d7b002e223.tar.xz
rawaccel-5b9b8ed308e7a8cefbd27b2db72d33d7b002e223.zip
Move optionsets to applyoptions
Diffstat (limited to 'grapher/Models/Options/ApplyOptions.cs')
-rw-r--r--grapher/Models/Options/ApplyOptions.cs79
1 files changed, 76 insertions, 3 deletions
diff --git a/grapher/Models/Options/ApplyOptions.cs b/grapher/Models/Options/ApplyOptions.cs
index 703f0d5..0241fdf 100644
--- a/grapher/Models/Options/ApplyOptions.cs
+++ b/grapher/Models/Options/ApplyOptions.cs
@@ -1,4 +1,5 @@
-using System;
+using grapher.Models.Serialized;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -14,7 +15,10 @@ namespace grapher.Models.Options
public ApplyOptions(
ToolStripMenuItem wholeVectorMenuItem,
- ToolStripMenuItem byComponentMenuItem)
+ ToolStripMenuItem byComponentMenuItem,
+ CheckBox byComponentVectorXYLock,
+ AccelOptionSet optionSetX,
+ AccelOptionSet optionSetY)
{
WholeVectorMenuItem = wholeVectorMenuItem;
ByComponentVectorMenuItem = byComponentMenuItem;
@@ -25,6 +29,14 @@ namespace grapher.Models.Options
WholeVectorMenuItem.CheckedChanged += new System.EventHandler(OnWholeCheckedChange);
ByComponentVectorMenuItem.CheckedChanged += new System.EventHandler(OnByComponentCheckedChange);
+ ByComponentVectorXYLock = byComponentVectorXYLock;
+ OptionSetX = optionSetX;
+ OptionSetY = optionSetY;
+
+ ByComponentVectorXYLock.CheckedChanged += new System.EventHandler(OnByComponentXYLockChecked);
+ ByComponentVectorXYLock.Checked = false;
+ ByComponentVectorXYLock.Checked = true;
+
IsWhole = false;
}
@@ -36,18 +48,54 @@ namespace grapher.Models.Options
public ToolStripMenuItem ByComponentVectorMenuItem { get; }
+ public CheckBox ByComponentVectorXYLock { get; }
+
+ public AccelOptionSet OptionSetX { get; }
+
+ public AccelOptionSet OptionSetY { get; }
+
public bool IsWhole { get; private set; }
#endregion Properties
#region Methods
- public void SetActive(bool isWhole)
+ public Vec2<AccelMode> GetModes()
+ {
+ var xMode = (AccelMode)OptionSetX.AccelTypeOptions.AccelerationIndex;
+
+ return new Vec2<AccelMode>
+ {
+ x = xMode,
+ y = ByComponentVectorXYLock.Checked ? xMode : (AccelMode)OptionSetY.AccelTypeOptions.AccelerationIndex
+ };
+ }
+
+ public Vec2<AccelArgs> GetArgs()
+ {
+ var xArgs = OptionSetX.GenerateArgs();
+
+ return new Vec2<AccelArgs>
+ {
+ x = xArgs,
+ y = ByComponentVectorXYLock.Checked ? xArgs : OptionSetY.GenerateArgs()
+ };
+
+ }
+
+ public void SetActiveValues(int xMode, int yMode, AccelArgs xArgs, AccelArgs yArgs, bool isWhole)
{
+ OptionSetX.SetActiveValues(xMode, xArgs);
+ OptionSetY.SetActiveValues(yMode, yArgs);
WholeVectorMenuItem.Checked = isWhole;
ByComponentVectorMenuItem.Checked = !isWhole;
}
+ public void SetActiveValues(DriverSettings settings)
+ {
+ SetActiveValues((int)settings.modes.x, (int)settings.modes.y, settings.args.x, settings.args.y, settings.combineMagnitudes);
+ }
+
public void OnWholeClicked(object sender, EventArgs e)
{
if (!WholeVectorMenuItem.Checked)
@@ -82,6 +130,31 @@ namespace grapher.Models.Options
}
}
+ public void ShowWholeOptionSet()
+ {
+ OptionSetX.SetTitleMode("X = Y");
+ OptionSetY.Hide();
+ }
+
+ public void ShowByComponentSets()
+ {
+ OptionSetX.SetTitleMode("X");
+ OptionSetY.SetTitleMode("Y");
+ OptionSetY.Show();
+ }
+
+ private void OnByComponentXYLockChecked(object sender, EventArgs e)
+ {
+ if (ByComponentVectorXYLock.Checked)
+ {
+ ShowWholeOptionSet();
+ }
+ else
+ {
+ ShowByComponentSets();
+ }
+ }
+
public void EnableWholeApplication()
{
IsWhole = true;