diff options
| author | Jacob Palecki <[email protected]> | 2020-07-31 12:20:11 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-07-31 12:20:11 -0700 |
| commit | 6537db04f7e717eda2f21e007cdba7e13b7f559e (patch) | |
| tree | efb65bf3f305f376ea75f4f687b08bf8998c020f /grapher/Layouts | |
| parent | Add class for storing settings from file (diff) | |
| parent | Merge pull request #6 from a1xd/st-refactor (diff) | |
| download | rawaccel-6537db04f7e717eda2f21e007cdba7e13b7f559e.tar.xz rawaccel-6537db04f7e717eda2f21e007cdba7e13b7f559e.zip | |
Show no settings for off, remove unused class for PR
Diffstat (limited to 'grapher/Layouts')
| -rw-r--r-- | grapher/Layouts/ClassicLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/DefaultLayout.cs | 8 | ||||
| -rw-r--r-- | grapher/Layouts/LayoutBase.cs | 32 | ||||
| -rw-r--r-- | grapher/Layouts/LinearLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/LogLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/NaturalLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/OffLayout.cs | 22 | ||||
| -rw-r--r-- | grapher/Layouts/PowerLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/SigmoidLayout.cs | 5 |
9 files changed, 72 insertions, 20 deletions
diff --git a/grapher/Layouts/ClassicLayout.cs b/grapher/Layouts/ClassicLayout.cs index a8fc2bd..093f7fa 100644 --- a/grapher/Layouts/ClassicLayout.cs +++ b/grapher/Layouts/ClassicLayout.cs @@ -9,11 +9,12 @@ namespace grapher.Layouts public class ClassicLayout : LayoutBase { public ClassicLayout() + : base() { Name = "Classic"; Index = 2; - Show = new bool[] { true, true, false }; - OptionNames = new string[] { Acceleration, Exponent, string.Empty }; + 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 index 2ad3c0e..095afdf 100644 --- a/grapher/Layouts/DefaultLayout.cs +++ b/grapher/Layouts/DefaultLayout.cs @@ -10,11 +10,13 @@ namespace grapher.Layouts public class DefaultLayout : LayoutBase { public DefaultLayout() + : base() { - Name = "Off"; + Name = "Default"; Index = 0; - Show = new bool[] { true, true, true }; - OptionNames = new string[] { Acceleration, $"{Limit}\\{Exponent}", Midpoint }; + 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 index 9c60008..a4d0827 100644 --- a/grapher/Layouts/LayoutBase.cs +++ b/grapher/Layouts/LayoutBase.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace grapher.Layouts { @@ -13,11 +14,14 @@ namespace grapher.Layouts public const string Exponent = "Exponent"; public const string Limit = "Limit"; public const string Midpoint = "Midpoint"; + public const string Offset = "Offset"; public LayoutBase() { - Show = new bool[] { false, false, false }; - OptionNames = new string[] { string.Empty, string.Empty, string.Empty }; + 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> @@ -28,16 +32,20 @@ namespace grapher.Layouts public string Name { get; internal set; } - internal bool[] Show { get; set; } + internal bool[] ShowOptions { get; set; } + + internal bool[] ShowOptionsXY { get; set; } internal string[] OptionNames { get; set; } - public void Layout(Option[] options) + 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 (Show[i]) + if (ShowOptions[i]) { options[i].Show(OptionNames[i]); } @@ -47,6 +55,20 @@ namespace grapher.Layouts } } + // 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 index b500b6b..2a0358e 100644 --- a/grapher/Layouts/LinearLayout.cs +++ b/grapher/Layouts/LinearLayout.cs @@ -9,11 +9,12 @@ namespace grapher.Layouts public class LinearLayout : LayoutBase { public LinearLayout() + : base() { Name = "Linear"; Index = 1; - Show = new bool[] { true, false, false }; - OptionNames = new string[] { Acceleration, string.Empty, string.Empty }; + 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 index 7c7fd9e..ae1a8f5 100644 --- a/grapher/Layouts/LogLayout.cs +++ b/grapher/Layouts/LogLayout.cs @@ -9,11 +9,12 @@ namespace grapher.Layouts public class LogLayout : LayoutBase { public LogLayout() + : base() { Name = "Logarithmic"; Index = 4; - Show = new bool[] { true, false, false }; - OptionNames = new string[] { Acceleration, string.Empty, string.Empty }; + 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 index 180a7c0..743135c 100644 --- a/grapher/Layouts/NaturalLayout.cs +++ b/grapher/Layouts/NaturalLayout.cs @@ -9,11 +9,12 @@ namespace grapher.Layouts public class NaturalLayout : LayoutBase { public NaturalLayout() + : base() { Name = "Natural"; Index = 3; - Show = new bool[] { true, true, false }; - OptionNames = new string[] { Acceleration, Limit, string.Empty }; + 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 index 6d4f5d7..da02cf5 100644 --- a/grapher/Layouts/PowerLayout.cs +++ b/grapher/Layouts/PowerLayout.cs @@ -9,11 +9,12 @@ namespace grapher.Layouts public class PowerLayout : LayoutBase { public PowerLayout() + : base() { Name = "Power"; Index = 6; - Show = new bool[] { true, true, false }; - OptionNames = new string[] { Scale, Exponent, string.Empty }; + 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 index 88d6c61..0dec3bf 100644 --- a/grapher/Layouts/SigmoidLayout.cs +++ b/grapher/Layouts/SigmoidLayout.cs @@ -9,11 +9,12 @@ namespace grapher.Layouts public class SigmoidLayout : LayoutBase { public SigmoidLayout() + : base() { Name = "Sigmoid"; Index = 5; - Show = new bool[] { true, true, true }; - OptionNames = new string[] { Acceleration, Limit, Midpoint }; + ShowOptions = new bool[] { true, true, true, true }; + OptionNames = new string[] { Offset, Acceleration, Limit, Midpoint }; } } } |