summaryrefslogtreecommitdiff
path: root/grapher/Models/Fields
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2021-01-12 09:43:25 -0800
committerJacob Palecki <[email protected]>2021-01-12 09:43:25 -0800
commitb6d7c7e67b487143276ad17c9ab85c0dba13180d (patch)
treeec11bd878269040000df936cbc40315068ea5a26 /grapher/Models/Fields
parentMany small tweaks (diff)
downloadrawaccel-b6d7c7e67b487143276ad17c9ab85c0dba13180d.tar.xz
rawaccel-b6d7c7e67b487143276ad17c9ab85c0dba13180d.zip
Fix xy anisotropy combining in gui
Diffstat (limited to 'grapher/Models/Fields')
-rw-r--r--grapher/Models/Fields/FieldXY.cs33
1 files changed, 26 insertions, 7 deletions
diff --git a/grapher/Models/Fields/FieldXY.cs b/grapher/Models/Fields/FieldXY.cs
index a7db922..3396907 100644
--- a/grapher/Models/Fields/FieldXY.cs
+++ b/grapher/Models/Fields/FieldXY.cs
@@ -7,13 +7,14 @@ namespace grapher
{
#region Constructors
- public FieldXY(TextBox xBox, TextBox yBox, CheckBox lockCheckBox, Form containingForm, double defaultData)
+ public FieldXY(TextBox xBox, TextBox yBox, CheckBox lockCheckBox, Form containingForm, double defaultData, bool allowCombined = true)
{
XField = new Field(xBox, containingForm, defaultData);
YField = new Field(yBox, containingForm, defaultData);
YField.FormatString = Constants.ShortenedFormatString;
LockCheckBox = lockCheckBox;
LockCheckBox.CheckedChanged += new System.EventHandler(CheckChanged);
+ AllowCombined = allowCombined;
XField.Box.Width = (YField.Box.Left + YField.Box.Width - XField.Box.Left - Constants.DefaultFieldSeparation) / 2;
YField.Box.Width = XField.Box.Width;
@@ -24,7 +25,7 @@ namespace grapher
YField.Box.Left = XField.Box.Left + XField.Box.Width + Constants.DefaultFieldSeparation;
CombinedWidth = DefaultWidthX + DefaultWidthY + YField.Box.Left - (XField.Box.Left + DefaultWidthX);
- SetCombined();
+ Startup();
}
#endregion Constructors
@@ -116,6 +117,7 @@ namespace grapher
private int DefaultWidthY { get; }
+ private bool AllowCombined { get; }
#endregion Properties
@@ -147,6 +149,20 @@ namespace grapher
}
}
+ private void Startup()
+ {
+ if (AllowCombined)
+ {
+ SetCombined();
+ }
+ else
+ {
+ SetSeparate();
+ LockCheckBox.Hide();
+ LockCheckBox.Enabled = false;
+ }
+ }
+
private void CheckChanged(object sender, EventArgs e)
{
if (LockCheckBox.CheckState == CheckState.Checked)
@@ -161,11 +177,14 @@ namespace grapher
public void SetCombined()
{
- Combined = true;
- YField.SetToUnavailable();
- YField.Hide();
- XField.Box.Width = CombinedWidth;
- XField.FormatString = Constants.DefaultFieldFormatString;
+ if (AllowCombined)
+ {
+ Combined = true;
+ YField.SetToUnavailable();
+ YField.Hide();
+ XField.Box.Width = CombinedWidth;
+ XField.FormatString = Constants.DefaultFieldFormatString;
+ }
}
public void SetSeparate()