diff options
author | Kjell Ericson <kjell@haxx.se> | 2003-05-22 06:42:14 +0000 |
---|---|---|
committer | Kjell Ericson <kjell@haxx.se> | 2003-05-22 06:42:14 +0000 |
commit | 53f156a6fcec07301a6b29a3f647fff43520af7a (patch) | |
tree | e780f297944fedf31f6cafce3a1d00d4dc989993 | |
parent | 231ddff4bd3e9d0214b520726ef9235117c87b31 (diff) | |
download | rockbox-53f156a6fcec07301a6b29a3f647fff43520af7a.tar.gz rockbox-53f156a6fcec07301a6b29a3f647fff43520af7a.zip |
New feature for player: Jump scroll!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3693 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/lang/english.lang | 15 | ||||
-rw-r--r-- | apps/lang/svenska.lang | 15 | ||||
-rw-r--r-- | apps/settings.c | 16 | ||||
-rw-r--r-- | apps/settings.h | 4 | ||||
-rw-r--r-- | apps/settings_menu.c | 15 | ||||
-rw-r--r-- | firmware/drivers/lcd-player.c | 65 |
6 files changed, 114 insertions, 16 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index b30a8cd11d..604a77bd2e 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1517,3 +1517,18 @@ id: LANG_MAX_FILES_IN_PLAYLIST | |||
1517 | desc: in settings_menu | 1517 | desc: in settings_menu |
1518 | eng: "Max playlist size" | 1518 | eng: "Max playlist size" |
1519 | new: | 1519 | new: |
1520 | |||
1521 | id: LANG_JUMP_SCROLL | ||
1522 | desc: (player) menu altarnative for jump scroll | ||
1523 | eng: "Jump scroll" | ||
1524 | new: | ||
1525 | |||
1526 | id: LANG_ONE_TIME | ||
1527 | desc: (player) the jump scroll shall be done "one time" | ||
1528 | eng: "One time" | ||
1529 | new: | ||
1530 | |||
1531 | id: LANG_ALWAYS | ||
1532 | desc: (player) the jump scroll shall be done "always" | ||
1533 | eng: "Always" | ||
1534 | new: | ||
diff --git a/apps/lang/svenska.lang b/apps/lang/svenska.lang index a83dcea7ba..6fd85c5acc 100644 --- a/apps/lang/svenska.lang +++ b/apps/lang/svenska.lang | |||
@@ -1483,3 +1483,18 @@ id: LANG_MAX_FILES_IN_PLAYLIST | |||
1483 | desc: in settings_menu | 1483 | desc: in settings_menu |
1484 | eng: "Max playlist size" | 1484 | eng: "Max playlist size" |
1485 | new: "Max storlek på spellistan" | 1485 | new: "Max storlek på spellistan" |
1486 | |||
1487 | id: LANG_JUMP_SCROLL | ||
1488 | desc: (player) menu altarnative for jump scroll | ||
1489 | eng: "Jump scroll" | ||
1490 | new: "Hopprullning" | ||
1491 | |||
1492 | id: LANG_ONE_TIME | ||
1493 | desc: (player) the jump scroll shall be done "one time" | ||
1494 | eng: "One time" | ||
1495 | new: "En gång" | ||
1496 | |||
1497 | id: LANG_ALWAYS | ||
1498 | desc: (player) the jump scroll shall be done "always" | ||
1499 | eng: "Always" | ||
1500 | new: "Alltid" | ||
diff --git a/apps/settings.c b/apps/settings.c index f4bb2427a4..5c7ef7e645 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -144,6 +144,7 @@ Rest of config block, only saved to disk: | |||
144 | 0xF4 (int) Playlist first index | 144 | 0xF4 (int) Playlist first index |
145 | 0xF8 (int) Playlist shuffle seed | 145 | 0xF8 (int) Playlist shuffle seed |
146 | 0xFC (char[260]) Resume playlist (path/to/dir or path/to/playlist.m3u) | 146 | 0xFC (char[260]) Resume playlist (path/to/dir or path/to/playlist.m3u) |
147 | 0xFD (char)jump scroll mode (only for player) | ||
147 | 148 | ||
148 | *************************************/ | 149 | *************************************/ |
149 | 150 | ||
@@ -411,7 +412,9 @@ int settings_save( void ) | |||
411 | memcpy(&config_block[0xF8], &global_settings.resume_seed, 4); | 412 | memcpy(&config_block[0xF8], &global_settings.resume_seed, 4); |
412 | 413 | ||
413 | strncpy(&config_block[0xFC], global_settings.resume_file, MAX_PATH); | 414 | strncpy(&config_block[0xFC], global_settings.resume_file, MAX_PATH); |
414 | 415 | #ifdef HAVE_LCD_CHARCELLS | |
416 | config_block[0xfd]=(unsigned char)global_settings.jump_scroll; | ||
417 | #endif | ||
415 | DEBUGF( "+Resume file %s\n",global_settings.resume_file ); | 418 | DEBUGF( "+Resume file %s\n",global_settings.resume_file ); |
416 | DEBUGF( "+Resume index %X offset %X\n", | 419 | DEBUGF( "+Resume index %X offset %X\n", |
417 | global_settings.resume_index, | 420 | global_settings.resume_index, |
@@ -528,6 +531,8 @@ void settings_apply(void) | |||
528 | font_reset(); | 531 | font_reset(); |
529 | 532 | ||
530 | lcd_scroll_step(global_settings.scroll_step); | 533 | lcd_scroll_step(global_settings.scroll_step); |
534 | #else | ||
535 | lcd_jump_scroll(global_settings.jump_scroll); | ||
531 | #endif | 536 | #endif |
532 | lcd_bidir_scroll(global_settings.bidir_limit); | 537 | lcd_bidir_scroll(global_settings.bidir_limit); |
533 | lcd_scroll_delay(global_settings.scroll_delay * (HZ/10)); | 538 | lcd_scroll_delay(global_settings.scroll_delay * (HZ/10)); |
@@ -727,6 +732,10 @@ void settings_load(void) | |||
727 | strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); | 732 | strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); |
728 | strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); | 733 | strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); |
729 | strncpy(global_settings.resume_file, &config_block[0xFC], MAX_PATH); | 734 | strncpy(global_settings.resume_file, &config_block[0xFC], MAX_PATH); |
735 | #ifdef HAVE_LCD_CHARSCELLS | ||
736 | if (config_block[0xfd] != 0xff) | ||
737 | global_settings.jump_scroll = config_block[0xfd]; | ||
738 | #endif | ||
730 | global_settings.resume_file[MAX_PATH]=0; | 739 | global_settings.resume_file[MAX_PATH]=0; |
731 | } | 740 | } |
732 | 741 | ||
@@ -1217,6 +1226,8 @@ bool settings_save_config(void) | |||
1217 | 1226 | ||
1218 | #ifdef HAVE_LCD_BITMAP | 1227 | #ifdef HAVE_LCD_BITMAP |
1219 | fprintf(fd, "scroll step: %d\r\n", global_settings.scroll_step); | 1228 | fprintf(fd, "scroll step: %d\r\n", global_settings.scroll_step); |
1229 | #else | ||
1230 | fprintf(fd, "jump scroll: %d\r\n", global_settings.jump_scroll); | ||
1220 | #endif | 1231 | #endif |
1221 | 1232 | ||
1222 | fprintf(fd, "bidir limit: %d\r\n", global_settings.bidir_limit); | 1233 | fprintf(fd, "bidir limit: %d\r\n", global_settings.bidir_limit); |
@@ -1393,6 +1404,9 @@ void settings_reset(void) { | |||
1393 | global_settings.battery_type = 0; | 1404 | global_settings.battery_type = 0; |
1394 | global_settings.scroll_speed = 8; | 1405 | global_settings.scroll_speed = 8; |
1395 | global_settings.bidir_limit = 50; | 1406 | global_settings.bidir_limit = 50; |
1407 | #ifdef HAVE_LCD_CHARCELLS | ||
1408 | global_settings.jump_scroll = 1; | ||
1409 | #endif | ||
1396 | global_settings.scroll_delay = 100; | 1410 | global_settings.scroll_delay = 100; |
1397 | global_settings.scroll_step = 6; | 1411 | global_settings.scroll_step = 6; |
1398 | global_settings.ff_rewind_min_step = DEFAULT_FF_REWIND_MIN_STEP; | 1412 | global_settings.ff_rewind_min_step = DEFAULT_FF_REWIND_MIN_STEP; |
diff --git a/apps/settings.h b/apps/settings.h index 55a6f96e2e..2d4d9fac2f 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -151,7 +151,9 @@ struct user_settings | |||
151 | int bidir_limit; /* bidir scroll length limit */ | 151 | int bidir_limit; /* bidir scroll length limit */ |
152 | int scroll_delay; /* delay (in 1/10s) before starting scroll */ | 152 | int scroll_delay; /* delay (in 1/10s) before starting scroll */ |
153 | int scroll_step; /* pixels to advance per update */ | 153 | int scroll_step; /* pixels to advance per update */ |
154 | 154 | #ifdef HAVE_LCD_CHARCELLS | |
155 | int jump_scroll; /* Fast jump when scrolling */ | ||
156 | #endif | ||
155 | bool fade_on_stop; /* fade on pause/unpause/stop */ | 157 | bool fade_on_stop; /* fade on pause/unpause/stop */ |
156 | bool caption_backlight; /* turn on backlight at end and start of track */ | 158 | bool caption_backlight; /* turn on backlight at end and start of track */ |
157 | 159 | ||
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 60ce4b2007..52b8d86aac 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -456,6 +456,16 @@ static bool bidir_limit(void) | |||
456 | &lcd_bidir_scroll, 25, 0, 200 ); | 456 | &lcd_bidir_scroll, 25, 0, 200 ); |
457 | } | 457 | } |
458 | 458 | ||
459 | #ifdef HAVE_LCD_CHARCELLS | ||
460 | static bool jump_scroll(void) | ||
461 | { | ||
462 | char* names[] = { str(LANG_OFF), str(LANG_ONE_TIME), str(LANG_ALWAYS)}; | ||
463 | |||
464 | return set_option(str(LANG_JUMP_SCROLL), &global_settings.jump_scroll, | ||
465 | names, 3, lcd_jump_scroll); | ||
466 | } | ||
467 | #endif | ||
468 | |||
459 | #ifndef SIMULATOR | 469 | #ifndef SIMULATOR |
460 | /** | 470 | /** |
461 | * Menu to set the battery capacity | 471 | * Menu to set the battery capacity |
@@ -748,7 +758,10 @@ static bool scroll_settings_menu(void) | |||
748 | #ifdef HAVE_LCD_BITMAP | 758 | #ifdef HAVE_LCD_BITMAP |
749 | { str(LANG_SCROLL_STEP), scroll_step }, | 759 | { str(LANG_SCROLL_STEP), scroll_step }, |
750 | #endif | 760 | #endif |
751 | { str(LANG_BIDIR_SCROLL), bidir_limit }, | 761 | { str(LANG_BIDIR_SCROLL), bidir_limit }, |
762 | #ifdef HAVE_LCD_CHARCELLS | ||
763 | { str(LANG_JUMP_SCROLL), jump_scroll }, | ||
764 | #endif | ||
752 | }; | 765 | }; |
753 | 766 | ||
754 | m = menu_init( items, sizeof items / sizeof(struct menu_items) ); | 767 | m = menu_init( items, sizeof items / sizeof(struct menu_items) ); |
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c index c5915af9fa..2496fb6f66 100644 --- a/firmware/drivers/lcd-player.c +++ b/firmware/drivers/lcd-player.c | |||
@@ -70,6 +70,7 @@ struct scrollinfo { | |||
70 | int starty; | 70 | int starty; |
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 | }; | 74 | }; |
74 | 75 | ||
75 | #define MAX_CURSOR_CHARS 8 | 76 | #define MAX_CURSOR_CHARS 8 |
@@ -91,6 +92,7 @@ static int scroll_delay = HZ/2; /* delay before starting scroll */ | |||
91 | static char scroll_spacing = 3; /* spaces between end and start of text */ | 92 | static char scroll_spacing = 3; /* spaces between end and start of text */ |
92 | static bool allow_bidirectional_scrolling = true; | 93 | static bool allow_bidirectional_scrolling = true; |
93 | static int bidir_limit = 50; /* percent */ | 94 | static int bidir_limit = 50; /* percent */ |
95 | static int jump_scroll = 0; /* 0=off, 1=once, 2=always */ | ||
94 | 96 | ||
95 | static struct scrollinfo scroll[SCROLLABLE_LINES]; | 97 | static struct scrollinfo scroll[SCROLLABLE_LINES]; |
96 | 98 | ||
@@ -498,6 +500,11 @@ void lcd_init (void) | |||
498 | sizeof(scroll_stack), scroll_name); | 500 | sizeof(scroll_stack), scroll_name); |
499 | } | 501 | } |
500 | 502 | ||
503 | void lcd_jump_scroll (int mode) /* 0=off, 1=once, 2=always */ | ||
504 | { | ||
505 | jump_scroll=mode; | ||
506 | } | ||
507 | |||
501 | void lcd_bidir_scroll(int percent) | 508 | void lcd_bidir_scroll(int percent) |
502 | { | 509 | { |
503 | bidir_limit = percent; | 510 | bidir_limit = percent; |
@@ -522,6 +529,9 @@ void lcd_puts_scroll(int x, int y, unsigned char* string ) | |||
522 | s->startx=x; | 529 | s->startx=x; |
523 | s->starty=y; | 530 | s->starty=y; |
524 | s->direction=+1; | 531 | s->direction=+1; |
532 | s->jump_scroll=0; | ||
533 | if (jump_scroll && scroll_delay/2<(HZ/scroll_speed)*(s->textlen-11+x)) | ||
534 | s->jump_scroll=11-x; | ||
525 | strncpy(s->text,string,sizeof s->text); | 535 | strncpy(s->text,string,sizeof s->text); |
526 | s->turn_offset=-1; | 536 | s->turn_offset=-1; |
527 | if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) { | 537 | if (bidir_limit && (s->textlen < ((11-x)*(100+bidir_limit))/100)) { |
@@ -596,18 +606,40 @@ static void scroll_thread(void) | |||
596 | if ( TIME_AFTER(current_tick, s->scroll_start_tick) ) { | 606 | if ( TIME_AFTER(current_tick, s->scroll_start_tick) ) { |
597 | char buffer[12]; | 607 | char buffer[12]; |
598 | update = true; | 608 | update = true; |
599 | if ( s->offset < s->textlen-1 ) { | 609 | if (s->jump_scroll) { |
600 | s->offset+=s->direction; | 610 | s->offset+=s->jump_scroll; |
601 | if (s->offset==0) { | 611 | s->scroll_start_tick = current_tick + |
602 | s->direction=+1; | 612 | scroll_delay/2; |
603 | s->scroll_start_tick = current_tick + scroll_delay; | 613 | /* Eat space */ |
604 | } else if (s->offset==s->turn_offset) { | 614 | while (s->offset < s->textlen && |
605 | s->direction=-1; | 615 | s->text[s->offset] == ' ') { |
606 | s->scroll_start_tick = current_tick + scroll_delay; | 616 | s->offset++; |
617 | } | ||
618 | if (s->offset >= s->textlen) { | ||
619 | s->offset=0; | ||
620 | if (jump_scroll!=2) { | ||
621 | s->jump_scroll=0; | ||
622 | s->direction=1; | ||
623 | } | ||
624 | } | ||
625 | } else { | ||
626 | if ( s->offset < s->textlen-1 ) { | ||
627 | s->offset+=s->direction; | ||
628 | if (s->offset==0) { | ||
629 | s->direction=+1; | ||
630 | s->scroll_start_tick = current_tick + | ||
631 | scroll_delay; | ||
632 | } else { | ||
633 | if (s->offset == s->turn_offset) { | ||
634 | s->direction=-1; | ||
635 | s->scroll_start_tick = current_tick + | ||
636 | scroll_delay; | ||
637 | } | ||
638 | } | ||
639 | } | ||
640 | else { | ||
641 | s->offset = 0; | ||
607 | } | 642 | } |
608 | } | ||
609 | else { | ||
610 | s->offset = 0; | ||
611 | } | 643 | } |
612 | 644 | ||
613 | i=0; | 645 | i=0; |
@@ -618,10 +650,17 @@ static void scroll_thread(void) | |||
618 | break; | 650 | break; |
619 | } | 651 | } |
620 | o=0; | 652 | o=0; |
621 | while (i<11) { | 653 | if (s->turn_offset == -1 && !s->jump_scroll) { |
622 | buffer[i++]=s->text[o++]; | 654 | while (i<11) { |
655 | buffer[i++]=s->text[o++]; | ||
656 | } | ||
657 | } else { | ||
658 | while (i<11) { | ||
659 | buffer[i++]=' '; | ||
660 | } | ||
623 | } | 661 | } |
624 | buffer[11]=0; | 662 | buffer[11]=0; |
663 | |||
625 | lcd_puts_cont_scroll(s->startx, s->starty, buffer); | 664 | lcd_puts_cont_scroll(s->startx, s->starty, buffer); |
626 | } | 665 | } |
627 | } | 666 | } |