From bb9aaf50654bb32184d289b18f110cf9fd6687d1 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Tue, 25 Jun 2002 13:26:04 +0000 Subject: A step towards WPS git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1184 a1c6a512-1295-4272-9138-f99709370657 --- apps/tree.c | 82 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 45 insertions(+), 37 deletions(-) (limited to 'apps/tree.c') diff --git a/apps/tree.c b/apps/tree.c index a1af9bc203..b43c1d725d 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,""); - lcd_puts(0,1,""); - 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,""); + lcd_puts(0,1,""); + 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(); } -- cgit v1.2.3