summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c82
1 files changed, 45 insertions, 37 deletions
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 @@
34#include "mpeg.h" 34#include "mpeg.h"
35#include "playlist.h" 35#include "playlist.h"
36#include "menu.h" 36#include "menu.h"
37#include "wps.h"
37 38
38#ifdef HAVE_LCD_BITMAP 39#ifdef HAVE_LCD_BITMAP
39#include "icons.h" 40#include "icons.h"
@@ -198,31 +199,31 @@ char* peek_next_track(int type)
198 return NULL; 199 return NULL;
199 200
200 switch(playing) { 201 switch(playing) {
201 default: 202 default:
202 case 1: 203 case 1:
203 /* play-full-dir mode */ 204 /* play-full-dir mode */
204 205
205 /* get next track in dir */ 206 /* get next track in dir */
206 while (dircursor + start + 1 < numentries ) { 207 while (dircursor + start + 1 < numentries ) {
207 if(dircursor+1 < TREE_MAX_ON_SCREEN) 208 if(dircursor+1 < TREE_MAX_ON_SCREEN)
208 dircursor++; 209 dircursor++;
209 else 210 else
210 start++; 211 start++;
211 if ( dircacheptr[dircursor+start]->file && 212 if ( dircacheptr[dircursor+start]->file &&
212 dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') { 213 dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') {
213 snprintf(buf,sizeof buf,"%s/%s", 214 snprintf(buf,sizeof buf,"%s/%s",
214 currdir, dircacheptr[dircursor+start]->name ); 215 currdir, dircacheptr[dircursor+start]->name );
215 lcd_clear_display(); 216 lcd_clear_display();
216 lcd_puts(0,0,"<Playing>"); 217 lcd_puts(0,0,"<Playing>");
217 lcd_puts(0,1,"<all files>"); 218 lcd_puts(0,1,"<all files>");
218 return buf; 219 return buf;
219 } 220 }
220 } 221 }
221 break; 222 break;
222 223
223 case 2: 224 case 2:
224 /* playlist mode */ 225 /* playlist mode */
225 return playlist_next(type); 226 return playlist_next(type);
226 } 227 }
227 228
228 return NULL; 229 return NULL;
@@ -246,6 +247,7 @@ bool dirbrowse(char *root)
246 lcd_update(); 247 lcd_update();
247 248
248 while(1) { 249 while(1) {
250 bool restore = false;
249 button = button_get(true); 251 button = button_get(true);
250 252
251 switch(button) { 253 switch(button) {
@@ -267,8 +269,7 @@ bool dirbrowse(char *root)
267 } 269 }
268 else 270 else
269 start = dircursor = 0; 271 start = dircursor = 0;
270 numentries = showdir(currdir, start); 272 restore = true;
271 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
272 } 273 }
273 else 274 else
274 mpeg_stop(); 275 mpeg_stop();
@@ -316,8 +317,7 @@ bool dirbrowse(char *root)
316 playing = 0; 317 playing = 0;
317 } 318 }
318 } 319 }
319 numentries = showdir(currdir, start); 320 restore = true;
320 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
321 break; 321 break;
322 322
323 case TREE_PREV: 323 case TREE_PREV:
@@ -354,20 +354,28 @@ bool dirbrowse(char *root)
354 case TREE_MENU: 354 case TREE_MENU:
355 lcd_stop_scroll(); 355 lcd_stop_scroll();
356 main_menu(); 356 main_menu();
357 restore = true;
358 break;
357 359
358 /* restore display */ 360 case BUTTON_ON:
359 /* TODO: this is just a copy from BUTTON_STOP, fix it */ 361 wps_show();
360 lcd_clear_display(); 362 restore = true;
361 numentries = showdir(currdir, start);
362 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
363
364 break; 363 break;
364
365 } 365 }
366 366
367 lcd_stop_scroll(); 367 if ( restore ) {
368 if ( numentries ) 368 /* restore display */
369 lcd_puts_scroll(LINE_X, LINE_Y+dircursor, 369 /* TODO: this is just a copy from BUTTON_STOP, fix it */
370 dircacheptr[start+dircursor]->name); 370 numentries = showdir(currdir, start);
371 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
372 }
373 else {
374 lcd_stop_scroll();
375 if ( numentries )
376 lcd_puts_scroll(LINE_X, LINE_Y+dircursor,
377 dircacheptr[start+dircursor]->name);
378 }
371 379
372 lcd_update(); 380 lcd_update();
373 } 381 }