diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-10-09 11:10:26 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-10-09 11:10:26 +0000 |
commit | 486869693c020e032626d3da6cd8dffb01217dbe (patch) | |
tree | bd088f84aa714986bcb7d57ff737137c886f207c | |
parent | ae569c6f820c1b6e8759e2ecc36641b870ae26f3 (diff) | |
download | rockbox-486869693c020e032626d3da6cd8dffb01217dbe.tar.gz rockbox-486869693c020e032626d3da6cd8dffb01217dbe.zip |
FS#9460 - Add a tag %mv which can be used to check if the volume button is being pressed (e.g %?mv<yes|no> ). It will stay true after its released for a little over half a second (not configurable unless someone comes up with a nice way to add a parameter to the tag? 1s is too long and .5s is too short...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18752 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/gwps-common.c | 5 | ||||
-rw-r--r-- | apps/gui/gwps.c | 4 | ||||
-rw-r--r-- | apps/gui/gwps.h | 8 | ||||
-rw-r--r-- | apps/gui/wps_parser.c | 2 |
4 files changed, 18 insertions, 1 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index c7343515f8..dd941e8061 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -1388,6 +1388,11 @@ static const char *get_token_value(struct gui_wps *gwps, | |||
1388 | else | 1388 | else |
1389 | return NULL; | 1389 | return NULL; |
1390 | #endif | 1390 | #endif |
1391 | case WPS_TOKEN_BUTTON_VOLUME: | ||
1392 | if (data->button_time_volume && | ||
1393 | TIME_BEFORE(current_tick, data->button_time_volume+2*HZ/3)) | ||
1394 | return ".:|"; | ||
1395 | return NULL; | ||
1391 | default: | 1396 | default: |
1392 | return NULL; | 1397 | return NULL; |
1393 | } | 1398 | } |
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 722dce685e..47cc05aad2 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c | |||
@@ -329,6 +329,8 @@ long gui_wps_show(void) | |||
329 | /* volume up */ | 329 | /* volume up */ |
330 | case ACTION_WPS_VOLUP: | 330 | case ACTION_WPS_VOLUP: |
331 | { | 331 | { |
332 | FOR_NB_SCREENS(i) | ||
333 | gui_wps[i].data->button_time_volume = current_tick; | ||
332 | global_settings.volume++; | 334 | global_settings.volume++; |
333 | bool res = false; | 335 | bool res = false; |
334 | setvol(); | 336 | setvol(); |
@@ -347,6 +349,8 @@ long gui_wps_show(void) | |||
347 | /* volume down */ | 349 | /* volume down */ |
348 | case ACTION_WPS_VOLDOWN: | 350 | case ACTION_WPS_VOLDOWN: |
349 | { | 351 | { |
352 | FOR_NB_SCREENS(i) | ||
353 | gui_wps[i].data->button_time_volume = current_tick; | ||
350 | global_settings.volume--; | 354 | global_settings.volume--; |
351 | setvol(); | 355 | setvol(); |
352 | bool res = false; | 356 | bool res = false; |
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 99bf701a7d..579a3409c2 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h | |||
@@ -292,7 +292,10 @@ enum wps_token_type { | |||
292 | #endif | 292 | #endif |
293 | 293 | ||
294 | /* Viewport display */ | 294 | /* Viewport display */ |
295 | WPS_VIEWPORT_ENABLE | 295 | WPS_VIEWPORT_ENABLE, |
296 | |||
297 | /* buttons */ | ||
298 | WPS_TOKEN_BUTTON_VOLUME | ||
296 | }; | 299 | }; |
297 | 300 | ||
298 | struct wps_token { | 301 | struct wps_token { |
@@ -423,6 +426,9 @@ struct wps_data | |||
423 | int num_strings; | 426 | int num_strings; |
424 | 427 | ||
425 | bool wps_loaded; | 428 | bool wps_loaded; |
429 | |||
430 | /* tick the volume button was last pressed */ | ||
431 | unsigned int button_time_volume; | ||
426 | }; | 432 | }; |
427 | 433 | ||
428 | /* initial setup of wps_data */ | 434 | /* initial setup of wps_data */ |
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index b2baddd747..eff65ef113 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c | |||
@@ -279,6 +279,7 @@ static const struct wps_tag all_tags[] = { | |||
279 | 279 | ||
280 | { WPS_TOKEN_REPEAT_MODE, "mm", WPS_REFRESH_DYNAMIC, NULL }, | 280 | { WPS_TOKEN_REPEAT_MODE, "mm", WPS_REFRESH_DYNAMIC, NULL }, |
281 | { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL }, | 281 | { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL }, |
282 | { WPS_TOKEN_BUTTON_VOLUME, "mv", WPS_REFRESH_DYNAMIC, NULL }, | ||
282 | 283 | ||
283 | #ifdef HAVE_LCD_BITMAP | 284 | #ifdef HAVE_LCD_BITMAP |
284 | { WPS_TOKEN_PEAKMETER, "pm", WPS_REFRESH_PEAK_METER, NULL }, | 285 | { WPS_TOKEN_PEAKMETER, "pm", WPS_REFRESH_PEAK_METER, NULL }, |
@@ -1443,6 +1444,7 @@ void wps_data_init(struct wps_data *wps_data) | |||
1443 | } | 1444 | } |
1444 | wps_data->full_line_progressbar = false; | 1445 | wps_data->full_line_progressbar = false; |
1445 | #endif | 1446 | #endif |
1447 | wps_data->button_time_volume = 0; | ||
1446 | wps_data->wps_loaded = false; | 1448 | wps_data->wps_loaded = false; |
1447 | } | 1449 | } |
1448 | 1450 | ||