diff options
| author | Jacob Palecki <[email protected]> | 2020-08-12 19:22:21 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-12 19:22:21 -0700 |
| commit | cc531c79f2bd664551071ef315a54814bd9ab914 (patch) | |
| tree | e6d1db3477e8ba41299d1d92eac4748a648c960b /grapher/FieldXY.cs | |
| parent | Add ability to have x\y graphs (diff) | |
| download | rawaccel-cc531c79f2bd664551071ef315a54814bd9ab914.tar.xz rawaccel-cc531c79f2bd664551071ef315a54814bd9ab914.zip | |
Reorganized solution into directories
Diffstat (limited to 'grapher/FieldXY.cs')
| -rw-r--r-- | grapher/FieldXY.cs | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/grapher/FieldXY.cs b/grapher/FieldXY.cs deleted file mode 100644 index 87e0b9c..0000000 --- a/grapher/FieldXY.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace grapher -{ - public class FieldXY - { - public const int DefaultSeparation = 4; - - public const string ShortenedFormatString = "0.###"; - - public FieldXY(TextBox xBox, TextBox yBox, CheckBox lockCheckBox, Form containingForm, double defaultData) - { - XField = new Field(xBox, containingForm, defaultData); - YField = new Field(yBox, containingForm, defaultData); - YField.FormatString = ShortenedFormatString; - LockCheckBox = lockCheckBox; - LockCheckBox.CheckedChanged += new System.EventHandler(CheckChanged); - - XField.Box.Width = (YField.Box.Left + YField.Box.Width - XField.Box.Left - DefaultSeparation) / 2; - YField.Box.Width = XField.Box.Width; - - DefaultWidthX = XField.Box.Width; - DefaultWidthY = YField.Box.Width; - - YField.Box.Left = XField.Box.Left + XField.Box.Width + DefaultSeparation; - - CombinedWidth = DefaultWidthX + DefaultWidthY + YField.Box.Left - (XField.Box.Left + DefaultWidthX); - SetCombined(); - } - public double X - { - get => XField.Data; - } - - public double Y - { - get - { - if (Combined) - { - return X; - } - else - { - return YField.Data; - } - } - } - - public CheckBox LockCheckBox { get; } - - public Field XField { get; } - - public Field YField { get; } - - 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) - { - SetCombined(); - } - else - { - SetSeparate(); - } - } - - public void SetCombined() - { - Combined = true; - YField.SetToUnavailable(); - YField.Box.Hide(); - XField.Box.Width = CombinedWidth; - XField.FormatString = Field.DefaultFormatString; - } - - public void SetSeparate() - { - Combined = false; - - XField.Box.Width = DefaultWidthX; - YField.Box.Width = DefaultWidthY; - - XField.FormatString = ShortenedFormatString; - - if (XField.State == Field.FieldState.Default) - { - YField.SetToDefault(); - } - else - { - 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(); - } - } -} |