diff options
| author | Jacob Palecki <[email protected]> | 2020-08-11 23:06:39 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-11 23:06:39 -0700 |
| commit | 65a74b97c0c9ac8ca10312c0749e33df9e64b3d9 (patch) | |
| tree | d15dbadb2497ae5df3d734b534d73ea613a0e943 /grapher/FieldXY.cs | |
| parent | Merge branch 'master' into GainCap (diff) | |
| download | rawaccel-65a74b97c0c9ac8ca10312c0749e33df9e64b3d9.tar.xz rawaccel-65a74b97c0c9ac8ca10312c0749e33df9e64b3d9.zip | |
Disallow differing x and y weights with gain cap
Diffstat (limited to 'grapher/FieldXY.cs')
| -rw-r--r-- | grapher/FieldXY.cs | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/grapher/FieldXY.cs b/grapher/FieldXY.cs index 42232c8..7338962 100644 --- a/grapher/FieldXY.cs +++ b/grapher/FieldXY.cs @@ -15,7 +15,10 @@ namespace grapher YField = new Field(yBox, containingForm, defaultData); LockCheckBox = lockCheckBox; LockCheckBox.CheckedChanged += new System.EventHandler(CheckChanged); - SetLocked(); + DefaultWidthX = XField.Box.Width; + DefaultWidthY = YField.Box.Width; + CombinedWidth = DefaultWidthX + DefaultWidthY + YField.Box.Left - (XField.Box.Left + DefaultWidthX); + SetCombined(); } public double X { @@ -26,7 +29,7 @@ namespace grapher { get { - if (Locked) + if (Combined) { return X; } @@ -43,29 +46,41 @@ namespace grapher public Field YField { get; } - private bool Locked { get; set; } + private bool Combined { get; set; } + + private int DefaultWidthX { get; } + + private int DefaultWidthY { get; } + + private int CombinedWidth { get; } private void CheckChanged(object sender, EventArgs e) { if (LockCheckBox.CheckState == CheckState.Checked) { - SetLocked(); + SetCombined(); } else { - SetUnlocked(); + SetSeparate(); } } - public void SetLocked() + public void SetCombined() { - Locked = true; + Combined = true; YField.SetToUnavailable(); + YField.Box.Hide(); + XField.Box.Width = CombinedWidth; } - public void SetUnlocked() + public void SetSeparate() { - Locked = false; + Combined = false; + + XField.Box.Width = DefaultWidthX; + YField.Box.Width = DefaultWidthY; + if (XField.State == Field.FieldState.Default) { YField.SetToDefault(); @@ -74,6 +89,27 @@ namespace grapher { YField.SetToEntered(XField.Data); } + + if (XField.Box.Visible) + { + YField.Box.Show(); + } + } + + public void Show() + { + XField.Box.Show(); + + if (!Combined) + { + YField.Box.Show(); + } + } + + public void Hide() + { + XField.Box.Hide(); + YField.Box.Hide(); } } } |