1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Kjell Ericson 2003-01-23 14:24:52 +00:00
parent 1b71742d35
commit f5d9584eac
3 changed files with 25 additions and 167 deletions

View file

@ -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)
{

View file

@ -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) {
if (scrolling_lines&(1<<index)) {
if (s->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<<index);
memset(s->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<<index) ) {
lcd_getstringsize(s->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<<index)) )
continue;
/* check pause */

View file

@ -30,14 +30,10 @@ 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_putc(int x, int y, unsigned short ch);
extern void lcd_scroll_pause(void);
extern void lcd_scroll_pause_line(int line);
extern void lcd_scroll_resume(void);
extern void lcd_scroll_resume_line(int line);
extern void lcd_puts_scroll(int x, int y, unsigned char* string );
extern void lcd_icon(int icon, bool enable);
extern void lcd_stop_scroll(void);
extern void lcd_stop_scroll_line(int line);
extern void lcd_scroll_speed( int speed );
extern void lcd_scroll_delay( int ms );
extern void lcd_set_contrast(int val);