diff options
Diffstat (limited to 'firmware/drivers/lcd-h100.c')
-rw-r--r-- | firmware/drivers/lcd-h100.c | 38 |
1 files changed, 30 insertions, 8 deletions
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 | } |