summaryrefslogtreecommitdiff
path: root/apps/gui/music_screen.c
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-07-27 13:27:38 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-07-27 13:27:38 +0000
commit95c25d6d274e932d01fe6b610f95744ea0882ede (patch)
treeec173c220033319dee69791650e01ff8fe4bb87c /apps/gui/music_screen.c
parentc08a2c7c53fcfc652bf2463986a447120f946b53 (diff)
downloadrockbox-95c25d6d274e932d01fe6b610f95744ea0882ede.tar.gz
rockbox-95c25d6d274e932d01fe6b610f95744ea0882ede.zip
Touchscreen targets: add basic progress bar & volume handling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22068 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/music_screen.c')
-rw-r--r--apps/gui/music_screen.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/apps/gui/music_screen.c b/apps/gui/music_screen.c
index 39d5e0e85b..d5eccd5868 100644
--- a/apps/gui/music_screen.c
+++ b/apps/gui/music_screen.c
@@ -553,12 +553,49 @@ int wps_get_touchaction(struct wps_data *data)
553 if (vx >= r->x && vx < r->x+r->width && 553 if (vx >= r->x && vx < r->x+r->width &&
554 vy >= r->y && vy < r->y+r->height) 554 vy >= r->y && vy < r->y+r->height)
555 { 555 {
556 if ((repeated && r->repeat) || 556 /* reposition the touch within the area */
557 (released && !r->repeat)) 557 vx -= r->x;
558 vy -= r->y;
559
560 switch(r->type)
558 { 561 {
559 last_action = r->action; 562 case WPS_TOUCHREGION_ACTION:
560 return r->action; 563 if ((repeated && r->repeat) || (released && !r->repeat))
561 } 564 {
565 last_action = r->action;
566 return r->action;
567 }
568 break;
569 case WPS_TOUCHREGION_SCROLLBAR:
570 if(r->width > r->height)
571 /* landscape */
572 wps_state.id3->elapsed = (vx *
573 wps_state.id3->length) / r->width;
574 else
575 /* portrait */
576 wps_state.id3->elapsed = (vy *
577 wps_state.id3->length) / r->height;
578
579 audio_ff_rewind(wps_state.id3->elapsed);
580 break;
581 case WPS_TOUCHREGION_VOLUME:
582 {
583 const int min_vol = sound_min(SOUND_VOLUME);
584 const int max_vol = sound_max(SOUND_VOLUME);
585 if(r->width > r->height)
586 /* landscape */
587 global_settings.volume = (vx *
588 (max_vol - min_vol)) / r->width;
589 else
590 /* portrait */
591 global_settings.volume = (vy *
592 (max_vol-min_vol)) / r->height;
593
594 global_settings.volume += min_vol;
595 setvol();
596 break;
597 }
598 }
562 } 599 }
563 } 600 }
564 } 601 }