summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-07-22 22:45:20 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-07-22 22:45:20 +0000
commitfe689a8541e294c472d111759e334d3814bfc5ba (patch)
tree56c260d6cc4150955321603ee1851f2ba81efcc1
parent97f94b4fac9dbbe81b66d96564e1fe80d5adc0c3 (diff)
downloadrockbox-fe689a8541e294c472d111759e334d3814bfc5ba.tar.gz
rockbox-fe689a8541e294c472d111759e334d3814bfc5ba.zip
First crude status display for Players
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1408 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tree.c136
-rw-r--r--apps/wps.c25
2 files changed, 84 insertions, 77 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 420c55bfcf..2559a1c399 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -36,6 +36,7 @@
36#include "menu.h" 36#include "menu.h"
37#include "wps.h" 37#include "wps.h"
38#include "settings.h" 38#include "settings.h"
39#include "status.h"
39#include "debug.h" 40#include "debug.h"
40 41
41#ifdef HAVE_LCD_BITMAP 42#ifdef HAVE_LCD_BITMAP
@@ -58,7 +59,7 @@ static char lastdir[MAX_PATH] = {0};
58 59
59void browse_root(void) 60void browse_root(void)
60{ 61{
61 dirbrowse("/"); 62 dirbrowse("/");
62} 63}
63 64
64 65
@@ -225,6 +226,7 @@ static int showdir(char *path, int start)
225 lcd_puts(LINE_X, LINE_Y+i-start, dircacheptr[i]->name); 226 lcd_puts(LINE_X, LINE_Y+i-start, dircacheptr[i]->name);
226 } 227 }
227 228
229 status_draw();
228 return filesindir; 230 return filesindir;
229} 231}
230 232
@@ -346,6 +348,7 @@ bool dirbrowse(char *root)
346 else { 348 else {
347 mpeg_stop(); 349 mpeg_stop();
348 play_mode = 0; 350 play_mode = 0;
351 status_set_playmode(STATUS_STOP);
349 } 352 }
350 break; 353 break;
351 354
@@ -368,8 +371,8 @@ bool dirbrowse(char *root)
368 play_mode = 0; 371 play_mode = 0;
369 memcpy(currdir,buf,sizeof(currdir)); 372 memcpy(currdir,buf,sizeof(currdir));
370 if ( dirlevel < MAX_DIR_LEVELS ) { 373 if ( dirlevel < MAX_DIR_LEVELS ) {
371 dirpos[dirlevel] = start; 374 dirpos[dirlevel] = start;
372 cursorpos[dirlevel] = dircursor; 375 cursorpos[dirlevel] = dircursor;
373 } 376 }
374 dirlevel++; 377 dirlevel++;
375 dircursor=0; 378 dircursor=0;
@@ -380,11 +383,14 @@ bool dirbrowse(char *root)
380 { 383 {
381 play_mode = 2; 384 play_mode = 2;
382 play_list(currdir, dircacheptr[dircursor+start]->name); 385 play_list(currdir, dircacheptr[dircursor+start]->name);
386 status_set_playmode(STATUS_PLAY);
383 } 387 }
384 else { 388 else {
385 play_mode = 1; 389 play_mode = 1;
386 mpeg_play(buf); 390 mpeg_play(buf);
391 status_set_playmode(STATUS_PLAY);
387 } 392 }
393 status_draw();
388 lcd_stop_scroll(); 394 lcd_stop_scroll();
389 rc = wps_show(); 395 rc = wps_show();
390 if(rc == SYS_USB_CONNECTED) 396 if(rc == SYS_USB_CONNECTED)
@@ -398,71 +404,71 @@ bool dirbrowse(char *root)
398 break; 404 break;
399 405
400 case TREE_PREV: 406 case TREE_PREV:
401 if(filesindir) 407 if(filesindir)
402 { 408 {
403 if(dircursor) { 409 if(dircursor) {
404 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, false); 410 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, false);
405 dircursor--; 411 dircursor--;
406 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); 412 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
407 } 413 }
408 else { 414 else {
409 if (start) { 415 if (start) {
410 start--; 416 start--;
411 numentries = showdir(currdir, start); 417 numentries = showdir(currdir, start);
412 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); 418 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
413 } 419 }
414 else { 420 else {
415 if (numentries < TREE_MAX_ON_SCREEN) { 421 if (numentries < TREE_MAX_ON_SCREEN) {
416 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, 422 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
417 false); 423 false);
418 dircursor = numentries - 1; 424 dircursor = numentries - 1;
419 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, 425 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
420 true); 426 true);
421 } 427 }
422 else { 428 else {
423 start = numentries - TREE_MAX_ON_SCREEN; 429 start = numentries - TREE_MAX_ON_SCREEN;
424 dircursor = TREE_MAX_ON_SCREEN - 1; 430 dircursor = TREE_MAX_ON_SCREEN - 1;
425 numentries = showdir(currdir, start); 431 numentries = showdir(currdir, start);
426 put_cursorxy(0, CURSOR_Y + LINE_Y + 432 put_cursorxy(0, CURSOR_Y + LINE_Y +
427 TREE_MAX_ON_SCREEN - 1, true); 433 TREE_MAX_ON_SCREEN - 1, true);
428 } 434 }
429 } 435 }
430 } 436 }
431 lcd_update(); 437 lcd_update();
432 } 438 }
433 break; 439 break;
434 440
435 case TREE_NEXT: 441 case TREE_NEXT:
436 if(filesindir) 442 if(filesindir)
437 { 443 {
438 if (dircursor + start + 1 < numentries ) { 444 if (dircursor + start + 1 < numentries ) {
439 if(dircursor+1 < TREE_MAX_ON_SCREEN) { 445 if(dircursor+1 < TREE_MAX_ON_SCREEN) {
440 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, 446 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
441 false); 447 false);
442 dircursor++; 448 dircursor++;
443 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); 449 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
444 } 450 }
445 else { 451 else {
446 start++; 452 start++;
447 numentries = showdir(currdir, start); 453 numentries = showdir(currdir, start);
448 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); 454 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
449 } 455 }
450 } 456 }
451 else { 457 else {
452 if(numentries < TREE_MAX_ON_SCREEN) { 458 if(numentries < TREE_MAX_ON_SCREEN) {
453 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, 459 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
454 false); 460 false);
455 start = dircursor = 0; 461 start = dircursor = 0;
456 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); 462 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
457 } 463 }
458 else { 464 else {
459 start = dircursor = 0; 465 start = dircursor = 0;
460 numentries = showdir(currdir, start); 466 numentries = showdir(currdir, start);
461 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); 467 put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
462 } 468 }
463 } 469 }
464 lcd_update(); 470 lcd_update();
465 } 471 }
466 break; 472 break;
467 473
468 case TREE_MENU: { 474 case TREE_MENU: {
diff --git a/apps/wps.c b/apps/wps.c
index e983079461..5e6cfb0449 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -32,7 +32,7 @@
32#include "mpeg.h" 32#include "mpeg.h"
33#include "usb.h" 33#include "usb.h"
34#include "power.h" 34#include "power.h"
35#include "main_menu.h" 35#include "status.h"
36 36
37#define LINE_Y 1 /* initial line */ 37#define LINE_Y 1 /* initial line */
38 38
@@ -114,6 +114,7 @@ static void draw_screen(struct mp3entry* id3)
114 break; 114 break;
115 } 115 }
116 } 116 }
117 status_draw();
117 lcd_update(); 118 lcd_update();
118} 119}
119 120
@@ -140,7 +141,6 @@ int wps_show(void)
140 ( (id3->album?id3->album[0]:0) != lastalbum ) || 141 ( (id3->album?id3->album[0]:0) != lastalbum ) ||
141 ( (id3->title?id3->title[0]:0) != lasttitle ) ) 142 ( (id3->title?id3->title[0]:0) != lasttitle ) )
142 { 143 {
143 lcd_stop_scroll();
144 draw_screen(id3); 144 draw_screen(id3);
145 lastlength = id3->length; 145 lastlength = id3->length;
146 lastsize = id3->filesize; 146 lastsize = id3->filesize;
@@ -179,10 +179,12 @@ int wps_show(void)
179#endif 179#endif
180 } 180 }
181 181
182 status_draw();
183
182#ifdef HAVE_LCD_BITMAP 184#ifdef HAVE_LCD_BITMAP
183 /* draw battery indicator line */ 185 /* draw battery indicator line */
184 lcd_clearline(0,LCD_HEIGHT-1,LCD_WIDTH-1, LCD_HEIGHT-1); 186 lcd_clearline(0,LCD_HEIGHT-1,LCD_WIDTH-1, LCD_HEIGHT-1);
185 lcd_drawline(0,LCD_HEIGHT-1,battery_level() * (LCD_WIDTH-1) / 100, LCD_HEIGHT-1); 187 lcd_drawline(0,LCD_HEIGHT-1,battery_level() * LCD_WIDTH / 100, LCD_HEIGHT-1);
186#endif 188#endif
187 189
188 for ( i=0;i<5;i++ ) { 190 for ( i=0;i<5;i++ ) {
@@ -196,9 +198,15 @@ int wps_show(void)
196 case BUTTON_UP: 198 case BUTTON_UP:
197#endif 199#endif
198 if ( playing ) 200 if ( playing )
201 {
199 mpeg_pause(); 202 mpeg_pause();
203 status_set_playmode(STATUS_PAUSE);
204 }
200 else 205 else
206 {
201 mpeg_resume(); 207 mpeg_resume();
208 status_set_playmode(STATUS_PLAY);
209 }
202 210
203 playing = !playing; 211 playing = !playing;
204 break; 212 break;
@@ -226,21 +234,14 @@ int wps_show(void)
226 case BUTTON_RIGHT: 234 case BUTTON_RIGHT:
227 mpeg_next(); 235 mpeg_next();
228 break; 236 break;
229#ifdef HAVE_RECORDER_KEYPAD 237
230 case BUTTON_F1:
231#else
232 case BUTTON_MENU:
233#endif
234 lcd_stop_scroll();
235 main_menu();
236 draw_screen(id3);
237 break;
238#ifdef HAVE_RECORDER_KEYPAD 238#ifdef HAVE_RECORDER_KEYPAD
239 case BUTTON_OFF: 239 case BUTTON_OFF:
240#else 240#else
241 case BUTTON_DOWN: 241 case BUTTON_DOWN:
242#endif 242#endif
243 mpeg_stop(); 243 mpeg_stop();
244 status_set_playmode(STATUS_STOP);
244 break; 245 break;
245#ifndef SIMULATOR 246#ifndef SIMULATOR
246 case SYS_USB_CONNECTED: 247 case SYS_USB_CONNECTED: