summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-05-17 06:25:18 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-05-17 06:25:18 +0000
commit2172c9147361829e4a65f1c918450b617c4d04d5 (patch)
treecb17cd04ca916afa99898347068eacc1b0a1dff6
parent03ea24929779fd29ac95cb0bfd8945d269f3733d (diff)
downloadrockbox-2172c9147361829e4a65f1c918450b617c4d04d5.tar.gz
rockbox-2172c9147361829e4a65f1c918450b617c4d04d5.zip
get repeat/hold actions working on the touchscreen WPS. prepending an action with & means that this will only get triggered if you hold down the area. cabbie WPS updated so the fwd/rwd icons will do that when held or skip fwd/back if just pressed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20974 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c6
-rw-r--r--apps/gui/gwps.c19
-rw-r--r--apps/gui/gwps.h5
-rw-r--r--apps/gui/wps_parser.c14
-rw-r--r--wps/cabbiev2.320x240x16.mrobe500.wps3
5 files changed, 40 insertions, 7 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 9a69c74bf3..9cfff4cba8 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -268,7 +268,13 @@ bool ffwd_rew(int button)
268 break; 268 break;
269 } 269 }
270 if (!exit) 270 if (!exit)
271 {
271 button = get_action(CONTEXT_WPS|ALLOW_SOFTLOCK,TIMEOUT_BLOCK); 272 button = get_action(CONTEXT_WPS|ALLOW_SOFTLOCK,TIMEOUT_BLOCK);
273#ifdef HAVE_TOUCHSCREEN
274 if (button == ACTION_TOUCHSCREEN)
275 button = wps_get_touchaction(gui_wps[SCREEN_MAIN].data);
276#endif
277 }
272 } 278 }
273 return usb; 279 return usb;
274} 280}
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index ae9dc453f5..c89a6fcbb4 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -295,15 +295,16 @@ void gwps_draw_statusbars(void)
295 viewportmanager_set_statusbar(wpsbars); 295 viewportmanager_set_statusbar(wpsbars);
296} 296}
297#ifdef HAVE_TOUCHSCREEN 297#ifdef HAVE_TOUCHSCREEN
298static int wps_get_touchaction(struct wps_data *data) 298int wps_get_touchaction(struct wps_data *data)
299{ 299{
300 short x,y; 300 short x,y;
301 short vx, vy; 301 short vx, vy;
302 int type = action_get_touchscreen_press(&x, &y); 302 int type = action_get_touchscreen_press(&x, &y);
303 int i; 303 int i;
304 static int last_action = ACTION_NONE;
304 struct touchregion *r; 305 struct touchregion *r;
305 if (type != BUTTON_REL) 306 bool repeated = (type == BUTTON_REPEAT);
306 return ACTION_TOUCHSCREEN; 307 bool released = (type == BUTTON_REL);
307 for (i=0; i<data->touchregion_count; i++) 308 for (i=0; i<data->touchregion_count; i++)
308 { 309 {
309 r = &data->touchregion[i]; 310 r = &data->touchregion[i];
@@ -320,9 +321,19 @@ static int wps_get_touchaction(struct wps_data *data)
320 /* now see if the point is inside this region */ 321 /* now see if the point is inside this region */
321 if (vx >= r->x && vx < r->x+r->width && 322 if (vx >= r->x && vx < r->x+r->width &&
322 vy >= r->y && vy < r->y+r->height) 323 vy >= r->y && vy < r->y+r->height)
323 return r->action; 324 {
325 if ((repeated && r->repeat) ||
326 (released && !r->repeat))
327 {
328 last_action = r->action;
329 return r->action;
330 }
331 }
324 } 332 }
325 } 333 }
334 if ((last_action == ACTION_WPS_SEEKBACK || last_action == ACTION_WPS_SEEKFWD))
335 return ACTION_WPS_STOPSEEK;
336 last_action = ACTION_TOUCHSCREEN;
326 return ACTION_TOUCHSCREEN; 337 return ACTION_TOUCHSCREEN;
327} 338}
328#endif 339#endif
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index f3562214a0..ac1cbad60b 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -375,6 +375,7 @@ struct touchregion {
375 short int y; /* y-pos */ 375 short int y; /* y-pos */
376 short int width; /* width */ 376 short int width; /* width */
377 short int height; /* height */ 377 short int height; /* height */
378 bool repeat; /* requires the area be held for the action */
378 int action; /* action this button will return */ 379 int action; /* action this button will return */
379}; 380};
380#define MAX_TOUCHREGIONS 12 381#define MAX_TOUCHREGIONS 12
@@ -533,6 +534,10 @@ extern struct gui_wps gui_wps[NB_SCREENS];
533 534
534void gui_sync_wps_init(void); 535void gui_sync_wps_init(void);
535 536
537#ifdef HAVE_TOUCHSCREEN
538int wps_get_touchaction(struct wps_data *data);
539#endif
540
536#ifdef HAVE_ALBUMART 541#ifdef HAVE_ALBUMART
537/* gives back if WPS contains an albumart tag */ 542/* gives back if WPS contains an albumart tag */
538bool gui_sync_wps_uses_albumart(void); 543bool gui_sync_wps_uses_albumart(void);
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 7211e6c86a..bd599509ae 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -1163,6 +1163,7 @@ struct touchaction {char* s; int action;};
1163static struct touchaction touchactions[] = { 1163static struct touchaction touchactions[] = {
1164 {"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP }, 1164 {"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP },
1165 {"prev", ACTION_WPS_SKIPPREV }, {"next", ACTION_WPS_SKIPNEXT }, 1165 {"prev", ACTION_WPS_SKIPPREV }, {"next", ACTION_WPS_SKIPNEXT },
1166 {"ffwd", ACTION_WPS_SEEKFWD }, {"rwd", ACTION_WPS_SEEKBACK },
1166 {"menu", ACTION_WPS_MENU }, {"browse", ACTION_WPS_BROWSE }, 1167 {"menu", ACTION_WPS_MENU }, {"browse", ACTION_WPS_BROWSE },
1167 {"shuffle", ACTION_TOUCH_SHUFFLE }, {"repmode", ACTION_TOUCH_REPMODE }, 1168 {"shuffle", ACTION_TOUCH_SHUFFLE }, {"repmode", ACTION_TOUCH_REPMODE },
1168 {"quickscreen", ACTION_WPS_QUICKSCREEN },{"contextmenu", ACTION_WPS_CONTEXT }, 1169 {"quickscreen", ACTION_WPS_QUICKSCREEN },{"contextmenu", ACTION_WPS_CONTEXT },
@@ -1178,13 +1179,14 @@ static int parse_touchregion(const char *wps_bufptr,
1178 int x,y,w,h; 1179 int x,y,w,h;
1179 1180
1180 /* format: %T|x|y|width|height|action| 1181 /* format: %T|x|y|width|height|action|
1182 * if action starts with & the area must be held to happen
1181 * action is one of: 1183 * action is one of:
1182 * play - play/pause playback 1184 * play - play/pause playback
1183 * stop - stop playback, exit the wps 1185 * stop - stop playback, exit the wps
1184 * prev - prev track 1186 * prev - prev track
1185 * next - next track 1187 * next - next track
1186 * ffwd 1188 * ffwd - seek forward
1187 * rwd 1189 * rwd - seek backwards
1188 * menu - go back to the main menu 1190 * menu - go back to the main menu
1189 * browse - go back to the file/db browser 1191 * browse - go back to the file/db browser
1190 * shuffle - toggle shuffle mode 1192 * shuffle - toggle shuffle mode
@@ -1213,6 +1215,14 @@ static int parse_touchregion(const char *wps_bufptr,
1213 region->height = h; 1215 region->height = h;
1214 region->wvp = &wps_data->viewports[wps_data->num_viewports]; 1216 region->wvp = &wps_data->viewports[wps_data->num_viewports];
1215 i = 0; 1217 i = 0;
1218 if (*action == '&')
1219 {
1220 action++;
1221 region->repeat = true;
1222 }
1223 else
1224 region->repeat = false;
1225
1216 while ((region->action == ACTION_NONE) && 1226 while ((region->action == ACTION_NONE) &&
1217 (i < sizeof(touchactions)/sizeof(*touchactions))) 1227 (i < sizeof(touchactions)/sizeof(*touchactions)))
1218 { 1228 {
diff --git a/wps/cabbiev2.320x240x16.mrobe500.wps b/wps/cabbiev2.320x240x16.mrobe500.wps
index ad66fbb02b..a18babd0f4 100644
--- a/wps/cabbiev2.320x240x16.mrobe500.wps
+++ b/wps/cabbiev2.320x240x16.mrobe500.wps
@@ -65,8 +65,9 @@
65#%T|50|5|24|24|pitch| 65#%T|50|5|24|24|pitch|
66%T|80|5|24|24|contextmenu| 66%T|80|5|24|24|contextmenu|
67%T|110|5|24|24|quickscreen| 67%T|110|5|24|24|quickscreen|
68%T|150|5|24|24|&rwd|
69%T|175|5|24|24|&ffwd|
68%T|150|5|24|24|prev| 70%T|150|5|24|24|prev|
69%T|175|5|24|24|next| 71%T|175|5|24|24|next|
70
71%Vl|u|0|74|-|30|1|-|-| 72%Vl|u|0|74|-|30|1|-|-|
72#purposly left blank 73#purposly left blank