From abbe20f63aded56c4714766ca1b93183eafa062a Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Wed, 30 Jun 2021 00:01:26 -0700 Subject: Add class for LUT apply type --- grapher/Models/Options/LUT/LutApplyOptions.cs | 176 ++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 grapher/Models/Options/LUT/LutApplyOptions.cs (limited to 'grapher/Models/Options/LUT/LutApplyOptions.cs') diff --git a/grapher/Models/Options/LUT/LutApplyOptions.cs b/grapher/Models/Options/LUT/LutApplyOptions.cs new file mode 100644 index 0000000..6ea7412 --- /dev/null +++ b/grapher/Models/Options/LUT/LutApplyOptions.cs @@ -0,0 +1,176 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher.Models.Options.LUT +{ + public class LutApplyOptions : OptionBase + { + public const string LUTApplyOptionsLabelText = "Apply as:"; + + public enum LutApplyType + { + Sensitivity, + Velocity + } + + public class LutApplyOption + { + public LutApplyType Type { get; set; } + + public string Name => Type.ToString(); + } + + public static readonly LutApplyOption Sensitivity = new LutApplyOption + { + Type = LutApplyType.Sensitivity, + }; + + public static readonly LutApplyOption Velocity = new LutApplyOption + { + Type = LutApplyType.Velocity, + }; + + public LutApplyOptions( + Label label, + ComboBox applyOptionsDropdown, + ActiveValueLabel lutApplyActiveValue) + { + ApplyOptions = applyOptionsDropdown; + ApplyOptions.Items.Clear(); + ApplyOptions.Items.AddRange( + new LutApplyOption[] + { + Sensitivity, + Velocity, + }); + + Label = label; + Label.Text = LUTApplyOptionsLabelText; + + ActiveValueLabel = lutApplyActiveValue; + } + + public LutApplyType ApplyType { get => ApplyOption.Type; } + + public LutApplyOption ApplyOption { + get + { + return ApplyOptions.SelectedItem as LutApplyOption; + } + set + { + ApplyOptions.SelectedItem = value; + } + } + + public Label Label { get; } + + public ActiveValueLabel ActiveValueLabel { get; } + + public ComboBox ApplyOptions { get; } + + public override bool Visible + { + get + { + return Label.Visible || ShouldShow; + } + } + + public override int Left + { + get + { + return Label.Left; + } + set + { + Label.Left = value; + ApplyOptions.Left = Label.Left + Label.Width + Constants.OptionLabelBoxSeperation; + } + } + + public override int Height + { + get + { + return Label.Height; + } + } + + public override int Top + { + get + { + return Label.Top; + } + set + { + Label.Top = value; + ApplyOptions.Top = value; + ActiveValueLabel.Top = value; + } + } + + public override int Width + { + get + { + return Label.Width; + } + set + { + ApplyOptions.Width = value - Label.Width - Constants.OptionLabelBoxSeperation; + } + } + + private bool ShouldShow { get; set; } + + public override void Hide() + { + Label.Hide(); + ApplyOptions.Hide(); + ShouldShow = false; + } + + public override void Show(string labelText) + { + Label.Show(); + + if (!string.IsNullOrWhiteSpace(labelText)) + { + Label.Text = labelText; + } + + ApplyOptions.Show(); + ShouldShow = true; + } + + public override void AlignActiveValues() + { + ActiveValueLabel.Align(); + } + + public void SetActiveValue(bool applyAsVelocity) + { + ApplyOption = ApplyOptionFromSettings(applyAsVelocity); + ActiveValueLabel.SetValue(ApplyOption.Name); + } + + public LutApplyOption ApplyOptionFromSettings(bool applyAsVelocity) + { + if (applyAsVelocity) + { + return Velocity; + } + else + { + return Sensitivity; + } + } + } +} -- cgit v1.2.3 From ac0a6eb86c8d783c21cb246d688a221913b15789 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 1 Jul 2021 19:13:12 -0700 Subject: Mostly working --- grapher/Models/Options/LUT/LutApplyOptions.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'grapher/Models/Options/LUT/LutApplyOptions.cs') diff --git a/grapher/Models/Options/LUT/LutApplyOptions.cs b/grapher/Models/Options/LUT/LutApplyOptions.cs index 6ea7412..f71c1e2 100644 --- a/grapher/Models/Options/LUT/LutApplyOptions.cs +++ b/grapher/Models/Options/LUT/LutApplyOptions.cs @@ -22,6 +22,8 @@ namespace grapher.Models.Options.LUT public LutApplyType Type { get; set; } public string Name => Type.ToString(); + + public override string ToString() => Name; } public static readonly LutApplyOption Sensitivity = new LutApplyOption @@ -50,6 +52,7 @@ namespace grapher.Models.Options.LUT Label = label; Label.Text = LUTApplyOptionsLabelText; + Label.Width = 45; ActiveValueLabel = lutApplyActiveValue; } -- cgit v1.2.3 From 308eed9ce9ed48984323e6512546a2ffeb195b14 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 1 Jul 2021 22:32:55 -0700 Subject: LUT Panel formatting --- grapher/Models/Options/LUT/LutApplyOptions.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'grapher/Models/Options/LUT/LutApplyOptions.cs') diff --git a/grapher/Models/Options/LUT/LutApplyOptions.cs b/grapher/Models/Options/LUT/LutApplyOptions.cs index f71c1e2..897460e 100644 --- a/grapher/Models/Options/LUT/LutApplyOptions.cs +++ b/grapher/Models/Options/LUT/LutApplyOptions.cs @@ -10,6 +10,7 @@ namespace grapher.Models.Options.LUT public class LutApplyOptions : OptionBase { public const string LUTApplyOptionsLabelText = "Apply as:"; + public const int LUTApplyLabelDropdownSeparation = 4; public enum LutApplyType { @@ -52,7 +53,8 @@ namespace grapher.Models.Options.LUT Label = label; Label.Text = LUTApplyOptionsLabelText; - Label.Width = 45; + Label.AutoSize = false; + Label.Width = 50; ActiveValueLabel = lutApplyActiveValue; } @@ -93,7 +95,7 @@ namespace grapher.Models.Options.LUT set { Label.Left = value; - ApplyOptions.Left = Label.Left + Label.Width + Constants.OptionLabelBoxSeperation; + ApplyOptions.Left = Label.Left + Label.Width + LUTApplyLabelDropdownSeparation; } } @@ -113,8 +115,8 @@ namespace grapher.Models.Options.LUT } set { - Label.Top = value; ApplyOptions.Top = value; + Label.Top = (ApplyOptions.Height - Label.Height) / 2 + ApplyOptions.Top; ActiveValueLabel.Top = value; } } -- cgit v1.2.3 From 44c20e12d53434c47b08dbe855567316159d0469 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Sat, 3 Jul 2021 14:52:54 -0700 Subject: Small fixes, guide additions, tweaks --- grapher/Models/Options/LUT/LutApplyOptions.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'grapher/Models/Options/LUT/LutApplyOptions.cs') diff --git a/grapher/Models/Options/LUT/LutApplyOptions.cs b/grapher/Models/Options/LUT/LutApplyOptions.cs index 897460e..7d8c737 100644 --- a/grapher/Models/Options/LUT/LutApplyOptions.cs +++ b/grapher/Models/Options/LUT/LutApplyOptions.cs @@ -139,6 +139,7 @@ namespace grapher.Models.Options.LUT { Label.Hide(); ApplyOptions.Hide(); + ActiveValueLabel.Hide(); ShouldShow = false; } @@ -152,6 +153,7 @@ namespace grapher.Models.Options.LUT } ApplyOptions.Show(); + ActiveValueLabel.Show(); ShouldShow = true; } -- cgit v1.2.3