Popups can now have an handler. It could perhaps avoid another EEPROM format @3djc ?

This commit is contained in:
Bertrand Songis
2019-03-21 15:44:16 +01:00
parent 4de9e3f73b
commit d4b14f614c
21 changed files with 104 additions and 61 deletions
+2 -5
View File
@@ -48,9 +48,9 @@ extern uint8_t warningInfoFlags;
#define SET_WARNING_INFO(...)
#else
#define DISPLAY_WARNING (*popupFunc)
#define POPUP_INFORMATION(s) (warningText = s, warningType = WARNING_TYPE_INFO, warningInfoText = 0, popupFunc = runPopupWarning)
#define POPUP_INFORMATION(s) (warningText = s, warningType = WARNING_TYPE_INFO, warningInfoText = nullptr, popupFunc = runPopupWarning)
#define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = runPopupWarning)
#define POPUP_CONFIRMATION(s, func) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = nullptr, popupFunc = runPopupWarning, popupMenuHandler = func)
#define POPUP_INPUT(s, func) (warningText = s, popupFunc = func)
#define WARNING_INFO_FLAGS warningInfoFlags
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
@@ -62,7 +62,6 @@ extern uint8_t warningInfoFlags;
#define POPUP_MENU_ADD_SD_ITEM(s)
#endif
#define NAVIGATION_MENUS
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuItemsCount < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuItemsCount++] = s; } while (0)
#define POPUP_MENU_SELECT_ITEM(s) s_menu_item = (s > 0 ? (s < popupMenuItemsCount ? s : popupMenuItemsCount) : 0)
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while (0)
@@ -78,13 +77,11 @@ extern uint8_t warningInfoFlags;
extern uint8_t popupMenuOffsetType;
extern uint8_t s_menu_item;
#if defined(NAVIGATION_MENUS)
extern uint16_t popupMenuOffset;
extern const char * popupMenuItems[POPUP_MENU_MAX_LINES];
extern uint16_t popupMenuItemsCount;
const char * runPopupMenu(event_t event);
extern void (*popupMenuHandler)(const char * result);
extern const char * popupMenuTitle;
#endif
#endif // _POPUPS_H_