From 9a506f235ce7903e345f2deecccdfd91bbc88304 Mon Sep 17 00:00:00 2001 From: Matthew Strasiotto <39424834+matthewstrasiotto@users.noreply.github.com> Date: Sat, 1 May 2021 20:33:57 +1000 Subject: remove Settings.Settings based config, migrate defintitions to constants --- grapher/App.config | 22 ------------ grapher/Constants/Constants.cs | 9 +++++ grapher/Models/Charts/ChartXY.cs | 16 ++++----- grapher/Properties/Settings.Designer.cs | 60 --------------------------------- grapher/Properties/Settings.settings | 20 ++--------- 5 files changed, 18 insertions(+), 109 deletions(-) diff --git a/grapher/App.config b/grapher/App.config index 8afc72c..ebe5140 100644 --- a/grapher/App.config +++ b/grapher/App.config @@ -1,30 +1,8 @@  - -
- - - - - 15 - - - 12 - - - 3 - - - Green - - - White - - - \ No newline at end of file diff --git a/grapher/Constants/Constants.cs b/grapher/Constants/Constants.cs index 6710aa0..ce18389 100644 --- a/grapher/Constants/Constants.cs +++ b/grapher/Constants/Constants.cs @@ -129,6 +129,15 @@ namespace grapher /// Style used by System.Double.Parse public const NumberStyles FloatStyle = NumberStyles.Float | NumberStyles.AllowThousands; + /// Font Size for Chart Titles + public const float ChartTitleFontSize = 15; + + /// Font Size for Chart Axis Titles + public const float ChartAxisFontSize = 12; + + /// Line Width For Series data on chart + public const int ChartSeriesLineWidth = 3; + /// Foreground Color When Streamer Mode Active public static readonly System.Drawing.Color fgStreamer = System.Drawing.Color.White; diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 969607c..d247264 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -91,8 +91,6 @@ namespace grapher public static void setChartColors(Chart chart, System.Drawing.Color fgColor, System.Drawing.Color bgColor) { - // System.Drawing.Color fgColor = global::grapher.Properties.Settings.Default.Chart_FG_Colour; - // System.Drawing.Color bgColor = global::grapher.Properties.Settings.Default.Chart_BG_Colour; System.Drawing.Color bgTrans = System.Drawing.Color.Transparent; chart.ForeColor = fgColor; @@ -154,15 +152,15 @@ namespace grapher chart.Series[1].Points.Clear(); chart.Series[1].Points.AddXY(0, 0); - area.AxisX.TitleFont = new System.Drawing.Font(area.AxisX.TitleFont.Name, global::grapher.Properties.Settings.Default.Chart_Axis_Font_Size, System.Drawing.FontStyle.Bold); + area.AxisX.TitleFont = new System.Drawing.Font(area.AxisX.TitleFont.Name, Constants.ChartAxisFontSize, System.Drawing.FontStyle.Bold); area.AxisY.TitleFont = area.AxisX.TitleFont; - title.Font = new System.Drawing.Font(title.Font.Name, global::grapher.Properties.Settings.Default.Chart_Font_Size, System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Bold); - int line_width = global::grapher.Properties.Settings.Default.Chart_Series_Line_Width; - chart.Series[0].BorderWidth = line_width; - chart.Series[0].MarkerSize = line_width * 2; - chart.Series[2].BorderWidth = line_width; - chart.Series[2].MarkerSize = line_width * 2; + title.Font = new System.Drawing.Font(title.Font.Name, Constants.ChartTitleFontSize, System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Bold); + + chart.Series[0].BorderWidth = Constants.ChartSeriesLineWidth; + chart.Series[0].MarkerSize = Constants.ChartSeriesLineWidth * 2; + chart.Series[2].BorderWidth = Constants.ChartSeriesLineWidth; + chart.Series[2].MarkerSize = Constants.ChartSeriesLineWidth * 2; area.AxisX.MinorGrid.Enabled = true; area.AxisX.MinorGrid.LineDashStyle = ChartDashStyle.Dot; diff --git a/grapher/Properties/Settings.Designer.cs b/grapher/Properties/Settings.Designer.cs index 076bd06..de55113 100644 --- a/grapher/Properties/Settings.Designer.cs +++ b/grapher/Properties/Settings.Designer.cs @@ -22,65 +22,5 @@ namespace grapher.Properties { return defaultInstance; } } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("15")] - public float Chart_Font_Size { - get { - return ((float)(this["Chart_Font_Size"])); - } - set { - this["Chart_Font_Size"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("12")] - public float Chart_Axis_Font_Size { - get { - return ((float)(this["Chart_Axis_Font_Size"])); - } - set { - this["Chart_Axis_Font_Size"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("3")] - public int Chart_Series_Line_Width { - get { - return ((int)(this["Chart_Series_Line_Width"])); - } - set { - this["Chart_Series_Line_Width"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Green")] - public global::System.Drawing.Color Chart_BG_Colour { - get { - return ((global::System.Drawing.Color)(this["Chart_BG_Colour"])); - } - set { - this["Chart_BG_Colour"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("White")] - public global::System.Drawing.Color Chart_FG_Colour { - get { - return ((global::System.Drawing.Color)(this["Chart_FG_Colour"])); - } - set { - this["Chart_FG_Colour"] = value; - } - } } } diff --git a/grapher/Properties/Settings.settings b/grapher/Properties/Settings.settings index 6fe821b..8e615f2 100644 --- a/grapher/Properties/Settings.settings +++ b/grapher/Properties/Settings.settings @@ -1,21 +1,5 @@  - + - - - 15 - - - 12 - - - 3 - - - Green - - - White - - + \ No newline at end of file -- cgit v1.2.3