Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 18831) +++ 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.c =================================================================== --- apps/settings.c (revision 18831) +++ 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); @@ -884,6 +885,7 @@ #ifdef HAVE_LCD_BITMAP lcd_scroll_step(global_settings.scroll_step); + lcd_scroll_padding(global_settings.scroll_padding); gui_list_screen_scroll_step(global_settings.screen_scroll_step); gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view); #else Index: apps/settings.h =================================================================== --- apps/settings.h (revision 18831) +++ apps/settings.h (working copy) @@ -495,10 +495,13 @@ 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 */ + /*string padding at the end of a scrolling line */ + unsigned char scroll_padding[LCD_WIDTH / 4]; #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 Index: apps/menus/display_menu.c =================================================================== --- apps/menus/display_menu.c (revision 18831) +++ 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,12 +226,67 @@ /***********************************/ /* SCROLL MENU */ + +#ifdef HAVE_LCD_BITMAP +/* Show the virtual keyboard to input the preffered scroll padding */ +void prepare_lcd_scroll_padding(void) { + unsigned char buf[LCD_WIDTH / 4]; + /* copy the settings string to buf */ + strncpy(buf, global_settings.scroll_padding, + strlen(global_settings.scroll_padding) + 1); + /* remove the last quote */ + buf[strlen(global_settings.scroll_padding) - 1] = '\0'; + + /* show the string without the first quote */ + if(!kbd_input(&buf[1], sizeof(buf))) { + /* after the string has been entered restore the quotes */ + buf[0] = '\"'; + buf[strlen(buf) + 1] = '\0'; + buf[strlen(buf)] = '\"'; + + if(strcmp(global_settings.scroll_padding, buf) != 0) { + strncpy(global_settings.scroll_padding, buf, strlen(buf) + 1); + lcd_scroll_padding(global_settings.scroll_padding); + settings_save(); + } + } +} +#endif + +#ifdef HAVE_REMOTE_LCD +void prepare_lcd_remote_scroll_padding(void) { + unsigned char buf[LCD_REMOTE_WIDTH / 4]; + /* copy the settings string to buf */ + strncpy(buf, global_settings.remote_scroll_padding, + strlen(global_settings.remote_scroll_padding) + 1); + /* remove the last quote */ + buf[strlen(global_settings.remote_scroll_padding) - 1] = '\0'; + + /* show the string without the first quote */ + if(!kbd_input(&buf[1], sizeof(buf))) { + /* after the string has been entered restore the quote */ + buf[0] = '\"'; + buf[strlen(buf) + 1] = '\0'; + buf[strlen(buf)] = '\"'; + + if(strcmp(global_settings.remote_scroll_padding, buf) != 0) { + strncpy(global_settings.remote_scroll_padding, + buf, strlen(buf) + 1); + 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); #ifdef HAVE_LCD_BITMAP MENUITEM_SETTING_W_TEXT(scroll_step, &global_settings.scroll_step, ID2P(LANG_SCROLL_STEP_EXAMPLE), NULL); +MENUITEM_FUNCTION(scroll_padding, 0, ID2P(LANG_SCROLL_PADDING), + prepare_lcd_scroll_padding, NULL, NULL, Icon_Menu_setting); #endif MENUITEM_SETTING(bidir_limit, &global_settings.bidir_limit, NULL); #ifdef HAVE_REMOTE_LCD @@ -238,11 +295,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); @@ -275,9 +335,9 @@ MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON, &scroll_speed, &scroll_delay, #ifdef HAVE_LCD_BITMAP - &scroll_step, + &scroll_step, &scroll_padding, #endif - &bidir_limit, + &bidir_limit, #ifdef HAVE_REMOTE_LCD &remote_scroll_sets, #endif Index: apps/settings_list.c =================================================================== --- apps/settings_list.c (revision 18831) +++ apps/settings_list.c (working copy) @@ -170,9 +170,9 @@ /* Default theme settings */ #define DEFAULT_WPSNAME "cabbiev2" +#define DEFAULT_SCROLL_PADDING "\" \"" #ifdef HAVE_LCD_BITMAP - #if LCD_HEIGHT <= 64 #define DEFAULT_FONTNAME "08-Rockfont" #elif LCD_HEIGHT <= 80 @@ -645,6 +645,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, NULL, NULL, 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), @@ -655,6 +657,8 @@ gui_list_screen_scroll_out_of_view), INT_SETTING(F_PADTITLE, scroll_step, LANG_SCROLL_STEP, 6, "scroll step", UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, lcd_scroll_step), + FILENAME_SETTING(0, scroll_padding, "scroll padding", + DEFAULT_SCROLL_PADDING, NULL, NULL, LCD_WIDTH / 4), INT_SETTING(F_PADTITLE, screen_scroll_step, LANG_SCREEN_SCROLL_STEP, 16, "screen scroll step", UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, gui_list_screen_scroll_step), Index: firmware/export/scroll_engine.h =================================================================== --- firmware/export/scroll_engine.h (revision 18831) +++ firmware/export/scroll_engine.h (working copy) @@ -38,11 +38,10 @@ #endif /* internal usage, but in multiple drivers */ -#define SCROLL_SPACING 3 #ifdef HAVE_LCD_BITMAP -#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2) +#define SCROLL_LINE_SIZE (MAX_PATH + 3*LCD_WIDTH/2 + 2) #else -#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH + 2) +#define SCROLL_LINE_SIZE (MAX_PATH + 3*LCD_WIDTH + 2) #endif struct scrollinfo @@ -76,6 +75,7 @@ #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 18831) +++ firmware/export/lcd.h (working copy) @@ -417,6 +417,7 @@ int height); extern void lcd_scroll_step(int pixels); +extern void lcd_scroll_padding(unsigned char *str); #if LCD_DEPTH > 1 extern void lcd_set_foreground(unsigned foreground); Index: firmware/export/lcd-remote.h =================================================================== --- firmware/export/lcd-remote.h (revision 18831) +++ 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 18831) +++ 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 @@ -130,6 +131,21 @@ { lcd_scroll_info.step = step; } + +void lcd_scroll_padding(unsigned char *str) +{ + unsigned char *pch; + + /* copy the padding string to .padding without the quotes */ + strncpy(lcd_scroll_info.padding, str + 1, strlen(str)); + pch = strrchr(lcd_scroll_info.padding, '\"'); + + /* make the last quote the end of string */ + /* if no quote is found prevent crashing */ + if(pch != NULL) + *pch= '\0'; + +} #endif void lcd_scroll_delay(int ms) @@ -211,6 +227,20 @@ lcd_remote_scroll_info.delay = ms / (HZ / 10); } +void lcd_remote_scroll_padding(unsigned char *str) +{ + unsigned char *pch; + + /* copy the padding string to .padding without the quotes */ + strncpy(lcd_remote_scroll_info.padding, str + 1, strlen(str)); + pch = strrchr(lcd_remote_scroll_info.padding, '\"'); + + /* make the last quote the end of string */ + /* if no quote is found prevent crashing */ + if(pch != NULL) + *pch= '\0'; +} + 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 18831) +++ 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 18831) +++ firmware/drivers/lcd-charcell.c (working copy) @@ -492,7 +492,7 @@ { strcat(s->line, " "); /* get new width incl. spaces */ - s->len += SCROLL_SPACING; + s->len += 3; } end = strchr(s->line, '\0'); Index: firmware/drivers/lcd-2bit-vert.c =================================================================== --- firmware/drivers/lcd-2bit-vert.c (revision 18831) +++ 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 18831) +++ 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 18831) +++ 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 18831) +++ 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 18831) +++ 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