From ed98f885e4f69db1b0ee33c26fcf5d9f5678aab5 Mon Sep 17 00:00:00 2001 From: jdgordon Date: Tue, 22 Mar 2011 09:31:45 +0000 Subject: [PATCH] Add some playback controls to the SBS. 2 new touch regions wps_next/wps_prev needed to make it work. 'next' in the sbs changes list selection, 'wps_next' in sbs changes audio tracks. no difference in the wps git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29631 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_parser.c | 1 + apps/gui/skin_engine/skin_touchsupport.c | 53 +++++++++++++++++++++++++++++++- apps/gui/wps.c | 47 ++++++++++++++++------------ apps/gui/wps.h | 1 + manual/appendix/wps_tags.tex | 6 ++-- 5 files changed, 85 insertions(+), 23 deletions(-) diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index c09bed6e4f..236c6feea1 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -965,6 +965,7 @@ static const struct touchaction touchactions[] = { {"setting_set", ACTION_SETTINGS_SET}, /* WPS specific actions */ + {"wps_prev", ACTION_WPS_SKIPPREV }, {"wps_next", ACTION_WPS_SKIPNEXT }, {"browse", ACTION_WPS_BROWSE }, {"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP }, {"shuffle", ACTION_TOUCH_SHUFFLE }, {"repmode", ACTION_TOUCH_REPMODE }, diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c index 110e97f997..c16d223af3 100644 --- a/apps/gui/skin_engine/skin_touchsupport.c +++ b/apps/gui/skin_engine/skin_touchsupport.c @@ -28,7 +28,10 @@ #include "option_select.h" #include "sound.h" #include "settings_list.h" - +#include "wps.h" +#include "lang.h" +#include "splash.h" +#include "playlist.h" /** Disarms all touchregions. */ void skin_disarm_touchregions(struct wps_data *data) @@ -125,8 +128,56 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset, if (returncode != ACTION_NONE) { + if (global_settings.party_mode) + { + switch (returncode) + { + case ACTION_WPS_PLAY: + case ACTION_WPS_SKIPPREV: + case ACTION_WPS_SKIPNEXT: + case ACTION_WPS_STOP: + returncode = ACTION_NONE; + break; + default: + break; + } + } switch (returncode) { + case ACTION_WPS_PLAY: + if (!audio_status()) + { + if ( global_status.resume_index != -1 ) + { + if (playlist_resume() != -1) + { + playlist_start(global_status.resume_index, + global_status.resume_offset); + } + } + else + { + splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME)); + } + } + else + { + wps_do_playpause(false); + } + returncode = ACTION_REDRAW; + break; + case ACTION_WPS_SKIPPREV: + audio_prev(); + returncode = ACTION_REDRAW; + break; + case ACTION_WPS_SKIPNEXT: + audio_next(); + returncode = ACTION_REDRAW; + break; + case ACTION_WPS_STOP: + audio_stop(); + returncode = ACTION_REDRAW; + break; case ACTION_SETTINGS_INC: case ACTION_SETTINGS_DEC: { diff --git a/apps/gui/wps.c b/apps/gui/wps.c index a522a08101..473f0a4d75 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -657,6 +657,32 @@ static void gwps_enter_wps(void) send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); } +void wps_do_playpause(bool updatewps) +{ + struct wps_state *state = skin_get_global_state(); + if ( state->paused ) + { + state->paused = false; + if ( global_settings.fade_on_stop ) + fade(true, updatewps); + else + audio_resume(); + } + else + { + state->paused = true; + if ( global_settings.fade_on_stop ) + fade(false, updatewps); + else + audio_pause(); + settings_save(); +#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) + call_storage_idle_notifys(true); /* make sure resume info is saved */ +#endif + } +} + + /* The WPS can be left in two ways: * a) call a function, which draws over the wps. In this case, the wps * will be still active (i.e. the below function didn't return) @@ -783,26 +809,7 @@ long gui_wps_show(void) case ACTION_WPS_PLAY: if (global_settings.party_mode) break; - if ( state->paused ) - { - state->paused = false; - if ( global_settings.fade_on_stop ) - fade(true, true); - else - audio_resume(); - } - else - { - state->paused = true; - if ( global_settings.fade_on_stop ) - fade(false, true); - else - audio_pause(); - settings_save(); -#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) - call_storage_idle_notifys(true); /* make sure resume info is saved */ -#endif - } + wps_do_playpause(true); break; case ACTION_WPS_VOLUP: diff --git a/apps/gui/wps.h b/apps/gui/wps.h index 50fb891a14..7438f1ac7b 100644 --- a/apps/gui/wps.h +++ b/apps/gui/wps.h @@ -35,6 +35,7 @@ void fade(bool fade_in, bool updatewps); bool ffwd_rew(int button); void display_keylock_text(bool locked); +void wps_do_playpause(bool updatewps); #ifdef IPOD_ACCESSORY_PROTOCOL /* whether the wps is fading the volume due to pausing/stopping */ diff --git a/manual/appendix/wps_tags.tex b/manual/appendix/wps_tags.tex index c4e96a29e3..46bf4a3967 100644 --- a/manual/appendix/wps_tags.tex +++ b/manual/appendix/wps_tags.tex @@ -607,8 +607,10 @@ display cycling round the defined sublines. See \begin{description} \item[play] -- Play/pause playback. \item[stop] -- Stop playback and exit the WPS. - \item[prev] -- Previous track. - \item[next] -- Next track. + \item[prev] -- Previous track/item. + \item[next] -- Next track/item. + \item[wps_prev] -- Previous track. + \item[wps_next] -- Next track. \item[ffwd] -- Seek forwards in the track. \item[rwd] -- Seek backwards in the track. \item[menu] -- Go to the main menu. -- 2.11.4.GIT