diff options
| author | Björn Stenberg <bjorn@haxx.se> | 2002-05-31 12:11:22 +0000 |
|---|---|---|
| committer | Björn Stenberg <bjorn@haxx.se> | 2002-05-31 12:11:22 +0000 |
| commit | 1d3226563e0c9a909bfaf02897b815beb2128a91 (patch) | |
| tree | 8646b0b9e24a2fb24032e566e653b219bbf194dd | |
| parent | 39526925710c6bb2b8abb3130c95b895ea3b6ee8 (diff) | |
| download | rockbox-1d3226563e0c9a909bfaf02897b815beb2128a91.zip rockbox-1d3226563e0c9a909bfaf02897b815beb2128a91.tar.gz rockbox-1d3226563e0c9a909bfaf02897b815beb2128a91.tar.bz2 rockbox-1d3226563e0c9a909bfaf02897b815beb2128a91.tar.xz | |
Added peek_next_track() for playing all files in a dir
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@854 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/tree.c | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/apps/tree.c b/apps/tree.c index 401d5de..a71a60e 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -126,6 +126,7 @@ static int showdir(char *path, int start) lastdir[sizeof(lastdir)-1] = 0; qsort(dircacheptr,filesindir,sizeof(struct entry*),compare); } + #ifdef HAVE_NEW_CHARCELL_LCD lcd_double_height(false); #endif @@ -165,18 +166,48 @@ static int showdir(char *path, int start) return filesindir; } +static int numentries=0; +static int dircursor=0; +static int start=0; +static int dirpos[MAX_DIR_LEVELS]; +static int cursorpos[MAX_DIR_LEVELS]; +static int dirlevel=0; +static bool playing = false; +static char currdir[255]; + +/* QUICK HACK! this should be handled by the playlist code later */ +char* peek_next_track(int type) +{ + static char buf[256]; + + /* next-song only works when not browsing */ + if (!playing) + return NULL; + + /* 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; + } + } + + return NULL; +} + bool dirbrowse(char *root) { - int numentries; char buf[255]; - char currdir[255]; - int dircursor=0; int i; - int start=0; - int dirpos[MAX_DIR_LEVELS]; - int cursorpos[MAX_DIR_LEVELS]; - int dirlevel=0; - lcd_clear_display(); #ifdef HAVE_LCD_BITMAP @@ -255,7 +286,9 @@ bool dirbrowse(char *root) dircursor=0; start=0; } else { + playing = true; playtune(currdir, dircacheptr[dircursor+start]->name); + playing = false; #ifdef HAVE_LCD_BITMAP lcd_setmargins(0, MARGIN_Y); lcd_setfont(0); |