From 376668f72be39bcabc11ac7d7c955f5e8d21be2d Mon Sep 17 00:00:00 2001 From: Sjef Verhoeven PE5PVB Date: Tue, 26 Mar 2024 17:55:59 +0100 Subject: [PATCH] Fix issues with skin and theme selector --- TEF6686_ESP32.ino | 2 +- src/gui.cpp | 116 +++++++++++++++++++++++++++++++++------------- src/language.h | 56 ++++++++++++++-------- 3 files changed, 123 insertions(+), 51 deletions(-) diff --git a/TEF6686_ESP32.ino b/TEF6686_ESP32.ino index bf7eddc..f47609b 100644 --- a/TEF6686_ESP32.ino +++ b/TEF6686_ESP32.ino @@ -558,7 +558,7 @@ void setup() { FrequencySprite.createSprite(200, 50); FrequencySprite.setTextDatum(TR_DATUM); - RDSSprite.createSprite(172, 19); + RDSSprite.createSprite(165, 19); RDSSprite.setTextDatum(TL_DATUM); SquelchSprite.createSprite(47, 19); diff --git a/src/gui.cpp b/src/gui.cpp index 3aa77fb..9ab7a94 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -417,6 +417,38 @@ void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de BatteryValueColor = Teal; BatteryValueColorSmooth = Black; break; + + case 13: // New skin theme + PrimaryColor = Yellow; + PrimaryColorSmooth = YellowSmooth; + SecondaryColor = Skyblue; + SecondaryColorSmooth = SkyblueSmooth; + FrameColor = Blue; + GreyoutColor = Darkgrey; + BackgroundColor = Black; + ActiveColor = White; + ActiveColorSmooth = WhiteSmooth; + FreqColor = Yellow; + FreqColorSmooth = YellowSmooth; + SignificantColor = Red; + SignificantColorSmooth = RedSmooth; + InsignificantColor = Green; + InsignificantColorSmooth = GreenSmooth; + StereoColor = Red; + StereoColorSmooth = RedSmooth; + RDSColor = Yellow; + RDSColorSmooth = YellowSmooth; + RDSDropoutColor = Teal; + RDSDropoutColorSmooth = TealSmooth; + BarSignificantColor = Red; + BarInsignificantColor = Green; + ModBarSignificantColor = Red; + ModBarInsignificantColor = Green; + BWAutoColor = Teal; + BWAutoColorSmooth = TealSmooth; + BatteryValueColor = Teal; + BatteryValueColorSmooth = Black; + break; } } @@ -1215,7 +1247,7 @@ void ShowOneLine(byte position, byte item, bool selected) { FullLineSprite.setTextDatum(TR_DATUM); FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); - FullLineSprite.drawString(Theme[CurrentTheme], 298, 3); + if (CurrentSkin != 1) FullLineSprite.drawString(Theme[CurrentTheme], 298, 3); break; case RDSSETTINGS: @@ -1929,12 +1961,17 @@ void MenuUp() { CurrentSkin ++; if (CurrentSkin > sizeof(Skin) / sizeof(Skin[0]) - 1) CurrentSkin = 0; - BuildMenu(); if (CurrentSkin == 0) { + CurrentTheme = 0; + doTheme(); + BuildMenu(); tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); OneBigLineSprite.fillSprite(BackgroundColor); } else if (CurrentSkin == 1) { + CurrentTheme = 13; + doTheme(); + BuildMenu(); tft.pushImage (13, 30, 292, 170, popupbackground); OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground); OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); @@ -1947,21 +1984,25 @@ void MenuUp() { break; case ITEM9: - CurrentTheme ++; - if (CurrentTheme > sizeof(Theme) / sizeof(Theme[0]) - 1) CurrentTheme = 0; - doTheme(); - if (CurrentSkin == 0) { - tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); - tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); - } else if (CurrentSkin == 1) { - tft.pushImage (13, 30, 292, 170, popupbackground); - OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground); + if (CurrentSkin != 1) { + CurrentTheme ++; + if (CurrentTheme > sizeof(Theme) / sizeof(Theme[0]) - 1) CurrentTheme = 0; + doTheme(); + if (CurrentSkin == 0) { + OneBigLineSprite.fillSprite(BackgroundColor); + tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); + tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); + } else if (CurrentSkin == 1) { + tft.pushImage (13, 30, 292, 170, popupbackground); + OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground); + OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); + OneBigLineSprite.setTextDatum(TC_DATUM); + } + Infoboxprint(myLanguage[language][77]); OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); - OneBigLineSprite.setTextDatum(TC_DATUM); + OneBigLineSprite.drawString(Theme[CurrentTheme], 135, 0); + OneBigLineSprite.pushSprite(24, 118); } - Infoboxprint(myLanguage[language][77]); - OneBigLineSprite.drawString(Theme[CurrentTheme], 135, 0); - OneBigLineSprite.pushSprite(24, 118); break; case ITEM10: @@ -2690,12 +2731,17 @@ void MenuDown() { CurrentSkin --; if (CurrentSkin > sizeof(Skin) / sizeof(Skin[0]) - 1) CurrentSkin = sizeof(Skin) / sizeof(Skin[0]) - 1; - BuildMenu(); if (CurrentSkin == 0) { + CurrentTheme = 0; + doTheme(); + BuildMenu(); OneBigLineSprite.fillSprite(BackgroundColor); tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); } else if (CurrentSkin == 1) { + CurrentTheme = 13; + doTheme(); + BuildMenu(); tft.pushImage (13, 30, 292, 170, popupbackground); OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground); OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); @@ -2708,22 +2754,26 @@ void MenuDown() { break; case ITEM9: - CurrentTheme --; - if (CurrentTheme > sizeof(Theme) / sizeof(Theme[0]) - 1) CurrentTheme = sizeof(Theme) / sizeof(Theme[0]) - 1; + if (CurrentSkin != 1) { + CurrentTheme --; + if (CurrentTheme > sizeof(Theme) / sizeof(Theme[0]) - 1) CurrentTheme = sizeof(Theme) / sizeof(Theme[0]) - 1; - doTheme(); - if (CurrentSkin == 0) { - tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); - tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); - } else if (CurrentSkin == 1) { - tft.pushImage (13, 30, 292, 170, popupbackground); - OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground); + doTheme(); + if (CurrentSkin == 0) { + OneBigLineSprite.fillSprite(BackgroundColor); + tft.drawRoundRect(10, 30, 300, 170, 5, ActiveColor); + tft.fillRoundRect(12, 32, 296, 166, 5, BackgroundColor); + } else if (CurrentSkin == 1) { + tft.pushImage (13, 30, 292, 170, popupbackground); + OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground); + OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); + OneBigLineSprite.setTextDatum(TC_DATUM); + } + Infoboxprint(myLanguage[language][77]); OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); - OneBigLineSprite.setTextDatum(TC_DATUM); + OneBigLineSprite.drawString(Theme[CurrentTheme], 135, 0); + OneBigLineSprite.pushSprite(24, 118); } - Infoboxprint(myLanguage[language][77]); - OneBigLineSprite.drawString(Theme[CurrentTheme], 135, 0); - OneBigLineSprite.pushSprite(24, 118); break; case ITEM10: @@ -3489,9 +3539,13 @@ void DoMenu() { break; case ITEM9: - Infoboxprint(myLanguage[language][77]); + if (CurrentSkin != 1) { + Infoboxprint(myLanguage[language][77]); - OneBigLineSprite.drawString(Theme[CurrentTheme], 135, 0); + OneBigLineSprite.drawString(Theme[CurrentTheme], 135, 0); + } else { + Infoboxprint(myLanguage[language][208]); + } OneBigLineSprite.pushSprite(24, 118); break; diff --git a/src/language.h b/src/language.h index 3e81684..628072f 100644 --- a/src/language.h +++ b/src/language.h @@ -5,7 +5,7 @@ // [number of languages][number of texts] // *** means the text is the same as in English -static const char* const myLanguage[18][208] PROGMEM = { +static const char* const myLanguage[18][209] PROGMEM = { { "English", // English "Rotary direction changed", // 1 "Please release button", // 2 @@ -213,7 +213,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Default", // 204 "Mute screen on\nXDRGTK connection", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Nederlands", // Dutch @@ -423,7 +424,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Standaard", // 204 "Scherm uit bij\nXDRGTK verbinding", // 205 "FMSI stereo verbetering", // 206 - "Alleen beschikbaar op\nTEF6687/6689!" // 207 + "Alleen beschikbaar op\nTEF6687/6689!", // 207 + "Niet beschikbaar op\ngekozen uiterlijk!" // 208 }, { "Polski", // Polish @@ -633,7 +635,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Domyslny", // 204 "Wylacz ekran gdy\npołączony z XDR-GTK", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Hrvatski", // Croatian @@ -843,7 +846,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Zadano", // 204 "Isključi zaslon\ntijekom veze XDRGTK-om", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Ελληνικά", // Greek @@ -1053,7 +1057,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Προεπιλογή", // 204 "Μαύρη οθόνη σε\nσύνδεση XDRGTK", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Română", // Romanian @@ -1263,7 +1268,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Mod implicit", // 204 "Mute screen on\nXDRGTK connection", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Deutsch", // German @@ -1473,7 +1479,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Default", // 204 "Mute screen on\nXDRGTK connection", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Český", // Czech @@ -1683,7 +1690,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Default", // 204 "Mute screen on\nXDRGTK connection", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Slovenský", // Slovak @@ -1893,7 +1901,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Default", // 204 "Mute screen on\nXDRGTK connection", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Français", // French @@ -2103,7 +2112,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Défaut", // 204 "Écran muet sur\nla connexion XDRGTK", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Български", // Bulgarian @@ -2313,7 +2323,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Default", // 204 "Mute screen on\nXDRGTK connection", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Русский", // Russian @@ -2523,7 +2534,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Default", // 204 "Mute screen on\nXDRGTK connection", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Українська", // Ukranian @@ -2733,7 +2745,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Default", // 204 "Mute screen on\nXDRGTK connection", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Italiano", // Italian @@ -2943,7 +2956,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Default", // 204 "Mute screen on\nXDRGTK connection", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Simplified Chinese", // Simplified Chinese @@ -3153,7 +3167,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "默认", // 204 "XDRGTK连接时锁屏", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Norsk", // Norwegian @@ -3363,7 +3378,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Standard", // 204 "Dempet skjerm på\nXDRGTK tilkobling", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Español", // Spanish @@ -3573,7 +3589,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Por defecto", // 204 "Pantalla de mudo\nen la conexión XDRGTK", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 }, { "Português", // Portuguese @@ -3783,7 +3800,8 @@ static const char* const myLanguage[18][208] PROGMEM = { "Predefinição", // 204 "Tela mudo na\nconexão XDRGTK", // 205 "FMSI stereo improvement", // 206 - "Function only available\non TEF6687/6689!" // 207 + "Function only available\non TEF6687/6689!", // 207 + "Function not available\non selected skin!" // 208 } }; #endif \ No newline at end of file