diff options
-rw-r--r-- | apps/menu.c | 24 | ||||
-rw-r--r-- | apps/settings_list.c | 8 | ||||
-rw-r--r-- | apps/settings_list.h | 3 |
3 files changed, 30 insertions, 5 deletions
diff --git a/apps/menu.c b/apps/menu.c index 8e96cc4edf..c657c2c1ca 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -282,10 +282,34 @@ bool do_setting_from_menu(const struct menu_item_ex *temp) | |||
282 | temp->variable, | 282 | temp->variable, |
283 | &setting_id); | 283 | &setting_id); |
284 | char *title; | 284 | char *title; |
285 | char padded_title[MAX_PATH]; | ||
285 | if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT) | 286 | if ((temp->flags&MENU_TYPE_MASK) == MT_SETTING_W_TEXT) |
286 | title = temp->callback_and_desc->desc; | 287 | title = temp->callback_and_desc->desc; |
287 | else | 288 | else |
288 | title = ID2P(setting->lang_id); | 289 | title = ID2P(setting->lang_id); |
290 | |||
291 | /* this is needed so the scroll settings title | ||
292 | can actually be used to test the setting */ | ||
293 | if (setting->flags&F_PADTITLE) | ||
294 | { | ||
295 | int i = 0, len; | ||
296 | if (setting->lang_id == -1) | ||
297 | title = (char*)setting->cfg_vals; | ||
298 | else | ||
299 | title = P2STR((unsigned char*)title); | ||
300 | len = strlen(title); | ||
301 | while (i<MAX_PATH) | ||
302 | { | ||
303 | strncpy(&padded_title[i], title, | ||
304 | len<MAX_PATH-1-i?len:MAX_PATH-1-i); | ||
305 | i += len; | ||
306 | if (i<MAX_PATH-1) | ||
307 | padded_title[i++] = ' '; | ||
308 | } | ||
309 | padded_title[i] = '\0'; | ||
310 | title = padded_title; | ||
311 | } | ||
312 | |||
289 | option_screen((struct settings_list *)setting, | 313 | option_screen((struct settings_list *)setting, |
290 | setting->flags&F_TEMPVAR, title); | 314 | setting->flags&F_TEMPVAR, title); |
291 | return false; | 315 | return false; |
diff --git a/apps/settings_list.c b/apps/settings_list.c index 82f56c2bf9..def6973378 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -586,9 +586,9 @@ const struct settings_list settings[] = { | |||
586 | TALK_ID(1, UNIT_SEC), TALK_ID(2, UNIT_SEC), | 586 | TALK_ID(1, UNIT_SEC), TALK_ID(2, UNIT_SEC), |
587 | TALK_ID(3, UNIT_SEC), TALK_ID(5, UNIT_SEC), TALK_ID(10, UNIT_SEC)), | 587 | TALK_ID(3, UNIT_SEC), TALK_ID(5, UNIT_SEC), TALK_ID(10, UNIT_SEC)), |
588 | #endif | 588 | #endif |
589 | INT_SETTING(0, scroll_speed, LANG_SCROLL_SPEED, 9,"scroll speed", | 589 | INT_SETTING(F_PADTITLE, scroll_speed, LANG_SCROLL_SPEED, 9,"scroll speed", |
590 | UNIT_INT, 0, 15, 1, NULL, NULL, lcd_scroll_speed), | 590 | UNIT_INT, 0, 15, 1, NULL, NULL, lcd_scroll_speed), |
591 | INT_SETTING(0, scroll_delay, LANG_SCROLL_DELAY, 1000, "scroll delay", | 591 | INT_SETTING(F_PADTITLE, scroll_delay, LANG_SCROLL_DELAY, 1000, "scroll delay", |
592 | UNIT_MS, 0, 2500, 100, NULL, | 592 | UNIT_MS, 0, 2500, 100, NULL, |
593 | NULL, lcd_scroll_delay) , | 593 | NULL, lcd_scroll_delay) , |
594 | INT_SETTING(0, bidir_limit, LANG_BIDIR_SCROLL, 50, "bidir limit", | 594 | INT_SETTING(0, bidir_limit, LANG_BIDIR_SCROLL, 50, "bidir limit", |
@@ -606,9 +606,9 @@ const struct settings_list settings[] = { | |||
606 | #ifdef HAVE_LCD_BITMAP | 606 | #ifdef HAVE_LCD_BITMAP |
607 | OFFON_SETTING(0, offset_out_of_view, LANG_SCREEN_SCROLL_VIEW, | 607 | OFFON_SETTING(0, offset_out_of_view, LANG_SCREEN_SCROLL_VIEW, |
608 | false, "Screen Scrolls Out Of View", gui_list_screen_scroll_out_of_view), | 608 | false, "Screen Scrolls Out Of View", gui_list_screen_scroll_out_of_view), |
609 | INT_SETTING(0, scroll_step, LANG_SCROLL_STEP, 6, "scroll step", | 609 | INT_SETTING(F_PADTITLE, scroll_step, LANG_SCROLL_STEP, 6, "scroll step", |
610 | UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, lcd_scroll_step), | 610 | UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, lcd_scroll_step), |
611 | INT_SETTING(0, screen_scroll_step, LANG_SCREEN_SCROLL_STEP, | 611 | INT_SETTING(F_PADTITLE, screen_scroll_step, LANG_SCREEN_SCROLL_STEP, |
612 | 16, "screen scroll step", | 612 | 16, "screen scroll step", |
613 | UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, gui_list_screen_scroll_step), | 613 | UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, gui_list_screen_scroll_step), |
614 | #endif /* HAVE_LCD_BITMAP */ | 614 | #endif /* HAVE_LCD_BITMAP */ |
diff --git a/apps/settings_list.h b/apps/settings_list.h index 0859b440e1..3127dbaf00 100644 --- a/apps/settings_list.h +++ b/apps/settings_list.h | |||
@@ -103,10 +103,11 @@ struct choice_setting { | |||
103 | - a NVRAM setting is removed | 103 | - a NVRAM setting is removed |
104 | */ | 104 | */ |
105 | #define F_TEMPVAR 0x0400 /* used if the setting should be set using a temp var */ | 105 | #define F_TEMPVAR 0x0400 /* used if the setting should be set using a temp var */ |
106 | #define F_PADTITLE 0x800 /* pad the title with spaces to force it to scroll */ | ||
106 | #define F_NO_WRAP 0x1000 /* used if the list should not wrap */ | 107 | #define F_NO_WRAP 0x1000 /* used if the list should not wrap */ |
107 | 108 | ||
108 | struct settings_list { | 109 | struct settings_list { |
109 | uint32_t flags; /* ____ ___R TFFF ____ NNN_ _TVC IFRB STTT */ | 110 | uint32_t flags; /* ____ ___R TFFF ____ NNN_ PTVC IFRB STTT */ |
110 | void *setting; | 111 | void *setting; |
111 | int lang_id; /* -1 for none */ | 112 | int lang_id; /* -1 for none */ |
112 | union storage_type default_val; | 113 | union storage_type default_val; |