Popups refactoring

This commit is contained in:
Bertrand Songis
2019-05-03 23:26:17 +02:00
parent 8376e1b16b
commit 7d4adc1afe
8 changed files with 117 additions and 63 deletions
-5
View File
@@ -247,11 +247,6 @@ void editSingleName(coord_t x, coord_t y, const char * label, char * name, uint8
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint8_t delay);
#define EDIT_DELAY(y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
#define WARNING_TYPE_ASTERISK 0
#define WARNING_TYPE_CONFIRM 1
#define WARNING_TYPE_INPUT 2
#define WARNING_TYPE_INFO 4
void copySelection(char * dst, const char * src, uint8_t size);
#define COPY_MODE 1
-13
View File
@@ -33,22 +33,9 @@
#define WARNING_LINE_X 16
#define WARNING_LINE_Y 3*FH
#define DISPLAY_WARNING (*popupFunc)
#define POPUP_INFORMATION(s) (warningText = s, warningType = WARNING_TYPE_INFO, warningInfoText = 0, popupFunc = runPopupWarning)
#define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
#define POPUP_CONFIRMATION(s, func) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, 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)
#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)
#define POPUP_MENU_MAX_LINES 12
#define MENU_MAX_DISPLAY_LINES 6
#define POPUP_MENU_ADD_SD_ITEM(s) POPUP_MENU_ADD_ITEM(s)
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
#define POPUP_MENU_SET_BSS_FLAG()
enum {
MENU_OFFSET_INTERNAL,