Mercurial > public > ostc4
comparison Discovery/Src/t7.c @ 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 |
parents | 255326edf00b |
children | 878dc9e0dbc5 |
comparison
equal
deleted
inserted
replaced
195:05df3b395615 | 196:2885628ab3ba |
---|---|
56 void t7_debug(void); | 56 void t7_debug(void); |
57 | 57 |
58 void t7_miniLiveLogProfile(void); | 58 void t7_miniLiveLogProfile(void); |
59 //void t7_clock(void); | 59 //void t7_clock(void); |
60 void t7_logo_OSTC(void); | 60 void t7_logo_OSTC(void); |
61 void t7_colorscheme_mod(char *text); | 61 static void t7_colorscheme_mod(char *text); |
62 | 62 |
63 uint8_t t7_test_customview_warnings(void); | 63 uint8_t t7_test_customview_warnings(void); |
64 void t7_show_customview_warnings(void); | 64 void t7_show_customview_warnings(void); |
65 | 65 |
66 uint8_t t7_test_customview_warnings_surface_mode(void); | 66 uint8_t t7_test_customview_warnings_surface_mode(void); |
2637 | 2637 |
2638 text[textptr] = 0; | 2638 text[textptr] = 0; |
2639 return lineCount; | 2639 return lineCount; |
2640 } | 2640 } |
2641 | 2641 |
2642 /* could be extended to search for \020 inside | 2642 static void t7_colorscheme_mod(char *text) { |
2643 */ | 2643 char *p = text; |
2644 void t7_colorscheme_mod(char *text) | 2644 while (*p) { |
2645 { | 2645 if ((*p == '\020') && !GFX_is_colorschemeDiveStandard()) |
2646 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | 2646 *p = '\027'; |
2647 { | 2647 p++; |
2648 text[0] = '\027'; | 2648 } |
2649 } | |
2650 } | 2649 } |
2651 | 2650 |
2652 | 2651 |
2653 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide) | 2652 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide) |
2654 { | 2653 { |
3104 text[textpointer++] = '\n'; | 3103 text[textpointer++] = '\n'; |
3105 text[textpointer++] = '\r'; | 3104 text[textpointer++] = '\r'; |
3106 text[textpointer++] = '\t'; | 3105 text[textpointer++] = '\t'; |
3107 textpointer += snprintf(&text[textpointer],10,"\020%i'", pDecoinfoFuture->output_time_to_surface_seconds / 60); | 3106 textpointer += snprintf(&text[textpointer],10,"\020%i'", pDecoinfoFuture->output_time_to_surface_seconds / 60); |
3108 text[textpointer++] = 0; | 3107 text[textpointer++] = 0; |
3108 t7_colorscheme_mod(text); | |
3109 GFX_write_string(&FontT42, &t7cY0free, text, 1); | 3109 GFX_write_string(&FontT42, &t7cY0free, text, 1); |
3110 } | 3110 } |
3111 | 3111 |
3112 | 3112 |
3113 | 3113 |