From 95cc3ed0a0bf66f5535b873f245bc1c35a145478 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 21:45:42 -0700 Subject: intermittent commit - large commit halfway done --- grapher/Layouts/LayoutBase.cs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'grapher/Layouts/LayoutBase.cs') diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs index eed1716..0ad855a 100644 --- a/grapher/Layouts/LayoutBase.cs +++ b/grapher/Layouts/LayoutBase.cs @@ -40,7 +40,7 @@ namespace grapher.Layouts internal bool ButtonEnabled { get; set; } - public void Layout(Option[] options, OptionXY[] optionsXY, Button button) + public void Layout(Option[] options, Button button) { // Relies on AccelOptions to keep lengths correct. for (int i = 0; i < options.Length; i++) @@ -55,19 +55,6 @@ 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; } } -- cgit v1.2.3 From 26130b21dabaab7fc331844df11465623a811197 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 22:42:07 -0700 Subject: Second half - the parts in place --- grapher/Layouts/LayoutBase.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'grapher/Layouts/LayoutBase.cs') diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs index 0ad855a..daac6f1 100644 --- a/grapher/Layouts/LayoutBase.cs +++ b/grapher/Layouts/LayoutBase.cs @@ -15,12 +15,14 @@ namespace grapher.Layouts public const string Limit = "Limit"; public const string Midpoint = "Midpoint"; public const string Offset = "Offset"; + public const string Cap = "Cap"; + public const string Weight = "Weight"; public LayoutBase() { - ShowOptions = new bool[] { false, false, false, false }; + ShowOptions = new bool[] { false, false, false, false, true, true }; ShowOptionsXY = new bool[] { true, true }; - OptionNames = new string[] { string.Empty, string.Empty, string.Empty, string.Empty }; + OptionNames = new string[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; ButtonEnabled = true; } -- cgit v1.2.3 From aff3a066575f4bfa429f67a5104a1fcffc5f326e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Mon, 7 Sep 2020 15:19:39 -0700 Subject: Refactor type options --- grapher/Layouts/LayoutBase.cs | 86 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 18 deletions(-) (limited to 'grapher/Layouts/LayoutBase.cs') diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs index daac6f1..629b0a4 100644 --- a/grapher/Layouts/LayoutBase.cs +++ b/grapher/Layouts/LayoutBase.cs @@ -1,4 +1,5 @@ -using System; +using grapher.Models.Options; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -20,9 +21,13 @@ namespace grapher.Layouts public LayoutBase() { - ShowOptions = new bool[] { false, false, false, false, true, true }; - ShowOptionsXY = new bool[] { true, true }; - OptionNames = new string[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }; + AccelLayout = new OptionLayout(false, string.Empty); + CapLayout = new OptionLayout(false, string.Empty); + WeightLayout = new OptionLayout(false, string.Empty); + OffsetLayout = new OptionLayout(false, string.Empty); + LimExpLayout = new OptionLayout(false, string.Empty); + MidpointLayout = new OptionLayout(false, string.Empty); + ButtonEnabled = true; } @@ -34,30 +39,75 @@ namespace grapher.Layouts public string Name { get; internal set; } - internal bool[] ShowOptions { get; set; } + protected bool ButtonEnabled { get; set; } + + protected OptionLayout AccelLayout { get; set; } + + protected OptionLayout CapLayout { get; set; } + + protected OptionLayout WeightLayout { get; set; } - internal bool[] ShowOptionsXY { get; set; } + protected OptionLayout OffsetLayout { get; set; } - internal string[] OptionNames { get; set; } + protected OptionLayout LimExpLayout { get; set; } - internal bool ButtonEnabled { get; set; } + protected OptionLayout MidpointLayout { get; set; } - public void Layout(Option[] options, Button button) + public void Layout( + IOption accelOption, + IOption capOption, + IOption weightOption, + IOption offsetOption, + IOption limExpOption, + IOption midpointOption, + Button button, + int top) { - // Relies on AccelOptions to keep lengths correct. - for (int i = 0; i < options.Length; i++) + AccelLayout.Layout(accelOption); + CapLayout.Layout(capOption); + WeightLayout.Layout(weightOption); + OffsetLayout.Layout(offsetOption); + LimExpLayout.Layout(limExpOption); + MidpointLayout.Layout(midpointOption); + + button.Enabled = ButtonEnabled; + + IOption previous = null; + foreach (var option in new IOption[] { accelOption, capOption, weightOption, offsetOption, limExpOption, midpointOption}) { - if (ShowOptions[i]) + if (option.Visible) { - options[i].Show(OptionNames[i]); - } - else - { - options[i].Hide(); + if (previous != null) + { + option.SnapTo(previous); + } + else + { + option.Top = top; + } + + previous = option; } } + } - button.Enabled = ButtonEnabled; + public void Layout( + IOption accelOption, + IOption capOption, + IOption weightOption, + IOption offsetOption, + IOption limExpOption, + IOption midpointOption, + Button button) + { + Layout(accelOption, + capOption, + weightOption, + offsetOption, + limExpOption, + midpointOption, + button, + accelOption.Top); } } } -- cgit v1.2.3 From 9502dcf7608475857b1487375997d20a9d29622e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 01:26:22 -0700 Subject: Remove and sort usings en masse --- grapher/Layouts/LayoutBase.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'grapher/Layouts/LayoutBase.cs') diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs index 629b0a4..6ed8fee 100644 --- a/grapher/Layouts/LayoutBase.cs +++ b/grapher/Layouts/LayoutBase.cs @@ -1,9 +1,4 @@ using grapher.Models.Options; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace grapher.Layouts -- cgit v1.2.3