diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 6337fa1ea7..b13e4cee90 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -585,8 +585,26 @@ void lcd_putsxy(int x, int y, const unsigned char *str) | |||
585 | 585 | ||
586 | /*** line oriented text output ***/ | 586 | /*** line oriented text output ***/ |
587 | 587 | ||
588 | /* put a string at a given char position */ | ||
589 | void lcd_puts(int x, int y, const unsigned char *str) | ||
590 | { | ||
591 | lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, 0); | ||
592 | } | ||
593 | |||
588 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) | 594 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) |
589 | { | 595 | { |
596 | lcd_puts_style_offset(x, y, str, style, 0); | ||
597 | } | ||
598 | |||
599 | void lcd_puts_offset(int x, int y, const unsigned char *str, int offset) | ||
600 | { | ||
601 | lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, offset); | ||
602 | } | ||
603 | |||
604 | /* put a string at a given char position, style, and pixel position, | ||
605 | * skipping first offset pixel columns */ | ||
606 | void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset) | ||
607 | { | ||
590 | int xpos,ypos,w,h; | 608 | int xpos,ypos,w,h; |
591 | int lastmode = drawmode; | 609 | int lastmode = drawmode; |
592 | 610 | ||
@@ -599,7 +617,7 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) | |||
599 | lcd_getstringsize(str, &w, &h); | 617 | lcd_getstringsize(str, &w, &h); |
600 | xpos = xmargin + x*w / utf8length(str); | 618 | xpos = xmargin + x*w / utf8length(str); |
601 | ypos = ymargin + y*h; | 619 | ypos = ymargin + y*h; |
602 | lcd_putsxy(xpos, ypos, str); | 620 | lcd_putsxyofs(xpos, ypos, offset, str); |
603 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); | 621 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
604 | (void)style; | 622 | (void)style; |
605 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); | 623 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); |
@@ -611,12 +629,6 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) | |||
611 | drawmode = lastmode; | 629 | drawmode = lastmode; |
612 | } | 630 | } |
613 | 631 | ||
614 | /* put a string at a given char position */ | ||
615 | void lcd_puts(int x, int y, const unsigned char *str) | ||
616 | { | ||
617 | lcd_puts_style(x, y, str, STYLE_DEFAULT); | ||
618 | } | ||
619 | |||
620 | /*** scrolling ***/ | 632 | /*** scrolling ***/ |
621 | 633 | ||
622 | /* Reverse the invert setting of the scrolling line (if any) at given char | 634 | /* Reverse the invert setting of the scrolling line (if any) at given char |
@@ -663,6 +675,17 @@ void lcd_puts_scroll(int x, int y, const unsigned char *string) | |||
663 | 675 | ||
664 | void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | 676 | void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) |
665 | { | 677 | { |
678 | lcd_puts_scroll_style_offset(x, y, string, style, 0); | ||
679 | } | ||
680 | |||
681 | void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, int offset) | ||
682 | { | ||
683 | lcd_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset); | ||
684 | } | ||
685 | |||
686 | void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, | ||
687 | int style, int offset) | ||
688 | { | ||
666 | struct scrollinfo* s; | 689 | struct scrollinfo* s; |
667 | int w, h; | 690 | int w, h; |
668 | 691 | ||
@@ -672,10 +695,10 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | |||
672 | s->invert = false; | 695 | s->invert = false; |
673 | if (style & STYLE_INVERT) { | 696 | if (style & STYLE_INVERT) { |
674 | s->invert = true; | 697 | s->invert = true; |
675 | lcd_puts_style(x,y,string,STYLE_INVERT); | 698 | lcd_puts_style_offset(x,y,string,STYLE_INVERT,offset); |
676 | } | 699 | } |
677 | else | 700 | else |
678 | lcd_puts(x,y,string); | 701 | lcd_puts_offset(x,y,string,offset); |
679 | 702 | ||
680 | lcd_getstringsize(string, &w, &h); | 703 | lcd_getstringsize(string, &w, &h); |
681 | 704 | ||
@@ -708,7 +731,7 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) | |||
708 | strncpy(end, string, LCD_WIDTH/2); | 731 | strncpy(end, string, LCD_WIDTH/2); |
709 | 732 | ||
710 | s->len = utf8length(string); | 733 | s->len = utf8length(string); |
711 | s->offset = 0; | 734 | s->offset = offset; |
712 | s->startx = x; | 735 | s->startx = x; |
713 | s->backward = false; | 736 | s->backward = false; |
714 | scrolling_lines |= (1<<y); | 737 | scrolling_lines |= (1<<y); |