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
This commit is contained in:
Jonathan Gordon 2009-05-15 05:36:16 +00:00
parent 33d08e8315
commit c1267dc700
4 changed files with 39 additions and 2 deletions

View file

@ -228,6 +228,14 @@ enum {
ACTION_KBD_DOWN, ACTION_KBD_DOWN,
ACTION_KBD_MORSE_INPUT, ACTION_KBD_MORSE_INPUT,
ACTION_KBD_MORSE_SELECT, ACTION_KBD_MORSE_SELECT,
#ifdef HAVE_TOUCHSCREEN
/* the following are helper actions for touchscreen targets,
* These are for actions which are not doable or required if buttons are
* being used, but are nice additions if the touchscreen is used */
ACTION_TOUCH_SHUFFLE,
ACTION_TOUCH_REPMODE,
#endif
LAST_ACTION_PLACEHOLDER, /* custom actions should be this + something */ LAST_ACTION_PLACEHOLDER, /* custom actions should be this + something */

View file

@ -64,6 +64,8 @@
#include "appevents.h" #include "appevents.h"
#include "viewport.h" #include "viewport.h"
#include "pcmbuf.h" #include "pcmbuf.h"
#include "option_select.h"
#include "dsp.h"
#define RESTORE_WPS_INSTANTLY 0l #define RESTORE_WPS_INSTANTLY 0l
#define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) #define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick))
@ -732,7 +734,29 @@ long gui_wps_show(void)
restore = true; restore = true;
} }
break; 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 */ case ACTION_REDRAW: /* yes are locked, just redraw */
/* fall througgh */ /* fall througgh */
case ACTION_NONE: /* Timeout, do an partial update */ case ACTION_NONE: /* Timeout, do an partial update */

View file

@ -1162,7 +1162,8 @@ struct touchaction {char* s; int action;};
static struct touchaction touchactions[] = { static struct touchaction touchactions[] = {
{"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP }, {"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP },
{"prev", ACTION_WPS_SKIPPREV }, {"next", ACTION_WPS_SKIPNEXT }, {"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, static int parse_touchregion(const char *wps_bufptr,
struct wps_token *token, struct wps_data *wps_data) struct wps_token *token, struct wps_data *wps_data)
@ -1184,6 +1185,8 @@ static int parse_touchregion(const char *wps_bufptr,
* rwd * rwd
* menu - go back to the main menu * menu - go back to the main menu
* browse - go back to the file/db browser * 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 != '|')) if ((wps_data->touchregion_count +1 >= MAX_TOUCHREGIONS) || (*ptr != '|'))

View file

@ -4,6 +4,8 @@
%wd %wd
%T|286|207|24|24|play| %T|286|207|24|24|play|
%T|0|207|84|24|menu| %T|0|207|84|24|menu|
%T|218|211|24|24|shuffle|
%T|261|207|24|24|repmode|
%X|wpsbackdrop-320x240x16.bmp| %X|wpsbackdrop-320x240x16.bmp|
%xl|A|lock-320x240x16.bmp|91|207|2| %xl|A|lock-320x240x16.bmp|91|207|2|
%xl|B|battery-320x240x16.bmp|126|207|10| %xl|B|battery-320x240x16.bmp|126|207|10|