summaryrefslogtreecommitdiff
path: root/grapher/Models
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2021-04-25 23:05:44 -0700
committerJacob Palecki <[email protected]>2021-04-25 23:05:44 -0700
commit0cf5ce3762926fa556418572e9661d79cbbaa240 (patch)
treef5dd9c5c77acf0f4a8d910636660bed93f8fb16b /grapher/Models
parentFixed layout issues for LUT (diff)
downloadrawaccel-0cf5ce3762926fa556418572e9661d79cbbaa240.tar.xz
rawaccel-0cf5ce3762926fa556418572e9661d79cbbaa240.zip
Start of LUT points editing
Diffstat (limited to 'grapher/Models')
-rw-r--r--grapher/Models/AccelGUIFactory.cs5
-rw-r--r--grapher/Models/Options/AccelTypeOptions.cs10
-rw-r--r--grapher/Models/Options/LUT/LUTPanelOptions.cs136
3 files changed, 151 insertions, 0 deletions
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);
+ }
+ }
+}