From c1267dc70088474731ab360244d90340d7c877ad Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Fri, 15 May 2009 05:36:16 +0000 Subject: allow the user to change the shuffle and repeat modes from the touchscreen, update the mr500 default wps to show how to do it (hint, press the shuffle/rep icon) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20937 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps.c | 26 +++++++++++++++++++++++++- apps/gui/wps_parser.c | 5 ++++- 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 273f5d8e61..ae9dc453f5 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c @@ -64,6 +64,8 @@ #include "appevents.h" #include "viewport.h" #include "pcmbuf.h" +#include "option_select.h" +#include "dsp.h" #define RESTORE_WPS_INSTANTLY 0l #define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) @@ -732,7 +734,29 @@ long gui_wps_show(void) restore = true; } break; - +#ifdef HAVE_TOUCHSCREEN + case ACTION_TOUCH_SHUFFLE: /* toggle shuffle mode */ + { + global_settings.playlist_shuffle = + !global_settings.playlist_shuffle; +#if CONFIG_CODEC == SWCODEC + dsp_set_replaygain(); +#endif + if (global_settings.playlist_shuffle) + playlist_randomise(NULL, current_tick, true); + else + playlist_sort(NULL, true); + } + break; + case ACTION_TOUCH_REPMODE: /* cycle the repeat mode setting */ + { + const struct settings_list *rep_setting = + find_setting(&global_settings.repeat_mode, NULL); + option_select_next_val(rep_setting, false, true); + audio_flush_and_reload_tracks(); + } + break; +#endif /* HAVE_TOUCHSCREEN */ case ACTION_REDRAW: /* yes are locked, just redraw */ /* fall througgh */ case ACTION_NONE: /* Timeout, do an partial update */ diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index 290f370fe7..d8155d71df 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -1162,7 +1162,8 @@ struct touchaction {char* s; int action;}; static struct touchaction touchactions[] = { {"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP }, {"prev", ACTION_WPS_SKIPPREV }, {"next", ACTION_WPS_SKIPNEXT }, - {"menu", ACTION_WPS_MENU }, {"browse", ACTION_WPS_BROWSE } + {"menu", ACTION_WPS_MENU }, {"browse", ACTION_WPS_BROWSE }, + {"shuffle", ACTION_TOUCH_SHUFFLE }, {"repmode", ACTION_TOUCH_REPMODE } }; static int parse_touchregion(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data) @@ -1184,6 +1185,8 @@ static int parse_touchregion(const char *wps_bufptr, * rwd * menu - go back to the main menu * browse - go back to the file/db browser + * shuffle - toggle shuffle mode + * repmode - cycle the repeat mode */ if ((wps_data->touchregion_count +1 >= MAX_TOUCHREGIONS) || (*ptr != '|')) -- cgit v1.2.3