Navigation code shared and improved (#6923)

This commit is contained in:
Bertrand Songis
2019-10-10 14:03:49 +02:00
committed by GitHub
parent 200d2f3357
commit aee77ed9e9
6 changed files with 28 additions and 18 deletions
+4 -4
View File
@@ -360,7 +360,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
case EVT_ENTRY:
menuEntryTime = get_tmr10ms();
s_editMode = EDIT_MODE_INIT;
l_posVert = MENU_FIRST_LINE_EDIT;
l_posVert = MENU_FIRST_LINE_EDIT(horTab, horTabMax);
l_posHorz = POS_HORZ_INIT(l_posVert);
SET_SCROLLBAR_X(LCD_W-1);
break;
@@ -402,7 +402,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
AUDIO_KEY_PRESS();
}
else {
uint8_t posVertInit = MENU_FIRST_LINE_EDIT;
uint8_t posVertInit = MENU_FIRST_LINE_EDIT(horTab, horTabMax);
if (menuVerticalOffset != 0 || l_posVert != posVertInit) {
menuVerticalOffset = 0;
l_posVert = posVertInit;
@@ -438,7 +438,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
}
do {
INC(l_posVert, MENU_FIRST_LINE_EDIT, rowcount-1);
INC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount-1);
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
s_editMode = 0; // if we go down, we must be in this mode
@@ -467,7 +467,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
}
do {
DEC(l_posVert, MENU_FIRST_LINE_EDIT, rowcount-1);
DEC(l_posVert, MENU_FIRST_LINE_EDIT(horTab, horTabMax), rowcount-1);
} while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert));
s_editMode = 0; // if we go up, we must be in this mode