diff options
Diffstat (limited to 'grapher/Layouts')
| -rw-r--r-- | grapher/Layouts/ClassicLayout.cs | 20 | ||||
| -rw-r--r-- | grapher/Layouts/DefaultLayout.cs | 22 | ||||
| -rw-r--r-- | grapher/Layouts/LayoutBase.cs | 74 | ||||
| -rw-r--r-- | grapher/Layouts/LinearLayout.cs | 20 | ||||
| -rw-r--r-- | grapher/Layouts/LogLayout.cs | 20 | ||||
| -rw-r--r-- | grapher/Layouts/NaturalLayout.cs | 20 | ||||
| -rw-r--r-- | grapher/Layouts/OffLayout.cs | 22 | ||||
| -rw-r--r-- | grapher/Layouts/PowerLayout.cs | 20 | ||||
| -rw-r--r-- | grapher/Layouts/SigmoidLayout.cs | 20 |
9 files changed, 238 insertions, 0 deletions
diff --git a/grapher/Layouts/ClassicLayout.cs b/grapher/Layouts/ClassicLayout.cs new file mode 100644 index 0000000..093f7fa --- /dev/null +++ b/grapher/Layouts/ClassicLayout.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Layouts +{ + public class ClassicLayout : LayoutBase + { + public ClassicLayout() + : base() + { + Name = "Classic"; + Index = 2; + ShowOptions = new bool[] { true, true, true, false }; + OptionNames = new string[] { Offset, Acceleration, Exponent, string.Empty }; + } + } +} diff --git a/grapher/Layouts/DefaultLayout.cs b/grapher/Layouts/DefaultLayout.cs new file mode 100644 index 0000000..095afdf --- /dev/null +++ b/grapher/Layouts/DefaultLayout.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher.Layouts +{ + public class DefaultLayout : LayoutBase + { + public DefaultLayout() + : base() + { + Name = "Default"; + Index = 0; + ShowOptions = new bool[] { true, true, true, true }; + OptionNames = new string[] { Offset, Acceleration, $"{Limit}\\{Exponent}", Midpoint }; + ButtonEnabled = false; + } + } +} diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs new file mode 100644 index 0000000..a4d0827 --- /dev/null +++ b/grapher/Layouts/LayoutBase.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher.Layouts +{ + public abstract class LayoutBase + { + public const string Acceleration = "Acceleration"; + public const string Scale = "Scale"; + public const string Exponent = "Exponent"; + public const string Limit = "Limit"; + public const string Midpoint = "Midpoint"; + public const string Offset = "Offset"; + + public LayoutBase() + { + ShowOptions = new bool[] { false, false, false, false }; + ShowOptionsXY = new bool[] { true, true }; + OptionNames = new string[] { string.Empty, string.Empty, string.Empty, string.Empty }; + ButtonEnabled = true; + } + + /// <summary> + /// Gets or sets mapping from acceleration type to identifying integer. + /// Must match order in tagged_union in rawaccel.hpp (which is 1-indexed, meaning 0 is off.) + /// </summary> + public int Index { get; internal set; } + + public string Name { get; internal set; } + + internal bool[] ShowOptions { get; set; } + + internal bool[] ShowOptionsXY { get; set; } + + internal string[] OptionNames { get; set; } + + internal bool ButtonEnabled { get; set; } + + public void Layout(Option[] options, OptionXY[] optionsXY, Button button) + { + // Relies on AccelOptions to keep lengths correct. + for (int i = 0; i< options.Length; i++) + { + if (ShowOptions[i]) + { + options[i].Show(OptionNames[i]); + } + else + { + options[i].Hide(); + } + } + + // Relies on AccelOptions to keep lengths correct. + for (int i = 0; i< optionsXY.Length; i++) + { + if (ShowOptionsXY[i]) + { + optionsXY[i].Show(); + } + else + { + optionsXY[i].Hide(); + } + } + + button.Enabled = ButtonEnabled; + } + } +} diff --git a/grapher/Layouts/LinearLayout.cs b/grapher/Layouts/LinearLayout.cs new file mode 100644 index 0000000..2a0358e --- /dev/null +++ b/grapher/Layouts/LinearLayout.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Layouts +{ + public class LinearLayout : LayoutBase + { + public LinearLayout() + : base() + { + Name = "Linear"; + Index = 1; + ShowOptions = new bool[] { true, true, false, false }; + OptionNames = new string[] { Offset, Acceleration, string.Empty, string.Empty }; + } + } +} diff --git a/grapher/Layouts/LogLayout.cs b/grapher/Layouts/LogLayout.cs new file mode 100644 index 0000000..ae1a8f5 --- /dev/null +++ b/grapher/Layouts/LogLayout.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Layouts +{ + public class LogLayout : LayoutBase + { + public LogLayout() + : base() + { + Name = "Logarithmic"; + Index = 4; + ShowOptions = new bool[] { true, true, false, false }; + OptionNames = new string[] { Offset, Acceleration, string.Empty, string.Empty }; + } + } +} diff --git a/grapher/Layouts/NaturalLayout.cs b/grapher/Layouts/NaturalLayout.cs new file mode 100644 index 0000000..743135c --- /dev/null +++ b/grapher/Layouts/NaturalLayout.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Layouts +{ + public class NaturalLayout : LayoutBase + { + public NaturalLayout() + : base() + { + Name = "Natural"; + Index = 3; + ShowOptions = new bool[] { true, true, true, false }; + OptionNames = new string[] { Offset, Acceleration, Limit, string.Empty }; + } + } +} diff --git a/grapher/Layouts/OffLayout.cs b/grapher/Layouts/OffLayout.cs new file mode 100644 index 0000000..cecba05 --- /dev/null +++ b/grapher/Layouts/OffLayout.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Layouts +{ + public class OffLayout : LayoutBase + { + public OffLayout() + : base() + { + Name = "Off"; + Index = 7; + ShowOptions = new bool[] { false, false, false, false }; + OptionNames = new string[] { string.Empty, string.Empty, string.Empty, string.Empty }; + ShowOptionsXY = new bool[] { false, false }; + ButtonEnabled = true; + } + } +} diff --git a/grapher/Layouts/PowerLayout.cs b/grapher/Layouts/PowerLayout.cs new file mode 100644 index 0000000..da02cf5 --- /dev/null +++ b/grapher/Layouts/PowerLayout.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Layouts +{ + public class PowerLayout : LayoutBase + { + public PowerLayout() + : base() + { + Name = "Power"; + Index = 6; + ShowOptions = new bool[] { true, true, true, false }; + OptionNames = new string[] { Offset, Scale, Exponent, string.Empty }; + } + } +} diff --git a/grapher/Layouts/SigmoidLayout.cs b/grapher/Layouts/SigmoidLayout.cs new file mode 100644 index 0000000..0dec3bf --- /dev/null +++ b/grapher/Layouts/SigmoidLayout.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Layouts +{ + public class SigmoidLayout : LayoutBase + { + public SigmoidLayout() + : base() + { + Name = "Sigmoid"; + Index = 5; + ShowOptions = new bool[] { true, true, true, true }; + OptionNames = new string[] { Offset, Acceleration, Limit, Midpoint }; + } + } +} |