summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-06-26 23:25:03 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-06-26 23:25:03 +0000
commita72f95c2ba57c5f4764f20044d6ac1ca4be79e4e (patch)
tree0d7431f044538633c97512a5e4133d9796aac561 /apps/tree.c
parent72315c29fa12d14513a06d961a79570f2a37f26a (diff)
downloadrockbox-a72f95c2ba57c5f4764f20044d6ac1ca4be79e4e.tar.gz
rockbox-a72f95c2ba57c5f4764f20044d6ac1ca4be79e4e.zip
Added next/previous track
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1211 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/apps/tree.c b/apps/tree.c
index a071ce73d6..4b16bac68b 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -190,7 +190,7 @@ static int playing = 0;
190static char currdir[255]; 190static char currdir[255];
191 191
192/* QUICK HACK! this should be handled by the playlist code later */ 192/* QUICK HACK! this should be handled by the playlist code later */
193char* peek_next_track(int type) 193char* peek_next_track(int steps)
194{ 194{
195 static char buf[256]; 195 static char buf[256];
196 196
@@ -204,26 +204,39 @@ char* peek_next_track(int type)
204 /* play-full-dir mode */ 204 /* play-full-dir mode */
205 205
206 /* get next track in dir */ 206 /* get next track in dir */
207 while (dircursor + start + 1 < numentries ) { 207 if ( steps == 1 ) {
208 if(dircursor+1 < TREE_MAX_ON_SCREEN) 208 while (dircursor + start + 1 < numentries ) {
209 dircursor++; 209 if(dircursor+1 < TREE_MAX_ON_SCREEN)
210 else 210 dircursor++;
211 start++; 211 else
212 if ( dircacheptr[dircursor+start]->file && 212 start++;
213 dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') { 213 if ( dircacheptr[dircursor+start]->file &&
214 snprintf(buf,sizeof buf,"%s/%s", 214 dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') {
215 currdir, dircacheptr[dircursor+start]->name ); 215 snprintf(buf,sizeof buf,"%s/%s",
216 lcd_clear_display(); 216 currdir, dircacheptr[dircursor+start]->name );
217 lcd_puts(0,0,"<Playing>"); 217 return buf;
218 lcd_puts(0,1,"<all files>"); 218 }
219 return buf; 219 }
220 }
221 else {
222 while (dircursor + start > 0) {
223 if (dircursor > 0)
224 dircursor--;
225 else
226 start--;
227 if ( dircacheptr[dircursor+start]->file &&
228 dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') {
229 snprintf(buf, sizeof(buf), "%s/%s",
230 currdir, dircacheptr[dircursor+start]->name);
231 return buf;
232 }
220 } 233 }
221 } 234 }
222 break; 235 break;
223 236
224 case 2: 237 case 2:
225 /* playlist mode */ 238 /* playlist mode */
226 return playlist_next(type); 239 return playlist_next(steps);
227 } 240 }
228 241
229 return NULL; 242 return NULL;
@@ -313,8 +326,9 @@ bool dirbrowse(char *root)
313 else { 326 else {
314 327
315 playing = 1; 328 playing = 1;
316 playtune(buf); 329 mpeg_play(buf);
317 playing = 0; 330 lcd_stop_scroll();
331 wps_show();
318 } 332 }
319 } 333 }
320 restore = true; 334 restore = true;
@@ -367,7 +381,6 @@ bool dirbrowse(char *root)
367 381
368 if ( restore ) { 382 if ( restore ) {
369 /* restore display */ 383 /* restore display */
370 /* TODO: this is just a copy from BUTTON_STOP, fix it */
371 numentries = showdir(currdir, start); 384 numentries = showdir(currdir, start);
372 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); 385 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
373 } 386 }