Index: apps/settings.c =================================================================== --- apps/settings.c (revision 18848) +++ apps/settings.c (working copy) @@ -736,6 +736,7 @@ lcd_remote_scroll_speed(global_settings.remote_scroll_speed); lcd_remote_scroll_step(global_settings.remote_scroll_step); lcd_remote_scroll_delay(global_settings.remote_scroll_delay); + lcd_remote_scroll_padding(global_settings.remote_scroll_padding); lcd_remote_bidir_scroll(global_settings.remote_bidir_limit); #ifdef HAVE_REMOTE_LCD_TICKING lcd_remote_emireduce(global_settings.remote_reduce_ticking); @@ -890,6 +891,7 @@ lcd_jump_scroll(global_settings.jump_scroll); lcd_jump_scroll_delay(global_settings.jump_scroll_delay); #endif + lcd_scroll_padding(global_settings.scroll_padding); lcd_bidir_scroll(global_settings.bidir_limit); lcd_scroll_delay(global_settings.scroll_delay); Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 18848) +++ apps/lang/english.lang (working copy) @@ -12109,3 +12109,17 @@ *: "Search Results" + + id: LANG_SCROLL_PADDING + desc: Padding at the end of scrolling lines + user: + + *: "Scroll Padding String" + + + *: "Scroll Padding String" + + + *: "Scroll Padding String" + + Index: apps/settings.h =================================================================== --- apps/settings.h (revision 18848) +++ apps/settings.h (working copy) @@ -494,15 +494,18 @@ int scroll_speed; /* long texts scrolling speed: 1-30 */ 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_REMOTE_LCD int remote_scroll_speed; /* long texts scrolling speed: 1-30 */ int remote_scroll_delay; /* delay (in 1/10s) before starting scroll */ int remote_scroll_step; /* pixels to advance per update */ + unsigned char remote_scroll_padding[LCD_REMOTE_WIDTH / 4]; int remote_bidir_limit; /* bidir scroll length limit */ #endif #ifdef HAVE_LCD_BITMAP + int scroll_step; /* pixels to advance per update */ + /*string padding at the end of a scrolling line */ + unsigned char scroll_padding[LCD_WIDTH / 4]; bool offset_out_of_view; int screen_scroll_step; #endif @@ -512,6 +515,7 @@ int autocreatebookmark; /* auto create option: 0=off, 1=ask, 2=on */ int usemrb; /* use MRB list: 0=No, 1=Yes*/ #ifdef HAVE_LCD_CHARCELLS + unsigned char scroll_padding[LCD_WIDTH]; int jump_scroll; /* Fast jump when scrolling */ int jump_scroll_delay; /* Delay between jump scroll screens */ #endif Index: apps/menus/display_menu.c =================================================================== --- apps/menus/display_menu.c (revision 18848) +++ apps/menus/display_menu.c (working copy) @@ -22,6 +22,7 @@ #include #include #include +#include #include "config.h" #include "appevents.h" #include "lang.h" @@ -30,6 +31,7 @@ #include "menu.h" #include "tree.h" #include "list.h" +#include "keyboard.h" #ifdef HAVE_LCD_BITMAP #include "peakmeter.h" #endif @@ -224,6 +226,45 @@ /***********************************/ /* SCROLL MENU */ + +/* Show the virtual keyboard to input the preferred scroll padding */ +/* Save settings and pass the string for insertion in lcd_x_scroll_padding */ +void prepare_lcd_scroll_padding(void) { + unsigned char buf[sizeof(global_settings.scroll_padding)]; + /* copy the settings string to buf */ + strncpy(buf, global_settings.scroll_padding, sizeof(buf)); + + if(!kbd_input(buf, sizeof(buf))) { + /* apply and save settings only if the user really changed the string */ + if(strcmp(global_settings.scroll_padding, buf) != 0) { + strncpy(global_settings.scroll_padding, buf, + sizeof(global_settings.scroll_padding)); + lcd_scroll_padding(global_settings.scroll_padding); + settings_save(); + } + } +} + +#ifdef HAVE_REMOTE_LCD +/* Show the virtual keyboard to input the preferred scroll padding */ +/* Save settings and pass the string for insertion in lcd_x_scroll_padding */ +void prepare_lcd_remote_scroll_padding(void) { + unsigned char buf[sizeof(global_settings.remote_scroll_padding)]; + /* copy the settings string to buf */ + strncpy(buf, global_settings.remote_scroll_padding, sizeof(buf)); + + if(!kbd_input(buf, sizeof(buf))) { + /* apply and save settings only if the user really changed the string */ + if(strcmp(global_settings.remote_scroll_padding, buf) != 0) { + strncpy(global_settings.remote_scroll_padding, buf, + sizeof(global_settings.remote_scroll_padding)); + lcd_remote_scroll_padding(global_settings.remote_scroll_padding); + settings_save(); + } + } +} +#endif + MENUITEM_SETTING_W_TEXT(scroll_speed, &global_settings.scroll_speed, ID2P(LANG_SCROLL), NULL); MENUITEM_SETTING(scroll_delay, &global_settings.scroll_delay, NULL); @@ -231,6 +272,8 @@ MENUITEM_SETTING_W_TEXT(scroll_step, &global_settings.scroll_step, ID2P(LANG_SCROLL_STEP_EXAMPLE), NULL); #endif +MENUITEM_FUNCTION(scroll_padding, 0, ID2P(LANG_SCROLL_PADDING), + prepare_lcd_scroll_padding, NULL, NULL, Icon_Menu_setting); MENUITEM_SETTING(bidir_limit, &global_settings.bidir_limit, NULL); #ifdef HAVE_REMOTE_LCD MENUITEM_SETTING_W_TEXT(remote_scroll_speed, &global_settings.remote_scroll_speed, @@ -238,11 +281,14 @@ MENUITEM_SETTING(remote_scroll_delay, &global_settings.remote_scroll_delay, NULL); MENUITEM_SETTING_W_TEXT(remote_scroll_step, &global_settings.remote_scroll_step, ID2P(LANG_SCROLL_STEP_EXAMPLE), NULL); +MENUITEM_FUNCTION(remote_scroll_padding, 0, ID2P(LANG_SCROLL_PADDING), + prepare_lcd_remote_scroll_padding, + NULL, NULL, Icon_Menu_setting); MENUITEM_SETTING(remote_bidir_limit, &global_settings.remote_bidir_limit, NULL); MAKE_MENU(remote_scroll_sets, ID2P(LANG_REMOTE_SCROLL_SETS), 0, Icon_NOICON, &remote_scroll_speed, &remote_scroll_delay, - &remote_scroll_step, &remote_bidir_limit); + &remote_scroll_step, &remote_scroll_padding, &remote_bidir_limit); #endif /* HAVE_REMOTE_LCD */ #ifdef HAVE_LCD_CHARCELLS MENUITEM_SETTING(jump_scroll, &global_settings.jump_scroll, NULL); @@ -277,7 +323,7 @@ #ifdef HAVE_LCD_BITMAP &scroll_step, #endif - &bidir_limit, + &scroll_padding, &bidir_limit, #ifdef HAVE_REMOTE_LCD &remote_scroll_sets, #endif Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (revision 18848) +++ apps/settings_list.c (working copy) @@ -170,6 +170,7 @@ /* Default theme settings */ #define DEFAULT_WPSNAME "cabbiev2" +#define DEFAULT_SCROLL_PADDING " " #ifdef HAVE_LCD_BITMAP @@ -633,6 +634,13 @@ INT_SETTING(F_PADTITLE, scroll_delay, LANG_SCROLL_DELAY, 1000, "scroll delay", UNIT_MS, 0, 2500, 100, NULL, NULL, lcd_scroll_delay), + FILENAME_SETTING(0, scroll_padding, "scroll padding", + DEFAULT_SCROLL_PADDING, "\"", "\"", +#ifdef HAVE_LCD_CHARCELLS + LCD_WIDTH), +#else + LCD_WIDTH / 4), +#endif INT_SETTING(0, bidir_limit, LANG_BIDIR_SCROLL, 50, "bidir limit", UNIT_PERCENT, 0, 200, 25, NULL, NULL, lcd_bidir_scroll), #ifdef HAVE_REMOTE_LCD @@ -645,6 +653,8 @@ INT_SETTING(0, remote_scroll_delay, LANG_SCROLL_DELAY, 1000, "remote scroll delay", UNIT_MS, 0, 2500, 100, NULL, NULL, lcd_remote_scroll_delay), + FILENAME_SETTING(0, remote_scroll_padding, "remote scroll padding", + DEFAULT_SCROLL_PADDING, "\"", "\"", LCD_REMOTE_WIDTH / 4), INT_SETTING(0, remote_bidir_limit, LANG_BIDIR_SCROLL, 50, "remote bidir limit", UNIT_PERCENT, 0, 200, 25, NULL, NULL, lcd_remote_bidir_scroll), Index: firmware/export/scroll_engine.h =================================================================== --- firmware/export/scroll_engine.h (revision 18848) +++ firmware/export/scroll_engine.h (working copy) @@ -73,9 +73,11 @@ #ifdef HAVE_LCD_CHARCELLS long jump_scroll_delay; /* delay between jump scroll jumps */ int jump_scroll; /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */ + char padding[LCD_WIDTH]; /* string to pad a scrolling line */ #endif #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) int step; /* pixels per scroll step */ + char padding[LCD_WIDTH / 4]; /* string to pad a scrolling line */ #endif #if defined(HAVE_REMOTE_LCD) long last_scroll; Index: firmware/export/lcd.h =================================================================== --- firmware/export/lcd.h (revision 18848) +++ firmware/export/lcd.h (working copy) @@ -122,6 +122,7 @@ int offset); extern void lcd_putc(int x, int y, unsigned long ucs); extern void lcd_stop_scroll(void); +extern void lcd_scroll_padding(unsigned char *str); extern void lcd_bidir_scroll(int threshold); extern void lcd_scroll_speed(int speed); extern void lcd_scroll_delay(int ms); Index: firmware/export/lcd-remote.h =================================================================== --- firmware/export/lcd-remote.h (revision 18848) +++ firmware/export/lcd-remote.h (working copy) @@ -176,6 +176,7 @@ extern void lcd_remote_bidir_scroll(int threshold); extern void lcd_remote_scroll_step(int pixels); +extern void lcd_remote_scroll_padding(unsigned char *str); #if LCD_REMOTE_DEPTH > 1 extern void lcd_remote_set_foreground(unsigned foreground); Index: firmware/scroll_engine.c =================================================================== --- firmware/scroll_engine.c (revision 18848) +++ firmware/scroll_engine.c (working copy) @@ -29,6 +29,7 @@ #include "usb.h" #include "lcd.h" #include "font.h" +#include #ifdef HAVE_REMOTE_LCD #include "lcd-remote.h" #endif @@ -137,6 +138,12 @@ lcd_scroll_info.delay = ms / (HZ / 10); } +/* copy string from prepare_lcd_scroll_padding to struct lcd_scroll_info. */ +void lcd_scroll_padding(unsigned char *str) +{ + strncpy(lcd_scroll_info.padding, str, sizeof(lcd_scroll_info.padding)); +} + void lcd_bidir_scroll(int percent) { lcd_scroll_info.bidir_limit = percent; @@ -211,6 +218,14 @@ lcd_remote_scroll_info.delay = ms / (HZ / 10); } +/* copy string from prepare_lcd_remote_scroll_padding + to struct lcd_remote_scroll_info. */ +void lcd_remote_scroll_padding(unsigned char *str) +{ + strncpy(lcd_remote_scroll_info.padding, str, + sizeof(lcd_remote_scroll_info.padding)); +} + void lcd_remote_bidir_scroll(int percent) { lcd_remote_scroll_info.bidir_limit = percent; Index: firmware/drivers/lcd-1bit-vert.c =================================================================== --- firmware/drivers/lcd-1bit-vert.c (revision 18848) +++ firmware/drivers/lcd-1bit-vert.c (working copy) @@ -819,9 +819,9 @@ else s->bidir = false; - if (!s->bidir) { /* add spaces if scrolling in the round */ - strcat(s->line, " "); - /* get new width incl. spaces */ + if (!s->bidir) { /* add a padding string if scrolling in the round */ + strcat(s->line, LCDFN(scroll_info).padding); + /* get new width including pad string */ s->width = LCDFN(getstringsize)(s->line, &w, &h); } Index: firmware/drivers/lcd-charcell.c =================================================================== --- firmware/drivers/lcd-charcell.c (revision 18848) +++ firmware/drivers/lcd-charcell.c (working copy) @@ -488,11 +488,10 @@ else s->bidir = false; - if (!s->bidir) /* add spaces if scrolling in the round */ - { - strcat(s->line, " "); - /* get new width incl. spaces */ - s->len += SCROLL_SPACING; + if (!s->bidir) { /* add a padding string if scrolling in the round */ + strcat(s->line, lcd_scroll_info.padding); + /* get new width including pad string */ + s->len = utf8length(s->line); } end = strchr(s->line, '\0'); Index: firmware/drivers/lcd-2bit-vert.c =================================================================== --- firmware/drivers/lcd-2bit-vert.c (revision 18848) +++ firmware/drivers/lcd-2bit-vert.c (working copy) @@ -1145,9 +1145,9 @@ else s->bidir = false; - if (!s->bidir) { /* add spaces if scrolling in the round */ - strcat(s->line, " "); - /* get new width incl. spaces */ + if (!s->bidir) { /* add a padding string if scrolling in the round */ + strcat(s->line, lcd_scroll_info.padding); + /* get new width including pad string */ s->width = lcd_getstringsize((unsigned char *)s->line, &w, &h); } Index: firmware/drivers/lcd-2bit-horz.c =================================================================== --- firmware/drivers/lcd-2bit-horz.c (revision 18848) +++ firmware/drivers/lcd-2bit-horz.c (working copy) @@ -1006,9 +1006,9 @@ else s->bidir = false; - if (!s->bidir) { /* add spaces if scrolling in the round */ - strcat(s->line, " "); - /* get new width incl. spaces */ + if (!s->bidir) { /* add a padding string if scrolling in the round */ + strcat(s->line, lcd_scroll_info.padding); + /* get new width including pad string */ s->width = lcd_getstringsize((unsigned char *)s->line, &w, &h); } Index: firmware/drivers/lcd-2bit-vi.c =================================================================== --- firmware/drivers/lcd-2bit-vi.c (revision 18848) +++ firmware/drivers/lcd-2bit-vi.c (working copy) @@ -1160,9 +1160,9 @@ else s->bidir = false; - if (!s->bidir) { /* add spaces if scrolling in the round */ - strcat(s->line, " "); - /* get new width incl. spaces */ + if (!s->bidir) { /* add a padding string if scrolling in the round */ + strcat(s->line, LCDFN(scroll_info).padding); + /* get new width including pad string */ s->width = LCDFN(getstringsize)(s->line, &w, &h); } Index: firmware/drivers/lcd-16bit.c =================================================================== --- firmware/drivers/lcd-16bit.c (revision 18848) +++ firmware/drivers/lcd-16bit.c (working copy) @@ -1060,9 +1060,9 @@ else s->bidir = false; - if (!s->bidir) { /* add spaces if scrolling in the round */ - strcat(s->line, " "); - /* get new width incl. spaces */ + if (!s->bidir) { /* add a padding string if scrolling in the round */ + strcat(s->line, lcd_scroll_info.padding); + /* get new width including pad string */ s->width = lcd_getstringsize(s->line, &w, &h); } Index: manual/configure_rockbox/display_options.tex =================================================================== --- manual/configure_rockbox/display_options.tex (revision 18848) +++ manual/configure_rockbox/display_options.tex (working copy) @@ -137,6 +137,9 @@ Defines the number of pixels the text should move for each step, as used by the Scroll Speed setting. } + \item[Scroll Padding:] + Inserts a preferred string via virtual keyboard, to pad the end of a + scolling line. This makes forward scrolling lines look less out of focus. \opt{HAVE_REMOTE_LCD}{ \item[Remote Scrolling Options:] The options here have the same effect on the remote LCD as the options