diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/tree.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/apps/tree.c b/apps/tree.c index 94dac2279c..06a59a6069 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -185,7 +185,7 @@ static int start=0; | |||
185 | static int dirpos[MAX_DIR_LEVELS]; | 185 | static int dirpos[MAX_DIR_LEVELS]; |
186 | static int cursorpos[MAX_DIR_LEVELS]; | 186 | static int cursorpos[MAX_DIR_LEVELS]; |
187 | static int dirlevel=0; | 187 | static int dirlevel=0; |
188 | static int playing = 0; | 188 | static int play_mode = 0; |
189 | static char currdir[255]; | 189 | static char currdir[255]; |
190 | 190 | ||
191 | /* QUICK HACK! this should be handled by the playlist code later */ | 191 | /* QUICK HACK! this should be handled by the playlist code later */ |
@@ -193,12 +193,7 @@ char* peek_next_track(int steps) | |||
193 | { | 193 | { |
194 | static char buf[256]; | 194 | static char buf[256]; |
195 | 195 | ||
196 | /* next-song only works when playing */ | 196 | switch(play_mode) { |
197 | if (!playing) | ||
198 | return NULL; | ||
199 | |||
200 | switch(playing) { | ||
201 | default: | ||
202 | case 1: | 197 | case 1: |
203 | /* play-full-dir mode */ | 198 | /* play-full-dir mode */ |
204 | 199 | ||
@@ -264,6 +259,7 @@ bool dirbrowse(char *root) | |||
264 | 259 | ||
265 | switch(button) { | 260 | switch(button) { |
266 | case TREE_EXIT: | 261 | case TREE_EXIT: |
262 | play_mode = 0; | ||
267 | i=strlen(currdir); | 263 | i=strlen(currdir); |
268 | if (i>1) { | 264 | if (i>1) { |
269 | while (currdir[i-1]!='/') | 265 | while (currdir[i-1]!='/') |
@@ -285,7 +281,6 @@ bool dirbrowse(char *root) | |||
285 | } | 281 | } |
286 | else | 282 | else |
287 | mpeg_stop(); | 283 | mpeg_stop(); |
288 | |||
289 | break; | 284 | break; |
290 | 285 | ||
291 | case TREE_ENTER: | 286 | case TREE_ENTER: |
@@ -303,6 +298,8 @@ bool dirbrowse(char *root) | |||
303 | } | 298 | } |
304 | 299 | ||
305 | if (!dircacheptr[dircursor+start]->file) { | 300 | if (!dircacheptr[dircursor+start]->file) { |
301 | if ( play_mode == 1 ) | ||
302 | play_mode = 0; | ||
306 | memcpy(currdir,buf,sizeof(currdir)); | 303 | memcpy(currdir,buf,sizeof(currdir)); |
307 | if ( dirlevel < MAX_DIR_LEVELS ) { | 304 | if ( dirlevel < MAX_DIR_LEVELS ) { |
308 | dirpos[dirlevel] = start; | 305 | dirpos[dirlevel] = start; |
@@ -318,16 +315,15 @@ bool dirbrowse(char *root) | |||
318 | !strcasecmp(&dircacheptr[dircursor+start]->name[len-4], | 315 | !strcasecmp(&dircacheptr[dircursor+start]->name[len-4], |
319 | ".m3u")) | 316 | ".m3u")) |
320 | { | 317 | { |
321 | playing = 2; | 318 | play_mode = 2; |
322 | play_list(currdir, dircacheptr[dircursor+start]->name); | 319 | play_list(currdir, dircacheptr[dircursor+start]->name); |
323 | } | 320 | } |
324 | 321 | ||
325 | else { | 322 | else { |
326 | playing = 1; | 323 | play_mode = 1; |
327 | mpeg_play(buf); | 324 | mpeg_play(buf); |
328 | lcd_stop_scroll(); | 325 | lcd_stop_scroll(); |
329 | wps_show(); | 326 | wps_show(); |
330 | playing = 0; | ||
331 | } | 327 | } |
332 | } | 328 | } |
333 | restore = true; | 329 | restore = true; |
@@ -371,9 +367,11 @@ bool dirbrowse(char *root) | |||
371 | break; | 367 | break; |
372 | 368 | ||
373 | case BUTTON_ON: | 369 | case BUTTON_ON: |
374 | lcd_stop_scroll(); | 370 | if ( play_mode ) { |
375 | wps_show(); | 371 | lcd_stop_scroll(); |
376 | restore = true; | 372 | wps_show(); |
373 | restore = true; | ||
374 | } | ||
377 | break; | 375 | break; |
378 | 376 | ||
379 | } | 377 | } |