1
0
Fork 0
forked from len0rd/rockbox

New feature for player: Jump scroll!

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3693 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Kjell Ericson 2003-05-22 06:42:14 +00:00
parent 231ddff4bd
commit 53f156a6fc
6 changed files with 114 additions and 16 deletions

View file

@ -1517,3 +1517,18 @@ id: LANG_MAX_FILES_IN_PLAYLIST
desc: in settings_menu
eng: "Max playlist size"
new:
id: LANG_JUMP_SCROLL
desc: (player) menu altarnative for jump scroll
eng: "Jump scroll"
new:
id: LANG_ONE_TIME
desc: (player) the jump scroll shall be done "one time"
eng: "One time"
new:
id: LANG_ALWAYS
desc: (player) the jump scroll shall be done "always"
eng: "Always"
new:

View file

@ -1483,3 +1483,18 @@ id: LANG_MAX_FILES_IN_PLAYLIST
desc: in settings_menu
eng: "Max playlist size"
new: "Max storlek på spellistan"
id: LANG_JUMP_SCROLL
desc: (player) menu altarnative for jump scroll
eng: "Jump scroll"
new: "Hopprullning"
id: LANG_ONE_TIME
desc: (player) the jump scroll shall be done "one time"
eng: "One time"
new: "En gång"
id: LANG_ALWAYS
desc: (player) the jump scroll shall be done "always"
eng: "Always"
new: "Alltid"

View file

@ -144,6 +144,7 @@ Rest of config block, only saved to disk:
0xF4 (int) Playlist first index
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)
*************************************/
@ -411,7 +412,9 @@ int settings_save( void )
memcpy(&config_block[0xF8], &global_settings.resume_seed, 4);
strncpy(&config_block[0xFC], global_settings.resume_file, MAX_PATH);
#ifdef HAVE_LCD_CHARCELLS
config_block[0xfd]=(unsigned char)global_settings.jump_scroll;
#endif
DEBUGF( "+Resume file %s\n",global_settings.resume_file );
DEBUGF( "+Resume index %X offset %X\n",
global_settings.resume_index,
@ -528,6 +531,8 @@ void settings_apply(void)
font_reset();
lcd_scroll_step(global_settings.scroll_step);
#else
lcd_jump_scroll(global_settings.jump_scroll);
#endif
lcd_bidir_scroll(global_settings.bidir_limit);
lcd_scroll_delay(global_settings.scroll_delay * (HZ/10));
@ -727,6 +732,10 @@ void settings_load(void)
strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME);
strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME);
strncpy(global_settings.resume_file, &config_block[0xFC], MAX_PATH);
#ifdef HAVE_LCD_CHARSCELLS
if (config_block[0xfd] != 0xff)
global_settings.jump_scroll = config_block[0xfd];
#endif
global_settings.resume_file[MAX_PATH]=0;
}
@ -1217,6 +1226,8 @@ bool settings_save_config(void)
#ifdef HAVE_LCD_BITMAP
fprintf(fd, "scroll step: %d\r\n", global_settings.scroll_step);
#else
fprintf(fd, "jump scroll: %d\r\n", global_settings.jump_scroll);
#endif
fprintf(fd, "bidir limit: %d\r\n", global_settings.bidir_limit);
@ -1393,6 +1404,9 @@ void settings_reset(void) {
global_settings.battery_type = 0;
global_settings.scroll_speed = 8;
global_settings.bidir_limit = 50;
#ifdef HAVE_LCD_CHARCELLS
global_settings.jump_scroll = 1;
#endif
global_settings.scroll_delay = 100;
global_settings.scroll_step = 6;
global_settings.ff_rewind_min_step = DEFAULT_FF_REWIND_MIN_STEP;

View file

@ -151,7 +151,9 @@ struct user_settings
int bidir_limit; /* bidir scroll length limit */
int scroll_delay; /* delay (in 1/10s) before starting scroll */
int scroll_step; /* pixels to advance per update */
#ifdef HAVE_LCD_CHARCELLS
int jump_scroll; /* Fast jump when scrolling */
#endif
bool fade_on_stop; /* fade on pause/unpause/stop */
bool caption_backlight; /* turn on backlight at end and start of track */

View file

@ -456,6 +456,16 @@ static bool bidir_limit(void)
&lcd_bidir_scroll, 25, 0, 200 );
}
#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);
}
#endif
#ifndef SIMULATOR
/**
* Menu to set the battery capacity
@ -748,7 +758,10 @@ static bool scroll_settings_menu(void)
#ifdef HAVE_LCD_BITMAP
{ str(LANG_SCROLL_STEP), scroll_step },
#endif
{ str(LANG_BIDIR_SCROLL), bidir_limit },
{ str(LANG_BIDIR_SCROLL), bidir_limit },
#ifdef HAVE_LCD_CHARCELLS
{ str(LANG_JUMP_SCROLL), jump_scroll },
#endif
};
m = menu_init( items, sizeof items / sizeof(struct menu_items) );

View file

@ -70,6 +70,7 @@ struct scrollinfo {
int starty;
long scroll_start_tick;
int direction; /* +1 for right or -1 for left*/
int jump_scroll;
};
#define MAX_CURSOR_CHARS 8
@ -91,6 +92,7 @@ static int scroll_delay = HZ/2; /* delay before starting scroll */
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 struct scrollinfo scroll[SCROLLABLE_LINES];
@ -498,6 +500,11 @@ void lcd_init (void)
sizeof(scroll_stack), scroll_name);
}
void lcd_jump_scroll (int mode) /* 0=off, 1=once, 2=always */
{
jump_scroll=mode;
}
void lcd_bidir_scroll(int percent)
{
bidir_limit = percent;
@ -522,6 +529,9 @@ void lcd_puts_scroll(int x, int y, unsigned char* string )
s->startx=x;
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;
strncpy(s->text,string,sizeof s->text);
s->turn_offset=-1;
if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) {
@ -596,18 +606,40 @@ static void scroll_thread(void)
if ( TIME_AFTER(current_tick, s->scroll_start_tick) ) {
char buffer[12];
update = true;
if ( s->offset < s->textlen-1 ) {
s->offset+=s->direction;
if (s->offset==0) {
s->direction=+1;
s->scroll_start_tick = current_tick + scroll_delay;
} else if (s->offset==s->turn_offset) {
s->direction=-1;
s->scroll_start_tick = current_tick + scroll_delay;
if (s->jump_scroll) {
s->offset+=s->jump_scroll;
s->scroll_start_tick = current_tick +
scroll_delay/2;
/* Eat space */
while (s->offset < s->textlen &&
s->text[s->offset] == ' ') {
s->offset++;
}
if (s->offset >= s->textlen) {
s->offset=0;
if (jump_scroll!=2) {
s->jump_scroll=0;
s->direction=1;
}
}
} else {
if ( s->offset < s->textlen-1 ) {
s->offset+=s->direction;
if (s->offset==0) {
s->direction=+1;
s->scroll_start_tick = current_tick +
scroll_delay;
} else {
if (s->offset == s->turn_offset) {
s->direction=-1;
s->scroll_start_tick = current_tick +
scroll_delay;
}
}
}
else {
s->offset = 0;
}
}
else {
s->offset = 0;
}
i=0;
@ -618,10 +650,17 @@ static void scroll_thread(void)
break;
}
o=0;
while (i<11) {
buffer[i++]=s->text[o++];
if (s->turn_offset == -1 && !s->jump_scroll) {
while (i<11) {
buffer[i++]=s->text[o++];
}
} else {
while (i<11) {
buffer[i++]=' ';
}
}
buffer[11]=0;
lcd_puts_cont_scroll(s->startx, s->starty, buffer);
}
}