summaryrefslogtreecommitdiff
path: root/grapher/AccelOptions.cs
diff options
context:
space:
mode:
authora1xd <[email protected]>2020-08-14 03:48:40 -0400
committerGitHub <[email protected]>2020-08-14 03:48:40 -0400
commit0621a7ebd431102d720497a143190505dcfeb7a1 (patch)
tree01d7df8f55e5a1cce90617fd876eaf994eb26846 /grapher/AccelOptions.cs
parentMerge pull request #14 from JacobPalecki/GainCap (diff)
parentFix initial points, add poll time constant (diff)
downloadrawaccel-0621a7ebd431102d720497a143190505dcfeb7a1.tar.xz
rawaccel-0621a7ebd431102d720497a143190505dcfeb7a1.zip
Merge pull request #15 from JacobPalecki/GUI
GUI: Add x/y graphs, moving dot
Diffstat (limited to 'grapher/AccelOptions.cs')
-rw-r--r--grapher/AccelOptions.cs79
1 files changed, 0 insertions, 79 deletions
diff --git a/grapher/AccelOptions.cs b/grapher/AccelOptions.cs
deleted file mode 100644
index b233552..0000000
--- a/grapher/AccelOptions.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using grapher.Layouts;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace grapher
-{
- public class AccelOptions
- {
- public const int PossibleOptionsCount = 4;
- public const int PossibleOptionsXYCount = 2;
-
- public static readonly Dictionary<string, LayoutBase> AccelerationTypes = new List<LayoutBase>
- {
- new DefaultLayout(),
- new LinearLayout(),
- new ClassicLayout(),
- new NaturalLayout(),
- new LogLayout(),
- new SigmoidLayout(),
- new PowerLayout(),
- new OffLayout()
- }.ToDictionary(k => k.Name);
-
- public AccelOptions(
- ComboBox accelDropdown,
- Option[] options,
- OptionXY[] optionsXY,
- Button writeButton)
- {
- AccelDropdown = accelDropdown;
- AccelDropdown.Items.Clear();
- AccelDropdown.Items.AddRange(AccelerationTypes.Keys.Skip(1).ToArray());
- AccelDropdown.SelectedIndexChanged += new System.EventHandler(OnIndexChanged);
-
- if (options.Length > PossibleOptionsCount)
- {
- throw new Exception("Layout given too many options.");
- }
-
- if (optionsXY.Length > PossibleOptionsXYCount)
- {
- throw new Exception("Layout given too many options.");
- }
-
- Options = options;
- OptionsXY = optionsXY;
- WriteButton = writeButton;
-
- Layout("Default");
- }
-
- public Button WriteButton { get; }
-
- public ComboBox AccelDropdown { get; }
-
- public int AccelerationIndex { get; private set; }
-
- public Option[] Options { get; }
-
- public OptionXY[] OptionsXY { get; }
-
- private void OnIndexChanged(object sender, EventArgs e)
- {
- var accelerationTypeString = AccelDropdown.SelectedItem.ToString();
- Layout(accelerationTypeString);
- }
-
- private void Layout(string type)
- {
- var accelerationType = AccelerationTypes[type];
- AccelerationIndex = accelerationType.Index;
- accelerationType.Layout(Options, OptionsXY, WriteButton);
- }
- }
-}