summaryrefslogtreecommitdiff
path: root/grapher/FieldXY.cs
diff options
context:
space:
mode:
authora1xd <[email protected]>2020-08-14 03:48:40 -0400
committerGitHub <[email protected]>2020-08-14 03:48:40 -0400
commit0621a7ebd431102d720497a143190505dcfeb7a1 (patch)
tree01d7df8f55e5a1cce90617fd876eaf994eb26846 /grapher/FieldXY.cs
parentMerge pull request #14 from JacobPalecki/GainCap (diff)
parentFix initial points, add poll time constant (diff)
downloadrawaccel-0621a7ebd431102d720497a143190505dcfeb7a1.tar.xz
rawaccel-0621a7ebd431102d720497a143190505dcfeb7a1.zip
Merge pull request #15 from JacobPalecki/GUI
GUI: Add x/y graphs, moving dot
Diffstat (limited to 'grapher/FieldXY.cs')
-rw-r--r--grapher/FieldXY.cs115
1 files changed, 0 insertions, 115 deletions
diff --git a/grapher/FieldXY.cs b/grapher/FieldXY.cs
deleted file mode 100644
index 7338962..0000000
--- a/grapher/FieldXY.cs
+++ /dev/null
@@ -1,115 +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 FieldXY(TextBox xBox, TextBox yBox, CheckBox lockCheckBox, Form containingForm, double defaultData)
- {
- XField = new Field(xBox, containingForm, defaultData);
- YField = new Field(yBox, containingForm, defaultData);
- LockCheckBox = lockCheckBox;
- LockCheckBox.CheckedChanged += new System.EventHandler(CheckChanged);
- DefaultWidthX = XField.Box.Width;
- DefaultWidthY = YField.Box.Width;
- 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;
- }
-
- public void SetSeparate()
- {
- Combined = false;
-
- XField.Box.Width = DefaultWidthX;
- YField.Box.Width = DefaultWidthY;
-
- 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();
- }
- }
-}