summaryrefslogtreecommitdiff
path: root/grapher/Models/AccelGUIFactory.cs
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2021-01-10 23:49:28 -0800
committerJacob Palecki <[email protected]>2021-01-10 23:49:28 -0800
commitde6b18db8226650cee9726c4694931bdc4b89fad (patch)
treec5bffd4d1eaad53842394c92d4907acb65c6ff84 /grapher/Models/AccelGUIFactory.cs
parentAdd to stigma, directional to settings (diff)
downloadrawaccel-de6b18db8226650cee9726c4694931bdc4b89fad.tar.xz
rawaccel-de6b18db8226650cee9726c4694931bdc4b89fad.zip
Implement direcitonality UI
Diffstat (limited to 'grapher/Models/AccelGUIFactory.cs')
-rw-r--r--grapher/Models/AccelGUIFactory.cs73
1 files changed, 68 insertions, 5 deletions
diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs
index 901a1b5..1035cb7 100644
--- a/grapher/Models/AccelGUIFactory.cs
+++ b/grapher/Models/AccelGUIFactory.cs
@@ -1,6 +1,7 @@
using grapher.Models.Calculations;
using grapher.Models.Mouse;
using grapher.Models.Options;
+using grapher.Models.Options.Directionality;
using grapher.Models.Serialized;
using System;
using System.Windows.Forms;
@@ -27,8 +28,6 @@ namespace grapher.Models
ButtonBase toggleButton,
ToolStripMenuItem showVelocityGainToolStripMenuItem,
ToolStripMenuItem showLastMouseMoveMenuItem,
- ToolStripMenuItem wholeVectorToolStripMenuItem,
- ToolStripMenuItem byVectorComponentToolStripMenuItem,
ToolStripMenuItem velocityGainCapToolStripMenuItem,
ToolStripMenuItem legacyCapToolStripMenuItem,
ToolStripMenuItem gainOffsetToolStripMenuItem,
@@ -37,6 +36,7 @@ namespace grapher.Models
ToolStripMenuItem scaleMenuItem,
ToolStripTextBox dpiTextBox,
ToolStripTextBox pollRateTextBox,
+ Panel directionalityPanel,
TextBox sensitivityBoxX,
TextBox sensitivityBoxY,
TextBox rotationBox,
@@ -56,8 +56,16 @@ namespace grapher.Models
TextBox expBoxY,
TextBox midpointBoxX,
TextBox midpointBoxY,
+ TextBox domainBoxX,
+ TextBox domainBoxY,
+ TextBox rangeBoxX,
+ TextBox rangeBoxY,
+ TextBox lpNormBox,
CheckBox sensXYLock,
CheckBox byComponentXYLock,
+ CheckBox fakeBox,
+ CheckBox wholeCheckBox,
+ CheckBox byComponentCheckBox,
Label lockXYLabel,
Label sensitivityLabel,
Label rotationLabel,
@@ -102,8 +110,23 @@ namespace grapher.Models
Label accelTypeActiveLabelY,
Label optionSetXTitle,
Label optionSetYTitle,
- Label mouseLabel)
+ Label mouseLabel,
+ Label directionalityLabel,
+ Label directionalityX,
+ Label directionalityY,
+ Label direcionalityActiveValueTitle,
+ Label lpNormLabel,
+ Label lpNormActiveLabel,
+ Label domainLabel,
+ Label domainActiveValueX,
+ Label domainActiveValueY,
+ Label rangeLabel,
+ Label rangeActiveValueX,
+ Label rangeActiveValueY)
{
+ fakeBox.Checked = false;
+ fakeBox.Hide();
+
var accelCalculator = new AccelCalculator(
new Field(dpiTextBox.TextBox, form, Constants.DefaultDPI, 1),
new Field(pollRateTextBox.TextBox, form, Constants.DefaultPollRate, 1));
@@ -141,6 +164,8 @@ namespace grapher.Models
var optionSetYLeft = rotation.Left + rotation.Width;
+ var directionalityLeft = directionalityPanel.Left;
+
var weightX = new Option(
weightBoxX,
form,
@@ -265,6 +290,34 @@ namespace grapher.Models
new ActiveValueLabel(midpointActiveLabelY, activeValueTitleY),
optionSetYLeft);
+ var lpNorm = new Option(
+ new Field(lpNormBox, form, 2),
+ lpNormLabel,
+ new ActiveValueLabel(lpNormActiveLabel, direcionalityActiveValueTitle),
+ directionalityLeft);
+
+ var domain = new OptionXY(
+ domainBoxX,
+ domainBoxY,
+ fakeBox,
+ form,
+ 1,
+ domainLabel,
+ new ActiveValueLabelXY(
+ new ActiveValueLabel(domainActiveValueX, direcionalityActiveValueTitle),
+ new ActiveValueLabel(domainActiveValueY, direcionalityActiveValueTitle)));
+
+ var range = new OptionXY(
+ rangeBoxX,
+ rangeBoxY,
+ fakeBox,
+ form,
+ 1,
+ rangeLabel,
+ new ActiveValueLabelXY(
+ new ActiveValueLabel(rangeActiveValueX, direcionalityActiveValueTitle),
+ new ActiveValueLabel(rangeActiveValueY, direcionalityActiveValueTitle)));
+
var capOptionsX = new CapOptions(
velocityGainCapToolStripMenuItem,
legacyCapToolStripMenuItem,
@@ -313,12 +366,22 @@ namespace grapher.Models
rotationBox.Top + rotationBox.Height + Constants.OptionVerticalSeperation,
accelerationOptionsY);
+ var directionalOptions = new DirectionalityOptions(
+ directionalityPanel,
+ directionalityLabel,
+ directionalityX,
+ directionalityY,
+ lpNorm,
+ domain,
+ range,
+ wholeCheckBox,
+ byComponentCheckBox);
+
var applyOptions = new ApplyOptions(
- wholeVectorToolStripMenuItem,
- byVectorComponentToolStripMenuItem,
byComponentXYLock,
optionsSetX,
optionsSetY,
+ directionalOptions,
sensitivity,
rotation,
lockXYLabel,