From 3cbec32cfa91bad661bc126b517faf78458a27a6 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 30 Jul 2020 01:13:24 -0700 Subject: Fully use acceloptions --- grapher/Option.cs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 grapher/Option.cs (limited to 'grapher/Option.cs') diff --git a/grapher/Option.cs b/grapher/Option.cs new file mode 100644 index 0000000..6c7bcda --- /dev/null +++ b/grapher/Option.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher +{ + public class Option + { + public Option(TextBox box, Label label) + { + Box = box; + Label = label; + } + + public TextBox Box { get; } + + public Label Label { get; } + + public void SetName(string name) + { + Label.Text = name; + } + + public void Hide() + { + Box.Hide(); + Label.Hide(); + } + + public void Show() + { + Box.Show(); + Label.Show(); + } + } +} -- cgit v1.2.3 From f315e8160e984df93be6667929db34749aa25cfa Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 30 Jul 2020 02:00:20 -0700 Subject: Use class heirarchy for layout types --- grapher/Option.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'grapher/Option.cs') diff --git a/grapher/Option.cs b/grapher/Option.cs index 6c7bcda..17e624b 100644 --- a/grapher/Option.cs +++ b/grapher/Option.cs @@ -22,6 +22,7 @@ namespace grapher public void SetName(string name) { Label.Text = name; + Label.Left = Convert.ToInt32((Box.Left / 2.0) - (Label.Width / 2.0)); } public void Hide() @@ -35,5 +36,13 @@ namespace grapher Box.Show(); Label.Show(); } + + public void Show(string name) + { + SetName(name); + + Box.Show(); + Label.Show(); + } } } -- cgit v1.2.3 From 49bd00c71b223d12f1d85d5c1bae635d450403fd Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 30 Jul 2020 20:15:12 -0700 Subject: Use options instead of fields --- grapher/Option.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'grapher/Option.cs') diff --git a/grapher/Option.cs b/grapher/Option.cs index 17e624b..a2a4f89 100644 --- a/grapher/Option.cs +++ b/grapher/Option.cs @@ -9,31 +9,31 @@ namespace grapher { public class Option { - public Option(TextBox box, Label label) + public Option(Field field, Label label) { - Box = box; + Field = field; Label = label; } - public TextBox Box { get; } + public Field Field { get; } public Label Label { get; } public void SetName(string name) { Label.Text = name; - Label.Left = Convert.ToInt32((Box.Left / 2.0) - (Label.Width / 2.0)); + Label.Left = Convert.ToInt32((Field.Box.Left / 2.0) - (Label.Width / 2.0)); } public void Hide() { - Box.Hide(); + Field.Box.Hide(); Label.Hide(); } public void Show() { - Box.Show(); + Field.Box.Show(); Label.Show(); } @@ -41,7 +41,7 @@ namespace grapher { SetName(name); - Box.Show(); + Field.Box.Show(); Label.Show(); } } -- cgit v1.2.3 From 498e5c1a2fabed3ba5f1c00768d7050c5738e76e Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Fri, 31 Jul 2020 10:46:23 -0700 Subject: Small refactoring, use new struct to store magnitudes --- grapher/Option.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'grapher/Option.cs') diff --git a/grapher/Option.cs b/grapher/Option.cs index a2a4f89..8e3ecdf 100644 --- a/grapher/Option.cs +++ b/grapher/Option.cs @@ -15,6 +15,17 @@ namespace grapher Label = label; } + public Option(TextBox box, Form containingForm, double defaultData, Label label) + : this(new Field(box, containingForm, defaultData), label) + { + } + + public Option(TextBox box, Form containingForm, double defaultData, Label label, string startingName) + : this(box, containingForm, defaultData, label) + { + SetName(startingName); + } + public Field Field { get; } public Label Label { get; } -- cgit v1.2.3