diff options
author | Kjell Ericson <kjell@haxx.se> | 2003-05-27 12:54:11 +0000 |
---|---|---|
committer | Kjell Ericson <kjell@haxx.se> | 2003-05-27 12:54:11 +0000 |
commit | 6143eeb22bac4306031bd96307f3428483c09273 (patch) | |
tree | c6d568a5902668ded5cc4b2774f09a578fc98600 /firmware | |
parent | 6f2a1a6127194c92f04b346630cc7e5f2b5436d5 (diff) | |
download | rockbox-6143eeb22bac4306031bd96307f3428483c09273.tar.gz rockbox-6143eeb22bac4306031bd96307f3428483c09273.zip |
Added "jump scroll delay" (for player).
Added that you can set how many times the jump scroll shall occur (max 5 times)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3697 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd-player.c | 33 | ||||
-rw-r--r-- | firmware/export/lcd.h | 4 |
2 files changed, 27 insertions, 10 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c index 2496fb6f66..6e62358da7 100644 --- a/firmware/drivers/lcd-player.c +++ b/firmware/drivers/lcd-player.c | |||
@@ -71,6 +71,7 @@ struct scrollinfo { | |||
71 | long scroll_start_tick; | 71 | long scroll_start_tick; |
72 | int direction; /* +1 for right or -1 for left*/ | 72 | int direction; /* +1 for right or -1 for left*/ |
73 | int jump_scroll; | 73 | int jump_scroll; |
74 | int jump_scroll_steps; | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | #define MAX_CURSOR_CHARS 8 | 77 | #define MAX_CURSOR_CHARS 8 |
@@ -89,10 +90,11 @@ static char scroll_stack[DEFAULT_STACK_SIZE]; | |||
89 | static char scroll_name[] = "scroll"; | 90 | static char scroll_name[] = "scroll"; |
90 | static char scroll_speed = 8; /* updates per second */ | 91 | static char scroll_speed = 8; /* updates per second */ |
91 | static int scroll_delay = HZ/2; /* delay before starting scroll */ | 92 | static int scroll_delay = HZ/2; /* delay before starting scroll */ |
93 | static int jump_scroll_delay = HZ/4; /* delay between jump scroll jumps */ | ||
92 | static char scroll_spacing = 3; /* spaces between end and start of text */ | 94 | static char scroll_spacing = 3; /* spaces between end and start of text */ |
93 | static bool allow_bidirectional_scrolling = true; | 95 | static bool allow_bidirectional_scrolling = true; |
94 | static int bidir_limit = 50; /* percent */ | 96 | static int bidir_limit = 50; /* percent */ |
95 | static int jump_scroll = 0; /* 0=off, 1=once, 2=always */ | 97 | static int jump_scroll = 0; /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */ |
96 | 98 | ||
97 | static struct scrollinfo scroll[SCROLLABLE_LINES]; | 99 | static struct scrollinfo scroll[SCROLLABLE_LINES]; |
98 | 100 | ||
@@ -500,7 +502,7 @@ void lcd_init (void) | |||
500 | sizeof(scroll_stack), scroll_name); | 502 | sizeof(scroll_stack), scroll_name); |
501 | } | 503 | } |
502 | 504 | ||
503 | void lcd_jump_scroll (int mode) /* 0=off, 1=once, 2=always */ | 505 | void lcd_jump_scroll (int mode) /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */ |
504 | { | 506 | { |
505 | jump_scroll=mode; | 507 | jump_scroll=mode; |
506 | } | 508 | } |
@@ -530,8 +532,11 @@ void lcd_puts_scroll(int x, int y, unsigned char* string ) | |||
530 | s->starty=y; | 532 | s->starty=y; |
531 | s->direction=+1; | 533 | s->direction=+1; |
532 | s->jump_scroll=0; | 534 | s->jump_scroll=0; |
533 | if (jump_scroll && scroll_delay/2<(HZ/scroll_speed)*(s->textlen-11+x)) | 535 | s->jump_scroll_steps=0; |
534 | s->jump_scroll=11-x; | 536 | if (jump_scroll && jump_scroll_delay<(HZ/scroll_speed)*(s->textlen-11+x)) { |
537 | s->jump_scroll_steps=11-x; | ||
538 | s->jump_scroll=jump_scroll; | ||
539 | } | ||
535 | strncpy(s->text,string,sizeof s->text); | 540 | strncpy(s->text,string,sizeof s->text); |
536 | s->turn_offset=-1; | 541 | s->turn_offset=-1; |
537 | if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) { | 542 | if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) { |
@@ -584,6 +589,13 @@ void lcd_scroll_delay(int ms) | |||
584 | scroll_delay = ms / (HZ / 10); | 589 | scroll_delay = ms / (HZ / 10); |
585 | DEBUGF("scroll_delay=%d (ms=%d, HZ=%d)\n", scroll_delay, ms, HZ); | 590 | DEBUGF("scroll_delay=%d (ms=%d, HZ=%d)\n", scroll_delay, ms, HZ); |
586 | } | 591 | } |
592 | |||
593 | void lcd_jump_scroll_delay(int ms) | ||
594 | { | ||
595 | jump_scroll_delay = ms / (HZ / 10); | ||
596 | DEBUGF("jump_scroll_delay=%d (ms=%d, HZ=%d)\n", jump_scroll_delay, ms, HZ); | ||
597 | } | ||
598 | |||
587 | static void scroll_thread(void) | 599 | static void scroll_thread(void) |
588 | { | 600 | { |
589 | struct scrollinfo* s; | 601 | struct scrollinfo* s; |
@@ -605,11 +617,12 @@ static void scroll_thread(void) | |||
605 | if ( s->mode == SCROLL_MODE_RUN ) { | 617 | if ( s->mode == SCROLL_MODE_RUN ) { |
606 | if ( TIME_AFTER(current_tick, s->scroll_start_tick) ) { | 618 | if ( TIME_AFTER(current_tick, s->scroll_start_tick) ) { |
607 | char buffer[12]; | 619 | char buffer[12]; |
620 | int jumping_scroll=s->jump_scroll; | ||
608 | update = true; | 621 | update = true; |
609 | if (s->jump_scroll) { | 622 | if (s->jump_scroll) { |
610 | s->offset+=s->jump_scroll; | 623 | s->offset+=s->jump_scroll_steps; |
611 | s->scroll_start_tick = current_tick + | 624 | s->scroll_start_tick = current_tick + |
612 | scroll_delay/2; | 625 | jump_scroll_delay; |
613 | /* Eat space */ | 626 | /* Eat space */ |
614 | while (s->offset < s->textlen && | 627 | while (s->offset < s->textlen && |
615 | s->text[s->offset] == ' ') { | 628 | s->text[s->offset] == ' ') { |
@@ -617,8 +630,10 @@ static void scroll_thread(void) | |||
617 | } | 630 | } |
618 | if (s->offset >= s->textlen) { | 631 | if (s->offset >= s->textlen) { |
619 | s->offset=0; | 632 | s->offset=0; |
620 | if (jump_scroll!=2) { | 633 | s->scroll_start_tick = current_tick + |
621 | s->jump_scroll=0; | 634 | scroll_delay; |
635 | if (s->jump_scroll != JUMP_SCROLL_ALWAYS) { | ||
636 | s->jump_scroll--; | ||
622 | s->direction=1; | 637 | s->direction=1; |
623 | } | 638 | } |
624 | } | 639 | } |
@@ -650,7 +665,7 @@ static void scroll_thread(void) | |||
650 | break; | 665 | break; |
651 | } | 666 | } |
652 | o=0; | 667 | o=0; |
653 | if (s->turn_offset == -1 && !s->jump_scroll) { | 668 | if (s->turn_offset == -1 && !jumping_scroll) { |
654 | while (i<11) { | 669 | while (i<11) { |
655 | buffer[i++]=s->text[o++]; | 670 | buffer[i++]=s->text[o++]; |
656 | } | 671 | } |
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index ff955e170b..0818f9d92e 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -87,7 +87,9 @@ enum | |||
87 | extern void lcd_define_hw_pattern (int which,char *pattern,int length); | 87 | extern void lcd_define_hw_pattern (int which,char *pattern,int length); |
88 | extern void lcd_define_pattern (int which,char *pattern); | 88 | extern void lcd_define_pattern (int which,char *pattern); |
89 | extern void lcd_double_height (bool on); | 89 | extern void lcd_double_height (bool on); |
90 | extern void lcd_jump_scroll (int mode); /* 0=off, 1=once, 2=always */ | 90 | #define JUMP_SCROLL_ALWAYS 5 |
91 | extern void lcd_jump_scroll (int mode); /* 0=off, 1=once, ..., ALWAYS */ | ||
92 | extern void lcd_jump_scroll_delay( int ms ); | ||
91 | unsigned char lcd_get_locked_pattern(void); | 93 | unsigned char lcd_get_locked_pattern(void); |
92 | void lcd_unlock_pattern(unsigned char pat); | 94 | void lcd_unlock_pattern(unsigned char pat); |
93 | void lcd_allow_bidirectional_scrolling(bool on); | 95 | void lcd_allow_bidirectional_scrolling(bool on); |