From e0fa546b10e45775f107d7112f64554696b3c45c Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 9 Oct 2015 19:36:57 +0200 Subject: [PATCH] Quick and dirty - I will rewrite this commit later --- radio/src/bitmaps/Horus/mask_index_shadow.png | Bin 0 -> 743 bytes radio/src/gui/Horus/menus.h | 4 +- radio/src/gui/Horus/navigation.cpp | 7 ++- radio/src/gui/Horus/widgets.cpp | 41 +++++++++++-- radio/src/main_arm.cpp | 54 ++++++++++-------- 5 files changed, 74 insertions(+), 32 deletions(-) create mode 100644 radio/src/bitmaps/Horus/mask_index_shadow.png diff --git a/radio/src/bitmaps/Horus/mask_index_shadow.png b/radio/src/bitmaps/Horus/mask_index_shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..ba2a278a2e11d33f96b060cc12c2b0317705adca GIT binary patch literal 743 zcmeAS@N?(olHy`uVBq!ia0vp^sz7YP!3HF&t{J)kDVAa<&kznEsNqQI0P;BtJR*yM z>aT+^qm#z$3ZS55iEBhjaDG}zd16s2LwR|*US?i)adKios$PCk`s{Z$QVa}CDV{El zAsLNtZ*KH{?I3gDuK_lw=a`d7T=5A_{C_;>8K)Y9YYy2X{{ zsHm{e#MAQ=o1y>x%g2wJUwODMII8dT^68fr+6RV)9_2qh(_G>{7d8kdP?{+_tv*ZIHCpQrcr^;y{4tNUK&?=CAZzj^Oo-jGTXo;{kMpTE~!uGj7B*W34;I9deeugl*WrLi>b`o8+j_um`OK6~Qx zpT&0yUwKZ>yng-q*R9VhdDxhn6n+%-D{#E{TD5+|_R9D`5g#?-O*+3{FJU-jpu)kV zeBtO(*5AK>Gk9pe{QmpRn>PZk7pH4zs_uLL`1il}lY_iAZrJeQ{Op-?!X~N6$jDq- zAA5c2?YBa%g5BNSZp-gxbg8x^Sj~M@d2jjb`Sa!#RaAIPQu$i7*7Wr0(?9m*|M?-^ ze{D)oOl+*7RPTkT#}<6Rh`n>~o{V1hx$mlykbo388E&U?OR&mMu}hJ`YdmuV(STzXmZqQq*; z?YF%kne#X8min) {val--;} else {val=max;} -void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint16_t scrollbar_X, uint8_t flags) +bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint16_t scrollbar_X, uint8_t flags) { vertpos_t l_posVert = m_posVert; horzpos_t l_posHorz = m_posHorz; @@ -246,7 +246,7 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t if (cc != curr) { chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc])); - return; + return false; } } @@ -315,7 +315,6 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t case EVT_KEY_REPT(KEY_LEFT): DEC(l_posHorz, 0, maxcol); break; - break; case EVT_ROTARY_RIGHT: if (s_editMode != 0) break; @@ -445,6 +444,8 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t m_posVert = l_posVert; m_posHorz = l_posHorz; + + return true; } void check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t rowcount, uint16_t scrollbar_X) diff --git a/radio/src/gui/Horus/widgets.cpp b/radio/src/gui/Horus/widgets.cpp index bda3da69e..70a3566a6 100644 --- a/radio/src/gui/Horus/widgets.cpp +++ b/radio/src/gui/Horus/widgets.cpp @@ -170,6 +170,7 @@ const uint8_t LBM_LUA_SCRIPTS_ICON[] = { const uint8_t LBM_TELEMETRY_ICON[] = { #include "../../bitmaps/Horus/mask_telemetry.lbm" }; + const uint8_t * const LBM_MODEL_ICONS[] = { LBM_MODEL_SETUP_ICON, CASE_HELI(LBM_HELI_ICON) @@ -187,8 +188,28 @@ const uint8_t * const LBM_MODEL_ICONS[] = { LBM_TELEMETRY_ICON }; -const uint8_t LBM_BALL[] = { -#include "../../bitmaps/Horus/mask_ball.lbm" +const uint8_t LBM_TOP_POLYGON[] = { +#include "../../bitmaps/Horus/mask_top_polygon.lbm" +}; + +const uint8_t LBM_DOT[] = { +#include "../../bitmaps/Horus/mask_dot.lbm" +}; + +const uint8_t LBM_CURRENT_BG[] = { +#include "../../bitmaps/Horus/mask_current_bg.lbm" +}; + +const uint8_t LBM_CURRENT_SHADOW[] = { +#include "../../bitmaps/Horus/mask_index_shadow.lbm" +}; + +const uint8_t LBM_CURRENT_DOT[] = { +#include "../../bitmaps/Horus/mask_current_dot.lbm" +}; + +const uint8_t LBM_MENU_MODEL[] = { +#include "../../bitmaps/Horus/mask_menu_model.lbm" }; #define MENU_ICONS_SPACING 34 @@ -197,17 +218,29 @@ void drawMenuTemplate(const char *name, evt_t event, int pageIndex, int pageCoun { // clear the screen lcdDrawFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR); + lcdDrawFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, MENU_TITLE_TOP-MENU_HEADER_HEIGHT, TEXT_BGCOLOR); lcdDrawFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, TITLE_BGCOLOR); lcdDrawFilledRect(0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT, TEXT_BGCOLOR); lcdDrawFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR); - lcdDrawFilledRect(58+pageIndex*MENU_ICONS_SPACING-11, 0, 36, MENU_HEADER_HEIGHT, TITLE_BGCOLOR); + lcdDrawBitmapPattern(0, 0, LBM_TOP_POLYGON, TITLE_BGCOLOR); + + lcdDrawBitmapPattern(5, 5, LBM_MENU_MODEL, MENU_TITLE_COLOR); + + if (m_posVert < 0) { + lcdDrawBitmapPattern(58+pageIndex*MENU_ICONS_SPACING-11, 0, LBM_CURRENT_BG, TITLE_BGCOLOR); + lcdDrawBitmapPattern(58+pageIndex*MENU_ICONS_SPACING-11, 0, LBM_CURRENT_SHADOW, TEXT_COLOR); + lcdDrawBitmapPattern(58+pageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR); + } + else { + lcdDrawFilledRect(58+pageIndex*MENU_ICONS_SPACING-11, 0, 36, MENU_HEADER_HEIGHT, TITLE_BGCOLOR); + lcdDrawBitmapPattern(58+pageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_DOT, MENU_TITLE_COLOR); + } for (int i=0; i