summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-06-25 13:26:04 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-06-25 13:26:04 +0000
commitbb9aaf50654bb32184d289b18f110cf9fd6687d1 (patch)
tree188943fa5d709086a89de94f1b3f98ed12979bea /apps/tree.c
parent3f9c7c2ab5edef46346fed58807307ea4499b39c (diff)
downloadrockbox-bb9aaf50654bb32184d289b18f110cf9fd6687d1.zip
rockbox-bb9aaf50654bb32184d289b18f110cf9fd6687d1.tar.gz
rockbox-bb9aaf50654bb32184d289b18f110cf9fd6687d1.tar.bz2
rockbox-bb9aaf50654bb32184d289b18f110cf9fd6687d1.tar.xz
A step towards WPS
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1184 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c82
1 files changed, 45 insertions, 37 deletions
diff --git a/apps/tree.c b/apps/tree.c
index a1af9bc..b43c1d7 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -34,6 +34,7 @@
#include "mpeg.h"
#include "playlist.h"
#include "menu.h"
+#include "wps.h"
#ifdef HAVE_LCD_BITMAP
#include "icons.h"
@@ -198,31 +199,31 @@ char* peek_next_track(int type)
return NULL;
switch(playing) {
- default:
- case 1:
- /* play-full-dir mode */
+ default:
+ case 1:
+ /* play-full-dir mode */
- /* get next track in dir */
- while (dircursor + start + 1 < numentries ) {
- if(dircursor+1 < TREE_MAX_ON_SCREEN)
- dircursor++;
- else
- start++;
- if ( dircacheptr[dircursor+start]->file &&
- dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') {
- snprintf(buf,sizeof buf,"%s/%s",
- currdir, dircacheptr[dircursor+start]->name );
- lcd_clear_display();
- lcd_puts(0,0,"<Playing>");
- lcd_puts(0,1,"<all files>");
- return buf;
- }
- }
- break;
+ /* get next track in dir */
+ while (dircursor + start + 1 < numentries ) {
+ if(dircursor+1 < TREE_MAX_ON_SCREEN)
+ dircursor++;
+ else
+ start++;
+ if ( dircacheptr[dircursor+start]->file &&
+ dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') {
+ snprintf(buf,sizeof buf,"%s/%s",
+ currdir, dircacheptr[dircursor+start]->name );
+ lcd_clear_display();
+ lcd_puts(0,0,"<Playing>");
+ lcd_puts(0,1,"<all files>");
+ return buf;
+ }
+ }
+ break;
- case 2:
- /* playlist mode */
- return playlist_next(type);
+ case 2:
+ /* playlist mode */
+ return playlist_next(type);
}
return NULL;
@@ -246,6 +247,7 @@ bool dirbrowse(char *root)
lcd_update();
while(1) {
+ bool restore = false;
button = button_get(true);
switch(button) {
@@ -267,8 +269,7 @@ bool dirbrowse(char *root)
}
else
start = dircursor = 0;
- numentries = showdir(currdir, start);
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ restore = true;
}
else
mpeg_stop();
@@ -316,8 +317,7 @@ bool dirbrowse(char *root)
playing = 0;
}
}
- numentries = showdir(currdir, start);
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ restore = true;
break;
case TREE_PREV:
@@ -354,20 +354,28 @@ bool dirbrowse(char *root)
case TREE_MENU:
lcd_stop_scroll();
main_menu();
+ restore = true;
+ break;
- /* restore display */
- /* TODO: this is just a copy from BUTTON_STOP, fix it */
- lcd_clear_display();
- numentries = showdir(currdir, start);
- put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
-
+ case BUTTON_ON:
+ wps_show();
+ restore = true;
break;
+
}
- lcd_stop_scroll();
- if ( numentries )
- lcd_puts_scroll(LINE_X, LINE_Y+dircursor,
- dircacheptr[start+dircursor]->name);
+ if ( restore ) {
+ /* restore display */
+ /* TODO: this is just a copy from BUTTON_STOP, fix it */
+ numentries = showdir(currdir, start);
+ put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
+ }
+ else {
+ lcd_stop_scroll();
+ if ( numentries )
+ lcd_puts_scroll(LINE_X, LINE_Y+dircursor,
+ dircacheptr[start+dircursor]->name);
+ }
lcd_update();
}