summaryrefslogtreecommitdiff
path: root/apps/wps-display.c
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/wps-display.c
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/wps-display.c')
-rw-r--r--apps/wps-display.c59
1 files changed, 54 insertions, 5 deletions
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 }