From ca0d618f6d1ca77bde98504f5f7ee32b815c22f2 Mon Sep 17 00:00:00 2001 From: philmoz Date: Mon, 20 Nov 2023 10:09:51 +1100 Subject: [PATCH] fix(color): Formatting of text on controls warning dialog (#4331) --- radio/src/gui/colorlcd/fullscreen_dialog.cpp | 20 +++++++++++++++++++ radio/src/gui/colorlcd/switch_warn_dialog.cpp | 7 +++++-- radio/src/targets/horus/libopenui_config.h | 9 --------- radio/src/targets/nv14/libopenui_config.h | 9 --------- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/radio/src/gui/colorlcd/fullscreen_dialog.cpp b/radio/src/gui/colorlcd/fullscreen_dialog.cpp index e0017ef7d..9b4ac7233 100644 --- a/radio/src/gui/colorlcd/fullscreen_dialog.cpp +++ b/radio/src/gui/colorlcd/fullscreen_dialog.cpp @@ -28,6 +28,26 @@ #include "watchdog_driver.h" +#if LCD_W > LCD_H +constexpr uint32_t ALERT_FRAME_TOP = 50; +constexpr uint32_t ALERT_FRAME_HEIGHT = (LCD_H - 120); +constexpr uint32_t ALERT_BITMAP_TOP = ALERT_FRAME_TOP + 25; +constexpr uint32_t ALERT_BITMAP_LEFT = 20; +constexpr uint32_t ALERT_TITLE_TOP = ALERT_FRAME_TOP + 5; +constexpr uint32_t ALERT_TITLE_LEFT = 146; +constexpr uint32_t ALERT_MESSAGE_TOP = ALERT_TITLE_TOP + 85; +constexpr uint32_t ALERT_MESSAGE_LEFT = ALERT_TITLE_LEFT; +#else +constexpr uint32_t ALERT_FRAME_TOP = 70; +constexpr uint32_t ALERT_FRAME_HEIGHT = (LCD_H - 2 * ALERT_FRAME_TOP); +constexpr uint32_t ALERT_BITMAP_TOP = ALERT_FRAME_TOP + 15; +constexpr uint32_t ALERT_BITMAP_LEFT = 15; +constexpr uint32_t ALERT_TITLE_TOP = ALERT_FRAME_TOP + 10; +constexpr uint32_t ALERT_TITLE_LEFT = 140; +constexpr uint32_t ALERT_MESSAGE_TOP = ALERT_TITLE_TOP + 130; +constexpr uint32_t ALERT_MESSAGE_LEFT = 15; +#endif + static Window* _get_parent() { Window* p = Layer::back(); diff --git a/radio/src/gui/colorlcd/switch_warn_dialog.cpp b/radio/src/gui/colorlcd/switch_warn_dialog.cpp index 4ed70fc54..bddad880c 100644 --- a/radio/src/gui/colorlcd/switch_warn_dialog.cpp +++ b/radio/src/gui/colorlcd/switch_warn_dialog.cpp @@ -32,7 +32,7 @@ SwitchWarnDialog::SwitchWarnDialog() : void SwitchWarnDialog::delayedInit() { - lv_label_set_long_mode(messageLabel->getLvObj(), LV_LABEL_LONG_DOT); + lv_label_set_long_mode(messageLabel->getLvObj(), LV_LABEL_LONG_WRAP); AUDIO_ERROR_MESSAGE(AU_SWITCH_ALERT); } @@ -68,6 +68,7 @@ void SwitchWarnDialog::paint(BitmapBuffer * dc) if ((switches_states & mask) != (states & mask)) { swarnstate_t state = (states >> (i*3)) & 0x07; warn_txt += getSwitchPositionName(SWSRC_FIRST_SWITCH + i * 3 + state - 1); + warn_txt += " "; } } } @@ -79,7 +80,9 @@ void SwitchWarnDialog::paint(BitmapBuffer * dc) if (!IS_POT_SLIDER_AVAILABLE(i)) { continue; } if ( (g_model.potsWarnEnabled & (1 << i))) { if (abs(g_model.potsWarnPosition[i] - GET_LOWRES_POT_POSITION(i)) > 1) { + warn_txt += STR_CHAR_POT; warn_txt += getPotLabel(i); + warn_txt += " "; } } } @@ -96,7 +99,7 @@ ThrottleWarnDialog::ThrottleWarnDialog(const char* msg) : void ThrottleWarnDialog::delayedInit() { - lv_label_set_long_mode(messageLabel->getLvObj(), LV_LABEL_LONG_DOT); + lv_label_set_long_mode(messageLabel->getLvObj(), LV_LABEL_LONG_WRAP); AUDIO_ERROR_MESSAGE(AU_THROTTLE_ALERT); } diff --git a/radio/src/targets/horus/libopenui_config.h b/radio/src/targets/horus/libopenui_config.h index 1abe40395..82af1e474 100644 --- a/radio/src/targets/horus/libopenui_config.h +++ b/radio/src/targets/horus/libopenui_config.h @@ -21,15 +21,6 @@ #pragma once -constexpr uint32_t ALERT_FRAME_TOP = 70; -constexpr uint32_t ALERT_FRAME_HEIGHT = (LCD_H - 2 * ALERT_FRAME_TOP); -constexpr uint32_t ALERT_BITMAP_TOP = ALERT_FRAME_TOP + 15; -constexpr uint32_t ALERT_BITMAP_LEFT = 40; -constexpr uint32_t ALERT_TITLE_TOP = ALERT_FRAME_TOP + 10; -constexpr uint32_t ALERT_TITLE_LEFT = 186; -constexpr uint32_t ALERT_MESSAGE_TOP = ALERT_TITLE_TOP + 90; -constexpr uint32_t ALERT_MESSAGE_LEFT = ALERT_TITLE_LEFT; - constexpr coord_t INPUT_EDIT_CURVE_WIDTH = 132; constexpr coord_t INPUT_EDIT_CURVE_HEIGHT = INPUT_EDIT_CURVE_WIDTH; constexpr coord_t MENUS_MAX_HEIGHT = (MENUS_LINE_HEIGHT * 7) + 8; diff --git a/radio/src/targets/nv14/libopenui_config.h b/radio/src/targets/nv14/libopenui_config.h index 9d88bc779..b8ba4ae22 100644 --- a/radio/src/targets/nv14/libopenui_config.h +++ b/radio/src/targets/nv14/libopenui_config.h @@ -21,15 +21,6 @@ #pragma once -constexpr uint32_t ALERT_FRAME_TOP = 70; -constexpr uint32_t ALERT_FRAME_HEIGHT = (LCD_H - 2 * ALERT_FRAME_TOP); -constexpr uint32_t ALERT_BITMAP_TOP = ALERT_FRAME_TOP + 15; -constexpr uint32_t ALERT_BITMAP_LEFT = 15; -constexpr uint32_t ALERT_TITLE_TOP = ALERT_FRAME_TOP + 10; -constexpr uint32_t ALERT_TITLE_LEFT = 140; -constexpr uint32_t ALERT_MESSAGE_TOP = ALERT_TITLE_TOP + 130; -constexpr uint32_t ALERT_MESSAGE_LEFT = 15; - constexpr coord_t INPUT_EDIT_CURVE_WIDTH = 176; constexpr coord_t INPUT_EDIT_CURVE_HEIGHT = 132; constexpr coord_t MENUS_MAX_HEIGHT = (MENUS_LINE_HEIGHT * 10);