1
0
Fork 0
forked from len0rd/rockbox

Show the same information in the ID3 browser as in the WPS screen; use string version of tags if available, format time in the same way.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7029 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Magnus Holmgren 2005-07-05 19:33:33 +00:00
parent 3e33a0f8ee
commit 1e5119b77b
3 changed files with 90 additions and 77 deletions

View file

@ -40,11 +40,12 @@
#include "action.h" #include "action.h"
#include "talk.h" #include "talk.h"
#include "misc.h" #include "misc.h"
#include "id3.h" #include "id3.h"
#include "screens.h" #include "screens.h"
#include "debug.h" #include "debug.h"
#include "led.h" #include "led.h"
#include "sound.h" #include "sound.h"
#include "wps-display.h"
#ifdef HAVE_MMC #ifdef HAVE_MMC
#include "ata_mmc.h" #include "ata_mmc.h"
#endif #endif
@ -60,7 +61,7 @@ static const unsigned char usb_logo[] = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x81, 0x81, 0x81, 0x81, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x81, 0x81, 0x81, 0x81,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0xf1, 0x4f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x01, 0x01, 0x01, 0x01, 0xf1, 0x4f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0,
0x00, 0x00, 0xe0, 0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0xe0, 0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x81, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x81, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0,
@ -68,7 +69,7 @@ static const unsigned char usb_logo[] = {
0x0c, 0x0e, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0c, 0x0e, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x00,
0x00, 0x00, 0xe0, 0x1f, 0x00, 0xf8, 0x06, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0xf8, 0x06, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x82, 0x7e, 0x00, 0xc0, 0x3e, 0x01, 0x02, 0x02, 0x02, 0x82, 0x7e, 0x00, 0xc0, 0x3e, 0x01,
0x70, 0x4f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, 0x4f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, 0x07, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, 0x07, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f,
@ -76,7 +77,7 @@ static const unsigned char usb_logo[] = {
0x1f, 0x3f, 0x7b, 0xf3, 0xe3, 0xc3, 0x83, 0x83, 0x83, 0x83, 0xe3, 0xe3, 0xe3, 0x1f, 0x3f, 0x7b, 0xf3, 0xe3, 0xc3, 0x83, 0x83, 0x83, 0x83, 0xe3, 0xe3, 0xe3,
0xe3, 0xe3, 0xe3, 0x03, 0x03, 0x03, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x02, 0xe3, 0xe3, 0xe3, 0x03, 0x03, 0x03, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x02,
0xc0, 0x3e, 0x01, 0xe0, 0x9f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0x3e, 0x01, 0xe0, 0x9f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0xf0, 0x0f, 0x80, 0x78, 0x07, 0x00, 0x00, 0x80, 0x80, 0xf0, 0x0f, 0x80, 0x78, 0x07, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80,
@ -84,7 +85,7 @@ static const unsigned char usb_logo[] = {
0x80, 0x80, 0x80, 0x80, 0x80, 0x81, 0x81, 0x81, 0x81, 0x81, 0x87, 0x87, 0x87, 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, 0x81, 0x81, 0x81, 0x81, 0x87, 0x87, 0x87,
0x87, 0x87, 0x87, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x87, 0x87, 0x87, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf0,
0x0f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00,
}; };
#endif #endif
@ -148,7 +149,7 @@ int mmc_remove_request(void)
splash(1, true, str(LANG_REMOVE_MMC)); splash(1, true, str(LANG_REMOVE_MMC));
if (global_settings.talk_menu) if (global_settings.talk_menu)
talk_id(LANG_REMOVE_MMC, false); talk_id(LANG_REMOVE_MMC, false);
while (1) while (1)
{ {
queue_wait_w_tmo(&button_queue, &ev, HZ/2); queue_wait_w_tmo(&button_queue, &ev, HZ/2);
@ -156,7 +157,7 @@ int mmc_remove_request(void)
{ {
case SYS_MMC_EXTRACTED: case SYS_MMC_EXTRACTED:
return SYS_MMC_EXTRACTED; return SYS_MMC_EXTRACTED;
case SYS_USB_DISCONNECTED: case SYS_USB_DISCONNECTED:
return SYS_USB_DISCONNECTED; return SYS_USB_DISCONNECTED;
} }
@ -223,20 +224,20 @@ void charging_display_info(bool animate)
animate = false; animate = false;
#endif /* HAVE_CHARGE_CTRL */ #endif /* HAVE_CHARGE_CTRL */
/* middle part */ /* middle part */
memset(charging_logo+3, 0x00, 32); memset(charging_logo+3, 0x00, 32);
charging_logo[0] = 0x3C; charging_logo[0] = 0x3C;
charging_logo[1] = 0x24; charging_logo[1] = 0x24;
charging_logo[2] = charging_logo[35] = 0xFF; charging_logo[2] = charging_logo[35] = 0xFF;
if (!animate) if (!animate)
{ /* draw the outline */ { /* draw the outline */
/* middle part */ /* middle part */
lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8); lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8);
lcd_set_drawmode(DRMODE_FG); lcd_set_drawmode(DRMODE_FG);
/* upper line */ /* upper line */
charging_logo[0] = charging_logo[1] = 0x00; charging_logo[0] = charging_logo[1] = 0x00;
memset(charging_logo+2, 0x80, 34); memset(charging_logo+2, 0x80, 34);
lcd_bitmap(charging_logo, pox_x, pox_y, sizeof(charging_logo), 8); lcd_bitmap(charging_logo, pox_x, pox_y, sizeof(charging_logo), 8);
/* lower line */ /* lower line */
@ -252,7 +253,7 @@ void charging_display_info(bool animate)
{ /* draw a "bubble" here */ { /* draw a "bubble" here */
unsigned bitpos; unsigned bitpos;
bitpos = (phase + i/8) % 15; /* "bounce" effect */ bitpos = (phase + i/8) % 15; /* "bounce" effect */
if (bitpos > 7) if (bitpos > 7)
bitpos = 14 - bitpos; bitpos = 14 - bitpos;
charging_logo[i] = 0x01 << bitpos; charging_logo[i] = 0x01 << bitpos;
} }
@ -274,7 +275,7 @@ static const unsigned char logo_pattern[] = {
static void logo_lock_patterns(bool on) static void logo_lock_patterns(bool on)
{ {
int i; int i;
if (on) if (on)
{ {
@ -301,7 +302,7 @@ void charging_display_info(bool animate)
snprintf(buf, sizeof(buf), "%s %d.%02dV", logo_chars, snprintf(buf, sizeof(buf), "%s %d.%02dV", logo_chars,
battery_voltage / 100, battery_voltage % 100); battery_voltage / 100, battery_voltage % 100);
lcd_puts(0, 1, buf); lcd_puts(0, 1, buf);
memcpy(buf, logo_pattern, 28); /* copy logo patterns */ memcpy(buf, logo_pattern, 28); /* copy logo patterns */
if (!animate) /* build the screen */ if (!animate) /* build the screen */
@ -323,7 +324,7 @@ void charging_display_info(bool animate)
} }
phase++; phase++;
} }
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
lcd_define_pattern(logo_chars[i], buf + 7 * i); lcd_define_pattern(logo_chars[i], buf + 7 * i);
} }
@ -410,7 +411,7 @@ int pitch_screen(void)
lcd_clear_display(); lcd_clear_display();
lcd_setfont(FONT_SYSFIXED); lcd_setfont(FONT_SYSFIXED);
ptr = str(LANG_PITCH_UP); ptr = str(LANG_PITCH_UP);
lcd_getstringsize(ptr,&w,&h); lcd_getstringsize(ptr,&w,&h);
lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr); lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr);
@ -528,7 +529,7 @@ bool quick_screen(int context, int button)
int w, h, key; int w, h, key;
char buf[32]; char buf[32];
int oldrepeat = global_settings.repeat_mode; int oldrepeat = global_settings.repeat_mode;
/* just to stop compiler warning */ /* just to stop compiler warning */
context = context; context = context;
lcd_setfont(FONT_SYSFIXED); lcd_setfont(FONT_SYSFIXED);
@ -551,8 +552,8 @@ bool quick_screen(int context, int button)
/* Shuffle mode */ /* Shuffle mode */
lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE)); lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE));
lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
lcd_putsxy(0, LCD_HEIGHT/2, lcd_putsxy(0, LCD_HEIGHT/2,
global_settings.playlist_shuffle ? global_settings.playlist_shuffle ?
str(LANG_ON) : str(LANG_OFF)); str(LANG_ON) : str(LANG_OFF));
/* Directory Filter */ /* Directory Filter */
@ -560,15 +561,15 @@ bool quick_screen(int context, int button)
case SHOW_ALL: case SHOW_ALL:
ptr = str(LANG_FILTER_ALL); ptr = str(LANG_FILTER_ALL);
break; break;
case SHOW_SUPPORTED: case SHOW_SUPPORTED:
ptr = str(LANG_FILTER_SUPPORTED); ptr = str(LANG_FILTER_SUPPORTED);
break; break;
case SHOW_MUSIC: case SHOW_MUSIC:
ptr = str(LANG_FILTER_MUSIC); ptr = str(LANG_FILTER_MUSIC);
break; break;
case SHOW_PLAYLIST: case SHOW_PLAYLIST:
ptr = str(LANG_FILTER_PLAYLIST); ptr = str(LANG_FILTER_PLAYLIST);
break; break;
@ -577,7 +578,7 @@ bool quick_screen(int context, int button)
ptr = str(LANG_FILTER_ID3DB); ptr = str(LANG_FILTER_ID3DB);
break; break;
} }
snprintf(buf, sizeof buf, "%s:", str(LANG_FILTER)); snprintf(buf, sizeof buf, "%s:", str(LANG_FILTER));
lcd_getstringsize(buf,&w,&h); lcd_getstringsize(buf,&w,&h);
lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf); lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf);
@ -589,20 +590,20 @@ bool quick_screen(int context, int button)
case REPEAT_OFF: case REPEAT_OFF:
ptr = str(LANG_OFF); ptr = str(LANG_OFF);
break; break;
case REPEAT_ALL: case REPEAT_ALL:
ptr = str(LANG_REPEAT_ALL); ptr = str(LANG_REPEAT_ALL);
break; break;
case REPEAT_ONE: case REPEAT_ONE:
ptr = str(LANG_REPEAT_ONE); ptr = str(LANG_REPEAT_ONE);
break; break;
case REPEAT_SHUFFLE: case REPEAT_SHUFFLE:
ptr = str(LANG_SHUFFLE); ptr = str(LANG_SHUFFLE);
break; break;
} }
lcd_getstringsize(str(LANG_SHUFFLE),&w,&h); lcd_getstringsize(str(LANG_SHUFFLE),&w,&h);
lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, str(LANG_REPEAT)); lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, str(LANG_REPEAT));
lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
@ -613,17 +614,17 @@ bool quick_screen(int context, int button)
/* Scrollbar */ /* Scrollbar */
lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL)); lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL));
lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR)); lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
lcd_putsxy(0, LCD_HEIGHT/2, lcd_putsxy(0, LCD_HEIGHT/2,
global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF)); global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF));
/* Status bar */ /* Status bar */
ptr = str(LANG_F3_STATUS); ptr = str(LANG_F3_STATUS);
lcd_getstringsize(ptr,&w,&h); lcd_getstringsize(ptr,&w,&h);
lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr); lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr);
lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR)); lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2,
global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF)); global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF));
/* Flip */ /* Flip */
ptr = str(LANG_FLIP_DISPLAY); ptr = str(LANG_FLIP_DISPLAY);
lcd_getstringsize(ptr,&w,&h); lcd_getstringsize(ptr,&w,&h);
@ -636,7 +637,7 @@ bool quick_screen(int context, int button)
#endif #endif
} }
lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8); LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8);
lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8); LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8);
@ -645,15 +646,15 @@ bool quick_screen(int context, int button)
lcd_update(); lcd_update();
key = button_get(true); key = button_get(true);
/* /*
* This is a temporary kludge so that the F2 & F3 menus operate in exactly * This is a temporary kludge so that the F2 & F3 menus operate in exactly
* the same manner up until the full F2/F3 configurable menus are complete * the same manner up until the full F2/F3 configurable menus are complete
*/ */
if( key == BUTTON_LEFT || key == BUTTON_RIGHT || key == BUTTON_DOWN || key == ( BUTTON_LEFT | BUTTON_REPEAT ) || key == ( BUTTON_RIGHT | BUTTON_REPEAT ) || key == ( BUTTON_DOWN | BUTTON_REPEAT ) ) if( key == BUTTON_LEFT || key == BUTTON_RIGHT || key == BUTTON_DOWN || key == ( BUTTON_LEFT | BUTTON_REPEAT ) || key == ( BUTTON_RIGHT | BUTTON_REPEAT ) || key == ( BUTTON_DOWN | BUTTON_REPEAT ) )
key = button | key; key = button | key;
switch (key) { switch (key) {
case SCREENS_QUICK | BUTTON_LEFT: case SCREENS_QUICK | BUTTON_LEFT:
case SCREENS_QUICK | BUTTON_LEFT | BUTTON_REPEAT: case SCREENS_QUICK | BUTTON_LEFT | BUTTON_REPEAT:
@ -712,12 +713,12 @@ bool quick_screen(int context, int button)
case BUTTON_F3 | BUTTON_REL: case BUTTON_F3 | BUTTON_REL:
#endif #endif
case SCREENS_QUICK | BUTTON_REL: case SCREENS_QUICK | BUTTON_REL:
if( used ) if( used )
exit = true; exit = true;
used = true; used = true;
break; break;
case BUTTON_OFF | BUTTON_REL: case BUTTON_OFF | BUTTON_REL:
@ -732,7 +733,7 @@ bool quick_screen(int context, int button)
} }
settings_save(); settings_save();
switch( button ) switch( button )
{ {
case SCREENS_QUICK: case SCREENS_QUICK:
@ -748,11 +749,11 @@ bool quick_screen(int context, int button)
lcd_setmargins(0, STATUSBAR_HEIGHT); lcd_setmargins(0, STATUSBAR_HEIGHT);
else else
lcd_setmargins(0, 0); lcd_setmargins(0, 0);
break; break;
#endif #endif
} }
lcd_setfont(FONT_UI); lcd_setfont(FONT_UI);
return false; return false;
@ -794,13 +795,13 @@ void splash(int ticks, /* how long the splash is displayed */
#endif #endif
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
lcd_double_height (false); lcd_double_height (false);
#endif #endif
va_start( ap, fmt ); va_start( ap, fmt );
vsnprintf( splash_buf, sizeof(splash_buf), fmt, ap ); vsnprintf( splash_buf, sizeof(splash_buf), fmt, ap );
if(center) { if(center) {
/* first a pass to measure sizes */ /* first a pass to measure sizes */
next = strtok_r(splash_buf, " ", &store); next = strtok_r(splash_buf, " ", &store);
while (next) { while (next) {
@ -965,7 +966,7 @@ static void say_time(int cursorpos, const struct tm *tm)
value = tm->tm_mday; value = tm->tm_mday;
break; break;
} }
if (cursorpos == 4) /* month */ if (cursorpos == 4) /* month */
talk_id(LANG_MONTH_JANUARY + tm->tm_mon, false); talk_id(LANG_MONTH_JANUARY + tm->tm_mon, false);
else else
@ -1019,7 +1020,7 @@ bool set_time_screen(const char* string, struct tm *tm)
char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12}, char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12},
{24, 16, 24}, {54, 16, 18}, {78, 16, 12}}; {24, 16, 24}, {54, 16, 18}, {78, 16, 12}};
char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int monthname_len = 0, dayname_len = 0; int monthname_len = 0, dayname_len = 0;
int *valptr = NULL; int *valptr = NULL;
@ -1205,7 +1206,7 @@ bool set_time_screen(const char* string, struct tm *tm)
break; break;
case BUTTON_DOWN: case BUTTON_DOWN:
case BUTTON_DOWN | BUTTON_REPEAT: case BUTTON_DOWN | BUTTON_REPEAT:
*valptr = (*valptr + steps - min - 1) % *valptr = (*valptr + steps - min - 1) %
steps + min; steps + min;
if(*valptr == 0) if(*valptr == 0)
*valptr = min; *valptr = min;
@ -1259,7 +1260,7 @@ bool shutdown_screen(void)
default: default:
if(default_event_handler(button) == SYS_USB_CONNECTED) if(default_event_handler(button) == SYS_USB_CONNECTED)
return true; return true;
/* Return if any other button was pushed, or if there /* Return if any other button was pushed, or if there
was a timeout. We ignore RELEASE events, since we may was a timeout. We ignore RELEASE events, since we may
have been called by a button down event, and the user might have been called by a button down event, and the user might
@ -1295,27 +1296,30 @@ bool browse_id3(void)
{ {
case 0: case 0:
lcd_puts(0, 0, str(LANG_ID3_TITLE)); lcd_puts(0, 0, str(LANG_ID3_TITLE));
lcd_puts_scroll(0, 1, id3->title ? id3->title : lcd_puts_scroll(0, 1, id3->title ? id3->title :
(char*)str(LANG_ID3_NO_TITLE)); (char*)str(LANG_ID3_NO_TITLE));
break; break;
case 1: case 1:
lcd_puts(0, 0, str(LANG_ID3_ARTIST)); lcd_puts(0, 0, str(LANG_ID3_ARTIST));
lcd_puts_scroll(0, 1, lcd_puts_scroll(0, 1,
id3->artist ? id3->artist : id3->artist ? id3->artist :
(char*)str(LANG_ID3_NO_ARTIST)); (char*)str(LANG_ID3_NO_ARTIST));
break; break;
case 2: case 2:
lcd_puts(0, 0, str(LANG_ID3_ALBUM)); lcd_puts(0, 0, str(LANG_ID3_ALBUM));
lcd_puts_scroll(0, 1, id3->album ? id3->album : lcd_puts_scroll(0, 1, id3->album ? id3->album :
(char*)str(LANG_ID3_NO_ALBUM)); (char*)str(LANG_ID3_NO_ALBUM));
break; break;
case 3: case 3:
lcd_puts(0, 0, str(LANG_ID3_TRACKNUM)); lcd_puts(0, 0, str(LANG_ID3_TRACKNUM));
if (id3->tracknum) { if (id3->track_string) {
lcd_puts_scroll(0, 1, id3->track_string);
}
else if (id3->tracknum) {
snprintf(scroll_text,sizeof(scroll_text), "%d", snprintf(scroll_text,sizeof(scroll_text), "%d",
id3->tracknum); id3->tracknum);
lcd_puts_scroll(0, 1, scroll_text); lcd_puts_scroll(0, 1, scroll_text);
@ -1326,15 +1330,24 @@ bool browse_id3(void)
case 4: case 4:
lcd_puts(0, 0, str(LANG_ID3_GENRE)); lcd_puts(0, 0, str(LANG_ID3_GENRE));
lcd_puts_scroll(0, 1,
id3_get_genre(id3) ? if (id3->genre_string) {
id3_get_genre(id3) : lcd_puts_scroll(0, 1, id3->genre_string);
(char*)str(LANG_ID3_NO_INFO)); }
else {
lcd_puts_scroll(0, 1,
id3_get_genre(id3) ?
id3_get_genre(id3) :
(char*)str(LANG_ID3_NO_INFO));
}
break; break;
case 5: case 5:
lcd_puts(0, 0, str(LANG_ID3_YEAR)); lcd_puts(0, 0, str(LANG_ID3_YEAR));
if (id3->year) { if (id3->year_string) {
lcd_puts_scroll(0, 1, id3->year_string);
}
else if (id3->year) {
snprintf(scroll_text,sizeof(scroll_text), "%d", snprintf(scroll_text,sizeof(scroll_text), "%d",
id3->year); id3->year);
lcd_puts_scroll(0, 1, scroll_text); lcd_puts_scroll(0, 1, scroll_text);
@ -1345,9 +1358,7 @@ bool browse_id3(void)
case 6: case 6:
lcd_puts(0, 0, str(LANG_ID3_LENGHT)); lcd_puts(0, 0, str(LANG_ID3_LENGHT));
snprintf(scroll_text,sizeof(scroll_text), "%d:%02d", wps_format_time(scroll_text, sizeof(scroll_text), id3->length);
(int) (id3->length / 60000),
(int) (id3->length % 60000 / 1000) );
lcd_puts(0, 1, scroll_text); lcd_puts(0, 1, scroll_text);
break; break;
@ -1361,7 +1372,7 @@ bool browse_id3(void)
case 8: case 8:
lcd_puts(0, 0, str(LANG_ID3_BITRATE)); lcd_puts(0, 0, str(LANG_ID3_BITRATE));
snprintf(scroll_text,sizeof(scroll_text), "%d kbps", snprintf(scroll_text,sizeof(scroll_text), "%d kbps",
id3->bitrate); id3->bitrate);
lcd_puts(0, 1, scroll_text); lcd_puts(0, 1, scroll_text);
break; break;

View file

@ -225,7 +225,7 @@ bool wps_load(const char* file, bool display)
/* reset image buffer */ /* reset image buffer */
img_buf_ptr = img_buf; img_buf_ptr = img_buf;
img_buf_free = IMG_BUFSIZE; img_buf_free = IMG_BUFSIZE;
/* set images to unloaded */ /* set images to unloaded */
for (i = 0; i < MAX_IMAGES; i++) { for (i = 0; i < MAX_IMAGES; i++) {
img[i].loaded = false; img[i].loaded = false;
@ -263,9 +263,9 @@ bool wps_load(const char* file, bool display)
} }
if (any_defined_line) if (any_defined_line)
{ {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
wps_display_images(); wps_display_images();
#endif #endif
lcd_update(); lcd_update();
sleep(HZ/2); sleep(HZ/2);
} }
@ -285,7 +285,7 @@ bool wps_load(const char* file, bool display)
* buf_size - size of buffer. * buf_size - size of buffer.
* time - time to format, in milliseconds. * time - time to format, in milliseconds.
*/ */
static void format_time(char* buf, int buf_size, long time) void wps_format_time(char* buf, int buf_size, long time)
{ {
if ( time < 3600000 ) { if ( time < 3600000 ) {
snprintf(buf, buf_size, "%d:%02d", snprintf(buf, buf_size, "%d:%02d",
@ -544,18 +544,19 @@ static char* get_tag(struct mp3entry* cid3,
case 'c': /* Current Time in Song */ case 'c': /* Current Time in Song */
*flags |= WPS_REFRESH_DYNAMIC; *flags |= WPS_REFRESH_DYNAMIC;
format_time(buf, buf_size, id3->elapsed + ff_rewind_count); wps_format_time(buf, buf_size,
id3->elapsed + ff_rewind_count);
return buf; return buf;
case 'r': /* Remaining Time in Song */ case 'r': /* Remaining Time in Song */
*flags |= WPS_REFRESH_DYNAMIC; *flags |= WPS_REFRESH_DYNAMIC;
format_time(buf, buf_size, wps_format_time(buf, buf_size,
id3->length - id3->elapsed - ff_rewind_count); id3->length - id3->elapsed - ff_rewind_count);
return buf; return buf;
case 't': /* Total Time */ case 't': /* Total Time */
*flags |= WPS_REFRESH_STATIC; *flags |= WPS_REFRESH_STATIC;
format_time(buf, buf_size, id3->length); wps_format_time(buf, buf_size, id3->length);
return buf; return buf;
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
@ -767,7 +768,7 @@ static void format_display(char* buf,
char* value = NULL; char* value = NULL;
int level = 0; int level = 0;
unsigned char tag_length; unsigned char tag_length;
/* needed for images (ifdef is to kill a warning on player)*/ /* needed for images (ifdef is to kill a warning on player)*/
int n; int n;
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
@ -823,7 +824,7 @@ static void format_display(char* buf,
temp_buf[pos - ptr] = 0; temp_buf[pos - ptr] = 0;
n = atoi(temp_buf); n = atoi(temp_buf);
ptr = pos+1; ptr = pos+1;
/* check image number, and load state. */ /* check image number, and load state. */
if ((n < MAX_IMAGES) && (!img[n].loaded)) { if ((n < MAX_IMAGES) && (!img[n].loaded)) {
/* Get filename */ /* Get filename */
@ -862,7 +863,7 @@ static void format_display(char* buf,
else else
/* weird syntax, get out */ /* weird syntax, get out */
break; break;
/* and load the image */ /* and load the image */
ret = read_bmp_file(imgname, &img[n].w, &img[n].h, img_buf_ptr, ret = read_bmp_file(imgname, &img[n].w, &img[n].h, img_buf_ptr,
img_buf_free); img_buf_free);
@ -887,7 +888,7 @@ static void format_display(char* buf,
} }
fmt++; fmt++;
break; break;
case '%': case '%':
case '|': case '|':
@ -1068,7 +1069,7 @@ bool wps_refresh(struct mp3entry* id3,
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
/* progress */ /* progress */
if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) { if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) {
scrollbar(0, i*h + offset + 1, LCD_WIDTH, 6, scrollbar(0, i*h + offset + (h > 7 ? (h - 6) / 2 : 1), LCD_WIDTH, 6,
id3->length?id3->length:1, 0, id3->length?id3->length:1, 0,
id3->length?id3->elapsed + ff_rewind_count:0, id3->length?id3->elapsed + ff_rewind_count:0,
HORIZONTAL); HORIZONTAL);
@ -1197,7 +1198,7 @@ bool wps_display(struct mp3entry* id3,
yield(); yield();
wps_refresh(id3, nid3, 0, WPS_REFRESH_ALL); wps_refresh(id3, nid3, 0, WPS_REFRESH_ALL);
status_draw(true); status_draw(true);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
wps_display_images(); wps_display_images();
#endif #endif
lcd_update(); lcd_update();
@ -1284,7 +1285,7 @@ static void draw_player_fullbar(char* buf, int buf_size,
time=(id3->elapsed + ff_rewind_count); time=(id3->elapsed + ff_rewind_count);
memset(timestr, 0, sizeof(timestr)); memset(timestr, 0, sizeof(timestr));
format_time(timestr, sizeof(timestr), time); wps_format_time(timestr, sizeof(timestr), time);
for(lcd_char_pos=0; lcd_char_pos<6; lcd_char_pos++) { for(lcd_char_pos=0; lcd_char_pos<6; lcd_char_pos++) {
digits[lcd_char_pos] = map_fullbar_char(timestr[lcd_char_pos]); digits[lcd_char_pos] = map_fullbar_char(timestr[lcd_char_pos]);
} }

View file

@ -33,6 +33,7 @@
#define WPS_REFRESH_NON_STATIC (WPS_REFRESH_ALL & ~WPS_REFRESH_STATIC & ~WPS_REFRESH_SCROLL) #define WPS_REFRESH_NON_STATIC (WPS_REFRESH_ALL & ~WPS_REFRESH_STATIC & ~WPS_REFRESH_SCROLL)
void wps_format_time(char* buf, int buf_size, long time);
bool wps_refresh(struct mp3entry* id3, struct mp3entry* nid3, bool wps_refresh(struct mp3entry* id3, struct mp3entry* nid3,
int ffwd_offset, unsigned char refresh_mode); int ffwd_offset, unsigned char refresh_mode);
bool wps_display(struct mp3entry* id3, struct mp3entry* nid3); bool wps_display(struct mp3entry* id3, struct mp3entry* nid3);