diff options
| author | Jacob Palecki <[email protected]> | 2020-09-07 19:13:30 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-07 19:13:30 -0700 |
| commit | 0fb1013f66026c696fec6469c02aba1c91711289 (patch) | |
| tree | 5a8a93de6c372195504bf17156f106835cc3a6b7 /grapher/Models/Options | |
| parent | Refactor type options (diff) | |
| download | rawaccel-0fb1013f66026c696fec6469c02aba1c91711289.tar.xz rawaccel-0fb1013f66026c696fec6469c02aba1c91711289.zip | |
Fix some separation bugs
Diffstat (limited to 'grapher/Models/Options')
| -rw-r--r-- | grapher/Models/Options/AccelTypeOptions.cs | 39 | ||||
| -rw-r--r-- | grapher/Models/Options/CapOptions.cs | 4 | ||||
| -rw-r--r-- | grapher/Models/Options/IOption.cs | 2 | ||||
| -rw-r--r-- | grapher/Models/Options/OffsetOptions.cs | 4 | ||||
| -rw-r--r-- | grapher/Models/Options/Option.cs | 4 | ||||
| -rw-r--r-- | grapher/Models/Options/OptionBase.cs | 11 |
6 files changed, 47 insertions, 17 deletions
diff --git a/grapher/Models/Options/AccelTypeOptions.cs b/grapher/Models/Options/AccelTypeOptions.cs index 878c955..a5ed474 100644 --- a/grapher/Models/Options/AccelTypeOptions.cs +++ b/grapher/Models/Options/AccelTypeOptions.cs @@ -10,7 +10,7 @@ using System.Windows.Forms; namespace grapher { - public class AccelTypeOptions + public class AccelTypeOptions : OptionBase { #region Fields @@ -102,7 +102,7 @@ namespace grapher private IEnumerable<OptionBase> Options { get; } - public int Top + public override int Top { get { @@ -115,19 +115,15 @@ namespace grapher } } - public int Height + public override int Height { get { return AccelDropdown.Height; } - set - { - AccelDropdown.Height = value; - } } - public int Left + public override int Left { get { @@ -139,7 +135,7 @@ namespace grapher } } - public int Width + public override int Width { get { @@ -151,13 +147,21 @@ namespace grapher } } + public override bool Visible + { + get + { + return AccelDropdown.Visible; + } + } + private bool ShowingDefault { get; set; } #endregion Properties #region Methods - public void Hide() + public override void Hide() { AccelDropdown.Hide(); @@ -175,6 +179,11 @@ namespace grapher Layout(); } + public override void Show(string name) + { + Show(); + } + public void SetActiveValues(int index, AccelArgs args) { var name = AccelerationTypes.Where(t => t.Value.Index == index).FirstOrDefault().Value.Name; @@ -195,8 +204,8 @@ namespace grapher AccelDropdown.Text = Constants.AccelDropDownDefaultFullText; } - Left = Acceleration.Left; - Width = Acceleration.Width; + Left = Acceleration.Left + Constants.DropDownLeftSeparation; + Width = Acceleration.Width - Constants.DropDownLeftSeparation; } public void ShowShortened() @@ -236,14 +245,14 @@ namespace grapher private void OnIndexChanged(object sender, EventArgs e) { var accelerationTypeString = AccelDropdown.SelectedItem.ToString(); - Layout(accelerationTypeString); + Layout(accelerationTypeString, Beneath); ShowingDefault = false; } - private void Layout(string type) + private void Layout(string type, int top = -1) { AccelerationType = AccelerationTypes[type]; - Layout(); + Layout(top); } private void Layout(int top = -1) diff --git a/grapher/Models/Options/CapOptions.cs b/grapher/Models/Options/CapOptions.cs index cf587c7..a44b536 100644 --- a/grapher/Models/Options/CapOptions.cs +++ b/grapher/Models/Options/CapOptions.cs @@ -114,6 +114,10 @@ namespace grapher { return CapOption.Width; } + set + { + CapOption.Width = value; + } } public override bool Visible diff --git a/grapher/Models/Options/IOption.cs b/grapher/Models/Options/IOption.cs index 71ac5e4..b387971 100644 --- a/grapher/Models/Options/IOption.cs +++ b/grapher/Models/Options/IOption.cs @@ -15,6 +15,8 @@ namespace grapher.Models.Options int Left { get; } int Width { get; } + + int Beneath { get; } bool Visible { get; } diff --git a/grapher/Models/Options/OffsetOptions.cs b/grapher/Models/Options/OffsetOptions.cs index fbc6898..ffcb862 100644 --- a/grapher/Models/Options/OffsetOptions.cs +++ b/grapher/Models/Options/OffsetOptions.cs @@ -103,6 +103,10 @@ namespace grapher.Models.Options { return OffsetOption.Width; } + set + { + OffsetOption.Width = value; + } } public override bool Visible diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index 68ecf66..5355a8a 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -110,6 +110,10 @@ namespace grapher { return Field.Left + Field.Width - Label.Left; } + set + { + Field.Width = value; + } } public override bool Visible diff --git a/grapher/Models/Options/OptionBase.cs b/grapher/Models/Options/OptionBase.cs index 9fba72f..7fb7c0e 100644 --- a/grapher/Models/Options/OptionBase.cs +++ b/grapher/Models/Options/OptionBase.cs @@ -14,7 +14,14 @@ namespace grapher.Models.Options public abstract int Left { get; set; } - public abstract int Width { get; } + public abstract int Width { get; set; } + + public int Beneath { + get + { + return Top + Height + Constants.OptionVerticalSeperation; + } + } public abstract bool Visible { get; } @@ -24,7 +31,7 @@ namespace grapher.Models.Options public virtual void SnapTo(IOption option) { - Top = option.Top + option.Height + Constants.OptionVerticalSeperation; + Top = option.Beneath; } } } |