diff --git a/radio/src/bitmaps/horus/CMakeLists.txt b/radio/src/bitmaps/horus/CMakeLists.txt index b9db02667..5d45db11c 100644 --- a/radio/src/bitmaps/horus/CMakeLists.txt +++ b/radio/src/bitmaps/horus/CMakeLists.txt @@ -9,5 +9,6 @@ add_custom_target(ttf_horus_fonts DEPENDS ttf_horus_tinsize ttf_horus_smlsize tt add_bitmaps_target(horus_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/bmp_*.png" 480 5/6/5) add_bitmaps_target(horus_alpha_bitmaps "${RADIO_SRC_DIRECTORY}/bitmaps/horus/alpha_*.png" 480 5/6/5/8) add_bitmaps_target(horus_masks ${RADIO_SRC_DIRECTORY}/bitmaps/horus/mask_*.png 480 8bits) +add_bitmaps_target(horus_slider_masks "${RADIO_SRC_DIRECTORY}/bitmaps/horus/slider/*.png" 480 8bits) add_bitmaps_target(horus_fonts ${RADIO_SRC_DIRECTORY}/fonts/horus/*.png 480 8bits) -add_dependencies(horus_bitmaps horus_alpha_bitmaps horus_masks horus_fonts) +add_dependencies(horus_bitmaps horus_alpha_bitmaps horus_masks horus_slider_masks horus_fonts) diff --git a/radio/src/gui/horus/bitmaps.cpp b/radio/src/gui/horus/bitmaps.cpp index 799c72764..c4c75866f 100644 --- a/radio/src/gui/horus/bitmaps.cpp +++ b/radio/src/gui/horus/bitmaps.cpp @@ -263,3 +263,24 @@ const uint8_t LBM_SLEEP[] __DMA = { const uint8_t LBM_SHUTDOWN_CIRCLE[] __DMA = { #include "mask_shutdown_circle.lbm" }; + +const uint8_t LBM_SLIDER_BAR_LEFT[] __DMA = { +#include "bar_left.lbm" +}; + +const uint8_t LBM_SLIDER_BAR_RIGHT[] __DMA = { +#include "bar_right.lbm" +}; + +const uint8_t LBM_SLIDER_POINT_OUT[] __DMA = { +#include "point_out.lbm" +}; + +const uint8_t LBM_SLIDER_POINT_MID[] __DMA = { +#include "point_mid.lbm" +}; + +const uint8_t LBM_SLIDER_POINT_IN[] __DMA = { +#include "point_in.lbm" +}; + diff --git a/radio/src/gui/horus/gui.h b/radio/src/gui/horus/gui.h index 7883b80eb..3b993d0ca 100644 --- a/radio/src/gui/horus/gui.h +++ b/radio/src/gui/horus/gui.h @@ -135,3 +135,9 @@ extern const uint8_t LBM_CURVE_COORD_SHADOW[]; extern const uint8_t LBM_SHUTDOWN[]; extern const uint8_t LBM_SLEEP[]; extern const uint8_t LBM_SHUTDOWN_CIRCLE[]; +extern const uint8_t LBM_SLIDER_BAR_LEFT[]; +extern const uint8_t LBM_SLIDER_BAR_RIGHT[]; +extern const uint8_t LBM_SLIDER_POINT_OUT[]; +extern const uint8_t LBM_SLIDER_POINT_MID[]; +extern const uint8_t LBM_SLIDER_POINT_IN[]; + diff --git a/radio/src/gui/horus/widgets.cpp b/radio/src/gui/horus/widgets.cpp index 97adae9be..41d059f20 100644 --- a/radio/src/gui/horus/widgets.cpp +++ b/radio/src/gui/horus/widgets.cpp @@ -253,14 +253,22 @@ int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, evt_t e void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr) { - const int width = 50; - lcdDrawHorizontalLine(x, y+5, width, SOLID, TEXT_COLOR); - if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) { - lcdDrawSolidFilledRect(x+value*(width-5)/max, y, 5, 11, TEXT_INVERTED_BGCOLOR); - } - else { - lcdDrawSolidFilledRect(x+value*(width-5)/max, y, 5, 11, LINE_COLOR); - } + const int width = 100; + + // The bar + lcdDrawBitmapPattern(x, y + 10, LBM_SLIDER_BAR_LEFT, value <= 0 ? LINE_COLOR : TEXT_INVERTED_BGCOLOR); + int w = value * (width - 8) / max; + if (value > 0) + lcdDrawSolidFilledRect(x + 4, y + 10, w, 4, TEXT_INVERTED_BGCOLOR); + if (value < max) + lcdDrawSolidFilledRect(x + 4 + w, y + 10, width - 8 - w, 4, LINE_COLOR); + lcdDrawBitmapPattern(x + width - 4, y + 10, LBM_SLIDER_BAR_RIGHT, value >= max ? TEXT_INVERTED_BGCOLOR : LINE_COLOR); + + // The point + lcdDrawBitmapPattern(x + w - 4, y + 5, LBM_SLIDER_POINT_OUT, TEXT_COLOR); + lcdDrawBitmapPattern(x + w - 4, y + 5, LBM_SLIDER_POINT_MID, TEXT_BGCOLOR); + if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) + lcdDrawBitmapPattern(x + w - 4, y + 5, LBM_SLIDER_POINT_IN, TEXT_INVERTED_BGCOLOR); } #if defined(GVARS)