From b5b87e24053c9f52a2edb5b1cb48f8e27e434ce1 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 00:56:07 -0700 Subject: Show xy charts only when accel applied by component --- grapher/Models/Fields/FieldXY.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'grapher/Models/Fields') diff --git a/grapher/Models/Fields/FieldXY.cs b/grapher/Models/Fields/FieldXY.cs index 609af9d..87e0b9c 100644 --- a/grapher/Models/Fields/FieldXY.cs +++ b/grapher/Models/Fields/FieldXY.cs @@ -13,14 +13,13 @@ namespace grapher public const string ShortenedFormatString = "0.###"; - public FieldXY(TextBox xBox, TextBox yBox, CheckBox lockCheckBox, Form containingForm, double defaultData, AccelCharts accelCharts) + 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); - AccelCharts = accelCharts; XField.Box.Width = (YField.Box.Left + YField.Box.Width - XField.Box.Left - DefaultSeparation) / 2; YField.Box.Width = XField.Box.Width; @@ -59,8 +58,6 @@ namespace grapher public Field YField { get; } - private AccelCharts AccelCharts { get; } - private bool Combined { get; set; } private int DefaultWidthX { get; } @@ -79,8 +76,6 @@ namespace grapher { SetSeparate(); } - - AccelCharts.RefreshXY(); } public void SetCombined() -- cgit v1.2.3 From 246fb772c5bf7dd6a85143fadebece3b4d9f1e04 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 02:18:41 -0700 Subject: Add constants class and separate classes into regions --- grapher/Models/Fields/Field.cs | 5 ++--- grapher/Models/Fields/FieldXY.cs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'grapher/Models/Fields') diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs index 1810081..03693ed 100644 --- a/grapher/Models/Fields/Field.cs +++ b/grapher/Models/Fields/Field.cs @@ -16,7 +16,7 @@ namespace grapher #endregion Constants - #region Enums + #region Enumerations public enum FieldState { @@ -27,8 +27,7 @@ namespace grapher Unavailable, } - #endregion Enums - + #endregion Enumerations #region Constructors diff --git a/grapher/Models/Fields/FieldXY.cs b/grapher/Models/Fields/FieldXY.cs index 87e0b9c..83f6434 100644 --- a/grapher/Models/Fields/FieldXY.cs +++ b/grapher/Models/Fields/FieldXY.cs @@ -9,10 +9,16 @@ namespace grapher { public class FieldXY { + #region Constants + public const int DefaultSeparation = 4; public const string ShortenedFormatString = "0.###"; + #endregion Constants + + #region Constructors + public FieldXY(TextBox xBox, TextBox yBox, CheckBox lockCheckBox, Form containingForm, double defaultData) { XField = new Field(xBox, containingForm, defaultData); @@ -32,6 +38,11 @@ namespace grapher CombinedWidth = DefaultWidthX + DefaultWidthY + YField.Box.Left - (XField.Box.Left + DefaultWidthX); SetCombined(); } + + #endregion Constructors + + #region Properties + public double X { get => XField.Data; @@ -66,6 +77,10 @@ namespace grapher private int CombinedWidth { get; } + #endregion Properties + + #region Methods + private void CheckChanged(object sender, EventArgs e) { if (LockCheckBox.CheckState == CheckState.Checked) @@ -126,5 +141,7 @@ namespace grapher XField.Box.Hide(); YField.Box.Hide(); } + + #endregion Methods } } -- cgit v1.2.3 From 4aa2f3ed741dcbd39233e125a34cac8163267d8d Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 02:39:09 -0700 Subject: Move constants to central class --- grapher/Models/Fields/Field.cs | 8 +------- grapher/Models/Fields/FieldXY.cs | 18 +++++------------- 2 files changed, 6 insertions(+), 20 deletions(-) (limited to 'grapher/Models/Fields') diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs index 03693ed..7651a37 100644 --- a/grapher/Models/Fields/Field.cs +++ b/grapher/Models/Fields/Field.cs @@ -10,12 +10,6 @@ namespace grapher { public class Field { - #region Constants - - public const string DefaultFormatString = "0.#########"; - - #endregion Constants - #region Enumerations public enum FieldState @@ -39,7 +33,7 @@ namespace grapher DefaultData = defaultData; State = FieldState.Undefined; ContainingForm = containingForm; - FormatString = DefaultFormatString; + FormatString = Constants.DefaultFieldFormatString; box.KeyDown += new System.Windows.Forms.KeyEventHandler(KeyDown); box.Leave += new System.EventHandler(FocusLeave); diff --git a/grapher/Models/Fields/FieldXY.cs b/grapher/Models/Fields/FieldXY.cs index 83f6434..826be27 100644 --- a/grapher/Models/Fields/FieldXY.cs +++ b/grapher/Models/Fields/FieldXY.cs @@ -9,31 +9,23 @@ namespace grapher { public class FieldXY { - #region Constants - - public const int DefaultSeparation = 4; - - public const string ShortenedFormatString = "0.###"; - - #endregion Constants - #region Constructors 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; + YField.FormatString = Constants.ShortenedFormatString; LockCheckBox = lockCheckBox; LockCheckBox.CheckedChanged += new System.EventHandler(CheckChanged); - XField.Box.Width = (YField.Box.Left + YField.Box.Width - XField.Box.Left - DefaultSeparation) / 2; + XField.Box.Width = (YField.Box.Left + YField.Box.Width - XField.Box.Left - Constants.DefaultFieldSeparation) / 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; + YField.Box.Left = XField.Box.Left + XField.Box.Width + Constants.DefaultFieldSeparation; CombinedWidth = DefaultWidthX + DefaultWidthY + YField.Box.Left - (XField.Box.Left + DefaultWidthX); SetCombined(); @@ -99,7 +91,7 @@ namespace grapher YField.SetToUnavailable(); YField.Box.Hide(); XField.Box.Width = CombinedWidth; - XField.FormatString = Field.DefaultFormatString; + XField.FormatString = Constants.DefaultFieldFormatString; } public void SetSeparate() @@ -109,7 +101,7 @@ namespace grapher XField.Box.Width = DefaultWidthX; YField.Box.Width = DefaultWidthY; - XField.FormatString = ShortenedFormatString; + XField.FormatString = Constants.ShortenedFormatString; if (XField.State == Field.FieldState.Default) { -- cgit v1.2.3 From 95cc3ed0a0bf66f5535b873f245bc1c35a145478 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 21:45:42 -0700 Subject: intermittent commit - large commit halfway done --- grapher/Models/Fields/Field.cs | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'grapher/Models/Fields') diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs index 7651a37..6f38314 100644 --- a/grapher/Models/Fields/Field.cs +++ b/grapher/Models/Fields/Field.cs @@ -58,6 +58,54 @@ namespace grapher public FieldState PreviousState { get; private set; } + public int Top + { + get + { + return Box.Top; + } + set + { + Box.Top = value; + } + } + + public int Height + { + get + { + return Box.Height; + } + set + { + Box.Height = value; + } + } + + public int Left + { + get + { + return Box.Left; + } + set + { + Box.Left = value; + } + } + + public int Width + { + get + { + return Box.Width; + } + set + { + Box.Width = value; + } + } + private double DefaultData { get; } #endregion Properties -- cgit v1.2.3 From aff3a066575f4bfa429f67a5104a1fcffc5f326e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Mon, 7 Sep 2020 15:19:39 -0700 Subject: Refactor type options --- grapher/Models/Fields/Field.cs | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'grapher/Models/Fields') diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs index 6f38314..f8a9c2d 100644 --- a/grapher/Models/Fields/Field.cs +++ b/grapher/Models/Fields/Field.cs @@ -23,13 +23,19 @@ namespace grapher #endregion Enumerations + #region Fields + + private double _data; + + #endregion Fields + #region Constructors public Field(TextBox box, Form containingForm, double defaultData) { DefaultText = DecimalString(defaultData); Box = box; - Data = defaultData; + _data = defaultData; DefaultData = defaultData; State = FieldState.Undefined; ContainingForm = containingForm; @@ -48,8 +54,6 @@ namespace grapher private Form ContainingForm { get; } - public double Data { get; private set; } - public string FormatString { get; set; } public string DefaultText { get; } @@ -58,6 +62,20 @@ namespace grapher public FieldState PreviousState { get; private set; } + public double Data { + get + { + if (Box.Visible) + { + return _data; + } + else + { + return DefaultData; + } + } + } + public int Top { get @@ -122,7 +140,7 @@ namespace grapher PreviousState = FieldState.Default; } - Data = DefaultData; + _data = DefaultData; Box.Text = DefaultText; ContainingForm.ActiveControl = null; } @@ -159,7 +177,7 @@ namespace grapher { SetToEntered(); - Data = value; + _data = value; Box.Text = DecimalString(Data); } @@ -238,7 +256,7 @@ namespace grapher { try { - Data = Convert.ToDouble(Box.Text); + _data = Convert.ToDouble(Box.Text); } catch { -- cgit v1.2.3 From 254a66eda9d9f6add21937b3570d29f64af4ab1e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 01:09:19 -0700 Subject: Fix few small bugs --- grapher/Models/Fields/FieldXY.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'grapher/Models/Fields') diff --git a/grapher/Models/Fields/FieldXY.cs b/grapher/Models/Fields/FieldXY.cs index 826be27..b1db220 100644 --- a/grapher/Models/Fields/FieldXY.cs +++ b/grapher/Models/Fields/FieldXY.cs @@ -61,13 +61,21 @@ namespace grapher public Field YField { get; } + public int CombinedWidth { get; } + + public int Left { + get + { + return XField.Left; + } + } + private bool Combined { get; set; } private int DefaultWidthX { get; } private int DefaultWidthY { get; } - private int CombinedWidth { get; } #endregion Properties -- cgit v1.2.3 From 9502dcf7608475857b1487375997d20a9d29622e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 01:26:22 -0700 Subject: Remove and sort usings en masse --- grapher/Models/Fields/Field.cs | 4 ---- grapher/Models/Fields/FieldXY.cs | 4 ---- 2 files changed, 8 deletions(-) (limited to 'grapher/Models/Fields') diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs index f8a9c2d..0d1813e 100644 --- a/grapher/Models/Fields/Field.cs +++ b/grapher/Models/Fields/Field.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace grapher diff --git a/grapher/Models/Fields/FieldXY.cs b/grapher/Models/Fields/FieldXY.cs index b1db220..6f43998 100644 --- a/grapher/Models/Fields/FieldXY.cs +++ b/grapher/Models/Fields/FieldXY.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace grapher -- cgit v1.2.3 From a6448c4a2447a090558da5f52dea3dc418389e8a Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 12:35:23 -0700 Subject: Fix few small bugs --- grapher/Models/Fields/FieldXY.cs | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'grapher/Models/Fields') diff --git a/grapher/Models/Fields/FieldXY.cs b/grapher/Models/Fields/FieldXY.cs index 6f43998..15e6800 100644 --- a/grapher/Models/Fields/FieldXY.cs +++ b/grapher/Models/Fields/FieldXY.cs @@ -64,6 +64,50 @@ namespace grapher { return XField.Left; } + set + { + } + } + + public int Width + { + get + { + return CombinedWidth; + } + set + { + } + } + + public int Top + { + get + { + return XField.Top; + } + set + { + } + } + + public int Height + { + get + { + return XField.Height; + } + set + { + } + } + + public bool Visible + { + get + { + return XField.Box.Visible; + } } private bool Combined { get; set; } -- cgit v1.2.3