Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 18741) +++ apps/lang/english.lang (working copy) @@ -12061,3 +12061,17 @@ albumart: "" + + id: LANG_SCROLL_PADDING + desc: Padding at the end of scrolling + user: + + *: "Scroll Padding" + + + *: "Scroll Padding" + + + *: "Scroll Padding" + + \ No newline at end of file Index: apps/settings.c =================================================================== --- apps/settings.c (revision 18741) +++ 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); @@ -892,6 +893,7 @@ #endif lcd_bidir_scroll(global_settings.bidir_limit); lcd_scroll_delay(global_settings.scroll_delay); + lcd_scroll_padding(global_settings.scroll_padding); set_codepage(global_settings.default_codepage); Index: apps/settings.h =================================================================== --- apps/settings.h (revision 18741) +++ apps/settings.h (working copy) @@ -488,10 +488,12 @@ 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 */ + int scroll_padding; /* pixels to pad with spaces at the end of scrolling line */ #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 */ + int remote_scroll_padding; /* pixels to pad with spaces at the end of scrolling line */ int remote_bidir_limit; /* bidir scroll length limit */ #endif Index: apps/menus/display_menu.c =================================================================== --- apps/menus/display_menu.c (revision 18741) +++ apps/menus/display_menu.c (working copy) @@ -231,6 +231,7 @@ MENUITEM_SETTING_W_TEXT(scroll_step, &global_settings.scroll_step, ID2P(LANG_SCROLL_STEP_EXAMPLE), NULL); #endif +MENUITEM_SETTING(scroll_padding, &global_settings.scroll_padding, NULL); 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 +239,13 @@ 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_SETTING(remote_scroll_padding, + &global_settings.remote_scroll_padding, NULL); 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 +280,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 18741) +++ apps/settings_list.c (working copy) @@ -633,6 +633,9 @@ INT_SETTING(F_PADTITLE, scroll_delay, LANG_SCROLL_DELAY, 1000, "scroll delay", UNIT_MS, 0, 2500, 100, NULL, NULL, lcd_scroll_delay), + INT_SETTING(0, scroll_padding, LANG_SCROLL_PADDING, 10, + "scroll pading", UNIT_PIXEL, 0, LCD_WIDTH - (LCD_WIDTH % 10), + 10, NULL, NULL, lcd_scroll_padding), 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 +648,10 @@ INT_SETTING(0, remote_scroll_delay, LANG_SCROLL_DELAY, 1000, "remote scroll delay", UNIT_MS, 0, 2500, 100, NULL, NULL, lcd_remote_scroll_delay), + INT_SETTING(0, remote_scroll_padding, LANG_SCROLL_PADDING, 10, + "remote scroll pading", UNIT_PIXEL, 0, + LCD_REMOTE_WIDTH - (LCD_REMOTE_WIDTH % 10), + 10, NULL, NULL, lcd_remote_scroll_padding), 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 18741) +++ firmware/export/scroll_engine.h (working copy) @@ -69,6 +69,7 @@ int lines; /* Number of currently scrolling lines */ long ticks; /* # of ticks between updates*/ long delay; /* ticks delay before start */ + int padding; /* number of pixels of space padding in the end of the string */ int bidir_limit; /* percent */ #ifdef HAVE_LCD_CHARCELLS long jump_scroll_delay; /* delay between jump scroll jumps */ Index: firmware/export/lcd.h =================================================================== --- firmware/export/lcd.h (revision 18741) +++ firmware/export/lcd.h (working copy) @@ -125,6 +125,7 @@ extern void lcd_bidir_scroll(int threshold); extern void lcd_scroll_speed(int speed); extern void lcd_scroll_delay(int ms); +extern void lcd_scroll_padding(int pixels); extern void lcd_puts_scroll(int x, int y, const unsigned char* string); extern void lcd_puts_scroll_style(int x, int y, const unsigned char* string, int style); Index: firmware/export/lcd-remote.h =================================================================== --- firmware/export/lcd-remote.h (revision 18741) +++ firmware/export/lcd-remote.h (working copy) @@ -127,6 +127,7 @@ extern void lcd_remote_stop_scroll(void); extern void lcd_remote_scroll_speed(int speed); extern void lcd_remote_scroll_delay(int ms); +extern void lcd_remote_scroll_padding(int pixels); extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str); extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str, int style); Index: firmware/scroll_engine.c =================================================================== --- firmware/scroll_engine.c (revision 18741) +++ firmware/scroll_engine.c (working copy) @@ -137,6 +137,11 @@ lcd_scroll_info.delay = ms / (HZ / 10); } +void lcd_scroll_padding(int pixels) +{ + lcd_scroll_info.padding = pixels; +} + void lcd_bidir_scroll(int percent) { lcd_scroll_info.bidir_limit = percent; @@ -211,6 +216,11 @@ lcd_remote_scroll_info.delay = ms / (HZ / 10); } +void lcd_remote_scroll_padding(int pixels) +{ + lcd_remote_scroll_info.padding = pixels; +} + 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 18741) +++ firmware/drivers/lcd-1bit-vert.c (working copy) @@ -778,7 +778,8 @@ int style, int offset) { struct scrollinfo* s; - int w, h; + int w, h, spacenum; + char space[] = {" "}; if ((unsigned)y >= (unsigned)current_vp->height) return; @@ -820,7 +821,13 @@ s->bidir = false; if (!s->bidir) { /* add spaces if scrolling in the round */ - strcat(s->line, " "); + /* get width of one space and put as many as "pixels selected in settings" / width of space */ + LCDFN(getstringsize)(space, &w, &h); + spacenum = LCDFN(scroll_info).padding / w; + + end = strchr(s->line, '\0'); + memset(end, ' ', spacenum); + *(end + spacenum) = '\0'; /* get new width incl. spaces */ s->width = LCDFN(getstringsize)(s->line, &w, &h); } Index: firmware/drivers/lcd-charcell.c =================================================================== --- firmware/drivers/lcd-charcell.c (revision 18741) +++ firmware/drivers/lcd-charcell.c (working copy) @@ -451,7 +451,8 @@ int offset) { struct scrollinfo* s; - int len; + int len, spacenum; + char space[] = {" "}; if ((unsigned)y >= (unsigned)current_vp->height) return; @@ -490,9 +491,15 @@ if (!s->bidir) /* add spaces if scrolling in the round */ { - strcat(s->line, " "); + /* get width of one space and put as many as "pixels selected in settings" / width of space */ + len = utf8length(space); + spacenum = lcd_scroll_info.padding / len; + + end = strchr(s->line, '\0'); + memset(end, ' ', spacenum); + *(end + spacenum) = '\0'; /* get new width incl. spaces */ - s->len += SCROLL_SPACING; + s->len = utf8length(s->line); } end = strchr(s->line, '\0'); Index: firmware/drivers/lcd-2bit-vert.c =================================================================== --- firmware/drivers/lcd-2bit-vert.c (revision 18741) +++ firmware/drivers/lcd-2bit-vert.c (working copy) @@ -1104,7 +1104,8 @@ int style, int offset) { struct scrollinfo* s; - int w, h; + int w, h, spacenum; + char space[] = {" "}; if ((unsigned)y >= (unsigned)current_vp->height) return; @@ -1146,7 +1147,13 @@ s->bidir = false; if (!s->bidir) { /* add spaces if scrolling in the round */ - strcat(s->line, " "); + /* get width of one space and put as many as "pixels selected in settings" / width of space */ + lcd_getstringsize((unsigned char *)space, &w, &h); + spacenum = lcd_scroll_info.padding / w; + + end = strchr(s->line, '\0'); + memset(end, ' ', spacenum); + *(end + spacenum) = '\0'; /* get new width incl. spaces */ s->width = lcd_getstringsize((unsigned char *)s->line, &w, &h); } Index: firmware/drivers/lcd-2bit-horz.c =================================================================== --- firmware/drivers/lcd-2bit-horz.c (revision 18741) +++ firmware/drivers/lcd-2bit-horz.c (working copy) @@ -965,7 +965,8 @@ int style, int offset) { struct scrollinfo* s; - int w, h; + int w, h, spacenum; + char space[] = {" "}; if ((unsigned)y >= (unsigned)current_vp->height) return; @@ -1007,7 +1008,13 @@ s->bidir = false; if (!s->bidir) { /* add spaces if scrolling in the round */ - strcat(s->line, " "); + /* get width of one space and put as many as "pixels selected in settings" / width of space */ + lcd_getstringsize((unsigned char *)space, &w, &h); + spacenum = lcd_scroll_info.padding / w; + + end = strchr(s->line, '\0'); + memset(end, ' ', spacenum); + *(end + spacenum) = '\0'; /* get new width incl. spaces */ s->width = lcd_getstringsize((unsigned char *)s->line, &w, &h); } Index: firmware/drivers/lcd-2bit-vi.c =================================================================== --- firmware/drivers/lcd-2bit-vi.c (revision 18741) +++ firmware/drivers/lcd-2bit-vi.c (working copy) @@ -1119,7 +1119,8 @@ int style, int offset) { struct scrollinfo* s; - int w, h; + int w, h, spacenum; + char space[] = {" "}; if ((unsigned)y >= (unsigned)current_vp->height) return; @@ -1161,7 +1162,13 @@ s->bidir = false; if (!s->bidir) { /* add spaces if scrolling in the round */ - strcat(s->line, " "); + /* get width of one space and put as many as "pixels selected in settings" / width of space */ + LCDFN(getstringsize)(space, &w, &h); + spacenum = LCDFN(scroll_info).padding / w; + + end = strchr(s->line, '\0'); + memset(end, ' ', spacenum); + *(end + spacenum) = '\0'; /* get new width incl. spaces */ s->width = LCDFN(getstringsize)(s->line, &w, &h); } Index: firmware/drivers/lcd-16bit.c =================================================================== --- firmware/drivers/lcd-16bit.c (revision 18741) +++ firmware/drivers/lcd-16bit.c (working copy) @@ -1023,7 +1023,8 @@ int style, int offset) { struct scrollinfo* s; - int w, h; + int w, h, spacenum; + char space[] = {" "}; if ((unsigned)y >= (unsigned)current_vp->height) return; @@ -1061,7 +1062,13 @@ s->bidir = false; if (!s->bidir) { /* add spaces if scrolling in the round */ - strcat(s->line, " "); + /* get width of one space and put as many as "pixels selected in settings" / width of space */ + lcd_getstringsize(space, &w, &h); + spacenum = lcd_scroll_info.padding / w; + + end = strchr(s->line, '\0'); + memset(end, ' ', spacenum); + *(end + spacenum) = '\0'; /* get new width incl. spaces */ s->width = lcd_getstringsize(s->line, &w, &h); } Index: manual/configure_rockbox/display_options.tex =================================================================== --- manual/configure_rockbox/display_options.tex (revision 18741) +++ 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:] + Number of padding pixels, separating the end of a scrolling line + and its beggining. \opt{HAVE_REMOTE_LCD}{ \item[Remote Scrolling Options:] The options here have the same effect on the remote LCD as the options