summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-08-26 10:20:16 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-08-26 10:20:16 +0000
commit1d613bee0fd4b3bb6266a7ad93aade2aaeb3705c (patch)
tree46e5f301081ae3250d0e89229333fd8124bc8f3c
parent6b85f18b64e3df6dd1fe665384374b731f1466f0 (diff)
downloadrockbox-1d613bee0fd4b3bb6266a7ad93aade2aaeb3705c.zip
rockbox-1d613bee0fd4b3bb6266a7ad93aade2aaeb3705c.tar.gz
rockbox-1d613bee0fd4b3bb6266a7ad93aade2aaeb3705c.tar.bz2
rockbox-1d613bee0fd4b3bb6266a7ad93aade2aaeb3705c.tar.xz
Make the yes/no screen useable in the stylus touchscreen mode, add 2 soft-buttons. Also make bottom left yes in grid mode to line up with the new button
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27890 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/yesno.c36
-rw-r--r--apps/keymaps/keymap-touchscreen.c1
2 files changed, 36 insertions, 1 deletions
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c
index a834aa7..dfce541 100644
--- a/apps/gui/yesno.c
+++ b/apps/gui/yesno.c
@@ -89,7 +89,23 @@ static void gui_yesno_draw(struct gui_yesno * yn)
line_shift += put_message(display, yn->main_message,
line_shift, vp_lines);
-
+#ifdef HAVE_TOUCHSCREEN
+ if (display->screen_type == SCREEN_MAIN)
+ {
+ int w,h;
+ int rect_w = vp->width/2, rect_h = vp->height/2;
+ int old_pattern = vp->fg_pattern;
+ vp->fg_pattern = LCD_RGBPACK(0,255,0);
+ display->drawrect(0, rect_h, rect_w, rect_h);
+ display->getstringsize(str(LANG_SET_BOOL_YES), &w, &h);
+ display->putsxy((rect_w-w)/2, rect_h+(rect_h-h)/2, str(LANG_SET_BOOL_YES));
+ vp->fg_pattern = LCD_RGBPACK(255,0,0);
+ display->drawrect(rect_w, rect_h, rect_w, rect_h);
+ display->getstringsize(str(LANG_SET_BOOL_NO), &w, &h);
+ display->putsxy(rect_w + (rect_w-w)/2, rect_h+(rect_h-h)/2, str(LANG_SET_BOOL_NO));
+ vp->fg_pattern = old_pattern;
+ }
+#else
/* Space remaining for yes / no text ? */
if(line_shift+2 <= vp_lines)
{
@@ -100,6 +116,7 @@ static void gui_yesno_draw(struct gui_yesno * yn)
display->puts(0, line_shift+1, str(LANG_CANCEL_WITH_ANY));
#endif
}
+#endif
display->update_viewport();
display->set_viewport(NULL);
}
@@ -165,6 +182,23 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
button = get_action(CONTEXT_YESNOSCREEN, HZ*5);
switch (button)
{
+#ifdef HAVE_TOUCHSCREEN
+ case ACTION_TOUCHSCREEN:
+ {
+ short int x, y;
+ if (action_get_touchscreen_press_in_vp(&x, &y, yn[0].vp) == BUTTON_TOUCHSCREEN)
+ {
+ if (y > yn[0].vp->height/2)
+ {
+ if (x <= yn[0].vp->width/2)
+ result = YESNO_YES;
+ else
+ result = YESNO_NO;
+ }
+ }
+ }
+ break;
+#endif
case ACTION_YESNO_ACCEPT:
result=YESNO_YES;
break;
diff --git a/apps/keymaps/keymap-touchscreen.c b/apps/keymaps/keymap-touchscreen.c
index bc65f01..9825c92 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[] = {
static const struct button_mapping button_context_yesno[] = {
{ ACTION_YESNO_ACCEPT, BUTTON_TOPRIGHT, BUTTON_NONE },
+ { ACTION_YESNO_ACCEPT, BUTTON_BOTTOMLEFT, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_YESNOSCREEN)
}; /* button_context_settings_yesno */