Index: apps/action.h =================================================================== --- apps/action.h (revision 14675) +++ apps/action.h (working copy) @@ -111,6 +111,9 @@ ACTION_WPS_ID3SCREEN,/* optional */ ACTION_WPS_CONTEXT, ACTION_WPS_QUICKSCREEN,/* optional */ +#ifdef ACCEPT_DOUBLE_CLICK + ACTION_WPS_SCRUBSEEK,/* optional */ +#endif ACTION_WPS_MENU, /*this should be the same as ACTION_STD_MENU */ ACTION_WPS_REC, #if 0 Index: apps/gui/gwps-common.c =================================================================== --- apps/gui/gwps-common.c (revision 14675) +++ apps/gui/gwps-common.c (working copy) @@ -142,6 +142,147 @@ return false; } +bool scrub_ffwd_rew(int button) +{ + static const uint16_t ff_rew_steps[] = { + 1000, 2000, 3000, 4000, + 5000, 6000, 8000, 10000, + 15000, 20000, 25000, 30000, + 45000, 60000 + }; + + unsigned int step = 0; /* current ff/rewind step */ + unsigned int max_step = 0; /* maximum ff/rewind step */ + int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */ + int direction = -1; /* forward=1 or backward=-1 */ + long accel_tick = 0; /* next time at which to bump the step size */ + bool exit = false; + bool usb = false; + int i = 0; + + if (button == ACTION_WPS_BROWSE) /* exit - should never happen */ + { + status_set_ffmode(0); + return usb; + } + while (!exit) /* main loop - read button, take action*/ + { + switch ( button ) + { + case ACTION_WPS_VOLUP: + direction = 1; + case ACTION_WPS_VOLDOWN: + if (wps_state.ff_rewind) /* enabled further down */ + { + if (direction == 1) + { + /* fast forwarding, calc max step relative to end */ + max_step = (wps_state.id3->length - + (wps_state.id3->elapsed + + ff_rewind_count)) * + FF_REWIND_MAX_PERCENT / 100; + status_set_ffmode(STATUS_FASTFORWARD); + } + else + { + /* rewinding, calc max step relative to start */ + max_step = (wps_state.id3->elapsed + ff_rewind_count) * + FF_REWIND_MAX_PERCENT / 100; + status_set_ffmode(STATUS_FASTBACKWARD); + } + + max_step = MAX(max_step, MIN_FF_REWIND_STEP); + + if (step > max_step) + step = max_step; + + ff_rewind_count += step * direction; + + if (global_settings.ff_rewind_accel != 0 && + current_tick >= accel_tick) + { + step *= 2; + accel_tick = current_tick + + global_settings.ff_rewind_accel*HZ; + } + } + else + { + if ( (audio_status() & AUDIO_STATUS_PLAY) && + wps_state.id3 && wps_state.id3->length ) + { +#if CONFIG_KEYPAD == PLAYER_PAD + FOR_NB_SCREENS(i) + gui_wps[i].display->stop_scroll(); +#endif + wps_state.ff_rewind = true; + + step = ff_rew_steps[global_settings.ff_rewind_min_step]; + + accel_tick = current_tick + + global_settings.ff_rewind_accel*HZ; + } + else + break; + } + + if (direction > 0) { + if ((wps_state.id3->elapsed + ff_rewind_count) > + wps_state.id3->length) + ff_rewind_count = wps_state.id3->length - + wps_state.id3->elapsed; + } + else { + if ((int)(wps_state.id3->elapsed + ff_rewind_count) < 0) + ff_rewind_count = -wps_state.id3->elapsed; + } + + FOR_NB_SCREENS(i) + gui_wps_refresh(&gui_wps[i], + (wps_state.wps_time_countup == false)? + ff_rewind_count:-ff_rewind_count, + WPS_REFRESH_PLAYER_PROGRESS | + WPS_REFRESH_DYNAMIC); + direction = -1; + break; + + case ACTION_WPS_BROWSE: /* Exit on Select */ + case ACTION_WPS_PLAY: /* Exit on Play */ + wps_state.id3->elapsed = wps_state.id3->elapsed+ff_rewind_count; + audio_ff_rewind(wps_state.id3->elapsed); + wps_state.paused=false; + ff_rewind_count = 0; + wps_state.ff_rewind = false; + status_set_ffmode(0); + audio_resume(); +#ifdef HAVE_LCD_CHARCELLS + gui_wps_display(); +#endif + exit = true; + break; + + default: /* loop unless USB is connected */ + if(default_event_handler(button) == SYS_USB_CONNECTED) { + status_set_ffmode(0); + usb = true; + exit = true; + } + direction = -1; + + if (!wps_state.paused) + audio_pause(); + status_set_ffmode(0); + wps_state.paused=true; /* display paused when not ff or rew */ + FOR_NB_SCREENS(i) + gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_DYNAMIC); + break; + } + if (!exit) + button = get_action(CONTEXT_WPS|ALLOW_SOFTLOCK,TIMEOUT_BLOCK); + } + return usb; +} + bool ffwd_rew(int button) { static const uint16_t ff_rew_steps[] = { Index: apps/gui/gwps-common.h =================================================================== --- apps/gui/gwps-common.h (revision 14675) +++ apps/gui/gwps-common.h (working copy) @@ -27,6 +27,7 @@ bool gui_wps_display(void); bool update_onvol_change(struct gui_wps * gwps); bool update(struct gui_wps *gwps); +bool scrub_ffwd_rew(int button); bool ffwd_rew(int button); void display_keylock_text(bool locked); Index: apps/gui/gwps.c =================================================================== --- apps/gui/gwps.c (revision 14675) +++ apps/gui/gwps.c (working copy) @@ -502,7 +502,15 @@ return GO_TO_ROOT; break; +#ifdef ACCEPT_DOUBLE_CLICK + case ACTION_WPS_SCRUBSEEK: + if (global_settings.party_mode) + break; + scrub_ffwd_rew(ACTION_NONE); /* go into scrub mode, but don't seek unless vol up or down */ + break; +#endif + #ifdef HAVE_QUICKSCREEN case ACTION_WPS_QUICKSCREEN: #if LCD_DEPTH > 1 Index: apps/keymaps/keymap-ipod.c =================================================================== --- apps/keymaps/keymap-ipod.c (revision 14675) +++ apps/keymaps/keymap-ipod.c (working copy) @@ -75,6 +75,9 @@ }; static const struct button_mapping button_context_wps[] = { +#ifdef ACCEPT_DOUBLE_CLICK + { ACTION_WPS_SCRUBSEEK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT|BUTTON_DBL }, +#endif { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, Index: firmware/export/config-ipodnano.h =================================================================== --- firmware/export/config-ipodnano.h (revision 14675) +++ firmware/export/config-ipodnano.h (working copy) @@ -147,4 +147,7 @@ #define ICODE_ATTR_TREMOR_NOT_MDCT +/* define this to turn on double click captures */ +#define ACCEPT_DOUBLE_CLICK + #endif