summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-10-09 11:10:26 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-10-09 11:10:26 +0000
commit486869693c020e032626d3da6cd8dffb01217dbe (patch)
treebd088f84aa714986bcb7d57ff737137c886f207c /apps
parentae569c6f820c1b6e8759e2ecc36641b870ae26f3 (diff)
downloadrockbox-486869693c020e032626d3da6cd8dffb01217dbe.tar.gz
rockbox-486869693c020e032626d3da6cd8dffb01217dbe.tar.bz2
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
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/gwps-common.c5
-rw-r--r--apps/gui/gwps.c4
-rw-r--r--apps/gui/gwps.h8
-rw-r--r--apps/gui/wps_parser.c2
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,
else
return NULL;
#endif
+ case WPS_TOKEN_BUTTON_VOLUME:
+ if (data->button_time_volume &&
+ TIME_BEFORE(current_tick, data->button_time_volume+2*HZ/3))
+ return ".:|";
+ return NULL;
default:
return NULL;
}
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)
/* volume up */
case ACTION_WPS_VOLUP:
{
+ FOR_NB_SCREENS(i)
+ gui_wps[i].data->button_time_volume = current_tick;
global_settings.volume++;
bool res = false;
setvol();
@@ -347,6 +349,8 @@ long gui_wps_show(void)
/* volume down */
case ACTION_WPS_VOLDOWN:
{
+ FOR_NB_SCREENS(i)
+ gui_wps[i].data->button_time_volume = current_tick;
global_settings.volume--;
setvol();
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 {
#endif
/* Viewport display */
- WPS_VIEWPORT_ENABLE
+ WPS_VIEWPORT_ENABLE,
+
+ /* buttons */
+ WPS_TOKEN_BUTTON_VOLUME
};
struct wps_token {
@@ -423,6 +426,9 @@ struct wps_data
int num_strings;
bool wps_loaded;
+
+ /* tick the volume button was last pressed */
+ unsigned int button_time_volume;
};
/* 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[] = {
{ WPS_TOKEN_REPEAT_MODE, "mm", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_BUTTON_VOLUME, "mv", WPS_REFRESH_DYNAMIC, NULL },
#ifdef HAVE_LCD_BITMAP
{ WPS_TOKEN_PEAKMETER, "pm", WPS_REFRESH_PEAK_METER, NULL },
@@ -1443,6 +1444,7 @@ void wps_data_init(struct wps_data *wps_data)
}
wps_data->full_line_progressbar = false;
#endif
+ wps_data->button_time_volume = 0;
wps_data->wps_loaded = false;
}