summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-05-31 12:11:22 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-05-31 12:11:22 +0000
commit1d3226563e0c9a909bfaf02897b815beb2128a91 (patch)
tree8646b0b9e24a2fb24032e566e653b219bbf194dd
parent39526925710c6bb2b8abb3130c95b895ea3b6ee8 (diff)
downloadrockbox-1d3226563e0c9a909bfaf02897b815beb2128a91.tar.gz
rockbox-1d3226563e0c9a909bfaf02897b815beb2128a91.zip
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.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 401d5de2af..a71a60e9cb 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -126,6 +126,7 @@ static int showdir(char *path, int start)
126 lastdir[sizeof(lastdir)-1] = 0; 126 lastdir[sizeof(lastdir)-1] = 0;
127 qsort(dircacheptr,filesindir,sizeof(struct entry*),compare); 127 qsort(dircacheptr,filesindir,sizeof(struct entry*),compare);
128 } 128 }
129
129#ifdef HAVE_NEW_CHARCELL_LCD 130#ifdef HAVE_NEW_CHARCELL_LCD
130 lcd_double_height(false); 131 lcd_double_height(false);
131#endif 132#endif
@@ -165,18 +166,48 @@ static int showdir(char *path, int start)
165 return filesindir; 166 return filesindir;
166} 167}
167 168
169static int numentries=0;
170static int dircursor=0;
171static int start=0;
172static int dirpos[MAX_DIR_LEVELS];
173static int cursorpos[MAX_DIR_LEVELS];
174static int dirlevel=0;
175static bool playing = false;
176static char currdir[255];
177
178/* QUICK HACK! this should be handled by the playlist code later */
179char* peek_next_track(int type)
180{
181 static char buf[256];
182
183 /* next-song only works when not browsing */
184 if (!playing)
185 return NULL;
186
187 /* get next track in dir */
188 while (dircursor + start + 1 < numentries ) {
189 if(dircursor+1 < TREE_MAX_ON_SCREEN)
190 dircursor++;
191 else
192 start++;
193 if ( dircacheptr[dircursor+start]->file &&
194 dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') {
195 snprintf(buf,sizeof buf,"%s/%s",
196 currdir, dircacheptr[dircursor+start]->name );
197 lcd_clear_display();
198 lcd_puts(0,0,"<Playing>");
199 lcd_puts(0,1,"<all files>");
200 return buf;
201 }
202 }
203
204 return NULL;
205}
206
168bool dirbrowse(char *root) 207bool dirbrowse(char *root)
169{ 208{
170 int numentries;
171 char buf[255]; 209 char buf[255];
172 char currdir[255];
173 int dircursor=0;
174 int i; 210 int i;
175 int start=0;
176 int dirpos[MAX_DIR_LEVELS];
177 int cursorpos[MAX_DIR_LEVELS];
178 int dirlevel=0;
179
180 lcd_clear_display(); 211 lcd_clear_display();
181 212
182#ifdef HAVE_LCD_BITMAP 213#ifdef HAVE_LCD_BITMAP
@@ -255,7 +286,9 @@ bool dirbrowse(char *root)
255 dircursor=0; 286 dircursor=0;
256 start=0; 287 start=0;
257 } else { 288 } else {
289 playing = true;
258 playtune(currdir, dircacheptr[dircursor+start]->name); 290 playtune(currdir, dircacheptr[dircursor+start]->name);
291 playing = false;
259#ifdef HAVE_LCD_BITMAP 292#ifdef HAVE_LCD_BITMAP
260 lcd_setmargins(0, MARGIN_Y); 293 lcd_setmargins(0, MARGIN_Y);
261 lcd_setfont(0); 294 lcd_setfont(0);