fix FS#7288 - pad the title of the scrolling settings so they actually scroll

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15469 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2007-11-05 13:15:35 +00:00
parent f29c4ccc6a
commit 91ccc01bcf
3 changed files with 30 additions and 5 deletions

View file

@ -282,10 +282,34 @@ bool do_setting_from_menu(const struct menu_item_ex *temp)
temp->variable,
&setting_id);
char *title;
char padded_title[MAX_PATH];
if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT)
title = temp->callback_and_desc->desc;
else
title = ID2P(setting->lang_id);
/* this is needed so the scroll settings title
can actually be used to test the setting */
if (setting->flags&F_PADTITLE)
{
int i = 0, len;
if (setting->lang_id == -1)
title = (char*)setting->cfg_vals;
else
title = P2STR((unsigned char*)title);
len = strlen(title);
while (i<MAX_PATH)
{
strncpy(&padded_title[i], title,
len<MAX_PATH-1-i?len:MAX_PATH-1-i);
i += len;
if (i<MAX_PATH-1)
padded_title[i++] = ' ';
}
padded_title[i] = '\0';
title = padded_title;
}
option_screen((struct settings_list *)setting,
setting->flags&F_TEMPVAR, title);
return false;

View file

@ -586,9 +586,9 @@ const struct settings_list settings[] = {
TALK_ID(1, UNIT_SEC), TALK_ID(2, UNIT_SEC),
TALK_ID(3, UNIT_SEC), TALK_ID(5, UNIT_SEC), TALK_ID(10, UNIT_SEC)),
#endif
INT_SETTING(0, scroll_speed, LANG_SCROLL_SPEED, 9,"scroll speed",
INT_SETTING(F_PADTITLE, scroll_speed, LANG_SCROLL_SPEED, 9,"scroll speed",
UNIT_INT, 0, 15, 1, NULL, NULL, lcd_scroll_speed),
INT_SETTING(0, scroll_delay, LANG_SCROLL_DELAY, 1000, "scroll delay",
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, bidir_limit, LANG_BIDIR_SCROLL, 50, "bidir limit",
@ -606,9 +606,9 @@ const struct settings_list settings[] = {
#ifdef HAVE_LCD_BITMAP
OFFON_SETTING(0, offset_out_of_view, LANG_SCREEN_SCROLL_VIEW,
false, "Screen Scrolls Out Of View", gui_list_screen_scroll_out_of_view),
INT_SETTING(0, scroll_step, LANG_SCROLL_STEP, 6, "scroll step",
INT_SETTING(F_PADTITLE, scroll_step, LANG_SCROLL_STEP, 6, "scroll step",
UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, lcd_scroll_step),
INT_SETTING(0, screen_scroll_step, LANG_SCREEN_SCROLL_STEP,
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),
#endif /* HAVE_LCD_BITMAP */

View file

@ -103,10 +103,11 @@ struct choice_setting {
- a NVRAM setting is removed
*/
#define F_TEMPVAR 0x0400 /* used if the setting should be set using a temp var */
#define F_PADTITLE 0x800 /* pad the title with spaces to force it to scroll */
#define F_NO_WRAP 0x1000 /* used if the list should not wrap */
struct settings_list {
uint32_t flags; /* ____ ___R TFFF ____ NNN_ _TVC IFRB STTT */
uint32_t flags; /* ____ ___R TFFF ____ NNN_ PTVC IFRB STTT */
void *setting;
int lang_id; /* -1 for none */
union storage_type default_val;