Merge branch 'kilrah/navigation' into next
This commit is contained in:
@@ -110,11 +110,20 @@ bool menuCommonCalib(evt_t event)
|
||||
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
calibrationState = CALIB_START;
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
if (calibrationState == CALIB_START) {
|
||||
killEvents(KEY_EXIT);
|
||||
popMenu();
|
||||
}
|
||||
else {
|
||||
calibrationState = CALIB_START;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
calibrationState++;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -231,8 +231,9 @@ bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
lcdDrawSizedText(x, y, cfn->play.name, sizeof(cfn->play.name), attr);
|
||||
else
|
||||
lcdDrawTextAtIndex(x, y, STR_VCSWFUNC, 0, attr);
|
||||
if (active && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
if (attr) s_editMode = 0;
|
||||
if (attr && event==EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
char directory[256];
|
||||
if (func==FUNC_PLAY_SCRIPT) {
|
||||
strcpy(directory, SCRIPTS_FUNCS_PATH);
|
||||
|
||||
@@ -68,8 +68,9 @@ bool menuModelCustomScriptOne(evt_t event)
|
||||
lcdDrawSizedText(SCRIPT_ONE_2ND_COLUMN_POS, y, sd.file, sizeof(sd.file), attr);
|
||||
else
|
||||
lcdDrawTextAtIndex(SCRIPT_ONE_2ND_COLUMN_POS, y, STR_VCSWFUNC, 0, attr);
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && !READ_ONLY()) {
|
||||
s_editMode = 0;
|
||||
if (attr) s_editMode = 0;
|
||||
if (attr && event==EVT_KEY_FIRST(KEY_ENTER) && !READ_ONLY()) {
|
||||
killEvents(KEY_ENTER);
|
||||
if (sdListFiles(SCRIPTS_MIXES_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) {
|
||||
popupMenuHandler = onModelCustomScriptMenu;
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ bool menuModelTelemetry(evt_t event)
|
||||
|
||||
case ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_IGNORE_INSTANCE);
|
||||
editCheckBox(g_model.ignoreSensorIds, TELEM_COL2, y, attr, event);
|
||||
g_model.ignoreSensorIds = editCheckBox(g_model.ignoreSensorIds, TELEM_COL2, y, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_LABEL:
|
||||
|
||||
@@ -412,13 +412,13 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||
if (menuTab && !calibrationState) {
|
||||
int cc = curr;
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_PGDN):
|
||||
case EVT_KEY_FIRST(KEY_PGDN):
|
||||
if (++cc == menuTabSize)
|
||||
cc = 0;
|
||||
break;
|
||||
|
||||
|
||||
case EVT_KEY_BREAK(KEY_PGUP):
|
||||
case EVT_KEY_FIRST(KEY_PGUP):
|
||||
if (cc-- == 0)
|
||||
cc = menuTabSize-1;
|
||||
break;
|
||||
@@ -455,12 +455,7 @@ bool check(check_event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, u
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
s_editMode = 0; // TODO needed? we call ENTRY_UP after which does the same
|
||||
popMenu();
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
if (s_editMode > 0) {
|
||||
s_editMode = 0;
|
||||
break;
|
||||
|
||||
@@ -89,7 +89,7 @@ bool editZoneOption(coord_t y, const ZoneOption * option, ZoneOptionValue * valu
|
||||
else
|
||||
lcdDrawTextAtIndex(SCREENS_SETUP_2ND_COLUMN, y, STR_VCSWFUNC, 0, attr); // TODO define
|
||||
if (attr) {
|
||||
if (event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (event==EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
if (sdListFiles(BITMAPS_PATH, BITMAPS_EXT, sizeof(value->stringValue), value->stringValue, LIST_NONE_SD_FILE)) {
|
||||
fileSelectionDone = false;
|
||||
@@ -230,13 +230,13 @@ bool menuWidgetChoice(evt_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
delete currentWidget;
|
||||
currentContainer->setWidget(currentZone, previousWidget);
|
||||
popMenu();
|
||||
return false;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
delete previousWidget;
|
||||
currentContainer->createWidget(currentZone, registeredWidgets[menuHorizontalPosition]);
|
||||
storageDirty(EE_MODEL);
|
||||
@@ -296,7 +296,8 @@ bool menuWidgetsSetup(evt_t event)
|
||||
case EVT_ENTRY:
|
||||
menuVerticalPosition = 0;
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
killEvents(KEY_EXIT);
|
||||
popMenu();
|
||||
return false;
|
||||
}
|
||||
@@ -319,7 +320,8 @@ bool menuWidgetsSetup(evt_t event)
|
||||
}
|
||||
if (menuVerticalPosition == i) {
|
||||
lcdDrawSolidRect(zone.x-padding, zone.y-padding, zone.w+2*padding, zone.h+2*padding, thickness, color);
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
currentZone = menuVerticalPosition;
|
||||
currentWidget = currentContainer->getWidget(menuVerticalPosition);
|
||||
if (currentWidget) {
|
||||
@@ -395,7 +397,7 @@ T * editThemeChoice(coord_t x, coord_t y, T * array[], uint8_t count, T * curren
|
||||
}
|
||||
if (attr && menuHorizontalPosition >= 0) {
|
||||
lcdDrawSolidRect(x + (menuHorizontalPosition - menuHorizontalOffset) * 56 - 3, y - 1, 57, 35, 1, TEXT_INVERTED_BGCOLOR);
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
return array[menuHorizontalPosition];
|
||||
}
|
||||
@@ -457,7 +459,7 @@ bool menuScreensTheme(evt_t event)
|
||||
else if (index == optionsCount) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, "Top bar");
|
||||
drawButton(SCREENS_SETUP_2ND_COLUMN, y, "Setup", attr);
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
currentScreen = customScreens[0];
|
||||
currentContainer = topbar;
|
||||
pushMenu(menuWidgetsSetup);
|
||||
@@ -519,6 +521,7 @@ bool menuScreenSetup(int index, evt_t event)
|
||||
delete customScreens[index];
|
||||
currentScreen = customScreens[index] = factory->create(&g_model.screenData[index].layoutData);
|
||||
strncpy(g_model.screenData[index].layoutName, factory->getName(), sizeof(g_model.screenData[index].layoutName));
|
||||
killEvents(KEY_ENTER);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
break;
|
||||
@@ -529,7 +532,7 @@ bool menuScreenSetup(int index, evt_t event)
|
||||
|
||||
case ITEM_SCREEN_SETUP_WIDGETS_SETUP:
|
||||
drawButton(SCREENS_SETUP_2ND_COLUMN, y, "Setup widgets", attr);
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
pushMenu(menuWidgetsSetup);
|
||||
}
|
||||
break;
|
||||
@@ -546,7 +549,7 @@ bool menuScreenSetup(int index, evt_t event)
|
||||
}
|
||||
else if (menuPageCount > 3 && o == optionsCount) {
|
||||
drawButton(SCREENS_SETUP_2ND_COLUMN, y, STR_REMOVE_SCREEN, attr);
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (attr && event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
delete currentScreen;
|
||||
if (index != MAX_CUSTOM_SCREENS-1) {
|
||||
memmove(&g_model.screenData[index], &g_model.screenData[index + 1], sizeof(CustomScreenData) * (MAX_CUSTOM_SCREENS - index - 1));
|
||||
@@ -554,6 +557,7 @@ bool menuScreenSetup(int index, evt_t event)
|
||||
}
|
||||
memset(&g_model.screenData[MAX_CUSTOM_SCREENS-1], 0, sizeof(CustomScreenData));
|
||||
customScreens[MAX_CUSTOM_SCREENS-1] = NULL;
|
||||
killEvents(KEY_ENTER);
|
||||
chainMenu(menuTabScreensSetup[index > 0 ? index : 1]);
|
||||
return false;
|
||||
}
|
||||
@@ -599,10 +603,11 @@ bool menuScreenAdd(evt_t event)
|
||||
{
|
||||
menuPageCount = updateMainviewsMenu();
|
||||
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
customScreens[menuPageCount-2] = registeredLayouts[0]->create(&g_model.screenData[menuPageCount-2].layoutData);
|
||||
s_editMode = 0;
|
||||
menuHorizontalPosition = -1;
|
||||
killEvents(KEY_ENTER);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -165,12 +165,12 @@ bool menuMainView(evt_t event)
|
||||
pushMenu(menuTabScreensSetup[1]);
|
||||
return false;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_PGDN):
|
||||
case EVT_KEY_FIRST(KEY_PGDN):
|
||||
storageDirty(EE_GENERAL);
|
||||
g_eeGeneral.view = circularIncDec(g_eeGeneral.view, +1, 0, getMainViewsCount()-1);
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_PGUP):
|
||||
case EVT_KEY_FIRST(KEY_PGUP):
|
||||
killEvents(event);
|
||||
storageDirty(EE_GENERAL);
|
||||
g_eeGeneral.view = circularIncDec(g_eeGeneral.view, -1, 0, getMainViewsCount()-1);
|
||||
@@ -193,6 +193,7 @@ bool menuMainView(evt_t event)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool menuMainViewChannelsMonitor(evt_t event)
|
||||
{
|
||||
switch (event) {
|
||||
@@ -204,3 +205,4 @@ bool menuMainViewChannelsMonitor(evt_t event)
|
||||
|
||||
return menuChannelsView(event);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -100,7 +100,7 @@ bool menuTextView(evt_t event)
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
case EVT_ROTARY_LEFT:
|
||||
if (menuVerticalOffset == 0)
|
||||
break;
|
||||
else
|
||||
@@ -108,7 +108,7 @@ bool menuTextView(evt_t event)
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_ROTARY_RIGHT:
|
||||
if (menuVerticalOffset+NUM_BODY_LINES >= lines_count)
|
||||
break;
|
||||
else
|
||||
@@ -116,7 +116,7 @@ bool menuTextView(evt_t event)
|
||||
readTextFile(lines_count);
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
popMenu();
|
||||
break;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ bool menuTextView(evt_t event)
|
||||
#endif
|
||||
// lcd_putsCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
|
||||
|
||||
drawVerticalScrollbar(LCD_W-5, 30, MENU_FOOTER_TOP-34, menuVerticalOffset, lines_count, NUM_BODY_LINES);
|
||||
drawVerticalScrollbar(LCD_W-5, 50, 195, menuVerticalOffset, lines_count, NUM_BODY_LINES);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user