diff options
-rw-r--r-- | apps/gui/yesno.c | 36 | ||||
-rw-r--r-- | apps/keymaps/keymap-touchscreen.c | 1 |
2 files changed, 36 insertions, 1 deletions
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index a834aa7b06..dfce541147 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c | |||
@@ -89,7 +89,23 @@ static void gui_yesno_draw(struct gui_yesno * yn) | |||
89 | 89 | ||
90 | line_shift += put_message(display, yn->main_message, | 90 | line_shift += put_message(display, yn->main_message, |
91 | line_shift, vp_lines); | 91 | line_shift, vp_lines); |
92 | 92 | #ifdef HAVE_TOUCHSCREEN | |
93 | if (display->screen_type == SCREEN_MAIN) | ||
94 | { | ||
95 | int w,h; | ||
96 | int rect_w = vp->width/2, rect_h = vp->height/2; | ||
97 | int old_pattern = vp->fg_pattern; | ||
98 | vp->fg_pattern = LCD_RGBPACK(0,255,0); | ||
99 | display->drawrect(0, rect_h, rect_w, rect_h); | ||
100 | display->getstringsize(str(LANG_SET_BOOL_YES), &w, &h); | ||
101 | display->putsxy((rect_w-w)/2, rect_h+(rect_h-h)/2, str(LANG_SET_BOOL_YES)); | ||
102 | vp->fg_pattern = LCD_RGBPACK(255,0,0); | ||
103 | display->drawrect(rect_w, rect_h, rect_w, rect_h); | ||
104 | display->getstringsize(str(LANG_SET_BOOL_NO), &w, &h); | ||
105 | display->putsxy(rect_w + (rect_w-w)/2, rect_h+(rect_h-h)/2, str(LANG_SET_BOOL_NO)); | ||
106 | vp->fg_pattern = old_pattern; | ||
107 | } | ||
108 | #else | ||
93 | /* Space remaining for yes / no text ? */ | 109 | /* Space remaining for yes / no text ? */ |
94 | if(line_shift+2 <= vp_lines) | 110 | if(line_shift+2 <= vp_lines) |
95 | { | 111 | { |
@@ -100,6 +116,7 @@ static void gui_yesno_draw(struct gui_yesno * yn) | |||
100 | display->puts(0, line_shift+1, str(LANG_CANCEL_WITH_ANY)); | 116 | display->puts(0, line_shift+1, str(LANG_CANCEL_WITH_ANY)); |
101 | #endif | 117 | #endif |
102 | } | 118 | } |
119 | #endif | ||
103 | display->update_viewport(); | 120 | display->update_viewport(); |
104 | display->set_viewport(NULL); | 121 | display->set_viewport(NULL); |
105 | } | 122 | } |
@@ -165,6 +182,23 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, | |||
165 | button = get_action(CONTEXT_YESNOSCREEN, HZ*5); | 182 | button = get_action(CONTEXT_YESNOSCREEN, HZ*5); |
166 | switch (button) | 183 | switch (button) |
167 | { | 184 | { |
185 | #ifdef HAVE_TOUCHSCREEN | ||
186 | case ACTION_TOUCHSCREEN: | ||
187 | { | ||
188 | short int x, y; | ||
189 | if (action_get_touchscreen_press_in_vp(&x, &y, yn[0].vp) == BUTTON_TOUCHSCREEN) | ||
190 | { | ||
191 | if (y > yn[0].vp->height/2) | ||
192 | { | ||
193 | if (x <= yn[0].vp->width/2) | ||
194 | result = YESNO_YES; | ||
195 | else | ||
196 | result = YESNO_NO; | ||
197 | } | ||
198 | } | ||
199 | } | ||
200 | break; | ||
201 | #endif | ||
168 | case ACTION_YESNO_ACCEPT: | 202 | case ACTION_YESNO_ACCEPT: |
169 | result=YESNO_YES; | 203 | result=YESNO_YES; |
170 | break; | 204 | break; |
diff --git a/apps/keymaps/keymap-touchscreen.c b/apps/keymaps/keymap-touchscreen.c index bc65f01525..9825c92e7d 100644 --- a/apps/keymaps/keymap-touchscreen.c +++ b/apps/keymaps/keymap-touchscreen.c | |||
@@ -173,6 +173,7 @@ static const struct button_mapping button_context_settings_right_is_inc[] = { | |||
173 | 173 | ||
174 | static const struct button_mapping button_context_yesno[] = { | 174 | static const struct button_mapping button_context_yesno[] = { |
175 | { ACTION_YESNO_ACCEPT, BUTTON_TOPRIGHT, BUTTON_NONE }, | 175 | { ACTION_YESNO_ACCEPT, BUTTON_TOPRIGHT, BUTTON_NONE }, |
176 | { ACTION_YESNO_ACCEPT, BUTTON_BOTTOMLEFT, BUTTON_NONE }, | ||
176 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_YESNOSCREEN) | 177 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_YESNOSCREEN) |
177 | }; /* button_context_settings_yesno */ | 178 | }; /* button_context_settings_yesno */ |
178 | 179 | ||