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/FieldXY.cs') 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/FieldXY.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'grapher/Models/Fields/FieldXY.cs') 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/FieldXY.cs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'grapher/Models/Fields/FieldXY.cs') 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 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/FieldXY.cs') 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/FieldXY.cs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'grapher/Models/Fields/FieldXY.cs') 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/FieldXY.cs') 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