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/AccelOptions.cs | |
| 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/AccelOptions.cs')
| -rw-r--r-- | grapher/AccelOptions.cs | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/grapher/AccelOptions.cs b/grapher/AccelOptions.cs index 0235bc7..b233552 100644 --- a/grapher/AccelOptions.cs +++ b/grapher/AccelOptions.cs @@ -10,7 +10,8 @@ namespace grapher { public class AccelOptions { - public const int PossibleOptionsCount = 3; + public const int PossibleOptionsCount = 4; + public const int PossibleOptionsXYCount = 2; public static readonly Dictionary<string, LayoutBase> AccelerationTypes = new List<LayoutBase> { @@ -21,15 +22,18 @@ namespace grapher new LogLayout(), new SigmoidLayout(), new PowerLayout(), + new OffLayout() }.ToDictionary(k => k.Name); public AccelOptions( ComboBox accelDropdown, - Option[] options) + Option[] options, + OptionXY[] optionsXY, + Button writeButton) { AccelDropdown = accelDropdown; AccelDropdown.Items.Clear(); - AccelDropdown.Items.AddRange(AccelerationTypes.Keys.ToArray()); + AccelDropdown.Items.AddRange(AccelerationTypes.Keys.Skip(1).ToArray()); AccelDropdown.SelectedIndexChanged += new System.EventHandler(OnIndexChanged); if (options.Length > PossibleOptionsCount) @@ -37,21 +41,39 @@ namespace grapher 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(); - var AccelerationType = AccelerationTypes[AccelerationTypeString]; - AccelerationIndex = AccelerationType.Index; - AccelerationType.Layout(Options); + var accelerationTypeString = AccelDropdown.SelectedItem.ToString(); + Layout(accelerationTypeString); + } + + private void Layout(string type) + { + var accelerationType = AccelerationTypes[type]; + AccelerationIndex = accelerationType.Index; + accelerationType.Layout(Options, OptionsXY, WriteButton); } } } |