First crude status display for Players

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1408 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-07-22 22:45:20 +00:00
parent 97f94b4fac
commit fe689a8541
2 changed files with 84 additions and 77 deletions

View file

@ -36,6 +36,7 @@
#include "menu.h"
#include "wps.h"
#include "settings.h"
#include "status.h"
#include "debug.h"
#ifdef HAVE_LCD_BITMAP
@ -58,7 +59,7 @@ static char lastdir[MAX_PATH] = {0};
void browse_root(void)
{
dirbrowse("/");
dirbrowse("/");
}
@ -225,6 +226,7 @@ static int showdir(char *path, int start)
lcd_puts(LINE_X, LINE_Y+i-start, dircacheptr[i]->name);
}
status_draw();
return filesindir;
}
@ -346,6 +348,7 @@ bool dirbrowse(char *root)
else {
mpeg_stop();
play_mode = 0;
status_set_playmode(STATUS_STOP);
}
break;
@ -368,8 +371,8 @@ bool dirbrowse(char *root)
play_mode = 0;
memcpy(currdir,buf,sizeof(currdir));
if ( dirlevel < MAX_DIR_LEVELS ) {
dirpos[dirlevel] = start;
cursorpos[dirlevel] = dircursor;
dirpos[dirlevel] = start;
cursorpos[dirlevel] = dircursor;
}
dirlevel++;
dircursor=0;
@ -380,11 +383,14 @@ bool dirbrowse(char *root)
{
play_mode = 2;
play_list(currdir, dircacheptr[dircursor+start]->name);
status_set_playmode(STATUS_PLAY);
}
else {
play_mode = 1;
mpeg_play(buf);
status_set_playmode(STATUS_PLAY);
}
status_draw();
lcd_stop_scroll();
rc = wps_show();
if(rc == SYS_USB_CONNECTED)
@ -398,71 +404,71 @@ bool dirbrowse(char *root)
break;
case TREE_PREV:
if(filesindir)
{
if(dircursor) {
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, false);
dircursor--;
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
else {
if (start) {
start--;
numentries = showdir(currdir, start);
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
else {
if (numentries < TREE_MAX_ON_SCREEN) {
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
false);
dircursor = numentries - 1;
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
true);
}
else {
start = numentries - TREE_MAX_ON_SCREEN;
dircursor = TREE_MAX_ON_SCREEN - 1;
numentries = showdir(currdir, start);
put_cursorxy(0, CURSOR_Y + LINE_Y +
TREE_MAX_ON_SCREEN - 1, true);
}
}
}
lcd_update();
}
if(filesindir)
{
if(dircursor) {
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, false);
dircursor--;
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
else {
if (start) {
start--;
numentries = showdir(currdir, start);
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
else {
if (numentries < TREE_MAX_ON_SCREEN) {
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
false);
dircursor = numentries - 1;
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
true);
}
else {
start = numentries - TREE_MAX_ON_SCREEN;
dircursor = TREE_MAX_ON_SCREEN - 1;
numentries = showdir(currdir, start);
put_cursorxy(0, CURSOR_Y + LINE_Y +
TREE_MAX_ON_SCREEN - 1, true);
}
}
}
lcd_update();
}
break;
case TREE_NEXT:
if(filesindir)
{
if (dircursor + start + 1 < numentries ) {
if(dircursor+1 < TREE_MAX_ON_SCREEN) {
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
false);
dircursor++;
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
else {
start++;
numentries = showdir(currdir, start);
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
}
else {
if(numentries < TREE_MAX_ON_SCREEN) {
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
false);
start = dircursor = 0;
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
else {
start = dircursor = 0;
numentries = showdir(currdir, start);
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
}
lcd_update();
}
if(filesindir)
{
if (dircursor + start + 1 < numentries ) {
if(dircursor+1 < TREE_MAX_ON_SCREEN) {
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
false);
dircursor++;
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
else {
start++;
numentries = showdir(currdir, start);
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
}
else {
if(numentries < TREE_MAX_ON_SCREEN) {
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor,
false);
start = dircursor = 0;
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
else {
start = dircursor = 0;
numentries = showdir(currdir, start);
put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true);
}
}
lcd_update();
}
break;
case TREE_MENU: {

View file

@ -32,7 +32,7 @@
#include "mpeg.h"
#include "usb.h"
#include "power.h"
#include "main_menu.h"
#include "status.h"
#define LINE_Y 1 /* initial line */
@ -114,6 +114,7 @@ static void draw_screen(struct mp3entry* id3)
break;
}
}
status_draw();
lcd_update();
}
@ -140,7 +141,6 @@ int wps_show(void)
( (id3->album?id3->album[0]:0) != lastalbum ) ||
( (id3->title?id3->title[0]:0) != lasttitle ) )
{
lcd_stop_scroll();
draw_screen(id3);
lastlength = id3->length;
lastsize = id3->filesize;
@ -179,10 +179,12 @@ int wps_show(void)
#endif
}
status_draw();
#ifdef HAVE_LCD_BITMAP
/* draw battery indicator line */
lcd_clearline(0,LCD_HEIGHT-1,LCD_WIDTH-1, LCD_HEIGHT-1);
lcd_drawline(0,LCD_HEIGHT-1,battery_level() * (LCD_WIDTH-1) / 100, LCD_HEIGHT-1);
lcd_drawline(0,LCD_HEIGHT-1,battery_level() * LCD_WIDTH / 100, LCD_HEIGHT-1);
#endif
for ( i=0;i<5;i++ ) {
@ -196,9 +198,15 @@ int wps_show(void)
case BUTTON_UP:
#endif
if ( playing )
{
mpeg_pause();
status_set_playmode(STATUS_PAUSE);
}
else
{
mpeg_resume();
status_set_playmode(STATUS_PLAY);
}
playing = !playing;
break;
@ -226,21 +234,14 @@ int wps_show(void)
case BUTTON_RIGHT:
mpeg_next();
break;
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_F1:
#else
case BUTTON_MENU:
#endif
lcd_stop_scroll();
main_menu();
draw_screen(id3);
break;
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_OFF:
#else
case BUTTON_DOWN:
#endif
mpeg_stop();
status_set_playmode(STATUS_STOP);
break;
#ifndef SIMULATOR
case SYS_USB_CONNECTED: