1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jonathan Gordon 2008-10-09 11:10:26 +00:00
parent ae569c6f82
commit 486869693c
4 changed files with 18 additions and 1 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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 */

View file

@ -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;
}