diff options
Diffstat (limited to 'grapher/Models/Fields')
| -rw-r--r-- | grapher/Models/Fields/Field.cs | 61 | ||||
| -rw-r--r-- | grapher/Models/Fields/FieldXY.cs | 32 |
2 files changed, 69 insertions, 24 deletions
diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs index 1810081..6f38314 100644 --- a/grapher/Models/Fields/Field.cs +++ b/grapher/Models/Fields/Field.cs @@ -10,13 +10,7 @@ namespace grapher { public class Field { - #region Constants - - public const string DefaultFormatString = "0.#########"; - - #endregion Constants - - #region Enums + #region Enumerations public enum FieldState { @@ -27,8 +21,7 @@ namespace grapher Unavailable, } - #endregion Enums - + #endregion Enumerations #region Constructors @@ -40,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); @@ -65,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 diff --git a/grapher/Models/Fields/FieldXY.cs b/grapher/Models/Fields/FieldXY.cs index 609af9d..826be27 100644 --- a/grapher/Models/Fields/FieldXY.cs +++ b/grapher/Models/Fields/FieldXY.cs @@ -9,30 +9,32 @@ namespace grapher { public class FieldXY { - public const int DefaultSeparation = 4; + #region Constructors - 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; + YField.FormatString = Constants.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; + 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(); } + + #endregion Constructors + + #region Properties + public double X { get => XField.Data; @@ -59,8 +61,6 @@ namespace grapher public Field YField { get; } - private AccelCharts AccelCharts { get; } - private bool Combined { get; set; } private int DefaultWidthX { get; } @@ -69,6 +69,10 @@ namespace grapher private int CombinedWidth { get; } + #endregion Properties + + #region Methods + private void CheckChanged(object sender, EventArgs e) { if (LockCheckBox.CheckState == CheckState.Checked) @@ -79,8 +83,6 @@ namespace grapher { SetSeparate(); } - - AccelCharts.RefreshXY(); } public void SetCombined() @@ -89,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() @@ -99,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) { @@ -131,5 +133,7 @@ namespace grapher XField.Box.Hide(); YField.Box.Hide(); } + + #endregion Methods } } |