From d7c018011c23f6a54bd8b44be700429d36419a69 Mon Sep 17 00:00:00 2001 From: Thomas Young <35073576+DrakeRichards@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:39:52 -0600 Subject: [PATCH] Added configuration setting for chart edge line colour --- README.md | 3 ++- src/settings/chart_config.c | 1 + src/settings/chart_config.h | 3 +++ src/settings/read_config.c | 4 ++++ src/vectorGraphics/cairo_page.c | 2 +- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1644ff4..9805c9a 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,8 @@ The following settings can be included in a `StarCharter` configuration file: * `axis_ticks_value_only` - If 1, axis labels will appear as simply "5h" or "30 deg". If 0, these labels will be preceded by alpha= or delta= * `az_central` - The local azimuth of the centre of the plot; degrees. This setting is only used if `coords=alt_az`. * `cardinals` - Boolean (0 or 1) indicating whether to write the cardinal points around the edge of alt/az star charts -* `chart_edge_line_width` - Line width to use when marking the edge of the chart. Default 2.5. +- `chart_edge_line_col` - Colour to use when marking the edge of the chart. Default `0,0,0`. +- `chart_edge_line_width` - Line width to use when marking the edge of the chart. Default 2.5. * `constellation_boundaries` - Boolean (0 or 1) indicating whether we draw constellation boundaries * `constellation_boundary_col` - Colour to use when drawing constellation boundaries * `constellation_highlight` - Optionally, highlight the boundary of one particular constellation, identified by a three-letter abbreviation. diff --git a/src/settings/chart_config.c b/src/settings/chart_config.c index 67fa871..86bc40a 100644 --- a/src/settings/chart_config.c +++ b/src/settings/chart_config.c @@ -216,6 +216,7 @@ void default_config(chart_config *i) { i->constellations_label_shadow = 1; i->constellation_sticks_line_width = 1.4; i->chart_edge_line_width = 2.5; + i->chart_edge_line_col = (colour) {0, 0, 0}; // Boolean flags indicating which settings have been manually overridden i->mag_min_is_set = 0; diff --git a/src/settings/chart_config.h b/src/settings/chart_config.h index 92f796c..e8422d3 100644 --- a/src/settings/chart_config.h +++ b/src/settings/chart_config.h @@ -612,6 +612,9 @@ typedef struct chart_config { //! Line width to use for the edge of the star chart double chart_edge_line_width; + //! Colour to use for the edge of the star chart + colour chart_edge_line_col; + //! Boolean flags indicating which settings have been manually overridden //! (so that automatic scaling does not overwrite them). int mag_min_is_set; diff --git a/src/settings/read_config.c b/src/settings/read_config.c index 94195f3..f277103 100644 --- a/src/settings/read_config.c +++ b/src/settings/read_config.c @@ -1135,6 +1135,10 @@ int process_configuration_file_line(char *line, const char *filename, const int CHECK_VALUE_NUMERIC("chart_edge_line_width") x->chart_edge_line_width = key_val_num; return 0; + } else if (strcmp(key, "chart_edge_line_col") == 0) { + //! chart_edge_line_col - Colour to use when marking the edge of the chart. + x->chart_edge_line_col = colour_from_string(key_val); + return 0; } else { snprintf(temp_err_string, FNAME_LENGTH, "Bad input file. Unrecognised setting '%s'.", key); stch_error(temp_err_string); diff --git a/src/vectorGraphics/cairo_page.c b/src/vectorGraphics/cairo_page.c index 3cfaaed..4a39999 100644 --- a/src/vectorGraphics/cairo_page.c +++ b/src/vectorGraphics/cairo_page.c @@ -287,7 +287,7 @@ void draw_chart_edging(cairo_page *p, chart_config *s) { cairo_show_text(s->cairo_draw, s->title); // Draw outline of chart - cairo_set_source_rgb(s->cairo_draw, 0, 0, 0); + cairo_set_source_rgb(s->cairo_draw, s->chart_edge_line_col.red, s->chart_edge_line_col.grn, s->chart_edge_line_col.blu); cairo_set_line_width(s->cairo_draw, s->chart_edge_line_width * s->line_width_base); cairo_new_path(s->cairo_draw); if ((s->projection == SW_PROJECTION_SPHERICAL) || (s->projection == SW_PROJECTION_ALTAZ)) {