From e43b78ac466588d8a0bc95efd7b476495739c47a Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 16 Apr 2003 00:12:31 +0000 Subject: Magnus Ă–man's long awaited inverted cursor patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3565 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd-recorder.c | 27 ++++++++++++++++++++++++--- firmware/export/lcd.h | 6 ++++++ 2 files changed, 30 insertions(+), 3 deletions(-) (limited to 'firmware') diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 6665ea88dc..fcb7d306b8 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c @@ -81,6 +81,7 @@ struct scrollinfo { int starty; bool backward; /* scroll presently forward or backward? */ bool bidir; + bool invert; /* invert the scrolled text */ long start_tick; }; @@ -269,6 +270,11 @@ int lcd_getstringsize(unsigned char *str, int *w, int *h) /* put a string at a given char position */ void lcd_puts(int x, int y, unsigned char *str) +{ + lcd_puts_style(x, y, str, STYLE_DEFAULT); +} + +void lcd_puts_style(int x, int y, unsigned char *str, int style) { int xpos,ypos,w,h; @@ -294,6 +300,8 @@ void lcd_puts(int x, int y, unsigned char *str) ypos = ymargin + y*h; lcd_putsxy(xpos, ypos, str); lcd_clearrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); + if (style & STYLE_INVERT) + lcd_invertrect(xpos, ypos, LCD_WIDTH - xpos, h); #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) lcd_update(); @@ -670,14 +678,19 @@ void lcd_invertpixel(int x, int y) INVERT_PIXEL(x,y); } -void lcd_puts_scroll(int x, int y, unsigned char* string) +void lcd_puts_scroll(int x, int y, unsigned char *string) +{ + lcd_puts_scroll_style(x, y, string, STYLE_DEFAULT); +} + +void lcd_puts_scroll_style(int x, int y, unsigned char *string, int style) { struct scrollinfo* s; int w, h; int index; int free_index=0; - DEBUGF("puts_scroll: %s\n", string); + DEBUGF("puts_scroll_style: %s\n", string); for (index = 0; index < SCROLLABLE_LINES; index++) { s = &scroll[index]; @@ -698,8 +711,14 @@ void lcd_puts_scroll(int x, int y, unsigned char* string) index=free_index; s = &scroll[index]; /* get the proper 's' */ s->start_tick = current_tick + scroll_delay; + s->invert = false; + if (style & STYLE_INVERT) { + s->invert = true; + lcd_puts_style(x,y,string,STYLE_INVERT); + } + else + lcd_puts(x,y,string); - lcd_puts(x,y,string); lcd_getstringsize(string, &w, &h); if (LCD_WIDTH - x * 8 - xmargin < w) { @@ -819,6 +838,8 @@ static void scroll_thread(void) lcd_clearrect(xpos, ypos, LCD_WIDTH - xmargin, h); lcd_putsxyofs(xpos, ypos, s->offset, s->line); + if (s->invert) + lcd_invertrect(xpos, ypos, LCD_WIDTH - xmargin, h); lcd_update_rect(xpos, ypos, LCD_WIDTH - xmargin, h); } diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 74bbcc304e..45d9296555 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -24,14 +24,20 @@ #include "sh7034.h" #include "config.h" +#define STYLE_DEFAULT 0 +#define STYLE_INVERT 1 + /* common functions */ extern void lcd_init(void); extern void lcd_clear_display(void); extern void lcd_backlight(bool on); extern void lcd_puts(int x, int y, unsigned char *string); +extern void lcd_puts_style(int x, int y, unsigned char *string, int style); extern void lcd_putc(int x, int y, unsigned short ch); extern void lcd_puts_scroll(int x, int y, unsigned char* string ); +extern void lcd_puts_scroll_style(int x, int y, unsigned char* string, + int style); extern void lcd_icon(int icon, bool enable); extern void lcd_stop_scroll(void); extern void lcd_scroll_speed( int speed ); -- cgit v1.2.3