diff options
Diffstat (limited to 'firmware/drivers/lcd-recorder.c')
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 41 |
1 files changed, 32 insertions, 9 deletions
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 | } |