From 4a7e0c79498f7b19179482c8069bb1d99b61b7ca Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Mon, 14 Jul 2008 20:39:30 +0000 Subject: Rename and rework the "Study Mode" menu into the "Skip Length" setting. Update manual. Bump plugin API thanks to having changed global_settings. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18041 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 4 +- apps/gui/gwps.c | 24 ++++++------ apps/lang/english.lang | 53 +++++++++++++++++++++------ apps/menus/playback_menu.c | 15 +++----- apps/plugin.h | 4 +- apps/settings.h | 3 +- apps/settings_list.c | 25 +++++++++++-- manual/configure_rockbox/playback_options.tex | 18 +++------ 8 files changed, 91 insertions(+), 55 deletions(-) diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index b6a7c89308..0ec89b7140 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -162,9 +162,9 @@ bool update_onvol_change(struct gui_wps * gwps) void play_hop(int direction) { if(!wps_state.id3 || !wps_state.id3->length - || global_settings.study_hop_step == 0) + || global_settings.skip_length == 0) return; -#define STEP ((unsigned)global_settings.study_hop_step *1000) +#define STEP ((unsigned)global_settings.skip_length*60*1000) if(direction == 1 && wps_state.id3->length - wps_state.id3->elapsed < STEP+1000) { #if CONFIG_CODEC == SWCODEC diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index c654b3b757..1740e99f9d 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c @@ -362,11 +362,11 @@ long gui_wps_show(void) break; /* fast forward OR next dir if this is straight after ACTION_WPS_SKIPNEXT - OR in study mode, next track if straight after SKIPPREV. */ + OR if skip length set, next track if straight after SKIPPREV. */ case ACTION_WPS_SEEKFWD: if (global_settings.party_mode) break; - if (!global_settings.study_mode + if (global_settings.skip_length == 0 && current_tick -last_right < HZ) { if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) @@ -378,7 +378,7 @@ long gui_wps_show(void) audio_next_dir(); } } - else if(global_settings.study_mode + else if (global_settings.skip_length > 0 && current_tick -last_left < HZ) { next_track(); update_track = true; @@ -388,12 +388,12 @@ long gui_wps_show(void) break; /* fast rewind OR prev dir if this is straight after ACTION_WPS_SKIPPREV, - OR in study mode, beg of track or prev track if this is + OR if skip length set, beg of track or prev track if this is straight after SKIPPREV */ case ACTION_WPS_SEEKBACK: if (global_settings.party_mode) break; - if (!global_settings.study_mode + if (global_settings.skip_length == 0 && current_tick -last_left < HZ) { if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type) @@ -411,10 +411,10 @@ long gui_wps_show(void) audio_prev_dir(); } } - else if(global_settings.study_mode + else if (global_settings.skip_length > 0 && current_tick -last_right < HZ) { - prev_track(3+global_settings.study_hop_step); + prev_track(3+global_settings.skip_length*60); update_track = true; } else ffwd_rew(ACTION_WPS_SEEKBACK); @@ -446,13 +446,13 @@ long gui_wps_show(void) /* ...otherwise, do it normally */ #endif - if(global_settings.study_mode) + if (global_settings.skip_length > 0) play_hop(-1); else prev_track(3); break; /* next - OR in study mode, hop by predetermined amount. */ + OR if skip length set, hop by predetermined amount. */ case ACTION_WPS_SKIPNEXT: if (global_settings.party_mode) break; @@ -477,7 +477,7 @@ long gui_wps_show(void) /* ...otherwise, do it normally */ #endif - if(global_settings.study_mode) + if (global_settings.skip_length > 0) play_hop(1); else next_track(); break; @@ -496,7 +496,7 @@ long gui_wps_show(void) else #endif { - if(global_settings.study_mode) + if (global_settings.skip_length > 0) next_track(); else audio_next_dir(); } @@ -510,7 +510,7 @@ long gui_wps_show(void) else #endif { - if(global_settings.study_mode) + if (global_settings.skip_length > 0) prev_track(3); else audio_prev_dir(); } diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 2a91100adf..3815edb656 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -11617,44 +11617,44 @@ id: LANG_STUDY_MODE - desc: playback settings menu + desc: DEPRECATED user: - *: "Study Mode" + *: "" - *: "Study Mode" + *: "" - *: "Study Mode" + *: "" id: LANG_STUDY_HOP_STEP - desc: playback settings menu + desc: DEPRECATED user: - *: "Study Increment" + *: "" - *: "Study Increment" + *: "" - *: "Study Increment" + *: "" id: LANG_ENABLE_STUDY_MODE - desc: playback settings menu + desc: DEPRECATED user: - *: "Enable Study Mode" + *: "" - *: "Enable Study Mode" + *: "" - *: "Enable Study Mode" + *: "" @@ -11806,3 +11806,32 @@ *: "Fast" + + id: LANG_SKIP_LENGTH + desc: playback settings menu + user: + + *: "Skip Length" + + + *: "Skip Length" + + + *: "Skip Length" + + + + id: LANG_SKIP_TRACK + desc: skip length setting entry 0 + user: + + *: "Skip Track" + + + *: "Skip Track" + + + *: "Skip Track" + + + diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index 2d3f3d17b2..8d5c0eeee6 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c @@ -35,10 +35,10 @@ #include "dsp.h" #include "scrobbler.h" #include "audio.h" -#include "cuesheet.h" -#if CONFIG_CODEC == SWCODEC -#include "playback.h" -#endif +#include "cuesheet.h" +#if CONFIG_CODEC == SWCODEC +#include "playback.h" +#endif #if CONFIG_CODEC == SWCODEC @@ -176,10 +176,7 @@ MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON, &unplug_mode, &unplug_rw, &unplug_autoresume); #endif -MENUITEM_SETTING(study_mode, &global_settings.study_mode, NULL); -MENUITEM_SETTING(study_hop_step, &global_settings.study_hop_step, NULL); -MAKE_MENU(study_mode_menu, ID2P(LANG_STUDY_MODE), 0, Icon_NOICON, - &study_mode, &study_hop_step); +MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL); MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, Icon_Playback_menu, @@ -201,7 +198,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, #ifdef HAVE_HEADPHONE_DETECTION ,&unplug_menu #endif - ,&study_mode_menu + ,&skip_length ); static int playback_callback(int action,const struct menu_item_ex *this_item) diff --git a/apps/plugin.h b/apps/plugin.h index 38d96f3751..dfe746342e 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -128,12 +128,12 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 119 +#define PLUGIN_API_VERSION 120 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 117 +#define PLUGIN_MIN_API_VERSION 120 /* plugin return codes */ enum plugin_status { diff --git a/apps/settings.h b/apps/settings.h index b9a2babee7..a1e5cb119c 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -740,8 +740,7 @@ struct user_settings int keyclick_repeats; /* keyclick on repeats */ #endif unsigned char playlist_catalog_dir[MAX_FILENAME+1]; - bool study_mode; /* study mode enabled */ - int study_hop_step; /* hop step in study mode, in seconds */ + int skip_length; /* skip length */ #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING int touchpad_sensitivity; #endif diff --git a/apps/settings_list.c b/apps/settings_list.c index f7d8ca3980..48ebd9e63d 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -257,6 +257,23 @@ static int32_t getlang_unit_0_is_off(int value, int unit) return TALK_ID(value,unit); } +static void formatter_unit_0_is_skip_track(char *buffer, size_t buffer_size, + int val, const char *unit) +{ + if (val == 0) + strcpy(buffer, str(LANG_SKIP_TRACK)); + else + snprintf(buffer, buffer_size, "%d %s", val, unit); +} + +static int32_t getlang_unit_0_is_skip_track(int value, int unit) +{ + if (value == 0) + return LANG_SKIP_TRACK; + else + return TALK_ID(value, unit); +} + #ifdef HAVE_BACKLIGHT static void backlight_formatter(char *buffer, size_t buffer_size, int val, const char *unit) @@ -1234,10 +1251,10 @@ const struct settings_list settings[] = { #endif OFFON_SETTING(0,cuesheet,LANG_CUESHEET_ENABLE,false,"cuesheet support", NULL), - OFFON_SETTING(0,study_mode,LANG_ENABLE_STUDY_MODE,false,"Study mode", - NULL), - INT_SETTING(0, study_hop_step, LANG_STUDY_HOP_STEP, 5, "Study hop step", - UNIT_SEC, 0, 250, 1, NULL, NULL, NULL), + TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, skip_length, + LANG_SKIP_LENGTH, 0, "skip length", "track", + UNIT_MIN, formatter_unit_0_is_skip_track, + getlang_unit_0_is_skip_track, NULL, 8, 0,1,2,3,4,5,10,15), CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, "start in screen", "previous,root,files,db,wps,menu," #ifdef HAVE_RECORDING diff --git a/manual/configure_rockbox/playback_options.tex b/manual/configure_rockbox/playback_options.tex index 7faf237f83..7701855781 100644 --- a/manual/configure_rockbox/playback_options.tex +++ b/manual/configure_rockbox/playback_options.tex @@ -259,19 +259,13 @@ related to audio playback. When you enable this option, you'll have to reboot for it to come into effect. -\item[Study Mode]\index{Study Mode} - Designed to prevent the unintentional skipping of tracks while listening to - audio books, Study Mode changes the behavior of the \ActionWpsSkipPrev{} and - \ActionWpsSkipNext{} buttons so that they skip by a user-defined number of - seconds instead of the entire track, thus preventing you from losing your place - entirely. +\item[Skip Length]\index{Skip Length} + Designed to speed up navigation and prevent unintentional track skipping when + listening to long audio tracks, \setting{Skip Length} changes the behavior of + the \ActionWpsSkipPrev{} and \ActionWpsSkipNext{} buttons so that they skip + by a given number of minutes instead of skipping to a new track. - \begin{description} - \item[Enable Study Mode] \setting{On}/\setting{Off}. - \item[Study Increment] The number of seconds to skip forward and backward. - \end{description} - - \note{To skip tracks with this setting on, press Short + \note{To skip tracks with this setting set to a time interval, press Short \ActionWpsSkipPrev{} + Long \ActionWpsSkipNext{} to go forward and Short \ActionWpsSkipNext{} + Long \ActionWpsSkipPrev{} to go back.} -- cgit v1.2.3