summaryrefslogtreecommitdiff
path: root/grapher/Models
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2020-09-01 00:31:18 -0700
committerJacob Palecki <[email protected]>2020-09-01 00:31:18 -0700
commit297d610ca1f2978c6e354c679cbed4e1908be743 (patch)
tree531bf849782a2a59ec29d113bbdbaeaef5429a78 /grapher/Models
parentRemove console project (diff)
downloadrawaccel-297d610ca1f2978c6e354c679cbed4e1908be743.tar.xz
rawaccel-297d610ca1f2978c6e354c679cbed4e1908be743.zip
Set whole or by component with toolstrip item
Diffstat (limited to 'grapher/Models')
-rw-r--r--grapher/Models/AccelGUI.cs8
-rw-r--r--grapher/Models/Options/ApplyOptions.cs85
-rw-r--r--grapher/Models/Options/CapOptions.cs8
3 files changed, 98 insertions, 3 deletions
diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs
index a15dba8..7789337 100644
--- a/grapher/Models/AccelGUI.cs
+++ b/grapher/Models/AccelGUI.cs
@@ -1,5 +1,6 @@
using grapher.Models.Calculations;
using grapher.Models.Mouse;
+using grapher.Models.Options;
using grapher.Models.Serialized;
using System;
using System.CodeDom;
@@ -23,6 +24,7 @@ namespace grapher
AccelCalculator accelCalculator,
AccelCharts accelCharts,
SettingsManager settings,
+ ApplyOptions applyOptions,
AccelOptions accelOptions,
OptionXY sensitivity,
Option rotation,
@@ -41,6 +43,7 @@ namespace grapher
AccelCalculator = accelCalculator;
AccelCharts = accelCharts;
AccelerationOptions = accelOptions;
+ ApplyOptions = applyOptions;
Sensitivity = sensitivity;
Rotation = rotation;
Weight = weight;
@@ -72,6 +75,8 @@ namespace grapher
public SettingsManager Settings { get; }
+ public ApplyOptions ApplyOptions { get; }
+
public AccelOptions AccelerationOptions { get; }
public OptionXY Sensitivity { get; }
@@ -110,7 +115,7 @@ namespace grapher
x = Sensitivity.Fields.X,
y = Sensitivity.Fields.Y
},
- combineMagnitudes = true,
+ combineMagnitudes = ApplyOptions.IsWhole,
modes = new Vec2<AccelMode>
{
x = (AccelMode)AccelerationOptions.AccelerationIndex
@@ -159,6 +164,7 @@ namespace grapher
Acceleration.SetActiveValue(settings.args.x.accel); // rate, powerscale
LimitOrExponent.SetActiveValue(settings.args.x.limit); //exp, powerexp
Midpoint.SetActiveValue(settings.args.x.midpoint);
+ ApplyOptions.SetActive(settings.combineMagnitudes);
//Cap.SetActiveValues(Settings.ActiveAccel.GainCap, Settings.ActiveAccel.CapX, Settings.ActiveAccel.CapY, Settings.ActiveAccel.GainCapEnabled);
}
diff --git a/grapher/Models/Options/ApplyOptions.cs b/grapher/Models/Options/ApplyOptions.cs
new file mode 100644
index 0000000..389bf62
--- /dev/null
+++ b/grapher/Models/Options/ApplyOptions.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Windows.Forms.DataVisualization.Charting;
+
+namespace grapher.Models.Options
+{
+ public class ApplyOptions
+ {
+ public ApplyOptions(
+ ToolStripMenuItem wholeVectorMenuItem,
+ ToolStripMenuItem byComponentMenuItem)
+ {
+ WholeVectorMenuItem = wholeVectorMenuItem;
+ ByComponentVectorMenuItem = byComponentMenuItem;
+
+ WholeVectorMenuItem.Click += new System.EventHandler(OnWholeClicked);
+ ByComponentVectorMenuItem.Click += new System.EventHandler(OnByComponentClicked);
+
+ WholeVectorMenuItem.CheckedChanged += new System.EventHandler(OnWholeCheckedChange);
+ ByComponentVectorMenuItem.CheckedChanged += new System.EventHandler(OnByComponentCheckedChange);
+
+ IsWhole = false;
+ }
+
+ public ToolStripMenuItem WholeVectorMenuItem { get; }
+
+ public ToolStripMenuItem ByComponentVectorMenuItem { get; }
+
+ public bool IsWhole { get; private set; }
+
+ public void SetActive(bool isWhole)
+ {
+ WholeVectorMenuItem.Checked = isWhole;
+ ByComponentVectorMenuItem.Checked = !isWhole;
+ }
+
+ public void OnWholeClicked(object sender, EventArgs e)
+ {
+ if (!WholeVectorMenuItem.Checked)
+ {
+ WholeVectorMenuItem.Checked = true;
+ ByComponentVectorMenuItem.Checked = false;
+ }
+ }
+
+ public void OnByComponentClicked(object sender, EventArgs e)
+ {
+ if (!ByComponentVectorMenuItem.Checked)
+ {
+ WholeVectorMenuItem.Checked = false;
+ ByComponentVectorMenuItem.Checked = true;
+ }
+ }
+
+ public void OnWholeCheckedChange(object sender, EventArgs e)
+ {
+ if (WholeVectorMenuItem.Checked)
+ {
+ EnableWholeApplication();
+ }
+ }
+
+ public void OnByComponentCheckedChange(object sender, EventArgs e)
+ {
+ if (ByComponentVectorMenuItem.Checked)
+ {
+ EnableWholeApplication();
+ }
+ }
+
+ public void EnableWholeApplication()
+ {
+ IsWhole = true;
+ }
+ public void EnableByComponentApplication()
+ {
+ IsWhole = false;
+ }
+
+ }
+}
diff --git a/grapher/Models/Options/CapOptions.cs b/grapher/Models/Options/CapOptions.cs
index 493561a..3bdf3c6 100644
--- a/grapher/Models/Options/CapOptions.cs
+++ b/grapher/Models/Options/CapOptions.cs
@@ -93,12 +93,16 @@ namespace grapher
CapOption.ActiveValueLabels.X.FormatString = GainCapFormatString;
CapOption.ActiveValueLabels.X.Prefix = "Gain";
CapOption.SetActiveValues(gainCap, gainCap);
+ SensitivityCapCheck.Checked = true;
+ VelocityGainCapCheck.Checked = false;
}
else
{
CapOption.ActiveValueLabels.X.FormatString = ActiveValueLabel.DefaultFormatString;
CapOption.ActiveValueLabels.X.Prefix = string.Empty;
CapOption.SetActiveValues(sensCapX, sensCapY);
+ SensitivityCapCheck.Checked = false;
+ VelocityGainCapCheck.Checked = true;
}
}
@@ -122,7 +126,7 @@ namespace grapher
void OnSensitivityCapCheckedChange(object sender, EventArgs e)
{
- if (SensitivityCapCheck.Checked == true)
+ if (SensitivityCapCheck.Checked)
{
EnableSensitivityCap();
}
@@ -130,7 +134,7 @@ namespace grapher
void OnVelocityGainCapCheckedChange(object sender, EventArgs e)
{
- if (SensitivityCapCheck.Checked == true)
+ if (SensitivityCapCheck.Checked)
{
EnableVelocityGainCap();
}