summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorChristi Scarborough <christi@coraline.org>2005-07-05 22:27:54 +0000
committerChristi Scarborough <christi@coraline.org>2005-07-05 22:27:54 +0000
commitbe7894509feb701630efa4a1a18a5af621068bac (patch)
tree19d18fd09ac3de9df25473091c423245668a40f8 /apps
parent5081182fe13f1158d41138b79985dff8b0632ca1 (diff)
downloadrockbox-be7894509feb701630efa4a1a18a5af621068bac.tar.gz
rockbox-be7894509feb701630efa4a1a18a5af621068bac.zip
(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
Diffstat (limited to 'apps')
-rw-r--r--apps/alarm_menu.c10
-rw-r--r--apps/dsp.c6
-rw-r--r--apps/metadata.c88
-rw-r--r--apps/plugin.h2
-rw-r--r--apps/settings.h2
-rw-r--r--apps/sound_menu.c2
-rw-r--r--apps/status.c2
-rw-r--r--apps/wps-display.c59
-rw-r--r--apps/wps-display.h5
-rw-r--r--apps/wps.c2
10 files changed, 116 insertions, 62 deletions
diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c
index 47d2c1226b..a3ddbeea79 100644
--- a/apps/alarm_menu.c
+++ b/apps/alarm_menu.c
@@ -46,7 +46,7 @@ bool alarm_screen(void)
46 46
47 rtc_get_alarm(&h, &m); 47 rtc_get_alarm(&h, &m);
48 48
49 if (m > 60 || h > 24) { /* after battery-change RTC-values are out of range */ 49 if (m > 60 || h > 24) { /* after battery-change RTC-values are out of range */
50 m = 0; 50 m = 0;
51 h = 12; 51 h = 12;
52 } else { 52 } else {
@@ -86,7 +86,7 @@ bool alarm_screen(void)
86 lcd_puts(0,1,str(LANG_ALARM_MOD_SHUTDOWN)); 86 lcd_puts(0,1,str(LANG_ALARM_MOD_SHUTDOWN));
87 lcd_update(); 87 lcd_update();
88 sleep(HZ); 88 sleep(HZ);
89 done = true; 89 done = true;
90 } else { 90 } else {
91 lcd_clear_display(); 91 lcd_clear_display();
92 lcd_puts(0,0,str(LANG_ALARM_MOD_ERROR)); 92 lcd_puts(0,0,str(LANG_ALARM_MOD_ERROR));
@@ -142,9 +142,9 @@ bool alarm_screen(void)
142 case BUTTON_MENU: 142 case BUTTON_MENU:
143#endif 143#endif
144 lcd_clear_display(); 144 lcd_clear_display();
145 lcd_puts(0,0,str(LANG_ALARM_MOD_DISABLE)); 145 lcd_puts(0,0,str(LANG_ALARM_MOD_DISABLE));
146 lcd_update(); 146 lcd_update();
147 sleep(HZ); 147 sleep(HZ);
148 rtc_enable_alarm(false); 148 rtc_enable_alarm(false);
149 done = true; 149 done = true;
150 break; 150 break;
diff --git a/apps/dsp.c b/apps/dsp.c
index b24e261371..404bd15d4f 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -39,8 +39,8 @@ static int fracbits;
39#define SAMPLE_DEPTH 16 39#define SAMPLE_DEPTH 16
40 40
41/* 41/*
42 * NAME: prng() 42 * NAME: prng()
43 * DESCRIPTION: 32-bit pseudo-random number generator 43 * DESCRIPTION: 32-bit pseudo-random number generator
44 */ 44 */
45static __inline 45static __inline
46unsigned long prng(unsigned long state) 46unsigned long prng(unsigned long state)
@@ -93,7 +93,7 @@ inline void dsp_clip(long *sample, long *output)
93 93
94/* 94/*
95 * NAME: dither() 95 * NAME: dither()
96 * DESCRIPTION: dither and scale sample 96 * DESCRIPTION: dither and scale sample
97 */ 97 */
98inline int scale_dither_clip(long sample) 98inline int scale_dither_clip(long sample)
99{ 99{
diff --git a/apps/metadata.c b/apps/metadata.c
index 0e770dde7a..7b9bb89706 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -301,7 +301,7 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname,
301 if (memcmp(&buf[i],"OggS",5)==0) { 301 if (memcmp(&buf[i],"OggS",5)==0) {
302 if (i < (j-17)) { 302 if (i < (j-17)) {
303 totalsamples=(buf[i+6])|(buf[i+7]<<8)|(buf[i+8]<<16)|(buf[i+9]<<24); 303 totalsamples=(buf[i+6])|(buf[i+7]<<8)|(buf[i+8]<<16)|(buf[i+9]<<24);
304 last_serialno=(buf[i+14])|(buf[i+15]<<8)|(buf[i+16]<<16)|(buf[i+17]<<24); 304 last_serialno=(buf[i+14])|(buf[i+15]<<8)|(buf[i+16]<<16)|(buf[i+17]<<24);
305 j=0; /* We can discard the rest of the buffer */ 305 j=0; /* We can discard the rest of the buffer */
306 } else { 306 } else {
307 break; 307 break;
@@ -321,11 +321,11 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname,
321 /* This file has mutiple vorbis bitstreams (or is corrupt) */ 321 /* This file has mutiple vorbis bitstreams (or is corrupt) */
322 /* FIXME we should display an error here */ 322 /* FIXME we should display an error here */
323 if (serialno != last_serialno) { 323 if (serialno != last_serialno) {
324 track->taginfo_ready=false; 324 track->taginfo_ready=false;
325 logf("serialno mismatch"); 325 logf("serialno mismatch");
326 logf("%ld", serialno); 326 logf("%ld", serialno);
327 logf("%ld", last_serialno); 327 logf("%ld", last_serialno);
328 return false; 328 return false;
329 } 329 }
330 330
331 track->id3.samples=totalsamples; 331 track->id3.samples=totalsamples;
@@ -794,24 +794,24 @@ static bool get_vorbis_comments (struct mp3entry *entry, int fd)
794 * packet extends to the third page). 794 * packet extends to the third page).
795 */ 795 */
796 for (i = 0; i < segments; i++) { 796 for (i = 0; i < segments; i++) {
797 packet_remaining += temp[i]; 797 packet_remaining += temp[i];
798 /* The last segment of a packet is always < 255 bytes */ 798 /* The last segment of a packet is always < 255 bytes */
799 if (temp[i] < 255) { 799 if (temp[i] < 255) {
800 break; 800 break;
801 } 801 }
802 } 802 }
803 803
804 /* Now read in packet header (type and id string) */ 804 /* Now read in packet header (type and id string) */
805 if(read(fd, temp, 7) < 7) { 805 if(read(fd, temp, 7) < 7) {
806 return false; 806 return false;
807 } 807 }
808 808
809 /* The first byte of a packet is the packet type; comment packets are 809 /* The first byte of a packet is the packet type; comment packets are
810 * type 3. 810 * type 3.
811 */ 811 */
812 if ((temp[0] != 3) || (memcmp(temp + 1,"vorbis",6)!=0)) { 812 if ((temp[0] != 3) || (memcmp(temp + 1,"vorbis",6)!=0)) {
813 logf("Not a vorbis comment packet"); 813 logf("Not a vorbis comment packet");
814 return false; 814 return false;
815 } 815 }
816 816
817 packet_remaining -= 7; 817 packet_remaining -= 7;
@@ -831,7 +831,7 @@ static bool get_vorbis_comments (struct mp3entry *entry, int fd)
831 little_endian_to_native(&comment_count, "L"); 831 little_endian_to_native(&comment_count, "L");
832 packet_remaining -= (vendor_length + 8); 832 packet_remaining -= (vendor_length + 8);
833 if ( packet_remaining <= 0 ) { 833 if ( packet_remaining <= 0 ) {
834 return true; 834 return true;
835 } 835 }
836 836
837 for ( i = 0; i < comment_count; i++ ) { 837 for ( i = 0; i < comment_count; i++ ) {
@@ -843,10 +843,10 @@ static bool get_vorbis_comments (struct mp3entry *entry, int fd)
843 843
844 little_endian_to_native(&comment_length, "L"); 844 little_endian_to_native(&comment_length, "L");
845 845
846 /* Quit if we've passed the end of the page */ 846 /* Quit if we've passed the end of the page */
847 packet_remaining -= (comment_length + 4); 847 packet_remaining -= (comment_length + 4);
848 if ( packet_remaining <= 0 ) { 848 if ( packet_remaining <= 0 ) {
849 return true; 849 return true;
850 } 850 }
851 851
852 /* Skip comment if it won't fit in buffer */ 852 /* Skip comment if it won't fit in buffer */
@@ -876,37 +876,37 @@ static bool get_vorbis_comments (struct mp3entry *entry, int fd)
876 name_length = 5; 876 name_length = 5;
877 p = &(entry->genre_string); 877 p = &(entry->genre_string);
878 } else if (strncasecmp(temp, "DATE=", 5) == 0) { 878 } else if (strncasecmp(temp, "DATE=", 5) == 0) {
879 int j=0; 879 int j=0;
880 /* verify that this is a number */ 880 /* verify that this is a number */
881 /* Note: vorbis uses UTF-8 for its comments, so it is 881 /* Note: vorbis uses UTF-8 for its comments, so it is
882 * safe to compare the values against ASCII 0 and 9 882 * safe to compare the values against ASCII 0 and 9
883 */ 883 */
884 while ( j < (comment_length - 5) ) { 884 while ( j < (comment_length - 5) ) {
885 if ( (temp[5+j] < '0') || (temp[5+j] > '9') ) { 885 if ( (temp[5+j] < '0') || (temp[5+j] > '9') ) {
886 break; 886 break;
887 } 887 }
888 j++; 888 j++;
889 } 889 }
890 if ( j == (comment_length - 5) ) { 890 if ( j == (comment_length - 5) ) {
891 p = NULL; 891 p = NULL;
892 entry->year = atoi(temp + 5); 892 entry->year = atoi(temp + 5);
893 } 893 }
894 } else if (strncasecmp(temp, "TRACKNUMBER=", 12) == 0) { 894 } else if (strncasecmp(temp, "TRACKNUMBER=", 12) == 0) {
895 int j=0; 895 int j=0;
896 /* verify that this is a number */ 896 /* verify that this is a number */
897 /* Note: vorbis uses UTF-8 for its comments, so it is 897 /* Note: vorbis uses UTF-8 for its comments, so it is
898 * safe to compare the values against ASCII 0 and 9 898 * safe to compare the values against ASCII 0 and 9
899 */ 899 */
900 while ( j < (comment_length - 12) ) { 900 while ( j < (comment_length - 12) ) {
901 if ( (temp[12+j] < '0') || (temp[12+j] > '9') ) { 901 if ( (temp[12+j] < '0') || (temp[12+j] > '9') ) {
902 break; 902 break;
903 } 903 }
904 j++; 904 j++;
905 } 905 }
906 if ( j == (comment_length - 12) ) { 906 if ( j == (comment_length - 12) ) {
907 p = NULL; 907 p = NULL;
908 entry->tracknum = atoi(temp + 12); 908 entry->tracknum = atoi(temp + 12);
909 } 909 }
910 } else { 910 } else {
911 p = NULL; 911 p = NULL;
912 } 912 }
diff --git a/apps/plugin.h b/apps/plugin.h
index 3f3ed327ac..46308a1e0b 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -304,7 +304,7 @@ struct plugin_api {
304#endif 304#endif
305#if CONFIG_HWCODEC == MASNONE 305#if CONFIG_HWCODEC == MASNONE
306 void (*pcm_play_data)(const unsigned char *start, int size, 306 void (*pcm_play_data)(const unsigned char *start, int size,
307 void (*get_more)(unsigned char** start, long*size)); 307 void (*get_more)(unsigned char** start, long*size));
308 void (*pcm_play_stop)(void); 308 void (*pcm_play_stop)(void);
309 void (*pcm_set_frequency)(unsigned int frequency); 309 void (*pcm_set_frequency)(unsigned int frequency);
310 bool (*pcm_is_playing)(void); 310 bool (*pcm_is_playing)(void);
diff --git a/apps/settings.h b/apps/settings.h
index 46f410a2f4..35a848a208 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -312,7 +312,7 @@ struct user_settings
312 int sort_dir; /* 0=alpha, 1=date (old first), 2=date (new first) */ 312 int sort_dir; /* 0=alpha, 1=date (old first), 2=date (new first) */
313 313
314#ifdef HAVE_REMOTE_LCD 314#ifdef HAVE_REMOTE_LCD
315 /* remote lcd */ 315 /* remote lcd */
316 int remote_contrast; /* lcd contrast: 0-63 0=low 63=high */ 316 int remote_contrast; /* lcd contrast: 0-63 0=low 63=high */
317 bool remote_invert; /* invert display */ 317 bool remote_invert; /* invert display */
318 bool remote_flip_display; /* turn display (and button layout) by 180 degrees */ 318 bool remote_flip_display; /* turn display (and button layout) by 180 degrees */
diff --git a/apps/sound_menu.c b/apps/sound_menu.c
index 9a67033b54..1b19593b6f 100644
--- a/apps/sound_menu.c
+++ b/apps/sound_menu.c
@@ -380,7 +380,7 @@ static bool recdirectory(void)
380static bool reconstartup(void) 380static bool reconstartup(void)
381{ 381{
382 return set_bool(str(LANG_RECORD_STARTUP), 382 return set_bool(str(LANG_RECORD_STARTUP),
383 &global_settings.rec_startup); 383 &global_settings.rec_startup);
384} 384}
385 385
386#endif /* MAS3587F */ 386#endif /* MAS3587F */
diff --git a/apps/status.c b/apps/status.c
index 03a69dd210..42204a6ee6 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -63,7 +63,7 @@ struct status_info {
63 bool battery_safe; 63 bool battery_safe;
64 bool redraw_volume; /* true if the volume gauge needs updating */ 64 bool redraw_volume; /* true if the volume gauge needs updating */
65#if CONFIG_LED == LED_VIRTUAL 65#if CONFIG_LED == LED_VIRTUAL
66 bool led; /* disk LED simulation in the status bar */ 66 bool led; /* disk LED simulation in the status bar */
67#endif 67#endif
68#ifdef HAVE_USB_POWER 68#ifdef HAVE_USB_POWER
69 bool usb_power; 69 bool usb_power;
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 71f88672ec..d3838f4311 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -808,7 +808,22 @@ static void format_display(char* buf,
808 case 0: 808 case 0:
809 *buf++ = '%'; 809 *buf++ = '%';
810 break; 810 break;
811 811 case 'a':
812 ++fmt;
813 switch (*fmt)
814 {
815 case 'l':
816 *flags |= WPS_ALIGN_LEFT;
817 break;
818 case 'c':
819 *flags |= WPS_ALIGN_CENTER;
820 break;
821 case 'r':
822 *flags |= WPS_ALIGN_RIGHT;
823 break;
824 }
825 ++fmt;
826 break;
812 case 's': 827 case 's':
813 *flags |= WPS_REFRESH_SCROLL; 828 *flags |= WPS_REFRESH_SCROLL;
814 ++fmt; 829 ++fmt;
@@ -830,9 +845,11 @@ static void format_display(char* buf,
830 /* Get filename */ 845 /* Get filename */
831 pos = strchr(ptr, '|'); /* get the second '|' */ 846 pos = strchr(ptr, '|'); /* get the second '|' */
832 if ((pos - ptr) < (int)sizeof(temp_buf)) { 847 if ((pos - ptr) < (int)sizeof(temp_buf)) {
833 memcpy(temp_buf, ptr, pos - ptr); /* get the filename */ 848 memcpy(temp_buf, ptr, pos - ptr);
849 /* get the filename */
834 temp_buf[pos - ptr] = 0; 850 temp_buf[pos - ptr] = 0;
835 snprintf(imgname, MAX_PATH, "/.rockbox/%s", temp_buf); 851 snprintf(imgname, MAX_PATH, "/.rockbox/%s",
852 temp_buf);
836 } 853 }
837 else { 854 else {
838 /* filename too long! */ 855 /* filename too long! */
@@ -1110,8 +1127,27 @@ bool wps_refresh(struct mp3entry* id3,
1110 /* scroll line */ 1127 /* scroll line */
1111 if ((refresh_mode & WPS_REFRESH_SCROLL) || 1128 if ((refresh_mode & WPS_REFRESH_SCROLL) ||
1112 new_subline_refresh) { 1129 new_subline_refresh) {
1113 lcd_puts_scroll(0, i, buf); 1130 int strw,strh;
1131 int ypos,xpos;
1132
1133 lcd_getstringsize(buf, &strw, &strh);
1134 ypos = (i*strh)+lcd_getymargin();
1114 update_line = true; 1135 update_line = true;
1136
1137 if (strw>LCD_WIDTH) {
1138 lcd_puts_scroll(0, i, buf);
1139 } else {
1140 if (flags & WPS_ALIGN_CENTER)
1141 {
1142 xpos = (LCD_WIDTH - strw) / 2;
1143 lcd_putsxy(xpos, ypos, buf);
1144 } else if (flags & WPS_ALIGN_RIGHT) {
1145 xpos = (LCD_WIDTH - strw);
1146 lcd_putsxy(xpos, ypos, buf);
1147 } else {
1148 lcd_putsxy(0, ypos, buf);
1149 }
1150 }
1115 } 1151 }
1116 } 1152 }
1117 else if (flags & (WPS_REFRESH_DYNAMIC | WPS_REFRESH_STATIC)) 1153 else if (flags & (WPS_REFRESH_DYNAMIC | WPS_REFRESH_STATIC))
@@ -1120,8 +1156,21 @@ bool wps_refresh(struct mp3entry* id3,
1120 if ((refresh_mode & (WPS_REFRESH_DYNAMIC|WPS_REFRESH_STATIC)) || 1156 if ((refresh_mode & (WPS_REFRESH_DYNAMIC|WPS_REFRESH_STATIC)) ||
1121 new_subline_refresh) 1157 new_subline_refresh)
1122 { 1158 {
1159 int ypos,xpos;
1160 int strw,strh;
1161
1162 lcd_getstringsize(buf, &strw, &strh);
1163 ypos = (i*strh)+lcd_getymargin();
1123 update_line = true; 1164 update_line = true;
1124 lcd_puts(0, i, buf); 1165 if (flags & WPS_ALIGN_CENTER) {
1166 xpos = (LCD_WIDTH - strw) / 2;
1167 lcd_putsxy(xpos, ypos, buf);
1168 } else if (flags & WPS_ALIGN_RIGHT) {
1169 xpos = (LCD_WIDTH - strw);
1170 lcd_putsxy(xpos, ypos, buf);
1171 } else {
1172 lcd_putsxy(0, ypos, buf);
1173 }
1125 } 1174 }
1126 } 1175 }
1127 } 1176 }
diff --git a/apps/wps-display.h b/apps/wps-display.h
index 2c5651fbe2..b23c0d603d 100644
--- a/apps/wps-display.h
+++ b/apps/wps-display.h
@@ -32,6 +32,11 @@
32/* to refresh only those lines that change over time */ 32/* to refresh only those lines that change over time */
33#define WPS_REFRESH_NON_STATIC (WPS_REFRESH_ALL & ~WPS_REFRESH_STATIC & ~WPS_REFRESH_SCROLL) 33#define WPS_REFRESH_NON_STATIC (WPS_REFRESH_ALL & ~WPS_REFRESH_STATIC & ~WPS_REFRESH_SCROLL)
34 34
35/* alignments */
36#define WPS_ALIGN_RIGHT 32
37#define WPS_ALIGN_CENTER 64
38#define WPS_ALIGN_LEFT 128
39
35 40
36void wps_format_time(char* buf, int buf_size, long time); 41void wps_format_time(char* buf, int buf_size, long time);
37bool wps_refresh(struct mp3entry* id3, struct mp3entry* nid3, 42bool wps_refresh(struct mp3entry* id3, struct mp3entry* nid3,
diff --git a/apps/wps.c b/apps/wps.c
index 70af303bf0..922deb2647 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -660,7 +660,7 @@ long wps_show(void)
660 if (quick_screen(CONTEXT_WPS, WPS_QUICK)) 660 if (quick_screen(CONTEXT_WPS, WPS_QUICK))
661 return SYS_USB_CONNECTED; 661 return SYS_USB_CONNECTED;
662 restore = true; 662 restore = true;
663 lastbutton = 0; 663 lastbutton = 0;
664 break; 664 break;
665 665
666 /* screen settings */ 666 /* screen settings */