From cc0bf335ef5adcee7de35d809c7a2da7fdcf6778 Mon Sep 17 00:00:00 2001 From: jdgordon Date: Mon, 10 Aug 2009 03:48:27 +0000 Subject: [PATCH] r22135 overwrote mcuelenaere's changes in r22068 to add slider-type regions for the touchscreen... so bring them back (spotted by kkurbjun) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22234 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/wps.c | 48 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 29c940323..30c4aa85b 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -599,15 +599,53 @@ int wps_get_touchaction(struct wps_data *data) if (vx >= r->x && vx < r->x+r->width && vy >= r->y && vy < r->y+r->height) { - if ((repeated && r->repeat) || - (released && !r->repeat)) + /* reposition the touch within the area */ + vx -= r->x; + vy -= r->y; + + switch(r->type) { - last_action = r->action; - return r->action; - } + case WPS_TOUCHREGION_ACTION: + if ((repeated && r->repeat) || (released && !r->repeat)) + { + last_action = r->action; + return r->action; + } + break; + case WPS_TOUCHREGION_SCROLLBAR: + if(r->width > r->height) + /* landscape */ + wps_state.id3->elapsed = (vx * + wps_state.id3->length) / r->width; + else + /* portrait */ + wps_state.id3->elapsed = (vy * + wps_state.id3->length) / r->height; + + audio_ff_rewind(wps_state.id3->elapsed); + break; + case WPS_TOUCHREGION_VOLUME: + { + const int min_vol = sound_min(SOUND_VOLUME); + const int max_vol = sound_max(SOUND_VOLUME); + if(r->width > r->height) + /* landscape */ + global_settings.volume = (vx * + (max_vol - min_vol)) / r->width; + else + /* portrait */ + global_settings.volume = (vy * + (max_vol-min_vol)) / r->height; + + global_settings.volume += min_vol; + setvol(); + break; + } + } } } } + if ((last_action == ACTION_WPS_SEEKBACK || last_action == ACTION_WPS_SEEKFWD)) return ACTION_WPS_STOPSEEK; last_action = ACTION_TOUCHSCREEN; -- 2.11.4.GIT