summaryrefslogtreecommitdiff
path: root/grapher/Layouts/LayoutBase.cs
diff options
context:
space:
mode:
authorJacobPalecki <[email protected]>2020-09-08 16:00:05 -0700
committerGitHub <[email protected]>2020-09-08 16:00:05 -0700
commite5461fa84e65d78823d0022339fa2d8864f7e63c (patch)
treeb486ef524c93bfeb29a86403114b6805bf9decf1 /grapher/Layouts/LayoutBase.cs
parentMerge pull request #19 from JacobPalecki/gainOffset (diff)
parentSave show last mouse value (diff)
downloadrawaccel-e5461fa84e65d78823d0022339fa2d8864f7e63c.tar.xz
rawaccel-e5461fa84e65d78823d0022339fa2d8864f7e63c.zip
Merge pull request #20 from JacobPalecki/GUI
GUI: Add By Component & Anisotropy; Remove Logarithm and Sigmoid; Delete Console; Some Refactoring
Diffstat (limited to 'grapher/Layouts/LayoutBase.cs')
-rw-r--r--grapher/Layouts/LayoutBase.cs102
1 files changed, 68 insertions, 34 deletions
diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs
index eed1716..6ed8fee 100644
--- a/grapher/Layouts/LayoutBase.cs
+++ b/grapher/Layouts/LayoutBase.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using grapher.Models.Options;
using System.Windows.Forms;
namespace grapher.Layouts
@@ -15,12 +11,18 @@ 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 };
- ShowOptionsXY = new bool[] { true, true };
- OptionNames = new string[] { 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;
}
@@ -32,43 +34,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; }
- internal bool[] ShowOptionsXY { get; set; }
+ protected OptionLayout WeightLayout { get; set; }
- internal string[] OptionNames { get; set; }
+ protected OptionLayout OffsetLayout { get; set; }
- internal bool ButtonEnabled { get; set; }
+ protected OptionLayout LimExpLayout { get; set; }
- public void Layout(Option[] options, OptionXY[] optionsXY, Button button)
+ protected OptionLayout MidpointLayout { get; set; }
+
+ 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++)
- {
- if (ShowOptions[i])
- {
- options[i].Show(OptionNames[i]);
- }
- else
- {
- options[i].Hide();
- }
- }
+ AccelLayout.Layout(accelOption);
+ CapLayout.Layout(capOption);
+ WeightLayout.Layout(weightOption);
+ OffsetLayout.Layout(offsetOption);
+ LimExpLayout.Layout(limExpOption);
+ MidpointLayout.Layout(midpointOption);
+
+ button.Enabled = ButtonEnabled;
- // Relies on AccelOptions to keep lengths correct.
- for (int i = 0; i< optionsXY.Length; i++)
+ IOption previous = null;
+ foreach (var option in new IOption[] { accelOption, capOption, weightOption, offsetOption, limExpOption, midpointOption})
{
- if (ShowOptionsXY[i])
- {
- optionsXY[i].Show();
- }
- else
+ if (option.Visible)
{
- optionsXY[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);
}
}
}