Introduce POPUP_INFORMATION window

This commit is contained in:
3djc
2019-02-07 10:17:19 +01:00
parent c5e8f18611
commit d01f1e8b3e
17 changed files with 23 additions and 8 deletions
+1
View File
@@ -266,6 +266,7 @@ uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint
#define WARNING_TYPE_ASTERISK 0
#define WARNING_TYPE_CONFIRM 1
#define WARNING_TYPE_INPUT 2
#define WARNING_TYPE_INFO 4
extern const char * warningText;
extern const char * warningInfoText;
+6 -6
View File
@@ -2,7 +2,7 @@
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
@@ -65,7 +65,7 @@ void drawAlertBox(const char * title, const char * text, const char * action)
lcdDrawText(MESSAGE_LCD_OFFSET, 0, title, DBLSIZE);
lcdDrawText(MESSAGE_LCD_OFFSET, 2*FH, STR_WARNING, DBLSIZE);
#endif
lcdDrawSolidFilledRect(0, 0, LCD_W, 32);
if (text) {
lcdDrawTextAlignedLeft(5*FH, text);
@@ -73,16 +73,16 @@ void drawAlertBox(const char * title, const char * text, const char * action)
if (action) {
lcdDrawTextAlignedLeft(7*FH, action);
}
#undef MESSAGE_LCD_OFFSET
}
void showAlertBox(const char * title, const char * text, const char * action , uint8_t sound)
{
drawAlertBox(title, text, action);
AUDIO_ERROR_MESSAGE(sound);
lcdRefresh();
lcdSetContrast();
clearKeyEvents();
@@ -97,7 +97,7 @@ void runPopupWarning(event_t event)
if (warningInfoText) {
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y+FH, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS);
}
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, warningType == WARNING_TYPE_INFO ? STR_OK : (warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS));
switch (event) {
case EVT_KEY_BREAK(KEY_ENTER):
if (warningType == WARNING_TYPE_ASTERISK)
+1
View File
@@ -51,6 +51,7 @@ 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_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = runPopupWarning)
#define POPUP_INPUT(s, func, start, min, max) (warningText = s, warningType = WARNING_TYPE_INPUT, popupFunc = func, warningInputValue = start, warningInputValueMin = min, warningInputValueMax = max)