Index: apps/gui/wps.c =================================================================== --- apps/gui/wps.c (revision 27942) +++ apps/gui/wps.c (working copy) @@ -276,6 +276,124 @@ } #endif /* HAVE_TOUCHSCREEN */ + + +void display_keylock_text(bool locked) +{ + int i; + FOR_NB_SCREENS(i) + gui_wps[i].display->stop_scroll(); + + splash(HZ, locked ? ID2P(LANG_KEYLOCK_ON) : ID2P(LANG_KEYLOCK_OFF)); +} + + + + +#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) +static void gwps_caption_backlight(struct wps_state *state) +{ + if (state && state->id3) + { +#ifdef HAVE_BACKLIGHT + if (global_settings.caption_backlight) + { + /* turn on backlight n seconds before track ends, and turn it off n + seconds into the new track. n == backlight_timeout, or 5s */ + int n = global_settings.backlight_timeout * 1000; + + if ( n < 1000 ) + n = 5000; /* use 5s if backlight is always on or off */ + + if (((state->id3->elapsed < 1000) || + ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && + (state->paused == false)) + backlight_on(); + } +#endif +#ifdef HAVE_REMOTE_LCD + if (global_settings.remote_caption_backlight) + { + /* turn on remote backlight n seconds before track ends, and turn it + off n seconds into the new track. n == remote_backlight_timeout, + or 5s */ + int n = global_settings.remote_backlight_timeout * 1000; + + if ( n < 1000 ) + n = 5000; /* use 5s if backlight is always on or off */ + + if (((state->id3->elapsed < 1000) || + ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && + (state->paused == false)) + remote_backlight_on(); + } +#endif + } +} +#endif + + +static void change_dir(int direction) +{ + if (global_settings.prevent_skip) + return; + + if (direction < 0) + audio_prev_dir(); + else if (direction > 0) + audio_next_dir(); + /* prevent the next dir to immediatly start being ffw'd */ + action_wait_for_release(); +} + +static void prev_track(unsigned long skip_thresh) +{ + if (wps_state.id3->elapsed < skip_thresh) + { + audio_prev(); + return; + } + else + { + if (wps_state.id3->cuesheet) + { + curr_cuesheet_skip(wps_state.id3->cuesheet, -1, wps_state.id3->elapsed); + return; + } + + if (!wps_state.paused) +#if (CONFIG_CODEC == SWCODEC) + audio_pre_ff_rewind(); +#else + audio_pause(); +#endif + + audio_ff_rewind(0); + +#if (CONFIG_CODEC != SWCODEC) + if (!wps_state.paused) + audio_resume(); +#endif + } +} + +static void next_track(void) +{ + /* take care of if we're playing a cuesheet */ + if (wps_state.id3->cuesheet) + { + if (curr_cuesheet_skip(wps_state.id3->cuesheet, 1, wps_state.id3->elapsed)) + { + /* if the result was false, then we really want + to skip to the next track */ + return; + } + } + + audio_next(); +} + + bool ffwd_rew(int button) { unsigned int step = 0; /* current ff/rewind step */ @@ -299,8 +417,20 @@ case ACTION_WPS_SEEKFWD: direction = 1; case ACTION_WPS_SEEKBACK: - if (wps_state.ff_rewind) + if ( wps_state.ff_rewind && step == 0 ) { + /* step == 0 implies that the FF/RW is set to skip tracks. */ + + if ( global_settings.prevent_skip ) + { + step = 1000; /* The default step for when the user + wants to skip but skipping is prevented. */ + } + /* Otherwise, do nothing. The skipping logic will be + handled when the ff/rw button is released. */ + } + else if (wps_state.ff_rewind && step != 0 ) + { if (direction == 1) { /* fast forwarding, calc max step relative to end */ @@ -392,6 +522,19 @@ FOR_NB_SCREENS(i) skin_update(&gui_wps[i], SKIN_REFRESH_ALL); #endif + + if ( step == 0 && !global_settings.prevent_skip ) + { + /* step == 0 implies that the FF/RW is set to skip tracks. */ + if (direction > 0) + next_track(); + else if (direction < 0) + prev_track(DEFAULT_SKIP_TRESH); + + wps_state.id3->elapsed = 0; + audio_ff_rewind(wps_state.id3->elapsed); + } + exit = true; break; @@ -419,121 +562,6 @@ } -void display_keylock_text(bool locked) -{ - int i; - FOR_NB_SCREENS(i) - gui_wps[i].display->stop_scroll(); - - splash(HZ, locked ? ID2P(LANG_KEYLOCK_ON) : ID2P(LANG_KEYLOCK_OFF)); -} - - - - -#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) -static void gwps_caption_backlight(struct wps_state *state) -{ - if (state && state->id3) - { -#ifdef HAVE_BACKLIGHT - if (global_settings.caption_backlight) - { - /* turn on backlight n seconds before track ends, and turn it off n - seconds into the new track. n == backlight_timeout, or 5s */ - int n = global_settings.backlight_timeout * 1000; - - if ( n < 1000 ) - n = 5000; /* use 5s if backlight is always on or off */ - - if (((state->id3->elapsed < 1000) || - ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && - (state->paused == false)) - backlight_on(); - } -#endif -#ifdef HAVE_REMOTE_LCD - if (global_settings.remote_caption_backlight) - { - /* turn on remote backlight n seconds before track ends, and turn it - off n seconds into the new track. n == remote_backlight_timeout, - or 5s */ - int n = global_settings.remote_backlight_timeout * 1000; - - if ( n < 1000 ) - n = 5000; /* use 5s if backlight is always on or off */ - - if (((state->id3->elapsed < 1000) || - ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && - (state->paused == false)) - remote_backlight_on(); - } -#endif - } -} -#endif - - -static void change_dir(int direction) -{ - if (global_settings.prevent_skip) - return; - - if (direction < 0) - audio_prev_dir(); - else if (direction > 0) - audio_next_dir(); - /* prevent the next dir to immediatly start being ffw'd */ - action_wait_for_release(); -} - -static void prev_track(unsigned long skip_thresh) -{ - if (wps_state.id3->elapsed < skip_thresh) - { - audio_prev(); - return; - } - else - { - if (wps_state.id3->cuesheet) - { - curr_cuesheet_skip(wps_state.id3->cuesheet, -1, wps_state.id3->elapsed); - return; - } - - if (!wps_state.paused) -#if (CONFIG_CODEC == SWCODEC) - audio_pre_ff_rewind(); -#else - audio_pause(); -#endif - - audio_ff_rewind(0); - -#if (CONFIG_CODEC != SWCODEC) - if (!wps_state.paused) - audio_resume(); -#endif - } -} - -static void next_track(void) -{ - /* take care of if we're playing a cuesheet */ - if (wps_state.id3->cuesheet) - { - if (curr_cuesheet_skip(wps_state.id3->cuesheet, 1, wps_state.id3->elapsed)) - { - /* if the result was false, then we really want - to skip to the next track */ - return; - } - } - - audio_next(); -} - static void play_hop(int direction) { long step = global_settings.skip_length*1000; Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (revision 27942) +++ apps/settings_list.c (working copy) @@ -927,8 +927,11 @@ OFFON_SETTING(0,party_mode,LANG_PARTY_MODE,false,"party mode",NULL), OFFON_SETTING(0,fade_on_stop,LANG_FADE_ON_STOP,true,"volume fade",NULL), TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, ff_rewind_min_step, - LANG_FFRW_STEP, 1, "scan min step", NULL, UNIT_SEC, - NULL, NULL, NULL, 14, 1,2,3,4,5,6,8,10,15,20,25,30,45,60), + LANG_FFRW_STEP, 1, "scan min step", + "track,1s,2s,3s,5s,7s,10s,15s,20s,30s,45s,1min,90s,2min,3min,5min,10min,15min", + UNIT_SEC, formatter_unit_0_is_skip_track, + getlang_unit_0_is_skip_track, NULL, + 14, 0,1,2,3,4,5,6,8,10,15,20,25,30,45,60), CHOICE_SETTING(0, ff_rewind_accel, LANG_FFRW_ACCEL, 2, "seek acceleration", "very fast,fast,normal,slow,very slow", NULL, 5, ID2P(LANG_VERY_FAST), ID2P(LANG_FAST), ID2P(LANG_NORMAL),