mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
(1) Patch 1231281: Alignment tags for the WPS by Per Holmaeng. Use %al for left align, %ac for centre, %ar for right. It is currently not possible to use more than one %a? tag per WPS line. (2) Lots of tabs removed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7034 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5081182fe1
commit
be7894509f
11 changed files with 117 additions and 62 deletions
|
@ -46,7 +46,7 @@ bool alarm_screen(void)
|
||||||
|
|
||||||
rtc_get_alarm(&h, &m);
|
rtc_get_alarm(&h, &m);
|
||||||
|
|
||||||
if (m > 60 || h > 24) { /* after battery-change RTC-values are out of range */
|
if (m > 60 || h > 24) { /* after battery-change RTC-values are out of range */
|
||||||
m = 0;
|
m = 0;
|
||||||
h = 12;
|
h = 12;
|
||||||
} else {
|
} else {
|
||||||
|
@ -86,7 +86,7 @@ bool alarm_screen(void)
|
||||||
lcd_puts(0,1,str(LANG_ALARM_MOD_SHUTDOWN));
|
lcd_puts(0,1,str(LANG_ALARM_MOD_SHUTDOWN));
|
||||||
lcd_update();
|
lcd_update();
|
||||||
sleep(HZ);
|
sleep(HZ);
|
||||||
done = true;
|
done = true;
|
||||||
} else {
|
} else {
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_puts(0,0,str(LANG_ALARM_MOD_ERROR));
|
lcd_puts(0,0,str(LANG_ALARM_MOD_ERROR));
|
||||||
|
@ -142,9 +142,9 @@ bool alarm_screen(void)
|
||||||
case BUTTON_MENU:
|
case BUTTON_MENU:
|
||||||
#endif
|
#endif
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_puts(0,0,str(LANG_ALARM_MOD_DISABLE));
|
lcd_puts(0,0,str(LANG_ALARM_MOD_DISABLE));
|
||||||
lcd_update();
|
lcd_update();
|
||||||
sleep(HZ);
|
sleep(HZ);
|
||||||
rtc_enable_alarm(false);
|
rtc_enable_alarm(false);
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -39,8 +39,8 @@ static int fracbits;
|
||||||
#define SAMPLE_DEPTH 16
|
#define SAMPLE_DEPTH 16
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NAME: prng()
|
* NAME: prng()
|
||||||
* DESCRIPTION: 32-bit pseudo-random number generator
|
* DESCRIPTION: 32-bit pseudo-random number generator
|
||||||
*/
|
*/
|
||||||
static __inline
|
static __inline
|
||||||
unsigned long prng(unsigned long state)
|
unsigned long prng(unsigned long state)
|
||||||
|
@ -93,7 +93,7 @@ inline void dsp_clip(long *sample, long *output)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NAME: dither()
|
* NAME: dither()
|
||||||
* DESCRIPTION: dither and scale sample
|
* DESCRIPTION: dither and scale sample
|
||||||
*/
|
*/
|
||||||
inline int scale_dither_clip(long sample)
|
inline int scale_dither_clip(long sample)
|
||||||
{
|
{
|
||||||
|
|
|
@ -301,7 +301,7 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname,
|
||||||
if (memcmp(&buf[i],"OggS",5)==0) {
|
if (memcmp(&buf[i],"OggS",5)==0) {
|
||||||
if (i < (j-17)) {
|
if (i < (j-17)) {
|
||||||
totalsamples=(buf[i+6])|(buf[i+7]<<8)|(buf[i+8]<<16)|(buf[i+9]<<24);
|
totalsamples=(buf[i+6])|(buf[i+7]<<8)|(buf[i+8]<<16)|(buf[i+9]<<24);
|
||||||
last_serialno=(buf[i+14])|(buf[i+15]<<8)|(buf[i+16]<<16)|(buf[i+17]<<24);
|
last_serialno=(buf[i+14])|(buf[i+15]<<8)|(buf[i+16]<<16)|(buf[i+17]<<24);
|
||||||
j=0; /* We can discard the rest of the buffer */
|
j=0; /* We can discard the rest of the buffer */
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -321,11 +321,11 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname,
|
||||||
/* This file has mutiple vorbis bitstreams (or is corrupt) */
|
/* This file has mutiple vorbis bitstreams (or is corrupt) */
|
||||||
/* FIXME we should display an error here */
|
/* FIXME we should display an error here */
|
||||||
if (serialno != last_serialno) {
|
if (serialno != last_serialno) {
|
||||||
track->taginfo_ready=false;
|
track->taginfo_ready=false;
|
||||||
logf("serialno mismatch");
|
logf("serialno mismatch");
|
||||||
logf("%ld", serialno);
|
logf("%ld", serialno);
|
||||||
logf("%ld", last_serialno);
|
logf("%ld", last_serialno);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
track->id3.samples=totalsamples;
|
track->id3.samples=totalsamples;
|
||||||
|
@ -794,24 +794,24 @@ static bool get_vorbis_comments (struct mp3entry *entry, int fd)
|
||||||
* packet extends to the third page).
|
* packet extends to the third page).
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < segments; i++) {
|
for (i = 0; i < segments; i++) {
|
||||||
packet_remaining += temp[i];
|
packet_remaining += temp[i];
|
||||||
/* The last segment of a packet is always < 255 bytes */
|
/* The last segment of a packet is always < 255 bytes */
|
||||||
if (temp[i] < 255) {
|
if (temp[i] < 255) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now read in packet header (type and id string) */
|
/* Now read in packet header (type and id string) */
|
||||||
if(read(fd, temp, 7) < 7) {
|
if(read(fd, temp, 7) < 7) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The first byte of a packet is the packet type; comment packets are
|
/* The first byte of a packet is the packet type; comment packets are
|
||||||
* type 3.
|
* type 3.
|
||||||
*/
|
*/
|
||||||
if ((temp[0] != 3) || (memcmp(temp + 1,"vorbis",6)!=0)) {
|
if ((temp[0] != 3) || (memcmp(temp + 1,"vorbis",6)!=0)) {
|
||||||
logf("Not a vorbis comment packet");
|
logf("Not a vorbis comment packet");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
packet_remaining -= 7;
|
packet_remaining -= 7;
|
||||||
|
@ -831,7 +831,7 @@ static bool get_vorbis_comments (struct mp3entry *entry, int fd)
|
||||||
little_endian_to_native(&comment_count, "L");
|
little_endian_to_native(&comment_count, "L");
|
||||||
packet_remaining -= (vendor_length + 8);
|
packet_remaining -= (vendor_length + 8);
|
||||||
if ( packet_remaining <= 0 ) {
|
if ( packet_remaining <= 0 ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = 0; i < comment_count; i++ ) {
|
for ( i = 0; i < comment_count; i++ ) {
|
||||||
|
@ -843,10 +843,10 @@ static bool get_vorbis_comments (struct mp3entry *entry, int fd)
|
||||||
|
|
||||||
little_endian_to_native(&comment_length, "L");
|
little_endian_to_native(&comment_length, "L");
|
||||||
|
|
||||||
/* Quit if we've passed the end of the page */
|
/* Quit if we've passed the end of the page */
|
||||||
packet_remaining -= (comment_length + 4);
|
packet_remaining -= (comment_length + 4);
|
||||||
if ( packet_remaining <= 0 ) {
|
if ( packet_remaining <= 0 ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip comment if it won't fit in buffer */
|
/* Skip comment if it won't fit in buffer */
|
||||||
|
@ -876,37 +876,37 @@ static bool get_vorbis_comments (struct mp3entry *entry, int fd)
|
||||||
name_length = 5;
|
name_length = 5;
|
||||||
p = &(entry->genre_string);
|
p = &(entry->genre_string);
|
||||||
} else if (strncasecmp(temp, "DATE=", 5) == 0) {
|
} else if (strncasecmp(temp, "DATE=", 5) == 0) {
|
||||||
int j=0;
|
int j=0;
|
||||||
/* verify that this is a number */
|
/* verify that this is a number */
|
||||||
/* Note: vorbis uses UTF-8 for its comments, so it is
|
/* Note: vorbis uses UTF-8 for its comments, so it is
|
||||||
* safe to compare the values against ASCII 0 and 9
|
* safe to compare the values against ASCII 0 and 9
|
||||||
*/
|
*/
|
||||||
while ( j < (comment_length - 5) ) {
|
while ( j < (comment_length - 5) ) {
|
||||||
if ( (temp[5+j] < '0') || (temp[5+j] > '9') ) {
|
if ( (temp[5+j] < '0') || (temp[5+j] > '9') ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
if ( j == (comment_length - 5) ) {
|
if ( j == (comment_length - 5) ) {
|
||||||
p = NULL;
|
p = NULL;
|
||||||
entry->year = atoi(temp + 5);
|
entry->year = atoi(temp + 5);
|
||||||
}
|
}
|
||||||
} else if (strncasecmp(temp, "TRACKNUMBER=", 12) == 0) {
|
} else if (strncasecmp(temp, "TRACKNUMBER=", 12) == 0) {
|
||||||
int j=0;
|
int j=0;
|
||||||
/* verify that this is a number */
|
/* verify that this is a number */
|
||||||
/* Note: vorbis uses UTF-8 for its comments, so it is
|
/* Note: vorbis uses UTF-8 for its comments, so it is
|
||||||
* safe to compare the values against ASCII 0 and 9
|
* safe to compare the values against ASCII 0 and 9
|
||||||
*/
|
*/
|
||||||
while ( j < (comment_length - 12) ) {
|
while ( j < (comment_length - 12) ) {
|
||||||
if ( (temp[12+j] < '0') || (temp[12+j] > '9') ) {
|
if ( (temp[12+j] < '0') || (temp[12+j] > '9') ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
if ( j == (comment_length - 12) ) {
|
if ( j == (comment_length - 12) ) {
|
||||||
p = NULL;
|
p = NULL;
|
||||||
entry->tracknum = atoi(temp + 12);
|
entry->tracknum = atoi(temp + 12);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p = NULL;
|
p = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,7 @@ struct plugin_api {
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_HWCODEC == MASNONE
|
#if CONFIG_HWCODEC == MASNONE
|
||||||
void (*pcm_play_data)(const unsigned char *start, int size,
|
void (*pcm_play_data)(const unsigned char *start, int size,
|
||||||
void (*get_more)(unsigned char** start, long*size));
|
void (*get_more)(unsigned char** start, long*size));
|
||||||
void (*pcm_play_stop)(void);
|
void (*pcm_play_stop)(void);
|
||||||
void (*pcm_set_frequency)(unsigned int frequency);
|
void (*pcm_set_frequency)(unsigned int frequency);
|
||||||
bool (*pcm_is_playing)(void);
|
bool (*pcm_is_playing)(void);
|
||||||
|
|
|
@ -312,7 +312,7 @@ struct user_settings
|
||||||
int sort_dir; /* 0=alpha, 1=date (old first), 2=date (new first) */
|
int sort_dir; /* 0=alpha, 1=date (old first), 2=date (new first) */
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
/* remote lcd */
|
/* remote lcd */
|
||||||
int remote_contrast; /* lcd contrast: 0-63 0=low 63=high */
|
int remote_contrast; /* lcd contrast: 0-63 0=low 63=high */
|
||||||
bool remote_invert; /* invert display */
|
bool remote_invert; /* invert display */
|
||||||
bool remote_flip_display; /* turn display (and button layout) by 180 degrees */
|
bool remote_flip_display; /* turn display (and button layout) by 180 degrees */
|
||||||
|
|
|
@ -380,7 +380,7 @@ static bool recdirectory(void)
|
||||||
static bool reconstartup(void)
|
static bool reconstartup(void)
|
||||||
{
|
{
|
||||||
return set_bool(str(LANG_RECORD_STARTUP),
|
return set_bool(str(LANG_RECORD_STARTUP),
|
||||||
&global_settings.rec_startup);
|
&global_settings.rec_startup);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MAS3587F */
|
#endif /* MAS3587F */
|
||||||
|
|
|
@ -63,7 +63,7 @@ struct status_info {
|
||||||
bool battery_safe;
|
bool battery_safe;
|
||||||
bool redraw_volume; /* true if the volume gauge needs updating */
|
bool redraw_volume; /* true if the volume gauge needs updating */
|
||||||
#if CONFIG_LED == LED_VIRTUAL
|
#if CONFIG_LED == LED_VIRTUAL
|
||||||
bool led; /* disk LED simulation in the status bar */
|
bool led; /* disk LED simulation in the status bar */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_USB_POWER
|
#ifdef HAVE_USB_POWER
|
||||||
bool usb_power;
|
bool usb_power;
|
||||||
|
|
|
@ -808,7 +808,22 @@ static void format_display(char* buf,
|
||||||
case 0:
|
case 0:
|
||||||
*buf++ = '%';
|
*buf++ = '%';
|
||||||
break;
|
break;
|
||||||
|
case 'a':
|
||||||
|
++fmt;
|
||||||
|
switch (*fmt)
|
||||||
|
{
|
||||||
|
case 'l':
|
||||||
|
*flags |= WPS_ALIGN_LEFT;
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
*flags |= WPS_ALIGN_CENTER;
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
*flags |= WPS_ALIGN_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++fmt;
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
*flags |= WPS_REFRESH_SCROLL;
|
*flags |= WPS_REFRESH_SCROLL;
|
||||||
++fmt;
|
++fmt;
|
||||||
|
@ -830,9 +845,11 @@ static void format_display(char* buf,
|
||||||
/* Get filename */
|
/* Get filename */
|
||||||
pos = strchr(ptr, '|'); /* get the second '|' */
|
pos = strchr(ptr, '|'); /* get the second '|' */
|
||||||
if ((pos - ptr) < (int)sizeof(temp_buf)) {
|
if ((pos - ptr) < (int)sizeof(temp_buf)) {
|
||||||
memcpy(temp_buf, ptr, pos - ptr); /* get the filename */
|
memcpy(temp_buf, ptr, pos - ptr);
|
||||||
|
/* get the filename */
|
||||||
temp_buf[pos - ptr] = 0;
|
temp_buf[pos - ptr] = 0;
|
||||||
snprintf(imgname, MAX_PATH, "/.rockbox/%s", temp_buf);
|
snprintf(imgname, MAX_PATH, "/.rockbox/%s",
|
||||||
|
temp_buf);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* filename too long! */
|
/* filename too long! */
|
||||||
|
@ -1110,8 +1127,27 @@ bool wps_refresh(struct mp3entry* id3,
|
||||||
/* scroll line */
|
/* scroll line */
|
||||||
if ((refresh_mode & WPS_REFRESH_SCROLL) ||
|
if ((refresh_mode & WPS_REFRESH_SCROLL) ||
|
||||||
new_subline_refresh) {
|
new_subline_refresh) {
|
||||||
lcd_puts_scroll(0, i, buf);
|
int strw,strh;
|
||||||
|
int ypos,xpos;
|
||||||
|
|
||||||
|
lcd_getstringsize(buf, &strw, &strh);
|
||||||
|
ypos = (i*strh)+lcd_getymargin();
|
||||||
update_line = true;
|
update_line = true;
|
||||||
|
|
||||||
|
if (strw>LCD_WIDTH) {
|
||||||
|
lcd_puts_scroll(0, i, buf);
|
||||||
|
} else {
|
||||||
|
if (flags & WPS_ALIGN_CENTER)
|
||||||
|
{
|
||||||
|
xpos = (LCD_WIDTH - strw) / 2;
|
||||||
|
lcd_putsxy(xpos, ypos, buf);
|
||||||
|
} else if (flags & WPS_ALIGN_RIGHT) {
|
||||||
|
xpos = (LCD_WIDTH - strw);
|
||||||
|
lcd_putsxy(xpos, ypos, buf);
|
||||||
|
} else {
|
||||||
|
lcd_putsxy(0, ypos, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (flags & (WPS_REFRESH_DYNAMIC | WPS_REFRESH_STATIC))
|
else if (flags & (WPS_REFRESH_DYNAMIC | WPS_REFRESH_STATIC))
|
||||||
|
@ -1120,8 +1156,21 @@ bool wps_refresh(struct mp3entry* id3,
|
||||||
if ((refresh_mode & (WPS_REFRESH_DYNAMIC|WPS_REFRESH_STATIC)) ||
|
if ((refresh_mode & (WPS_REFRESH_DYNAMIC|WPS_REFRESH_STATIC)) ||
|
||||||
new_subline_refresh)
|
new_subline_refresh)
|
||||||
{
|
{
|
||||||
|
int ypos,xpos;
|
||||||
|
int strw,strh;
|
||||||
|
|
||||||
|
lcd_getstringsize(buf, &strw, &strh);
|
||||||
|
ypos = (i*strh)+lcd_getymargin();
|
||||||
update_line = true;
|
update_line = true;
|
||||||
lcd_puts(0, i, buf);
|
if (flags & WPS_ALIGN_CENTER) {
|
||||||
|
xpos = (LCD_WIDTH - strw) / 2;
|
||||||
|
lcd_putsxy(xpos, ypos, buf);
|
||||||
|
} else if (flags & WPS_ALIGN_RIGHT) {
|
||||||
|
xpos = (LCD_WIDTH - strw);
|
||||||
|
lcd_putsxy(xpos, ypos, buf);
|
||||||
|
} else {
|
||||||
|
lcd_putsxy(0, ypos, buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
/* to refresh only those lines that change over time */
|
/* to refresh only those lines that change over time */
|
||||||
#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)
|
||||||
|
|
||||||
|
/* alignments */
|
||||||
|
#define WPS_ALIGN_RIGHT 32
|
||||||
|
#define WPS_ALIGN_CENTER 64
|
||||||
|
#define WPS_ALIGN_LEFT 128
|
||||||
|
|
||||||
|
|
||||||
void wps_format_time(char* buf, int buf_size, long time);
|
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,
|
||||||
|
|
|
@ -660,7 +660,7 @@ long wps_show(void)
|
||||||
if (quick_screen(CONTEXT_WPS, WPS_QUICK))
|
if (quick_screen(CONTEXT_WPS, WPS_QUICK))
|
||||||
return SYS_USB_CONNECTED;
|
return SYS_USB_CONNECTED;
|
||||||
restore = true;
|
restore = true;
|
||||||
lastbutton = 0;
|
lastbutton = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* screen settings */
|
/* screen settings */
|
||||||
|
|
|
@ -126,3 +126,4 @@ Hristo Kovachev
|
||||||
Sander Sweers
|
Sander Sweers
|
||||||
Antonius Hellman
|
Antonius Hellman
|
||||||
Ryan Jackson
|
Ryan Jackson
|
||||||
|
Per Holmäng
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue