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/Options/Option.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'grapher/Models/Options/Option.cs') diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index b0ef374..c5336a6 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -10,6 +10,8 @@ namespace grapher { public class Option { + #region Constructors + public Option( Field field, Label label, @@ -50,12 +52,20 @@ namespace grapher SetName(startingName); } + #endregion Constructors + + #region Properties + public Field Field { get; } public Label Label { get; } public ActiveValueLabel ActiveValueLabel { get; } + #endregion Properties + + #region Methods + public void SetName(string name) { Label.Text = name; @@ -93,5 +103,7 @@ namespace grapher Show(); } + + #endregion Methods } } -- 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/Options/Option.cs | 48 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'grapher/Models/Options/Option.cs') diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index c5336a6..bd2c9a1 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -62,6 +62,47 @@ namespace grapher public ActiveValueLabel ActiveValueLabel { get; } + public int Top + { + get + { + return Field.Top; + } + set + { + Field.Top = value; + Label.Top = value; + } + } + + public int Height + { + get + { + return Field.Height; + } + } + + public int Left + { + get + { + return Label.Left; + } + set + { + Label.Left = value; + Field.Left = value + Label.Width + Constants.OptionLabelBoxSeperation; + } + } + public int Width + { + get + { + return Field.Left + Field.Width - Label.Left; + } + } + #endregion Properties #region Methods @@ -70,7 +111,7 @@ namespace grapher { Label.Text = name; //Label.Left = Convert.ToInt32((Field.Box.Left / 2.0) - (Label.Width / 2.0)); //Centered - Label.Left = Convert.ToInt32(Field.Box.Left - Label.Width - 10); //Right-aligned + Left = Label.Left; } public void SetActiveValue(double value) @@ -103,6 +144,11 @@ namespace grapher Show(); } + + public void SnapTo(Option option) + { + Top = option.Top + option.Height + Constants.OptionVerticalSeperation; + } #endregion Methods } -- cgit v1.2.3 From 26130b21dabaab7fc331844df11465623a811197 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 22:42:07 -0700 Subject: Second half - the parts in place --- grapher/Models/Options/Option.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'grapher/Models/Options/Option.cs') diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index bd2c9a1..2006dec 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -150,6 +150,11 @@ namespace grapher Top = option.Top + option.Height + Constants.OptionVerticalSeperation; } + public void SnapTo(CapOptions option) + { + Top = option.Top + option.Height + Constants.OptionVerticalSeperation; + } + #endregion Methods } } -- cgit v1.2.3 From bf747ca2439a371ef74e21a49c1e8bc880d4d3e2 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 1 Sep 2020 23:36:52 -0700 Subject: Small fixes, correctly align labels and boxes --- grapher/Models/Options/Option.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'grapher/Models/Options/Option.cs') diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index 2006dec..22b78d4 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -15,11 +15,17 @@ namespace grapher public Option( Field field, Label label, - ActiveValueLabel activeValueLabel) + ActiveValueLabel activeValueLabel, + int left) { Field = field; Label = label; ActiveValueLabel = activeValueLabel; + Left = left; + + label.AutoSize = false; + label.Width = Field.Left - left - Constants.OptionLabelBoxSeperation; + label.TextAlign = System.Drawing.ContentAlignment.MiddleRight; } public Option( @@ -27,11 +33,13 @@ namespace grapher Form containingForm, double defaultData, Label label, + int left, ActiveValueLabel activeValueLabel) : this( new Field(box, containingForm, defaultData), label, - activeValueLabel) + activeValueLabel, + left) { } @@ -40,6 +48,7 @@ namespace grapher Form containingForm, double defaultData, Label label, + int left, ActiveValueLabel activeValueLabel, string startingName) : this( @@ -47,6 +56,7 @@ namespace grapher containingForm, defaultData, label, + left, activeValueLabel) { SetName(startingName); @@ -89,10 +99,9 @@ namespace grapher { return Label.Left; } - set + private set { Label.Left = value; - Field.Left = value + Label.Width + Constants.OptionLabelBoxSeperation; } } public int Width @@ -111,7 +120,6 @@ namespace grapher { Label.Text = name; //Label.Left = Convert.ToInt32((Field.Box.Left / 2.0) - (Label.Width / 2.0)); //Centered - Left = Label.Left; } public void SetActiveValue(double value) -- 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/Options/Option.cs | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'grapher/Models/Options/Option.cs') diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index 22b78d4..68ecf66 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -8,7 +8,7 @@ using System.Windows.Forms; namespace grapher { - public class Option + public class Option : OptionBase { #region Constructors @@ -72,7 +72,7 @@ namespace grapher public ActiveValueLabel ActiveValueLabel { get; } - public int Top + public override int Top { get { @@ -85,7 +85,7 @@ namespace grapher } } - public int Height + public override int Height { get { @@ -93,18 +93,18 @@ namespace grapher } } - public int Left + public override int Left { get { return Label.Left; } - private set + set { Label.Left = value; } } - public int Width + public override int Width { get { @@ -112,6 +112,14 @@ namespace grapher } } + public override bool Visible + { + get + { + return Field.Box.Visible; + } + } + #endregion Properties #region Methods @@ -127,7 +135,7 @@ namespace grapher ActiveValueLabel.SetValue(value); } - public void Hide() + public override void Hide() { Field.Box.Hide(); Label.Hide(); @@ -146,23 +154,13 @@ namespace grapher ActiveValueLabel.SetValue(value); } - public void Show(string name) + public override void Show(string name) { SetName(name); Show(); } - public void SnapTo(Option option) - { - Top = option.Top + option.Height + Constants.OptionVerticalSeperation; - } - - public void SnapTo(CapOptions option) - { - Top = option.Top + option.Height + Constants.OptionVerticalSeperation; - } - #endregion Methods } } -- cgit v1.2.3 From 0fb1013f66026c696fec6469c02aba1c91711289 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Mon, 7 Sep 2020 19:13:30 -0700 Subject: Fix some separation bugs --- grapher/Models/Options/Option.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'grapher/Models/Options/Option.cs') diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index 68ecf66..5355a8a 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -110,6 +110,10 @@ namespace grapher { return Field.Left + Field.Width - Label.Left; } + set + { + Field.Width = value; + } } public override bool Visible -- cgit v1.2.3 From 1462da675f1bc36d2a770413f13ccc68165cf1e9 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Mon, 7 Sep 2020 20:30:15 -0700 Subject: Add chart resize --- grapher/Models/Options/Option.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'grapher/Models/Options/Option.cs') diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index 5355a8a..3c7b2ec 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -112,7 +112,6 @@ namespace grapher } set { - Field.Width = value; } } -- cgit v1.2.3 From f2322540dd904474587ddebfa8d96dc66a902530 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 00:51:05 -0700 Subject: Alignment for whole mode works --- grapher/Models/Options/Option.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'grapher/Models/Options/Option.cs') diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index 3c7b2ec..fd4a6fe 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -26,6 +26,8 @@ namespace grapher label.AutoSize = false; label.Width = Field.Left - left - Constants.OptionLabelBoxSeperation; label.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + + ActiveValueLabel.Left = Field.Left + Field.Width; } public Option( @@ -82,6 +84,7 @@ namespace grapher { Field.Top = value; Label.Top = value; + ActiveValueLabel.Top = value; } } @@ -163,7 +166,12 @@ namespace grapher Show(); } - + + public override void AlignActiveValues(int width) + { + ActiveValueLabel.Width = width; + } + #endregion Methods } } -- 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/Options/Option.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'grapher/Models/Options/Option.cs') diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index fd4a6fe..f44e6b1 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -1,9 +1,4 @@ using grapher.Models.Options; -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/Options/Option.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'grapher/Models/Options/Option.cs') diff --git a/grapher/Models/Options/Option.cs b/grapher/Models/Options/Option.cs index f44e6b1..5dc022b 100644 --- a/grapher/Models/Options/Option.cs +++ b/grapher/Models/Options/Option.cs @@ -19,10 +19,12 @@ namespace grapher Left = left; label.AutoSize = false; - label.Width = Field.Left - left - Constants.OptionLabelBoxSeperation; label.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + label.Width = Field.Left - left - Constants.OptionLabelBoxSeperation; + label.Height = Field.Height; ActiveValueLabel.Left = Field.Left + Field.Width; + ActiveValueLabel.Height = Field.Height; } public Option( @@ -162,9 +164,9 @@ namespace grapher Show(); } - public override void AlignActiveValues(int width) + public override void AlignActiveValues() { - ActiveValueLabel.Width = width; + ActiveValueLabel.Align(); } #endregion Methods -- cgit v1.2.3