UI: made authors' list scrollable
This commit is contained in:
parent
a6f01c3e55
commit
ecea0186a0
|
|
@ -1983,9 +1983,16 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
else if(msg.keys & KEY_ESC)
|
else if(msg.keys & KEY_ESC)
|
||||||
_ui_menuBack(MENU_TOP);
|
_ui_menuBack(MENU_TOP);
|
||||||
break;
|
break;
|
||||||
// About screen
|
// About screen, scroll without rollover
|
||||||
case MENU_ABOUT:
|
case MENU_ABOUT:
|
||||||
if(msg.keys & KEY_ESC)
|
if(msg.keys & KEY_UP || msg.keys & KNOB_LEFT)
|
||||||
|
{
|
||||||
|
if(ui_state.menu_selected > 0)
|
||||||
|
ui_state.menu_selected -= 1;
|
||||||
|
}
|
||||||
|
else if(msg.keys & KEY_DOWN || msg.keys & KNOB_RIGHT)
|
||||||
|
ui_state.menu_selected += 1;
|
||||||
|
else if(msg.keys & KEY_ESC)
|
||||||
_ui_menuBack(MENU_TOP);
|
_ui_menuBack(MENU_TOP);
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
|
|
@ -2538,7 +2545,7 @@ bool ui_updateGUI()
|
||||||
break;
|
break;
|
||||||
// About menu screen
|
// About menu screen
|
||||||
case MENU_ABOUT:
|
case MENU_ABOUT:
|
||||||
_ui_drawMenuAbout();
|
_ui_drawMenuAbout(&ui_state);
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_RTC
|
#ifdef CONFIG_RTC
|
||||||
// Time&Date settings screen
|
// Time&Date settings screen
|
||||||
|
|
|
||||||
|
|
@ -811,7 +811,7 @@ void _ui_drawMenuInfo(ui_state_t* ui_state)
|
||||||
_ui_getInfoValueName);
|
_ui_getInfoValueName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMenuAbout()
|
void _ui_drawMenuAbout(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
|
|
||||||
|
|
@ -831,13 +831,18 @@ void _ui_drawMenuAbout()
|
||||||
yellow_fab413, currentLanguage->openRTX);
|
yellow_fab413, currentLanguage->openRTX);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t line_h = layout.menu_h;
|
point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (layout.menu_h * 3) - 5};
|
||||||
point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5};
|
uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1;
|
||||||
for(int author = 0; author < author_num; author++)
|
uint8_t max_scroll = author_num - entries_in_screen;
|
||||||
|
|
||||||
|
if(ui_state->menu_selected >= max_scroll)
|
||||||
|
ui_state->menu_selected = max_scroll;
|
||||||
|
|
||||||
|
for(uint8_t item = 0; item < entries_in_screen; item++)
|
||||||
{
|
{
|
||||||
gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT,
|
uint8_t elem = ui_state->menu_selected + item;
|
||||||
color_white, "%s", *(¤tLanguage->Niccolo + author));
|
gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, color_white, authors[elem]);
|
||||||
pos.y += line_h;
|
pos.y += layout.menu_h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -616,9 +616,16 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
else if(msg.keys & KEY_ESC)
|
else if(msg.keys & KEY_ESC)
|
||||||
_ui_menuBack(MENU_TOP);
|
_ui_menuBack(MENU_TOP);
|
||||||
break;
|
break;
|
||||||
// About screen
|
// About screen, scroll without rollover
|
||||||
case MENU_ABOUT:
|
case MENU_ABOUT:
|
||||||
if(msg.keys & KEY_ESC)
|
if(msg.keys & KEY_UP || msg.keys & KNOB_LEFT)
|
||||||
|
{
|
||||||
|
if(ui_state.menu_selected > 0)
|
||||||
|
ui_state.menu_selected -= 1;
|
||||||
|
}
|
||||||
|
else if(msg.keys & KEY_DOWN || msg.keys & KNOB_RIGHT)
|
||||||
|
ui_state.menu_selected += 1;
|
||||||
|
else if(msg.keys & KEY_ESC)
|
||||||
_ui_menuBack(MENU_TOP);
|
_ui_menuBack(MENU_TOP);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -869,7 +876,7 @@ bool ui_updateGUI()
|
||||||
break;
|
break;
|
||||||
// About menu screen
|
// About menu screen
|
||||||
case MENU_ABOUT:
|
case MENU_ABOUT:
|
||||||
_ui_drawMenuAbout();
|
_ui_drawMenuAbout(&ui_state);
|
||||||
break;
|
break;
|
||||||
// Display settings screen
|
// Display settings screen
|
||||||
case SETTINGS_DISPLAY:
|
case SETTINGS_DISPLAY:
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ void _ui_drawMenuInfo(ui_state_t* ui_state)
|
||||||
_ui_getInfoValueName);
|
_ui_getInfoValueName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMenuAbout()
|
void _ui_drawMenuAbout(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
|
|
||||||
|
|
@ -452,13 +452,18 @@ void _ui_drawMenuAbout()
|
||||||
gfx_print(openrtx_pos, layout.line3_font, TEXT_ALIGN_CENTER, color_white,
|
gfx_print(openrtx_pos, layout.line3_font, TEXT_ALIGN_CENTER, color_white,
|
||||||
"OpenRTX");
|
"OpenRTX");
|
||||||
|
|
||||||
uint8_t line_h = layout.menu_h;
|
point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (layout.menu_h * 3) - 5};
|
||||||
point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5};
|
uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1;
|
||||||
for(int author = 0; author < author_num; author++)
|
uint8_t max_scroll = author_num - entries_in_screen;
|
||||||
|
|
||||||
|
if(ui_state->menu_selected >= max_scroll)
|
||||||
|
ui_state->menu_selected = max_scroll;
|
||||||
|
|
||||||
|
for(uint8_t item = 0; item < entries_in_screen; item++)
|
||||||
{
|
{
|
||||||
gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT,
|
uint8_t elem = ui_state->menu_selected + item;
|
||||||
color_white, "%s", authors[author]);
|
gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, color_white, authors[elem]);
|
||||||
pos.y += line_h;
|
pos.y += layout.menu_h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue