From 6798b1f11af54469b63afc612a0454ed7227679d Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sun, 31 Jan 2021 19:17:48 +0200 Subject: [PATCH] Use a slider for temperature in the SDL GUI --- SDL/font.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ SDL/font.h | 2 ++ SDL/gui.c | 26 ++++----------------- 3 files changed, 72 insertions(+), 22 deletions(-) diff --git a/SDL/font.c b/SDL/font.c index eb6243e..ea2c590 100644 --- a/SDL/font.c +++ b/SDL/font.c @@ -1053,6 +1053,72 @@ uint8_t font[] = { X, _, _, _, X, _, X, _, _, _, X, _, X, X, X, X, X, _, + + /* Slider */ + _, _, _, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, + _, _, X, X, X, X, + _, _, _, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, + + _, _, _, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, + X, X, X, X, X, X, + _, _, _, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, + + _, _, _, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, + X, X, X, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, + + /* Slider, selected */ + _, X, X, X, _, _, + _, X, X, X, _, _, + _, X, X, X, _, _, + _, X, X, X, X, X, + _, X, X, X, _, _, + _, X, X, X, _, _, + _, _, X, _, _, _, + _, _, _, _, _, _, + + _, X, X, X, _, _, + _, X, X, X, _, _, + _, X, X, X, _, _, + X, X, X, X, X, X, + _, X, X, X, _, _, + _, X, X, X, _, _, + _, _, X, _, _, _, + _, _, _, _, _, _, + + _, X, X, X, _, _, + _, X, X, X, _, _, + _, X, X, X, _, _, + X, X, X, X, _, _, + _, X, X, X, _, _, + _, X, X, X, _, _, + _, _, X, _, _, _, + _, _, _, _, _, _, + + /* Slider, tick*/ + _, _, _, _, _, _, + _, _, X, _, _, _, + _, _, X, _, _, _, + X, X, X, X, X, X, + _, _, X, _, _, _, + _, _, X, _, _, _, + _, _, _, _, _, _, + _, _, _, _, _, _, }; const uint8_t font_max = sizeof(font) / GLYPH_HEIGHT / GLYPH_WIDTH + ' '; diff --git a/SDL/font.h b/SDL/font.h index 06d7adf..f2111c3 100644 --- a/SDL/font.h +++ b/SDL/font.h @@ -14,5 +14,7 @@ extern const uint8_t font_max; #define CMD_STRING "\x84\x85" #define ELLIPSIS_STRING "\x87" #define MOJIBAKE_STRING "\x88" +#define SLIDER_STRING "\x89\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8F\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8A\x8B" +#define SELECTED_SLIDER_STRING "\x8C\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8D\x8E" #endif /* font_h */ diff --git a/SDL/gui.c b/SDL/gui.c index 0846664..92d9479 100644 --- a/SDL/gui.c +++ b/SDL/gui.c @@ -519,28 +519,10 @@ const char *current_color_correction_mode(unsigned index) const char *current_color_temperature(unsigned index) { - return (const char *[]){"12000K", - "11450K", - "10900K", - "10350K", - "9800K", - "9250K", - "8700K", - "8150K", - "7600K", - "7050K", - "6500K (White)", - "5950K", - "5400K", - "4850K", - "4300K", - "3750K", - "3200K", - "2650K", - "2100K", - "1550K", - "1000K"} - [configuration.color_temperature]; + static char ret[22]; + strcpy(ret, SLIDER_STRING); + ret[configuration.color_temperature] = SELECTED_SLIDER_STRING[configuration.color_temperature]; + return ret; }