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
This commit is contained in:
Kjell Ericson 2003-05-27 12:54:11 +00:00
parent 6f2a1a6127
commit 6143eeb22b
6 changed files with 58 additions and 14 deletions

View file

@ -1532,3 +1532,8 @@ id: LANG_ALWAYS
desc: (player) the jump scroll shall be done "always"
eng: "Always"
new:
id: LANG_JUMP_SCROLL_DELAY
desc: (player) Delay before making a jump scroll
eng: "Jump Scroll Delay"
new:

View file

@ -145,6 +145,7 @@ Rest of config block, only saved to disk:
0xF8 (int) Playlist shuffle seed
0xFC (char[260]) Resume playlist (path/to/dir or path/to/playlist.m3u)
0xFD (char)jump scroll mode (only for player)
0xFE (char)jump scroll delay (only for player)
*************************************/
@ -414,6 +415,7 @@ int settings_save( void )
strncpy(&config_block[0xFC], global_settings.resume_file, MAX_PATH);
#ifdef HAVE_LCD_CHARCELLS
config_block[0xfd]=(unsigned char)global_settings.jump_scroll;
config_block[0xfe]=(unsigned char)global_settings.jump_scroll_delay;
#endif
DEBUGF( "+Resume file %s\n",global_settings.resume_file );
DEBUGF( "+Resume index %X offset %X\n",
@ -533,6 +535,7 @@ void settings_apply(void)
lcd_scroll_step(global_settings.scroll_step);
#else
lcd_jump_scroll(global_settings.jump_scroll);
lcd_jump_scroll_delay(global_settings.jump_scroll_delay);
#endif
lcd_bidir_scroll(global_settings.bidir_limit);
lcd_scroll_delay(global_settings.scroll_delay * (HZ/10));
@ -735,6 +738,8 @@ void settings_load(void)
#ifdef HAVE_LCD_CHARSCELLS
if (config_block[0xfd] != 0xff)
global_settings.jump_scroll = config_block[0xfd];
if (config_block[0xfe] != 0xff)
global_settings.jump_scroll_delay = config_block[0xfe];
#endif
global_settings.resume_file[MAX_PATH]=0;
}
@ -1228,6 +1233,7 @@ bool settings_save_config(void)
fprintf(fd, "scroll step: %d\r\n", global_settings.scroll_step);
#else
fprintf(fd, "jump scroll: %d\r\n", global_settings.jump_scroll);
fprintf(fd, "jump scroll delay: %d\r\n", global_settings.jump_scroll_delay);
#endif
fprintf(fd, "bidir limit: %d\r\n", global_settings.bidir_limit);
@ -1406,6 +1412,7 @@ void settings_reset(void) {
global_settings.bidir_limit = 50;
#ifdef HAVE_LCD_CHARCELLS
global_settings.jump_scroll = 1;
global_settings.jump_scroll_delay = 50;
#endif
global_settings.scroll_delay = 100;
global_settings.scroll_step = 6;

View file

@ -153,6 +153,7 @@ struct user_settings
int scroll_step; /* pixels to advance per update */
#ifdef HAVE_LCD_CHARCELLS
int jump_scroll; /* Fast jump when scrolling */
int jump_scroll_delay; /* Delay between jump scroll screens */
#endif
bool fade_on_stop; /* fade on pause/unpause/stop */
bool caption_backlight; /* turn on backlight at end and start of track */

View file

@ -459,10 +459,23 @@ static bool bidir_limit(void)
#ifdef HAVE_LCD_CHARCELLS
static bool jump_scroll(void)
{
char* names[] = { str(LANG_OFF), str(LANG_ONE_TIME), str(LANG_ALWAYS)};
return set_option(str(LANG_JUMP_SCROLL), &global_settings.jump_scroll,
names, 3, lcd_jump_scroll);
char* names[] = { str(LANG_OFF), str(LANG_ONE_TIME), "2",
"3", "4", str(LANG_ALWAYS)};
bool ret;
ret=set_option(str(LANG_JUMP_SCROLL), &global_settings.jump_scroll,
names, 6, lcd_jump_scroll);
if (!ret && global_settings.jump_scroll>=JUMP_SCROLL_ALWAYS) {
global_settings.jump_scroll=254; /* Nice future "safe" value */
}
return ret;
}
static bool jump_scroll_delay(void)
{
int dummy = global_settings.jump_scroll_delay * (HZ/10);
int rc = set_int(str(LANG_JUMP_SCROLL_DELAY), "ms", &dummy,
&lcd_jump_scroll_delay, 100, 0, 2500 );
global_settings.jump_scroll_delay = dummy / (HZ/10);
return rc;
}
#endif
@ -761,6 +774,7 @@ static bool scroll_settings_menu(void)
{ str(LANG_BIDIR_SCROLL), bidir_limit },
#ifdef HAVE_LCD_CHARCELLS
{ str(LANG_JUMP_SCROLL), jump_scroll },
{ str(LANG_JUMP_SCROLL_DELAY), jump_scroll_delay },
#endif
};

View file

@ -71,6 +71,7 @@ struct scrollinfo {
long scroll_start_tick;
int direction; /* +1 for right or -1 for left*/
int jump_scroll;
int jump_scroll_steps;
};
#define MAX_CURSOR_CHARS 8
@ -89,10 +90,11 @@ static char scroll_stack[DEFAULT_STACK_SIZE];
static char scroll_name[] = "scroll";
static char scroll_speed = 8; /* updates per second */
static int scroll_delay = HZ/2; /* delay before starting scroll */
static int jump_scroll_delay = HZ/4; /* delay between jump scroll jumps */
static char scroll_spacing = 3; /* spaces between end and start of text */
static bool allow_bidirectional_scrolling = true;
static int bidir_limit = 50; /* percent */
static int jump_scroll = 0; /* 0=off, 1=once, 2=always */
static int jump_scroll = 0; /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */
static struct scrollinfo scroll[SCROLLABLE_LINES];
@ -500,7 +502,7 @@ void lcd_init (void)
sizeof(scroll_stack), scroll_name);
}
void lcd_jump_scroll (int mode) /* 0=off, 1=once, 2=always */
void lcd_jump_scroll (int mode) /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */
{
jump_scroll=mode;
}
@ -530,8 +532,11 @@ void lcd_puts_scroll(int x, int y, unsigned char* string )
s->starty=y;
s->direction=+1;
s->jump_scroll=0;
if (jump_scroll && scroll_delay/2<(HZ/scroll_speed)*(s->textlen-11+x))
s->jump_scroll=11-x;
s->jump_scroll_steps=0;
if (jump_scroll && jump_scroll_delay<(HZ/scroll_speed)*(s->textlen-11+x)) {
s->jump_scroll_steps=11-x;
s->jump_scroll=jump_scroll;
}
strncpy(s->text,string,sizeof s->text);
s->turn_offset=-1;
if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) {
@ -584,6 +589,13 @@ void lcd_scroll_delay(int ms)
scroll_delay = ms / (HZ / 10);
DEBUGF("scroll_delay=%d (ms=%d, HZ=%d)\n", scroll_delay, ms, HZ);
}
void lcd_jump_scroll_delay(int ms)
{
jump_scroll_delay = ms / (HZ / 10);
DEBUGF("jump_scroll_delay=%d (ms=%d, HZ=%d)\n", jump_scroll_delay, ms, HZ);
}
static void scroll_thread(void)
{
struct scrollinfo* s;
@ -605,11 +617,12 @@ static void scroll_thread(void)
if ( s->mode == SCROLL_MODE_RUN ) {
if ( TIME_AFTER(current_tick, s->scroll_start_tick) ) {
char buffer[12];
int jumping_scroll=s->jump_scroll;
update = true;
if (s->jump_scroll) {
s->offset+=s->jump_scroll;
s->offset+=s->jump_scroll_steps;
s->scroll_start_tick = current_tick +
scroll_delay/2;
jump_scroll_delay;
/* Eat space */
while (s->offset < s->textlen &&
s->text[s->offset] == ' ') {
@ -617,8 +630,10 @@ static void scroll_thread(void)
}
if (s->offset >= s->textlen) {
s->offset=0;
if (jump_scroll!=2) {
s->jump_scroll=0;
s->scroll_start_tick = current_tick +
scroll_delay;
if (s->jump_scroll != JUMP_SCROLL_ALWAYS) {
s->jump_scroll--;
s->direction=1;
}
}
@ -650,7 +665,7 @@ static void scroll_thread(void)
break;
}
o=0;
if (s->turn_offset == -1 && !s->jump_scroll) {
if (s->turn_offset == -1 && !jumping_scroll) {
while (i<11) {
buffer[i++]=s->text[o++];
}

View file

@ -87,7 +87,9 @@ enum
extern void lcd_define_hw_pattern (int which,char *pattern,int length);
extern void lcd_define_pattern (int which,char *pattern);
extern void lcd_double_height (bool on);
extern void lcd_jump_scroll (int mode); /* 0=off, 1=once, 2=always */
#define JUMP_SCROLL_ALWAYS 5
extern void lcd_jump_scroll (int mode); /* 0=off, 1=once, ..., ALWAYS */
extern void lcd_jump_scroll_delay( int ms );
unsigned char lcd_get_locked_pattern(void);
void lcd_unlock_pattern(unsigned char pat);
void lcd_allow_bidirectional_scrolling(bool on);