diff options
| author | a1xd <[email protected]> | 2021-09-22 20:49:04 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-09-22 20:49:04 -0400 |
| commit | 8a4b6f57758338d5537d4671184099a4728a8cdd (patch) | |
| tree | df36529a344d5d21ff11f5ba021ec80afb4b68a4 /grapher/Layouts | |
| parent | Merge pull request #87 from matthewstrasiotto/streamer_mode (diff) | |
| parent | improve converter + docs (diff) | |
| download | rawaccel-8a4b6f57758338d5537d4671184099a4728a8cdd.tar.xz rawaccel-8a4b6f57758338d5537d4671184099a4728a8cdd.zip | |
Merge pull request #105 from a1xd/1.5.x
v1.5
Diffstat (limited to 'grapher/Layouts')
| -rw-r--r-- | grapher/Layouts/ClassicLayout.cs | 14 | ||||
| -rw-r--r-- | grapher/Layouts/DefaultLayout.cs | 10 | ||||
| -rw-r--r-- | grapher/Layouts/JumpLayout.cs | 32 | ||||
| -rw-r--r-- | grapher/Layouts/LUTLayout.cs | 42 | ||||
| -rw-r--r-- | grapher/Layouts/LayoutBase.cs | 81 | ||||
| -rw-r--r-- | grapher/Layouts/LinearLayout.cs | 16 | ||||
| -rw-r--r-- | grapher/Layouts/MotivityLayout.cs | 12 | ||||
| -rw-r--r-- | grapher/Layouts/NaturalGainLayout.cs | 24 | ||||
| -rw-r--r-- | grapher/Layouts/NaturalLayout.cs | 14 | ||||
| -rw-r--r-- | grapher/Layouts/OffLayout.cs | 10 | ||||
| -rw-r--r-- | grapher/Layouts/PowerLayout.cs | 16 | ||||
| -rw-r--r-- | grapher/Layouts/UnsupportedLayout.cs | 37 |
12 files changed, 257 insertions, 51 deletions
diff --git a/grapher/Layouts/ClassicLayout.cs b/grapher/Layouts/ClassicLayout.cs index 8403c5d..fb8fa02 100644 --- a/grapher/Layouts/ClassicLayout.cs +++ b/grapher/Layouts/ClassicLayout.cs @@ -8,16 +8,24 @@ namespace grapher.Layouts : base() { Name = "Classic"; - Index = (int)AccelMode.classic; + Mode = AccelMode.classic; + GainSwitchOptionLayout = new OptionLayout(true, Gain); AccelLayout = new OptionLayout(true, Acceleration); + DecayRateLayout = new OptionLayout(false, string.Empty); + GrowthRateLayout = new OptionLayout(false, string.Empty); + SmoothLayout = new OptionLayout(false, string.Empty); ScaleLayout = new OptionLayout(false, string.Empty); CapLayout = new OptionLayout(true, Cap); - WeightLayout = new OptionLayout(true, Weight); + WeightLayout = new OptionLayout(false, string.Empty); OffsetLayout = new OptionLayout(true, Offset); LimitLayout = new OptionLayout(false, string.Empty); - ExponentLayout = new OptionLayout(true, Exponent); + PowerClassicLayout = new OptionLayout(true, PowerClassic); + ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); + LutApplyOptionsLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/DefaultLayout.cs b/grapher/Layouts/DefaultLayout.cs index c2f7fd7..29d28f7 100644 --- a/grapher/Layouts/DefaultLayout.cs +++ b/grapher/Layouts/DefaultLayout.cs @@ -8,17 +8,25 @@ namespace grapher.Layouts : base() { Name = "Default"; - Index = (int)AccelMode.noaccel; + Mode = AccelMode.noaccel; LogarithmicCharts = false; + GainSwitchOptionLayout = new OptionLayout(true, Gain); AccelLayout = new OptionLayout(true, Acceleration); + DecayRateLayout = new OptionLayout(true, DecayRate); + GrowthRateLayout = new OptionLayout(true, GrowthRate); + SmoothLayout = new OptionLayout(true, Smooth); ScaleLayout = new OptionLayout(true, Scale); CapLayout = new OptionLayout(true, Cap); WeightLayout = new OptionLayout(true, Weight); OffsetLayout = new OptionLayout(true, Offset); LimitLayout = new OptionLayout(true, Limit); + PowerClassicLayout = new OptionLayout(true, PowerClassic); ExponentLayout = new OptionLayout(true, Exponent); MidpointLayout = new OptionLayout(true, Midpoint); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); + LutApplyOptionsLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/JumpLayout.cs b/grapher/Layouts/JumpLayout.cs new file mode 100644 index 0000000..277297c --- /dev/null +++ b/grapher/Layouts/JumpLayout.cs @@ -0,0 +1,32 @@ +using grapher.Models.Serialized; + +namespace grapher.Layouts +{ + public class JumpLayout : LayoutBase + { + public JumpLayout() + : base() + { + Name = "Jump"; + Mode = AccelMode.jump; + LogarithmicCharts = false; + + GainSwitchOptionLayout = new OptionLayout(true, Gain); + AccelLayout = new OptionLayout(false, string.Empty); + DecayRateLayout = new OptionLayout(false, string.Empty); + GrowthRateLayout = new OptionLayout(false, string.Empty); + SmoothLayout = new OptionLayout(true, Smooth); + ScaleLayout = new OptionLayout(false, string.Empty); + CapLayout = new OptionLayout(true, Cap); + WeightLayout = new OptionLayout(false, Weight); + OffsetLayout = new OptionLayout(true, Offset); + LimitLayout = new OptionLayout(false, Limit); + PowerClassicLayout = new OptionLayout(false, string.Empty); + ExponentLayout = new OptionLayout(false, string.Empty); + MidpointLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); + LutApplyOptionsLayout = new OptionLayout(false, string.Empty); + } + } +} diff --git a/grapher/Layouts/LUTLayout.cs b/grapher/Layouts/LUTLayout.cs new file mode 100644 index 0000000..5848adb --- /dev/null +++ b/grapher/Layouts/LUTLayout.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Layouts +{ + public class LUTLayout : LayoutBase + { + /// <summary> + /// String small enough to fit in active value label + /// </summary> + public const string LUTActiveName = "LUT"; + + public LUTLayout() + : base() + { + Name = "LookUpTable"; + Mode = AccelMode.lut; + + GainSwitchOptionLayout = new OptionLayout(false, string.Empty); + AccelLayout = new OptionLayout(false, Acceleration); + DecayRateLayout = new OptionLayout(false, string.Empty); + GrowthRateLayout = new OptionLayout(false, string.Empty); + SmoothLayout = new OptionLayout(false, string.Empty); + ScaleLayout = new OptionLayout(false, string.Empty); + CapLayout = new OptionLayout(false, Cap); + WeightLayout = new OptionLayout(false, Weight); + OffsetLayout = new OptionLayout(false, Offset); + LimitLayout = new OptionLayout(false, string.Empty); + PowerClassicLayout = new OptionLayout(false, string.Empty); + ExponentLayout = new OptionLayout(false, Exponent); + MidpointLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(true, string.Empty); + LutPanelLayout = new OptionLayout(true, string.Empty); + LutApplyOptionsLayout = new OptionLayout(true, string.Empty); + } + + public override string ActiveName => LUTActiveName; + } +} diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs index 83af292..66260eb 100644 --- a/grapher/Layouts/LayoutBase.cs +++ b/grapher/Layouts/LayoutBase.cs @@ -1,46 +1,62 @@ using grapher.Models.Options; -using System.Windows.Forms; namespace grapher.Layouts { public abstract class LayoutBase { public const string Acceleration = "Acceleration"; + public const string GrowthRate = "Growth Rate"; + public const string DecayRate = "Decay Rate"; public const string Scale = "Scale"; public const string Exponent = "Exponent"; + public const string PowerClassic = "Power"; public const string Limit = "Limit"; public const string Midpoint = "Midpoint"; public const string Motivity = "Motivity"; public const string Offset = "Offset"; public const string Cap = "Cap"; public const string Weight = "Weight"; + public const string Smooth = "Smooth"; + public const string Gain = "Gain"; public LayoutBase() { AccelLayout = new OptionLayout(false, string.Empty); + DecayRateLayout = new OptionLayout(false, string.Empty); + GrowthRateLayout = new OptionLayout(false, string.Empty); + SmoothLayout = new OptionLayout(false, string.Empty); ScaleLayout = new OptionLayout(false, string.Empty); CapLayout = new OptionLayout(false, string.Empty); WeightLayout = new OptionLayout(false, string.Empty); OffsetLayout = new OptionLayout(false, string.Empty); LimitLayout = new OptionLayout(false, string.Empty); + PowerClassicLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); + LutApplyOptionsLayout = new OptionLayout(false, string.Empty); + GainSwitchOptionLayout = new OptionLayout(false, string.Empty); LogarithmicCharts = false; } - /// <summary> - /// Gets or sets mapping from acceleration type to identifying integer. - /// Must match accel_mode defined in rawaccel-settings.h - /// </summary> - public int Index { get; protected set; } + public AccelMode Mode { get; protected set; } public string Name { get; protected set; } + public virtual string ActiveName { get => Name; } + public bool LogarithmicCharts { get; protected set; } protected OptionLayout AccelLayout { get; set; } + protected OptionLayout DecayRateLayout { get; set; } + + protected OptionLayout GrowthRateLayout { get; set; } + + protected OptionLayout SmoothLayout { get; set; } + protected OptionLayout ScaleLayout { get; set; } protected OptionLayout CapLayout { get; set; } @@ -51,33 +67,64 @@ namespace grapher.Layouts protected OptionLayout LimitLayout { get; set; } + protected OptionLayout PowerClassicLayout { get; set; } + protected OptionLayout ExponentLayout { get; set; } protected OptionLayout MidpointLayout { get; set; } + protected OptionLayout LutTextLayout { get; set; } + + protected OptionLayout LutPanelLayout { get; set; } + + protected OptionLayout LutApplyOptionsLayout { get; set; } + + protected OptionLayout GainSwitchOptionLayout { get; set; } + + public override string ToString() + { + return Name; + } + public void Layout( + IOption gainSwitchOption, IOption accelOption, + IOption decayRateOption, + IOption growthRateOption, + IOption smoothOption, IOption scaleOption, IOption capOption, IOption weightOption, IOption offsetOption, IOption limitOption, + IOption powerClassicOption, IOption expOption, IOption midpointOption, + IOption lutTextOption, + IOption lutPanelOption, + IOption lutApplyOption, int top) { IOption previous = null; foreach (var option in new (OptionLayout, IOption)[] { + (GainSwitchOptionLayout, gainSwitchOption), (AccelLayout, accelOption), + (DecayRateLayout, decayRateOption), + (GrowthRateLayout, growthRateOption), + (SmoothLayout, smoothOption), (ScaleLayout, scaleOption), (CapLayout, capOption), (WeightLayout, weightOption), (OffsetLayout, offsetOption), (LimitLayout, limitOption), + (PowerClassicLayout, powerClassicOption), (ExponentLayout, expOption), - (MidpointLayout, midpointOption)}) + (MidpointLayout, midpointOption), + (LutTextLayout, lutTextOption), + (LutPanelLayout, lutPanelOption), + (LutApplyOptionsLayout, lutApplyOption)}) { option.Item1.Layout(option.Item2); @@ -98,23 +145,39 @@ namespace grapher.Layouts } public void Layout( + IOption gainSwitchOption, IOption accelOption, + IOption decayRateOption, + IOption growthRateOption, + IOption smoothOption, IOption scaleOption, IOption capOption, IOption weightOption, IOption offsetOption, IOption limitOption, + IOption powerClassicOption, IOption expOption, - IOption midpointOption) + IOption midpointOption, + IOption lutTextOption, + IOption lutPanelOption, + IOption lutApplyOption) { - Layout(accelOption, + Layout(gainSwitchOption, + accelOption, + decayRateOption, + growthRateOption, + smoothOption, scaleOption, capOption, weightOption, offsetOption, limitOption, + powerClassicOption, expOption, midpointOption, + lutTextOption, + lutPanelOption, + lutApplyOption, accelOption.Top); } } diff --git a/grapher/Layouts/LinearLayout.cs b/grapher/Layouts/LinearLayout.cs index 0412a2a..6108a0b 100644 --- a/grapher/Layouts/LinearLayout.cs +++ b/grapher/Layouts/LinearLayout.cs @@ -4,21 +4,31 @@ namespace grapher.Layouts { public class LinearLayout : LayoutBase { + public const string LinearName = "Linear"; + public LinearLayout() : base() { - Name = "Linear"; - Index = (int)AccelMode.linear; + Name = LinearName; + Mode = AccelMode.classic; LogarithmicCharts = false; + GainSwitchOptionLayout = new OptionLayout(true, Gain); AccelLayout = new OptionLayout(true, Acceleration); + DecayRateLayout = new OptionLayout(false, string.Empty); + GrowthRateLayout = new OptionLayout(false, string.Empty); + SmoothLayout = new OptionLayout(false, string.Empty); ScaleLayout = new OptionLayout(false, string.Empty); CapLayout = new OptionLayout(true, Cap); - WeightLayout = new OptionLayout(true, Weight); + WeightLayout = new OptionLayout(false, Weight); OffsetLayout = new OptionLayout(true, Offset); LimitLayout = new OptionLayout(false, string.Empty); + PowerClassicLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); + LutApplyOptionsLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/MotivityLayout.cs b/grapher/Layouts/MotivityLayout.cs index b06e4fc..5443715 100644 --- a/grapher/Layouts/MotivityLayout.cs +++ b/grapher/Layouts/MotivityLayout.cs @@ -13,17 +13,25 @@ namespace grapher.Layouts : base() { Name = "Motivity"; - Index = (int)AccelMode.motivity; + Mode = AccelMode.motivity; LogarithmicCharts = true; - AccelLayout = new OptionLayout(true, Acceleration); + GainSwitchOptionLayout = new OptionLayout(true, Gain); + AccelLayout = new OptionLayout(false, string.Empty); + DecayRateLayout = new OptionLayout(false, string.Empty); + GrowthRateLayout = new OptionLayout(true, GrowthRate); + SmoothLayout = new OptionLayout(false, string.Empty); ScaleLayout = new OptionLayout(false, string.Empty); CapLayout = new OptionLayout(false, string.Empty); WeightLayout = new OptionLayout(false, string.Empty); OffsetLayout = new OptionLayout(false, string.Empty); LimitLayout = new OptionLayout(true, Motivity); + PowerClassicLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(true, Midpoint); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); + LutApplyOptionsLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/NaturalGainLayout.cs b/grapher/Layouts/NaturalGainLayout.cs deleted file mode 100644 index 12daed3..0000000 --- a/grapher/Layouts/NaturalGainLayout.cs +++ /dev/null @@ -1,24 +0,0 @@ -using grapher.Models.Serialized; - -namespace grapher.Layouts -{ - public class NaturalGainLayout : LayoutBase - { - public NaturalGainLayout() - : base() - { - Name = "NaturalGain"; - Index = (int)AccelMode.naturalgain; - LogarithmicCharts = false; - - AccelLayout = new OptionLayout(true, Acceleration); - ScaleLayout = new OptionLayout(false, string.Empty); - CapLayout = new OptionLayout(false, string.Empty); - WeightLayout = new OptionLayout(true, Weight); - OffsetLayout = new OptionLayout(true, Offset); - LimitLayout = new OptionLayout(true, Limit); - ExponentLayout = new OptionLayout(false, string.Empty); - MidpointLayout = new OptionLayout(false, string.Empty); - } - } -} diff --git a/grapher/Layouts/NaturalLayout.cs b/grapher/Layouts/NaturalLayout.cs index 44129f9..15166cb 100644 --- a/grapher/Layouts/NaturalLayout.cs +++ b/grapher/Layouts/NaturalLayout.cs @@ -8,17 +8,25 @@ namespace grapher.Layouts : base() { Name = "Natural"; - Index = (int)AccelMode.natural; + Mode = AccelMode.natural; LogarithmicCharts = false; - AccelLayout = new OptionLayout(true, Acceleration); + GainSwitchOptionLayout = new OptionLayout(true, Gain); + AccelLayout = new OptionLayout(false, string.Empty); + DecayRateLayout = new OptionLayout(true, DecayRate); + GrowthRateLayout = new OptionLayout(false, string.Empty); + SmoothLayout = new OptionLayout(false, string.Empty); ScaleLayout = new OptionLayout(false, string.Empty); CapLayout = new OptionLayout(false, string.Empty); - WeightLayout = new OptionLayout(true, Weight); + WeightLayout = new OptionLayout(false, string.Empty); OffsetLayout = new OptionLayout(true, Offset); LimitLayout = new OptionLayout(true, Limit); + PowerClassicLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); + LutApplyOptionsLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/OffLayout.cs b/grapher/Layouts/OffLayout.cs index 0b54cbb..d742ef8 100644 --- a/grapher/Layouts/OffLayout.cs +++ b/grapher/Layouts/OffLayout.cs @@ -8,17 +8,25 @@ namespace grapher.Layouts : base() { Name = "Off"; - Index = (int)AccelMode.noaccel; + Mode = AccelMode.noaccel; LogarithmicCharts = false; + GainSwitchOptionLayout = new OptionLayout(false, string.Empty); AccelLayout = new OptionLayout(false, string.Empty); + DecayRateLayout = new OptionLayout(false, string.Empty); + GrowthRateLayout = new OptionLayout(false, string.Empty); + SmoothLayout = new OptionLayout(false, string.Empty); ScaleLayout = new OptionLayout(false, string.Empty); CapLayout = new OptionLayout(false, string.Empty); WeightLayout = new OptionLayout(false, string.Empty); OffsetLayout = new OptionLayout(false, string.Empty); LimitLayout = new OptionLayout(false, string.Empty); + PowerClassicLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); + LutApplyOptionsLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/PowerLayout.cs b/grapher/Layouts/PowerLayout.cs index da7d5bb..03d9efa 100644 --- a/grapher/Layouts/PowerLayout.cs +++ b/grapher/Layouts/PowerLayout.cs @@ -1,6 +1,4 @@ -using grapher.Models.Serialized; - -namespace grapher.Layouts +namespace grapher.Layouts { public class PowerLayout : LayoutBase { @@ -8,17 +6,25 @@ namespace grapher.Layouts : base() { Name = "Power"; - Index = (int)AccelMode.power; + Mode = AccelMode.power; LogarithmicCharts = false; + GainSwitchOptionLayout = new OptionLayout(true, Gain); AccelLayout = new OptionLayout(false, string.Empty); + DecayRateLayout = new OptionLayout(false, string.Empty); + GrowthRateLayout = new OptionLayout(false, string.Empty); + SmoothLayout = new OptionLayout(false, string.Empty); ScaleLayout = new OptionLayout(true, Scale); - CapLayout = new OptionLayout(true, Cap); + CapLayout = new OptionLayout(false, string.Empty); WeightLayout = new OptionLayout(true, Weight); OffsetLayout = new OptionLayout(false, string.Empty); LimitLayout = new OptionLayout(false, string.Empty); + PowerClassicLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(true, Exponent); MidpointLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); + LutApplyOptionsLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/UnsupportedLayout.cs b/grapher/Layouts/UnsupportedLayout.cs new file mode 100644 index 0000000..4a401a4 --- /dev/null +++ b/grapher/Layouts/UnsupportedLayout.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace grapher.Layouts +{ + public class UnsupportedLayout : LayoutBase + { + public const string LUTLayoutText = "This mode is unsupported by this program. See the guide for details."; + + public UnsupportedLayout() + : base() + { + Name = "Unsupported"; + Mode = AccelMode.noaccel + 1; + + GainSwitchOptionLayout = new OptionLayout(false, string.Empty); + AccelLayout = new OptionLayout(false, Acceleration); + DecayRateLayout = new OptionLayout(false, string.Empty); + GrowthRateLayout = new OptionLayout(false, string.Empty); + SmoothLayout = new OptionLayout(false, string.Empty); + ScaleLayout = new OptionLayout(false, string.Empty); + CapLayout = new OptionLayout(false, Cap); + WeightLayout = new OptionLayout(false, Weight); + OffsetLayout = new OptionLayout(false, Offset); + LimitLayout = new OptionLayout(false, string.Empty); + PowerClassicLayout = new OptionLayout(false, string.Empty); + ExponentLayout = new OptionLayout(false, Exponent); + MidpointLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(true, LUTLayoutText); + LutPanelLayout = new OptionLayout(false, string.Empty); + LutApplyOptionsLayout = new OptionLayout(false, string.Empty); + } + } +}
\ No newline at end of file |