From f5d9584eacc2eeaea7665169a12df4055c5d1de1 Mon Sep 17 00:00:00 2001 From: Kjell Ericson Date: Thu, 23 Jan 2003 14:24:52 +0000 Subject: Removed lcd_scroll_pause() and lcd_scroll_resume(). lcd_stop_scroll() doesn't redraw the screen anymore. lcd_clear_display() stops and forgets all scrolls. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3153 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd-player.c | 59 ------------------- firmware/drivers/lcd-recorder.c | 127 ++++++++-------------------------------- firmware/drivers/lcd.h | 6 +- 3 files changed, 25 insertions(+), 167 deletions(-) (limited to 'firmware/drivers') diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c index 189cb0e899..1333a152f4 100644 --- a/firmware/drivers/lcd-player.c +++ b/firmware/drivers/lcd-player.c @@ -506,65 +506,6 @@ void lcd_stop_scroll(void) lcd_update(); } -void lcd_stop_scroll_line(int line) -{ - struct scrollinfo* s; - - s = &scroll[line]; - if ( s->mode == SCROLL_MODE_RUN || - s->mode == SCROLL_MODE_PAUSE ) { - /* restore scrolled row */ - lcd_puts(s->startx, s->starty, s->text); - } - - lcd_update(); -} - -void lcd_scroll_pause(void) -{ - struct scrollinfo* s; - int index; - - for ( index = 0; index < SCROLLABLE_LINES; index++ ) { - s = &scroll[index]; - if ( s->mode == SCROLL_MODE_RUN ) { - s->mode = SCROLL_MODE_PAUSE; - } - } -} - -void lcd_scroll_pause_line(int line) -{ - struct scrollinfo* s; - - s = &scroll[line]; - if ( s->mode == SCROLL_MODE_RUN ) { - s->mode = SCROLL_MODE_PAUSE; - } -} - -void lcd_scroll_resume(void) -{ - struct scrollinfo* s; - int index; - - for ( index = 0; index < SCROLLABLE_LINES; index++ ) { - s = &scroll[index]; - if ( s->mode == SCROLL_MODE_PAUSE ) { - s->mode = SCROLL_MODE_RUN; - } - } -} - -void lcd_scroll_resume_line(int line) -{ - struct scrollinfo* s; - - s = &scroll[line]; - if (s->mode == SCROLL_MODE_PAUSE ) { - s->mode = SCROLL_MODE_RUN; - } -} void lcd_allow_bidirectional_scrolling(bool on) { diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 08f14ea764..84fb486b8e 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c @@ -72,12 +72,7 @@ #define SCROLLABLE_LINES 10 -#define SCROLL_MODE_OFF 0 -#define SCROLL_MODE_PAUSE 1 -#define SCROLL_MODE_RUN 2 - struct scrollinfo { - int mode; char line[MAX_PATH + LCD_WIDTH/2 + SCROLL_SPACING + 2]; int len; /* length of line in chars */ int width; /* length of line in pixels */ @@ -89,6 +84,8 @@ struct scrollinfo { long start_tick; }; +static int scrolling_lines=0; /* Bitpattern of which lines are scrolling */ + static void scroll_thread(void); static char scroll_stack[DEFAULT_STACK_SIZE]; static char scroll_name[] = "scroll"; @@ -215,7 +212,9 @@ void lcd_roll(int lines) void lcd_clear_display (void) { + DEBUGF("lcd_clear_display()\n"); memset (lcd_framebuffer, 0, sizeof lcd_framebuffer); + scrolling_lines = 0; } void lcd_setmargins(int x, int y) @@ -245,6 +244,7 @@ int lcd_getstringsize(unsigned char *str, int *w, int *h) int ch; int width = 0; + /* DEBUGF("lcd_getstringsize('%s')\n", str); */ while((ch = *str++)) { /* check input range*/ if (ch < pf->firstchar || ch >= pf->firstchar+pf->size) @@ -258,7 +258,6 @@ int lcd_getstringsize(unsigned char *str, int *w, int *h) *w = width; if ( h ) *h = pf->height; - return width; } @@ -670,14 +669,21 @@ void lcd_puts_scroll(int x, int y, unsigned char* string) struct scrollinfo* s; int w, h; int index; + int free_index=0; - /* search for the next free entry */ + DEBUGF("lcd_puts_scroll(%d, %d, %s)\n", x, y, string); for (index = 0; index < SCROLLABLE_LINES; index++) { s = &scroll[index]; - if (s->mode == SCROLL_MODE_OFF) { - break; - } + if (scrolling_lines&(1<starty == y) { + free_index=index; + break; + } + } else + free_index=index; } + index=free_index; + s->start_tick = current_tick + scroll_delay; lcd_puts(x,y,string); @@ -687,6 +693,7 @@ void lcd_puts_scroll(int x, int y, unsigned char* string) /* prepare scroll line */ char *end; + scrolling_lines|=(1<line, 0, sizeof s->line); strcpy(s->line, string); @@ -710,7 +717,6 @@ void lcd_puts_scroll(int x, int y, unsigned char* string) for (end = s->line; *end; end++); strncpy(end, string, LCD_WIDTH/2); - s->mode = SCROLL_MODE_RUN; s->len = strlen(string); s->offset = 0; s->startx = x; @@ -721,15 +727,15 @@ void lcd_puts_scroll(int x, int y, unsigned char* string) void lcd_stop_scroll(void) { + DEBUGF("lcd_stop_scroll()\n"); +#if 0 struct scrollinfo* s; int w,h; int index; int update=0; - for ( index = 0; index < SCROLLABLE_LINES; index++ ) { s = &scroll[index]; - if ( s->mode == SCROLL_MODE_RUN || - s->mode == SCROLL_MODE_PAUSE ) { + if ( scrolling_lines&(1<line, &w, &h); lcd_clearrect(xmargin + s->startx * w / s->len, ymargin + s->starty * h, @@ -738,96 +744,13 @@ void lcd_stop_scroll(void) /* restore scrolled row */ lcd_puts(s->startx, s->starty, s->line); - s->mode = SCROLL_MODE_OFF; update++; } } - if(update) lcd_update(); /* update only if needed */ -} - -void lcd_stop_scroll_line(int line) -{ - struct scrollinfo* s; - int w,h; - int index; - int update=0; - - for ( index = 0; index < SCROLLABLE_LINES; index++ ) { - s = &scroll[index]; - if ( s->startx == line && - ( s->mode == SCROLL_MODE_RUN || - s->mode == SCROLL_MODE_PAUSE )) { - lcd_getstringsize(s->line, &w, &h); - lcd_clearrect(xmargin + s->startx * w / s->len, - ymargin + s->starty * h, - LCD_WIDTH - xmargin, - h); - - /* restore scrolled row */ - lcd_puts(s->startx, s->starty, s->line); - s->mode = SCROLL_MODE_OFF; - update++; - } - } - if(update) - /* only updated if need be */ - lcd_update(); -} - -void lcd_scroll_pause(void) -{ - struct scrollinfo* s; - int index; - - for ( index = 0; index < SCROLLABLE_LINES; index++ ) { - s = &scroll[index]; - if ( s->mode == SCROLL_MODE_RUN ) { - s->mode = SCROLL_MODE_PAUSE; - } - } -} - -void lcd_scroll_pause_line(int line) -{ - struct scrollinfo* s; - int index; - - for ( index = 0; index < SCROLLABLE_LINES; index++ ) { - s = &scroll[index]; - if ( s->startx == line && - s->mode == SCROLL_MODE_RUN ) { - s->mode = SCROLL_MODE_PAUSE; - } - } -} - -void lcd_scroll_resume(void) -{ - struct scrollinfo* s; - int index; - - for ( index = 0; index < SCROLLABLE_LINES; index++ ) { - s = &scroll[index]; - if ( s->mode == SCROLL_MODE_PAUSE ) { - s->mode = SCROLL_MODE_RUN; - } - } -} - -void lcd_scroll_resume_line(int line) -{ - struct scrollinfo* s; - int index; - - for ( index = 0; index < SCROLLABLE_LINES; index++ ) { - s = &scroll[index]; - if ( s->startx == line && - s->mode == SCROLL_MODE_PAUSE ) { - s->mode = SCROLL_MODE_RUN; - } - } +#endif + scrolling_lines=0; } void lcd_scroll_speed(int speed) @@ -857,16 +780,14 @@ static void scroll_thread(void) int xpos, ypos; /* initialize scroll struct array */ - for (index = 0; index < SCROLLABLE_LINES; index++) { - scroll[index].mode = SCROLL_MODE_OFF; - } + scrolling_lines = 0; while ( 1 ) { for ( index = 0; index < SCROLLABLE_LINES; index++ ) { s = &scroll[index]; /* really scroll? */ - if ( s->mode != SCROLL_MODE_RUN ) + if ( !(scrolling_lines&(1<