diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2009-08-10 03:48:27 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2009-08-10 03:48:27 +0000 |
commit | 1c0aeb18ca264e1f64e31f219189afab442676eb (patch) | |
tree | d426174b2e10a6665fe1f4fcb1d546b2c297a597 | |
parent | e1a83b9e99b19da665a3e93b279f02f52c0f8b98 (diff) | |
download | rockbox-1c0aeb18ca264e1f64e31f219189afab442676eb.tar.gz rockbox-1c0aeb18ca264e1f64e31f219189afab442676eb.zip |
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
-rw-r--r-- | apps/gui/wps.c | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 29c9403235..30c4aa85bb 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; |