Mercurial > public > ostc4
changeset 196:2885628ab3ba div-fixes-cleaup-2
Bugfix, minor: color the overview customview correctly
When using a custom color (from the SYS2 menu, layout), the overview
customview was the only one presented in the wrong color. While the fix
for this is rather simple (in hindsight), it was a non trivial search
trough rather obfuscated code.
There is a specific function to set the text color index on this page, but
this only worked for a single line text string, that has the color index
byte as the very first character. The original author already recognized
that this function "could be extended", but left this extension as an
exercise to the reader.
So, the coloring is fixed by extending the function, and actually using
it for the overview customview.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Wed, 20 Mar 2019 16:24:10 +0100 (2019-03-20) |
parents | 05df3b395615 |
children | c853f5d23bb7 |
files | Discovery/Src/t7.c |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Src/t7.c Tue Mar 19 15:43:38 2019 +0000 +++ b/Discovery/Src/t7.c Wed Mar 20 16:24:10 2019 +0100 @@ -58,7 +58,7 @@ void t7_miniLiveLogProfile(void); //void t7_clock(void); void t7_logo_OSTC(void); -void t7_colorscheme_mod(char *text); +static void t7_colorscheme_mod(char *text); uint8_t t7_test_customview_warnings(void); void t7_show_customview_warnings(void); @@ -2639,14 +2639,13 @@ return lineCount; } -/* could be extended to search for \020 inside - */ -void t7_colorscheme_mod(char *text) -{ - if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) - { - text[0] = '\027'; - } +static void t7_colorscheme_mod(char *text) { + char *p = text; + while (*p) { + if ((*p == '\020') && !GFX_is_colorschemeDiveStandard()) + *p = '\027'; + p++; + } } @@ -3106,6 +3105,7 @@ text[textpointer++] = '\t'; textpointer += snprintf(&text[textpointer],10,"\020%i'", pDecoinfoFuture->output_time_to_surface_seconds / 60); text[textpointer++] = 0; + t7_colorscheme_mod(text); GFX_write_string(&FontT42, &t7cY0free, text, 1); }