Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 18878)
+++ 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 18878)
+++ 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/settings.h
===================================================================
--- apps/settings.h (revision 18878)
+++ 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,8 @@
int autocreatebookmark; /* auto create option: 0=off, 1=ask, 2=on */
int usemrb; /* use MRB list: 0=No, 1=Yes*/
#ifdef HAVE_LCD_CHARCELLS
+ /* for player's charcell display scroll padding is as long as the screen */
+ 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 18878)
+++ 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,43 @@
/***********************************/
/* 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 */
+ strcpy(buf, global_settings.scroll_padding);
+
+ 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) {
+ strcpy(global_settings.scroll_padding, buf);
+ 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 */
+ strcpy(buf, global_settings.remote_scroll_padding);
+
+ 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) {
+ strcpy(global_settings.remote_scroll_padding, buf);
+ 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 +270,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 +279,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 +321,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 18878)
+++ apps/settings_list.c (working copy)
@@ -175,6 +175,7 @@
/* Default theme settings */
#define DEFAULT_WPSNAME "cabbiev2"
+#define DEFAULT_SCROLL_PADDING " "
#ifdef HAVE_LCD_BITMAP
@@ -638,6 +639,8 @@
INT_SETTING(F_PADTITLE, scroll_delay, LANG_SCROLL_DELAY, 1000,
"scroll delay", UNIT_MS, 0, 2500, 100, NULL,
NULL, lcd_scroll_delay),
+ TEXT_SETTING(0, scroll_padding, "scroll padding",
+ DEFAULT_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
@@ -650,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),
+ TEXT_SETTING(0, remote_scroll_padding, "remote scroll padding",
+ DEFAULT_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 18878)
+++ 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
@@ -73,9 +72,12 @@
#ifdef HAVE_LCD_CHARCELLS
long jump_scroll_delay; /* delay between jump scroll jumps */
int jump_scroll; /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */
+ /* player has a narrow screen, make padding as long as its screen */
+ unsigned char padding[LCD_WIDTH];
#endif
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
int step; /* pixels per scroll step */
+ unsigned 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 18878)
+++ 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 18878)
+++ 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 18878)
+++ 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,13 @@
lcd_scroll_info.delay = ms / (HZ / 10);
}
+/* Sets the string to use as the padding string for forward scrolling lines */
+void lcd_scroll_padding(unsigned char *str)
+{
+ strncpy(lcd_scroll_info.padding, str, sizeof(lcd_scroll_info.padding));
+ lcd_scroll_info.padding[sizeof(lcd_scroll_info.padding) - 1] = 0;
+}
+
void lcd_bidir_scroll(int percent)
{
lcd_scroll_info.bidir_limit = percent;
@@ -211,6 +219,15 @@
lcd_remote_scroll_info.delay = ms / (HZ / 10);
}
+/* Sets the string to use as the padding string for forward scrolling lines */
+void lcd_remote_scroll_padding(unsigned char *str)
+{
+ strncpy(lcd_remote_scroll_info.padding, str,
+ sizeof(lcd_remote_scroll_info.padding));
+ lcd_remote_scroll_info.padding[
+ sizeof(lcd_remote_scroll_info.padding) - 1] = 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 18878)
+++ firmware/drivers/lcd-1bit-vert.c (working copy)
@@ -33,6 +33,7 @@
#include "rbunicode.h"
#include "bidi.h"
#include "scroll_engine.h"
+#include
#ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */
#define LCDFN(fn) lcd_ ## fn
@@ -819,9 +820,12 @@
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 */
+ char buf[sizeof(s->line)];
+ snprintf(buf, sizeof(buf), "%s%s", s->line,
+ LCDFN(scroll_info).padding);
+ strcpy(s->line, buf);
+ /* 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 18878)
+++ firmware/drivers/lcd-charcell.c (working copy)
@@ -32,6 +32,7 @@
#include "lcd-charcell.h"
#include "rbunicode.h"
#include "scroll_engine.h"
+#include
/** definitions **/
@@ -488,11 +489,13 @@
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 */
+ char buf[sizeof(s->line)];
+ snprintf(buf, sizeof(buf), "%s%s", s->line,
+ lcd_scroll_info.padding);
+ strcpy(s->line, buf);
+ /* 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 18878)
+++ firmware/drivers/lcd-2bit-vert.c (working copy)
@@ -33,6 +33,7 @@
#include "rbunicode.h"
#include "bidi.h"
#include "scroll_engine.h"
+#include
/*** globals ***/
@@ -1145,9 +1146,12 @@
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 */
+ char buf[sizeof(s->line)];
+ snprintf(buf, sizeof(buf), "%s%s", s->line,
+ lcd_scroll_info.padding);
+ strcpy(s->line, buf);
+ /* 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 18878)
+++ firmware/drivers/lcd-2bit-horz.c (working copy)
@@ -36,6 +36,7 @@
#include "rbunicode.h"
#include "bidi.h"
#include "scroll_engine.h"
+#include
/*** globals ***/
@@ -1006,9 +1007,12 @@
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 */
+ char buf[sizeof(s->line)];
+ snprintf(buf, sizeof(buf), "%s%s", s->line,
+ lcd_scroll_info.padding);
+ strcpy(s->line, buf);
+ /* 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 18878)
+++ firmware/drivers/lcd-2bit-vi.c (working copy)
@@ -36,6 +36,7 @@
#include "rbunicode.h"
#include "bidi.h"
#include "scroll_engine.h"
+#include
#ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */
#define LCDFN(fn) lcd_ ## fn
@@ -1160,9 +1161,12 @@
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 */
+ char buf[sizeof(s->line)];
+ snprintf(buf, sizeof(buf), "%s%s", s->line,
+ LCDFN(scroll_info).padding);
+ strcpy(s->line, buf);
+ /* 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 18878)
+++ firmware/drivers/lcd-16bit.c (working copy)
@@ -36,6 +36,7 @@
#include "rbunicode.h"
#include "bidi.h"
#include "scroll_engine.h"
+#include
enum fill_opt {
OPT_NONE = 0,
@@ -1060,9 +1061,12 @@
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 */
+ char buf[sizeof(s->line)];
+ snprintf(buf, sizeof(buf), "%s%s", s->line,
+ lcd_scroll_info.padding);
+ strcpy(s->line, buf);
+ /* 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 18878)
+++ 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