diff options
| author | Jacob Palecki <[email protected]> | 2021-04-25 23:05:44 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2021-04-25 23:05:44 -0700 |
| commit | 0cf5ce3762926fa556418572e9661d79cbbaa240 (patch) | |
| tree | f5dd9c5c77acf0f4a8d910636660bed93f8fb16b | |
| parent | Fixed layout issues for LUT (diff) | |
| download | rawaccel-0cf5ce3762926fa556418572e9661d79cbbaa240.tar.xz rawaccel-0cf5ce3762926fa556418572e9661d79cbbaa240.zip | |
Start of LUT points editing
| -rw-r--r-- | grapher/Form1.Designer.cs | 54 | ||||
| -rw-r--r-- | grapher/Form1.cs | 2 | ||||
| -rw-r--r-- | grapher/Layouts/ClassicLayout.cs | 3 | ||||
| -rw-r--r-- | grapher/Layouts/DefaultLayout.cs | 3 | ||||
| -rw-r--r-- | grapher/Layouts/JumpLayout.cs | 3 | ||||
| -rw-r--r-- | grapher/Layouts/LUTLayout.cs | 5 | ||||
| -rw-r--r-- | grapher/Layouts/LayoutBase.cs | 15 | ||||
| -rw-r--r-- | grapher/Layouts/LinearLayout.cs | 3 | ||||
| -rw-r--r-- | grapher/Layouts/MotivityLayout.cs | 3 | ||||
| -rw-r--r-- | grapher/Layouts/NaturalLayout.cs | 3 | ||||
| -rw-r--r-- | grapher/Layouts/OffLayout.cs | 3 | ||||
| -rw-r--r-- | grapher/Layouts/PowerLayout.cs | 3 | ||||
| -rw-r--r-- | grapher/Layouts/UnsupportedLayout.cs | 3 | ||||
| -rw-r--r-- | grapher/Models/AccelGUIFactory.cs | 5 | ||||
| -rw-r--r-- | grapher/Models/Options/AccelTypeOptions.cs | 10 | ||||
| -rw-r--r-- | grapher/Models/Options/LUT/LUTPanelOptions.cs | 136 | ||||
| -rw-r--r-- | grapher/grapher.csproj | 1 |
17 files changed, 224 insertions, 31 deletions
diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs index 995a0b7..baf1254 100644 --- a/grapher/Form1.Designer.cs +++ b/grapher/Form1.Designer.cs @@ -71,6 +71,8 @@ namespace grapher System.Windows.Forms.DataVisualization.Charting.Title title6 = new System.Windows.Forms.DataVisualization.Charting.Title(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RawAcceleration)); this.optionsPanel = new System.Windows.Forms.Panel(); + this.gainSwitchActiveLabelY = new System.Windows.Forms.Label(); + this.gainSwitchActiveLabelX = new System.Windows.Forms.Label(); this.gainSwitchY = new System.Windows.Forms.CheckBox(); this.gainSwitchX = new System.Windows.Forms.CheckBox(); this.LUTTextLabelY = new System.Windows.Forms.Label(); @@ -186,8 +188,8 @@ namespace grapher this.GainChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.VelocityChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.AccelerationChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.gainSwitchActiveLabelX = new System.Windows.Forms.Label(); - this.gainSwitchActiveLabelY = new System.Windows.Forms.Label(); + this.LUTPanelX = new System.Windows.Forms.Panel(); + this.LUTPanelY = new System.Windows.Forms.Panel(); this.optionsPanel.SuspendLayout(); this.DirectionalityPanel.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -203,6 +205,8 @@ namespace grapher // optionsPanel // this.optionsPanel.AutoSize = true; + this.optionsPanel.Controls.Add(this.LUTPanelY); + this.optionsPanel.Controls.Add(this.LUTPanelX); this.optionsPanel.Controls.Add(this.gainSwitchActiveLabelY); this.optionsPanel.Controls.Add(this.gainSwitchActiveLabelX); this.optionsPanel.Controls.Add(this.gainSwitchY); @@ -289,6 +293,24 @@ namespace grapher this.optionsPanel.Size = new System.Drawing.Size(483, 956); this.optionsPanel.TabIndex = 34; // + // gainSwitchActiveLabelY + // + this.gainSwitchActiveLabelY.AutoSize = true; + this.gainSwitchActiveLabelY.Location = new System.Drawing.Point(417, 95); + this.gainSwitchActiveLabelY.Name = "gainSwitchActiveLabelY"; + this.gainSwitchActiveLabelY.Size = new System.Drawing.Size(29, 13); + this.gainSwitchActiveLabelY.TabIndex = 157; + this.gainSwitchActiveLabelY.Text = "Gain"; + // + // gainSwitchActiveLabelX + // + this.gainSwitchActiveLabelX.AutoSize = true; + this.gainSwitchActiveLabelX.Location = new System.Drawing.Point(200, 96); + this.gainSwitchActiveLabelX.Name = "gainSwitchActiveLabelX"; + this.gainSwitchActiveLabelX.Size = new System.Drawing.Size(29, 13); + this.gainSwitchActiveLabelX.TabIndex = 156; + this.gainSwitchActiveLabelX.Text = "Gain"; + // // gainSwitchY // this.gainSwitchY.AutoSize = true; @@ -1497,23 +1519,21 @@ namespace grapher title6.Text = "Sensitivity"; this.AccelerationChart.Titles.Add(title6); // - // gainSwitchActiveLabelX + // LUTPanelX // - this.gainSwitchActiveLabelX.AutoSize = true; - this.gainSwitchActiveLabelX.Location = new System.Drawing.Point(200, 96); - this.gainSwitchActiveLabelX.Name = "gainSwitchActiveLabelX"; - this.gainSwitchActiveLabelX.Size = new System.Drawing.Size(29, 13); - this.gainSwitchActiveLabelX.TabIndex = 156; - this.gainSwitchActiveLabelX.Text = "Gain"; + this.LUTPanelX.AutoScroll = true; + this.LUTPanelX.Location = new System.Drawing.Point(317, 369); + this.LUTPanelX.Name = "LUTPanelX"; + this.LUTPanelX.Size = new System.Drawing.Size(68, 135); + this.LUTPanelX.TabIndex = 158; // - // gainSwitchActiveLabelY + // LUTPanelY // - this.gainSwitchActiveLabelY.AutoSize = true; - this.gainSwitchActiveLabelY.Location = new System.Drawing.Point(417, 95); - this.gainSwitchActiveLabelY.Name = "gainSwitchActiveLabelY"; - this.gainSwitchActiveLabelY.Size = new System.Drawing.Size(29, 13); - this.gainSwitchActiveLabelY.TabIndex = 157; - this.gainSwitchActiveLabelY.Text = "Gain"; + this.LUTPanelY.AutoScroll = true; + this.LUTPanelY.Location = new System.Drawing.Point(397, 369); + this.LUTPanelY.Name = "LUTPanelY"; + this.LUTPanelY.Size = new System.Drawing.Size(73, 135); + this.LUTPanelY.TabIndex = 159; // // RawAcceleration // @@ -1662,6 +1682,8 @@ namespace grapher private System.Windows.Forms.CheckBox gainSwitchY; private System.Windows.Forms.Label gainSwitchActiveLabelY; private System.Windows.Forms.Label gainSwitchActiveLabelX; + private System.Windows.Forms.Panel LUTPanelY; + private System.Windows.Forms.Panel LUTPanelX; } } diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 7b21036..2b2ad42 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -100,6 +100,8 @@ namespace grapher ByComponentCheckBox, gainSwitchX, gainSwitchY, + LUTPanelX, + LUTPanelY, LockXYLabel, sensitivityLabel, rotationLabel, diff --git a/grapher/Layouts/ClassicLayout.cs b/grapher/Layouts/ClassicLayout.cs index fe5c25d..ca9195e 100644 --- a/grapher/Layouts/ClassicLayout.cs +++ b/grapher/Layouts/ClassicLayout.cs @@ -19,7 +19,8 @@ namespace grapher.Layouts LimitLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(true, Exponent); MidpointLayout = new OptionLayout(false, string.Empty); - LUTTextLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/DefaultLayout.cs b/grapher/Layouts/DefaultLayout.cs index 8146255..055536a 100644 --- a/grapher/Layouts/DefaultLayout.cs +++ b/grapher/Layouts/DefaultLayout.cs @@ -20,7 +20,8 @@ namespace grapher.Layouts LimitLayout = new OptionLayout(true, Limit); ExponentLayout = new OptionLayout(true, Exponent); MidpointLayout = new OptionLayout(true, Midpoint); - LUTTextLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/JumpLayout.cs b/grapher/Layouts/JumpLayout.cs index cf5eb24..4e34ef3 100644 --- a/grapher/Layouts/JumpLayout.cs +++ b/grapher/Layouts/JumpLayout.cs @@ -20,7 +20,8 @@ namespace grapher.Layouts LimitLayout = new OptionLayout(false, Limit); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(false, string.Empty); - LUTTextLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/LUTLayout.cs b/grapher/Layouts/LUTLayout.cs index 1ca5915..37c336e 100644 --- a/grapher/Layouts/LUTLayout.cs +++ b/grapher/Layouts/LUTLayout.cs @@ -8,7 +8,7 @@ namespace grapher.Layouts { public class LUTLayout : LayoutBase { - public const string LUTLayoutText = "This mode is for advanced users only. It requires a lut.json file to define the velocity curve. See the guide for specifics."; + public const string LUTLayoutText = "This mode is for advanced users only. We recommend setting points in the settings file with a script."; /// <summary> /// String small enough to fit in active value label @@ -30,7 +30,8 @@ namespace grapher.Layouts LimitLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(false, Exponent); MidpointLayout = new OptionLayout(false, string.Empty); - LUTTextLayout = new OptionLayout(true, LUTLayoutText); + LutTextLayout = new OptionLayout(true, LUTLayoutText); + LutPanelLayout = new OptionLayout(true, string.Empty); } public override string ActiveName => LUTActiveName; diff --git a/grapher/Layouts/LayoutBase.cs b/grapher/Layouts/LayoutBase.cs index 82d10d8..bc207d3 100644 --- a/grapher/Layouts/LayoutBase.cs +++ b/grapher/Layouts/LayoutBase.cs @@ -28,7 +28,8 @@ namespace grapher.Layouts LimitLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(false, string.Empty); - LUTTextLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); GainSwitchOptionLayout = new OptionLayout(false, string.Empty); LogarithmicCharts = false; @@ -58,7 +59,9 @@ namespace grapher.Layouts protected OptionLayout MidpointLayout { get; set; } - protected OptionLayout LUTTextLayout { get; set; } + protected OptionLayout LutTextLayout { get; set; } + + protected OptionLayout LutPanelLayout { get; set; } protected OptionLayout GainSwitchOptionLayout { get; set; } @@ -78,6 +81,7 @@ namespace grapher.Layouts IOption expOption, IOption midpointOption, IOption lutTextOption, + IOption lutPanelOption, int top) { @@ -93,7 +97,8 @@ namespace grapher.Layouts (LimitLayout, limitOption), (ExponentLayout, expOption), (MidpointLayout, midpointOption), - (LUTTextLayout, lutTextOption)}) + (LutTextLayout, lutTextOption), + (LutPanelLayout, lutPanelOption)}) { option.Item1.Layout(option.Item2); @@ -123,7 +128,8 @@ namespace grapher.Layouts IOption limitOption, IOption expOption, IOption midpointOption, - IOption lutTextOption) + IOption lutTextOption, + IOption lutPanelOption) { Layout(gainSwitchOption, accelOption, @@ -135,6 +141,7 @@ namespace grapher.Layouts expOption, midpointOption, lutTextOption, + lutPanelOption, accelOption.Top); } } diff --git a/grapher/Layouts/LinearLayout.cs b/grapher/Layouts/LinearLayout.cs index 88be3d4..6447833 100644 --- a/grapher/Layouts/LinearLayout.cs +++ b/grapher/Layouts/LinearLayout.cs @@ -22,7 +22,8 @@ namespace grapher.Layouts LimitLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(false, string.Empty); - LUTTextLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/MotivityLayout.cs b/grapher/Layouts/MotivityLayout.cs index 7458dfc..7ab2f3f 100644 --- a/grapher/Layouts/MotivityLayout.cs +++ b/grapher/Layouts/MotivityLayout.cs @@ -25,7 +25,8 @@ namespace grapher.Layouts LimitLayout = new OptionLayout(true, Motivity); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(true, Midpoint); - LUTTextLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/NaturalLayout.cs b/grapher/Layouts/NaturalLayout.cs index ece2b00..245a37b 100644 --- a/grapher/Layouts/NaturalLayout.cs +++ b/grapher/Layouts/NaturalLayout.cs @@ -20,7 +20,8 @@ namespace grapher.Layouts LimitLayout = new OptionLayout(true, Limit); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(false, string.Empty); - LUTTextLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/OffLayout.cs b/grapher/Layouts/OffLayout.cs index e802113..16e5c19 100644 --- a/grapher/Layouts/OffLayout.cs +++ b/grapher/Layouts/OffLayout.cs @@ -20,7 +20,8 @@ namespace grapher.Layouts LimitLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(false, string.Empty); MidpointLayout = new OptionLayout(false, string.Empty); - LUTTextLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/PowerLayout.cs b/grapher/Layouts/PowerLayout.cs index bb07457..bf40c24 100644 --- a/grapher/Layouts/PowerLayout.cs +++ b/grapher/Layouts/PowerLayout.cs @@ -18,7 +18,8 @@ LimitLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(true, Exponent); MidpointLayout = new OptionLayout(false, string.Empty); - LUTTextLayout = new OptionLayout(false, string.Empty); + LutTextLayout = new OptionLayout(false, string.Empty); + LutPanelLayout = new OptionLayout(false, string.Empty); } } } diff --git a/grapher/Layouts/UnsupportedLayout.cs b/grapher/Layouts/UnsupportedLayout.cs index 1607a6c..c17812d 100644 --- a/grapher/Layouts/UnsupportedLayout.cs +++ b/grapher/Layouts/UnsupportedLayout.cs @@ -25,7 +25,8 @@ namespace grapher.Layouts LimitLayout = new OptionLayout(false, string.Empty); ExponentLayout = new OptionLayout(false, Exponent); MidpointLayout = new OptionLayout(false, string.Empty); - LUTTextLayout = new OptionLayout(true, LUTLayoutText); + LutTextLayout = new OptionLayout(true, LUTLayoutText); + LutPanelLayout = new OptionLayout(false, string.Empty); } } }
\ No newline at end of file diff --git a/grapher/Models/AccelGUIFactory.cs b/grapher/Models/AccelGUIFactory.cs index 73be939..5035598 100644 --- a/grapher/Models/AccelGUIFactory.cs +++ b/grapher/Models/AccelGUIFactory.cs @@ -3,6 +3,7 @@ using grapher.Models.Devices; using grapher.Models.Mouse; using grapher.Models.Options; using grapher.Models.Options.Directionality; +using grapher.Models.Options.LUT; using grapher.Models.Serialized; using System; using System.Windows.Forms; @@ -66,6 +67,8 @@ namespace grapher.Models CheckBox byComponentCheckBox, CheckBox gainSwitchX, CheckBox gainSwitchY, + Panel lutPanelX, + Panel lutPanelY, Label lockXYLabel, Label sensitivityLabel, Label rotationLabel, @@ -336,6 +339,7 @@ namespace grapher.Models exponentX, midpointX, lutTextX, + new LUTPanelOptions(lutPanelX), writeButton, new ActiveValueLabel(accelTypeActiveLabelX, activeValueTitleX)); @@ -351,6 +355,7 @@ namespace grapher.Models exponentY, midpointY, lutTextY, + new LUTPanelOptions(lutPanelY), writeButton, new ActiveValueLabel(accelTypeActiveLabelY, activeValueTitleY)); diff --git a/grapher/Models/Options/AccelTypeOptions.cs b/grapher/Models/Options/AccelTypeOptions.cs index e79e767..74e748a 100644 --- a/grapher/Models/Options/AccelTypeOptions.cs +++ b/grapher/Models/Options/AccelTypeOptions.cs @@ -1,5 +1,6 @@ using grapher.Layouts; using grapher.Models.Options; +using grapher.Models.Options.LUT; using grapher.Models.Serialized; using System; using System.Collections.Generic; @@ -38,6 +39,7 @@ namespace grapher Option exponent, Option midpoint, TextOption lutText, + LUTPanelOptions lutPanelOptions, Button writeButton, ActiveValueLabel accelTypeActiveValue) { @@ -70,11 +72,15 @@ namespace grapher WriteButton = writeButton; AccelTypeActiveValue = accelTypeActiveValue; LutText = lutText; + LutPanel = lutPanelOptions; AccelTypeActiveValue.Left = AccelDropdown.Left + AccelDropdown.Width; AccelTypeActiveValue.Height = AccelDropdown.Height; GainSwitch.Left = Acceleration.Field.Left; + LutPanel.Left = AccelDropdown.Left; + LutPanel.Width = AccelDropdown.Width + AccelTypeActiveValue.Width; + AccelerationType = Off; Layout(); ShowingDefault = true; @@ -111,6 +117,8 @@ namespace grapher public CheckBoxOption GainSwitch { get; } + public LUTPanelOptions LutPanel { get; } + public LayoutBase AccelerationType { get @@ -198,6 +206,7 @@ namespace grapher Exponent.Hide(); Midpoint.Hide(); LutText.Hide(); + LutPanel.Hide(); } public void Show() @@ -322,6 +331,7 @@ namespace grapher Exponent, Midpoint, LutText, + LutPanel, top); } diff --git a/grapher/Models/Options/LUT/LUTPanelOptions.cs b/grapher/Models/Options/LUT/LUTPanelOptions.cs new file mode 100644 index 0000000..a6b894b --- /dev/null +++ b/grapher/Models/Options/LUT/LUTPanelOptions.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher.Models.Options.LUT +{ + public class LUTPanelOptions : OptionBase + { + public const string LUTPanelTitle = "LookupTable Points"; + public const string ApplyAsSensTitle = "Apply as sensitivity"; + public const string ApplyAsVelocityTitle = "Apply as velocity"; + public const int TitlePadding = 5; + public const int PanelHeight = 40; + + public LUTPanelOptions(Panel panel) + { + Panel = panel; + Panel.Height = PanelHeight; + Panel.Paint += Panel_Paint; + + Title = new Label(); + Title.Text = LUTPanelTitle; + ApplyAsSens = new CheckBox(); + ApplyAsSens.Text = ApplyAsSensTitle; + ApplyAsVelocity = new CheckBox(); + ApplyAsVelocity.Text = ApplyAsVelocityTitle; + + Panel.Controls.Add(Title); + Title.Left = TitlePadding; + Title.Top = TitlePadding; + } + + public Panel Panel + { + get; + } + + public Label Title + { + get; + } + + public CheckBox ApplyAsSens + { + get; + } + + public CheckBox ApplyAsVelocity + { + get; + } + + public override bool Visible + { + get + { + return Panel.Visible || ShouldShow; + } + } + + public override int Top + { + get + { + return Panel.Top; + } + set + { + Panel.Top = value; + } + } + + public override int Height + { + get + { + return Panel.Height; + } + } + + public override int Left + { + get + { + return Panel.Left; + } + set + { + Panel.Left = value; + } + } + + public override int Width + { + get + { + return Panel.Width; + } + set + { + Panel.Width = value; + } + } + + private bool ShouldShow { get; set; } + + public override void Hide() + { + Panel.Hide(); + ShouldShow = false; + } + + public override void Show(string name) + { + Panel.Show(); + ShouldShow = true; + } + + public override void AlignActiveValues() + { + // Nothing to do here. + } + + private void Panel_Paint(object sender, PaintEventArgs e) + { + Color col = Color.DarkGray; + ButtonBorderStyle bbs = ButtonBorderStyle.Dashed; + int thickness = 2; + ControlPaint.DrawBorder(e.Graphics, Panel.ClientRectangle, col, thickness, bbs, col, thickness, bbs, col, thickness, bbs, col, thickness, bbs); + } + } +} diff --git a/grapher/grapher.csproj b/grapher/grapher.csproj index 50545e4..029029b 100644 --- a/grapher/grapher.csproj +++ b/grapher/grapher.csproj @@ -133,6 +133,7 @@ <Compile Include="Models\Options\CheckBoxOption.cs" /> <Compile Include="Models\Options\Directionality\DirectionalityOptions.cs" /> <Compile Include="Models\Options\IOption.cs" /> + <Compile Include="Models\Options\LUT\LUTPanelOptions.cs" /> <Compile Include="Models\Options\OffsetOptions.cs" /> <Compile Include="Models\Options\Option.cs" /> <Compile Include="Layouts\OptionLayout.cs" /> |