diff options
author | Tomas Salfischberger <tomas@rockbox.org> | 2006-01-22 01:42:05 +0000 |
---|---|---|
committer | Tomas Salfischberger <tomas@rockbox.org> | 2006-01-22 01:42:05 +0000 |
commit | 7fa39df4277fba4b567a57c79a8933afc96d9339 (patch) | |
tree | 89b5fcf1e0f6f80828e5ebe41531151b88de4b75 /firmware/drivers | |
parent | ee6a95a7d188e4d53f43e35713f0e1c9efe34236 (diff) | |
download | rockbox-7fa39df4277fba4b567a57c79a8933afc96d9339.tar.gz rockbox-7fa39df4277fba4b567a57c79a8933afc96d9339.zip |
Horizontal scrolling patch by Shachar Liberman
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8412 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd-h100-remote.c | 31 | ||||
-rw-r--r-- | firmware/drivers/lcd-h100.c | 38 | ||||
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 41 |
3 files changed, 89 insertions, 21 deletions
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c index a2fe63ee97..a28cd2f4e5 100644 --- a/firmware/drivers/lcd-h100-remote.c +++ b/firmware/drivers/lcd-h100-remote.c | |||
@@ -1143,6 +1143,17 @@ void lcd_remote_puts(int x, int y, const unsigned char *str) | |||
1143 | 1143 | ||
1144 | void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style) | 1144 | void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style) |
1145 | { | 1145 | { |
1146 | lcd_remote_puts_style_offset(x, y, str, style, 0); | ||
1147 | } | ||
1148 | |||
1149 | void lcd_remote_puts_offset(int x, int y, const unsigned char *str, int offset) | ||
1150 | { | ||
1151 | lcd_remote_puts_style_offset(x, y, str, STYLE_DEFAULT, offset); | ||
1152 | } | ||
1153 | |||
1154 | /* put a string at a given char position at a given style and with a given offset */ | ||
1155 | void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset) | ||
1156 | { | ||
1146 | int xpos,ypos,w,h; | 1157 | int xpos,ypos,w,h; |
1147 | int lastmode = drawmode; | 1158 | int lastmode = drawmode; |
1148 | 1159 | ||
@@ -1155,7 +1166,7 @@ void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style) | |||
1155 | lcd_remote_getstringsize(str, &w, &h); | 1166 | lcd_remote_getstringsize(str, &w, &h); |
1156 | xpos = xmargin + x*w / utf8length((char *)str); | 1167 | xpos = xmargin + x*w / utf8length((char *)str); |
1157 | ypos = ymargin + y*h; | 1168 | ypos = ymargin + y*h; |
1158 | lcd_remote_putsxy(xpos, ypos, str); | 1169 | lcd_remote_putsxyofs(xpos, ypos, offset, str); |
1159 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); | 1170 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
1160 | lcd_remote_fillrect(xpos + w, ypos, LCD_REMOTE_WIDTH - (xpos + w), h); | 1171 | lcd_remote_fillrect(xpos + w, ypos, LCD_REMOTE_WIDTH - (xpos + w), h); |
1161 | if (style & STYLE_INVERT) | 1172 | if (style & STYLE_INVERT) |
@@ -1212,6 +1223,17 @@ void lcd_remote_puts_scroll(int x, int y, const unsigned char *string) | |||
1212 | 1223 | ||
1213 | void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int style) | 1224 | void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int style) |
1214 | { | 1225 | { |
1226 | lcd_remote_puts_scroll_style_offset(x, y, string, style, 0); | ||
1227 | } | ||
1228 | |||
1229 | void lcd_remote_puts_scroll_offset(int x, int y, const unsigned char *string, int offset) | ||
1230 | { | ||
1231 | lcd_remote_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset); | ||
1232 | } | ||
1233 | |||
1234 | void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *string, | ||
1235 | int style, int offset) | ||
1236 | { | ||
1215 | struct scrollinfo* s; | 1237 | struct scrollinfo* s; |
1216 | int w, h; | 1238 | int w, h; |
1217 | 1239 | ||
@@ -1221,10 +1243,10 @@ void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int | |||
1221 | s->invert = false; | 1243 | s->invert = false; |
1222 | if (style & STYLE_INVERT) { | 1244 | if (style & STYLE_INVERT) { |
1223 | s->invert = true; | 1245 | s->invert = true; |
1224 | lcd_remote_puts_style(x,y,string,STYLE_INVERT); | 1246 | lcd_remote_puts_style_offset(x,y,string,STYLE_INVERT,offset); |
1225 | } | 1247 | } |
1226 | else | 1248 | else |
1227 | lcd_remote_puts(x,y,string); | 1249 | lcd_remote_puts_offset(x,y,string,offset); |
1228 | 1250 | ||
1229 | lcd_remote_getstringsize(string, &w, &h); | 1251 | lcd_remote_getstringsize(string, &w, &h); |
1230 | 1252 | ||
@@ -1257,7 +1279,7 @@ void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int | |||
1257 | strncpy(end, (char *)string, LCD_REMOTE_WIDTH/2); | 1279 | strncpy(end, (char *)string, LCD_REMOTE_WIDTH/2); |
1258 | 1280 | ||
1259 | s->len = utf8length((char *)string); | 1281 | s->len = utf8length((char *)string); |
1260 | s->offset = 0; | 1282 | s->offset = offset; |
1261 | s->startx = x; | 1283 | s->startx = x; |
1262 | s->backward = false; | 1284 | s->backward = false; |
1263 | scrolling_lines |= (1<<y); | 1285 | scrolling_lines |= (1<<y); |
@@ -1267,6 +1289,7 @@ void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int | |||
1267 | scrolling_lines &= ~(1<<y); | 1289 | scrolling_lines &= ~(1<<y); |
1268 | } | 1290 | } |
1269 | 1291 | ||
1292 | |||
1270 | static void scroll_thread(void) | 1293 | static void scroll_thread(void) |
1271 | { | 1294 | { |
1272 | struct font* pf; | 1295 | struct font* pf; |
diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c index 1199bf04a1..0df1a3c71a 100644 --- a/firmware/drivers/lcd-h100.c +++ b/firmware/drivers/lcd-h100.c | |||
@@ -1057,7 +1057,9 @@ void lcd_putsxy(int x, int y, const unsigned char *str) | |||
1057 | 1057 | ||
1058 | /*** line oriented text output ***/ | 1058 | /*** line oriented text output ***/ |
1059 | 1059 | ||
1060 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) | 1060 | /* put a string at a given char position at a given style and with a given pixel position */ |
1061 | void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style, | ||
1062 | int offset) | ||
1061 | { | 1063 | { |
1062 | int xpos,ypos,w,h; | 1064 | int xpos,ypos,w,h; |
1063 | int lastmode = drawmode; | 1065 | int lastmode = drawmode; |
@@ -1071,7 +1073,7 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) | |||
1071 | lcd_getstringsize(str, &w, &h); | 1073 | lcd_getstringsize(str, &w, &h); |
1072 | xpos = xmargin + x*w / utf8length((char *)str); | 1074 | xpos = xmargin + x*w / utf8length((char *)str); |
1073 | ypos = ymargin + y*h; | 1075 | ypos = ymargin + y*h; |
1074 | lcd_putsxy(xpos, ypos, str); | 1076 | lcd_putsxyofs(xpos, ypos, offset, str); |
1075 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); | 1077 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
1076 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); | 1078 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); |
1077 | if (style & STYLE_INVERT) | 1079 | if (style & STYLE_INVERT) |
@@ -1081,6 +1083,16 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) | |||
1081 | } | 1083 | } |
1082 | drawmode = lastmode; | 1084 | drawmode = lastmode; |
1083 | } | 1085 | } |
1086 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) | ||
1087 | { | ||
1088 | lcd_puts_style_offset(x, y, str, style, 0); | ||
1089 | } | ||
1090 | |||
1091 | /* put a string at a given char position at a given offset mark */ | ||
1092 | void lcd_puts_offset(int x, int y, const unsigned char *str, int offset) | ||
1093 | { | ||
1094 | lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, offset); | ||
1095 | } | ||
1084 | 1096 | ||
1085 | /* put a string at a given char position */ | 1097 | /* put a string at a given char position */ |
1086 | void lcd_puts(int x, int y, const unsigned char *str) | 1098 | void lcd_puts(int x, int y, const unsigned char *str) |
@@ -1134,6 +1146,17 @@ void lcd_puts_scroll(int x, int y, const unsigned char *string) | |||
1134 | 1146 | ||
1135 | void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | 1147 | void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) |
1136 | { | 1148 | { |
1149 | lcd_puts_scroll_style_offset(x, y, string, style, 0); | ||
1150 | } | ||
1151 | |||
1152 | void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, int offset) | ||
1153 | { | ||
1154 | lcd_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset); | ||
1155 | } | ||
1156 | |||
1157 | void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, | ||
1158 | int style, int offset) | ||
1159 | { | ||
1137 | struct scrollinfo* s; | 1160 | struct scrollinfo* s; |
1138 | int w, h; | 1161 | int w, h; |
1139 | 1162 | ||
@@ -1143,10 +1166,10 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | |||
1143 | s->invert = false; | 1166 | s->invert = false; |
1144 | if (style & STYLE_INVERT) { | 1167 | if (style & STYLE_INVERT) { |
1145 | s->invert = true; | 1168 | s->invert = true; |
1146 | lcd_puts_style(x,y,string,STYLE_INVERT); | 1169 | lcd_puts_style_offset(x,y,string,STYLE_INVERT,offset); |
1147 | } | 1170 | } |
1148 | else | 1171 | else |
1149 | lcd_puts(x,y,string); | 1172 | lcd_puts_offset(x,y,string,offset); |
1150 | 1173 | ||
1151 | lcd_getstringsize(string, &w, &h); | 1174 | lcd_getstringsize(string, &w, &h); |
1152 | 1175 | ||
@@ -1179,7 +1202,7 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | |||
1179 | strncpy(end, (char *)string, LCD_WIDTH/2); | 1202 | strncpy(end, (char *)string, LCD_WIDTH/2); |
1180 | 1203 | ||
1181 | s->len = utf8length((char *)string); | 1204 | s->len = utf8length((char *)string); |
1182 | s->offset = 0; | 1205 | s->offset = offset; |
1183 | s->startx = x; | 1206 | s->startx = x; |
1184 | s->backward = false; | 1207 | s->backward = false; |
1185 | scrolling_lines |= (1<<y); | 1208 | scrolling_lines |= (1<<y); |
@@ -1203,7 +1226,7 @@ static void scroll_thread(void) | |||
1203 | while ( 1 ) { | 1226 | while ( 1 ) { |
1204 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { | 1227 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { |
1205 | /* really scroll? */ | 1228 | /* really scroll? */ |
1206 | if ( !(scrolling_lines&(1<<index)) ) | 1229 | if ( !(scrolling_lines&(1<<index))) |
1207 | continue; | 1230 | continue; |
1208 | 1231 | ||
1209 | s = &scroll[index]; | 1232 | s = &scroll[index]; |
@@ -1246,8 +1269,7 @@ static void scroll_thread(void) | |||
1246 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); | 1269 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
1247 | drawmode = DRMODE_SOLID; | 1270 | drawmode = DRMODE_SOLID; |
1248 | lcd_putsxyofs(xpos, ypos, s->offset, (unsigned char *)s->line); | 1271 | lcd_putsxyofs(xpos, ypos, s->offset, (unsigned char *)s->line); |
1249 | if (s->invert) | 1272 | if (s->invert) { |
1250 | { | ||
1251 | drawmode = DRMODE_COMPLEMENT; | 1273 | drawmode = DRMODE_COMPLEMENT; |
1252 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); | 1274 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
1253 | } | 1275 | } |
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 523e8a1c09..9f8a2b6568 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c | |||
@@ -917,7 +917,9 @@ void lcd_putsxy(int x, int y, const unsigned char *str) | |||
917 | 917 | ||
918 | /*** Line oriented text output ***/ | 918 | /*** Line oriented text output ***/ |
919 | 919 | ||
920 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) | 920 | /* put a string at a given char position at a given style and with a given pixel position */ |
921 | void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style, | ||
922 | int offset) | ||
921 | { | 923 | { |
922 | int xpos,ypos,w,h; | 924 | int xpos,ypos,w,h; |
923 | int lastmode = drawmode; | 925 | int lastmode = drawmode; |
@@ -931,7 +933,7 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) | |||
931 | lcd_getstringsize(str, &w, &h); | 933 | lcd_getstringsize(str, &w, &h); |
932 | xpos = xmargin + x*w / utf8length(str); | 934 | xpos = xmargin + x*w / utf8length(str); |
933 | ypos = ymargin + y*h; | 935 | ypos = ymargin + y*h; |
934 | lcd_putsxy(xpos, ypos, str); | 936 | lcd_putsxyofs(xpos, ypos, offset, str); |
935 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); | 937 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
936 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); | 938 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); |
937 | if (style & STYLE_INVERT) | 939 | if (style & STYLE_INVERT) |
@@ -942,10 +944,21 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) | |||
942 | drawmode = lastmode; | 944 | drawmode = lastmode; |
943 | } | 945 | } |
944 | 946 | ||
947 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) | ||
948 | { | ||
949 | lcd_puts_style_offset(x, y, str, style, 0); | ||
950 | } | ||
951 | |||
952 | /* put a string at a given char position at a given offset mark */ | ||
953 | void lcd_puts_offset(int x, int y, const unsigned char *str, int offset) | ||
954 | { | ||
955 | lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, offset); | ||
956 | } | ||
957 | |||
945 | /* put a string at a given char position */ | 958 | /* put a string at a given char position */ |
946 | void lcd_puts(int x, int y, const unsigned char *str) | 959 | void lcd_puts(int x, int y, const unsigned char *str) |
947 | { | 960 | { |
948 | lcd_puts_style(x, y, str, STYLE_DEFAULT); | 961 | lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, 0); |
949 | } | 962 | } |
950 | 963 | ||
951 | /*** scrolling ***/ | 964 | /*** scrolling ***/ |
@@ -989,11 +1002,22 @@ void lcd_bidir_scroll(int percent) | |||
989 | 1002 | ||
990 | void lcd_puts_scroll(int x, int y, const unsigned char *string) | 1003 | void lcd_puts_scroll(int x, int y, const unsigned char *string) |
991 | { | 1004 | { |
992 | lcd_puts_scroll_style(x, y, string, STYLE_DEFAULT); | 1005 | lcd_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, 0); |
993 | } | 1006 | } |
994 | 1007 | ||
1008 | void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, int offset) | ||
1009 | { | ||
1010 | lcd_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset); | ||
1011 | } | ||
1012 | |||
995 | void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | 1013 | void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) |
996 | { | 1014 | { |
1015 | lcd_puts_scroll_style_offset(x, y, string, style, 0); | ||
1016 | } | ||
1017 | |||
1018 | void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, | ||
1019 | int style, int offset) | ||
1020 | { | ||
997 | struct scrollinfo* s; | 1021 | struct scrollinfo* s; |
998 | int w, h; | 1022 | int w, h; |
999 | 1023 | ||
@@ -1003,10 +1027,10 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | |||
1003 | s->invert = false; | 1027 | s->invert = false; |
1004 | if (style & STYLE_INVERT) { | 1028 | if (style & STYLE_INVERT) { |
1005 | s->invert = true; | 1029 | s->invert = true; |
1006 | lcd_puts_style(x,y,string,STYLE_INVERT); | 1030 | lcd_puts_style_offset(x,y,string,STYLE_INVERT,offset); |
1007 | } | 1031 | } |
1008 | else | 1032 | else |
1009 | lcd_puts(x,y,string); | 1033 | lcd_puts_offset(x,y,string,offset); |
1010 | 1034 | ||
1011 | lcd_getstringsize(string, &w, &h); | 1035 | lcd_getstringsize(string, &w, &h); |
1012 | 1036 | ||
@@ -1039,7 +1063,7 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | |||
1039 | strncpy(end, string, LCD_WIDTH/2); | 1063 | strncpy(end, string, LCD_WIDTH/2); |
1040 | 1064 | ||
1041 | s->len = utf8length(string); | 1065 | s->len = utf8length(string); |
1042 | s->offset = 0; | 1066 | s->offset = offset; |
1043 | s->startx = x; | 1067 | s->startx = x; |
1044 | s->backward = false; | 1068 | s->backward = false; |
1045 | scrolling_lines |= (1<<y); | 1069 | scrolling_lines |= (1<<y); |
@@ -1106,8 +1130,7 @@ static void scroll_thread(void) | |||
1106 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); | 1130 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
1107 | drawmode = DRMODE_SOLID; | 1131 | drawmode = DRMODE_SOLID; |
1108 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); | 1132 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); |
1109 | if (s->invert) | 1133 | if (s->invert) { |
1110 | { | ||
1111 | drawmode = DRMODE_COMPLEMENT; | 1134 | drawmode = DRMODE_COMPLEMENT; |
1112 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); | 1135 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
1113 | } | 1136 | } |