mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
Quick and dirty - I will rewrite this commit later
This commit is contained in:
parent
ddaf6237b9
commit
e0fa546b10
5 changed files with 74 additions and 32 deletions
BIN
radio/src/bitmaps/Horus/mask_index_shadow.png
Normal file
BIN
radio/src/bitmaps/Horus/mask_index_shadow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 743 B |
|
@ -216,7 +216,7 @@ bool isInputSourceAvailable(int source);
|
||||||
#define CURSOR_ON_LINE() (m_posHorz<0)
|
#define CURSOR_ON_LINE() (m_posHorz<0)
|
||||||
|
|
||||||
#define CHECK_FLAG_NO_SCREEN_INDEX 1
|
#define CHECK_FLAG_NO_SCREEN_INDEX 1
|
||||||
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 maxrow, uint16_t scrollbar_X, uint8_t flags=0);
|
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 maxrow, uint16_t scrollbar_X, uint8_t flags=0);
|
||||||
void check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow, uint16_t scrollbar_X);
|
void check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow, uint16_t scrollbar_X);
|
||||||
void check_submenu_simple(check_event_t event, uint8_t maxrow, uint16_t scrollbar_X);
|
void check_submenu_simple(check_event_t event, uint8_t maxrow, uint16_t scrollbar_X);
|
||||||
void title(const pm_char * s);
|
void title(const pm_char * s);
|
||||||
|
@ -235,8 +235,8 @@ void drawMenuTemplate(const char *title, evt_t event, int pageIndex=0, int pageC
|
||||||
#define MENU(title, tab, menu, lines_count, scrollbar_X, ...) \
|
#define MENU(title, tab, menu, lines_count, scrollbar_X, ...) \
|
||||||
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
|
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
|
||||||
MENU_TAB(__VA_ARGS__); \
|
MENU_TAB(__VA_ARGS__); \
|
||||||
|
if (!MENU_CHECK(tab, menu, lines_count, scrollbar_X)) return; \
|
||||||
drawMenuTemplate(title, event, menu, DIM(tab)); \
|
drawMenuTemplate(title, event, menu, DIM(tab)); \
|
||||||
MENU_CHECK(tab, menu, lines_count, scrollbar_X)
|
|
||||||
|
|
||||||
#define MENU_FLAGS(title, tab, menu, flags, lines_count, scrollbar_X, ...) \
|
#define MENU_FLAGS(title, tab, menu, flags, lines_count, scrollbar_X, ...) \
|
||||||
MENU_TAB(__VA_ARGS__); \
|
MENU_TAB(__VA_ARGS__); \
|
||||||
|
|
|
@ -216,7 +216,7 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags
|
||||||
#define INC(val, min, max) if (val<max) {val++;} else {val=min;}
|
#define INC(val, min, max) if (val<max) {val++;} else {val=min;}
|
||||||
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
|
#define DEC(val, min, max) if (val>min) {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;
|
vertpos_t l_posVert = m_posVert;
|
||||||
horzpos_t l_posHorz = m_posHorz;
|
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) {
|
if (cc != curr) {
|
||||||
chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc]));
|
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):
|
case EVT_KEY_REPT(KEY_LEFT):
|
||||||
DEC(l_posHorz, 0, maxcol);
|
DEC(l_posHorz, 0, maxcol);
|
||||||
break;
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case EVT_ROTARY_RIGHT:
|
case EVT_ROTARY_RIGHT:
|
||||||
if (s_editMode != 0) break;
|
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_posVert = l_posVert;
|
||||||
m_posHorz = l_posHorz;
|
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)
|
void check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t rowcount, uint16_t scrollbar_X)
|
||||||
|
|
|
@ -170,6 +170,7 @@ const uint8_t LBM_LUA_SCRIPTS_ICON[] = {
|
||||||
const uint8_t LBM_TELEMETRY_ICON[] = {
|
const uint8_t LBM_TELEMETRY_ICON[] = {
|
||||||
#include "../../bitmaps/Horus/mask_telemetry.lbm"
|
#include "../../bitmaps/Horus/mask_telemetry.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t * const LBM_MODEL_ICONS[] = {
|
const uint8_t * const LBM_MODEL_ICONS[] = {
|
||||||
LBM_MODEL_SETUP_ICON,
|
LBM_MODEL_SETUP_ICON,
|
||||||
CASE_HELI(LBM_HELI_ICON)
|
CASE_HELI(LBM_HELI_ICON)
|
||||||
|
@ -187,8 +188,28 @@ const uint8_t * const LBM_MODEL_ICONS[] = {
|
||||||
LBM_TELEMETRY_ICON
|
LBM_TELEMETRY_ICON
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t LBM_BALL[] = {
|
const uint8_t LBM_TOP_POLYGON[] = {
|
||||||
#include "../../bitmaps/Horus/mask_ball.lbm"
|
#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
|
#define MENU_ICONS_SPACING 34
|
||||||
|
@ -197,17 +218,29 @@ void drawMenuTemplate(const char *name, evt_t event, int pageIndex, int pageCoun
|
||||||
{
|
{
|
||||||
// clear the screen
|
// clear the screen
|
||||||
lcdDrawFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
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_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, TITLE_BGCOLOR);
|
||||||
lcdDrawFilledRect(0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT, TEXT_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(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_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);
|
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<pageCount; i++) {
|
for (int i=0; i<pageCount; i++) {
|
||||||
lcdDrawBitmapPattern(50+i*MENU_ICONS_SPACING, 7, LBM_MODEL_ICONS[i], MENU_TITLE_COLOR);
|
lcdDrawBitmapPattern(50+i*MENU_ICONS_SPACING, 7, LBM_MODEL_ICONS[i], MENU_TITLE_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcdDrawBitmapPattern(58+pageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_BALL, MENU_TITLE_COLOR);
|
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
// header
|
// header
|
||||||
|
|
|
@ -202,16 +202,19 @@ void guiMain(evt_t evt)
|
||||||
const bool refreshScreen = true;
|
const bool refreshScreen = true;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#if defined(PCBHORUS)
|
||||||
|
for (int i=0; i<2; i++) {
|
||||||
|
#endif
|
||||||
// normal GUI from menus
|
// normal GUI from menus
|
||||||
const char *warn = s_warning;
|
const char *warn = s_warning;
|
||||||
uint8_t menu = s_menu_count;
|
uint8_t menu = s_menu_count;
|
||||||
#if !defined(COLORLCD)
|
#if !defined(COLORLCD)
|
||||||
if (refreshScreen) {
|
if (refreshScreen) {
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (menuEvent) {
|
if (menuEvent) {
|
||||||
m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : 0;
|
m_posVert = menuEvent == EVT_ENTRY_UP ? g_menuPos[g_menuStackPtr] : -1;
|
||||||
m_posHorz = 0;
|
m_posHorz = 0;
|
||||||
evt = menuEvent;
|
evt = menuEvent;
|
||||||
menuEvent = 0;
|
menuEvent = 0;
|
||||||
|
@ -227,6 +230,11 @@ void guiMain(evt_t evt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawStatusLine();
|
drawStatusLine();
|
||||||
|
#if defined(PCBHORUS)
|
||||||
|
if (menuEvent != EVT_ENTRY || menuEvent != EVT_ENTRY_UP)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue