1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Robert Hak
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
35 #include "settings_menu.h"
36 #include "backlight.h"
37 #include "playlist.h" /* for playlist_shuffle */
38 #include "fat.h" /* For dotfile settings */
39 #include "sleeptimer.h"
40 #include "powermgmt.h"
46 #include "timefuncs.h"
53 #include "rbunicode.h"
57 #include "color_picker.h"
59 #ifdef HAVE_LCD_BITMAP
60 #include "peakmeter.h"
63 #if CONFIG_CODEC == MAS3507D
64 void dac_line_in(bool enable
);
67 #include "alarm_menu.h"
70 #ifdef HAVE_REMOTE_LCD
71 #include "lcd-remote.h"
74 #if CONFIG_CODEC == SWCODEC
76 #include "pcm_playback.h"
81 static bool car_adapter_mode(void)
83 return set_bool( str(LANG_CAR_ADAPTER_MODE
),
84 &global_settings
.car_adapter_mode
);
89 * Menu to set icon visibility
91 static bool show_icons(void)
93 return set_bool( (char *)str(LANG_SHOW_ICONS
), &global_settings
.show_icons
);
97 * Menu to set the option to scroll paginated
99 static bool scroll_paginated(void)
101 return set_bool( (char *)str(LANG_SCROLL_PAGINATED
), &global_settings
.scroll_paginated
);
104 #ifdef HAVE_REMOTE_LCD
105 static bool remote_contrast(void)
107 return set_int( str(LANG_CONTRAST
), "", UNIT_INT
,
108 &global_settings
.remote_contrast
,
109 lcd_remote_set_contrast
, 1, MIN_CONTRAST_SETTING
,
110 MAX_CONTRAST_SETTING
, NULL
);
113 static bool remote_invert(void)
115 bool rc
= set_bool_options((char *)str(LANG_INVERT
),
116 &global_settings
.remote_invert
,
117 (char *)STR(LANG_INVERT_LCD_INVERSE
),
118 STR(LANG_INVERT_LCD_NORMAL
),
119 lcd_remote_set_invert_display
);
123 static bool remote_flip_display(void)
125 bool rc
= set_bool( (char *)str(LANG_FLIP_DISPLAY
),
126 &global_settings
.remote_flip_display
);
128 lcd_remote_set_flip(global_settings
.remote_flip_display
);
134 #ifdef HAVE_REMOTE_LCD_TICKING
135 static bool remote_reduce_ticking(void)
137 bool rc
= set_bool( str(LANG_REDUCE_TICKING
),
138 &global_settings
.remote_reduce_ticking
);
140 lcd_remote_emireduce(global_settings
.remote_reduce_ticking
);
147 #ifdef CONFIG_BACKLIGHT
148 static const struct opt_items backlight_timeouts
[] = {
151 { (unsigned char *)"1s ", TALK_ID(1, UNIT_SEC
) },
152 { (unsigned char *)"2s ", TALK_ID(2, UNIT_SEC
) },
153 { (unsigned char *)"3s ", TALK_ID(3, UNIT_SEC
) },
154 { (unsigned char *)"4s ", TALK_ID(4, UNIT_SEC
) },
155 { (unsigned char *)"5s ", TALK_ID(5, UNIT_SEC
) },
156 { (unsigned char *)"6s ", TALK_ID(6, UNIT_SEC
) },
157 { (unsigned char *)"7s ", TALK_ID(7, UNIT_SEC
) },
158 { (unsigned char *)"8s ", TALK_ID(8, UNIT_SEC
) },
159 { (unsigned char *)"9s ", TALK_ID(9, UNIT_SEC
) },
160 { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC
) },
161 { (unsigned char *)"15s", TALK_ID(15, UNIT_SEC
) },
162 { (unsigned char *)"20s", TALK_ID(20, UNIT_SEC
) },
163 { (unsigned char *)"25s", TALK_ID(25, UNIT_SEC
) },
164 { (unsigned char *)"30s", TALK_ID(30, UNIT_SEC
) },
165 { (unsigned char *)"45s", TALK_ID(45, UNIT_SEC
) },
166 { (unsigned char *)"60s", TALK_ID(60, UNIT_SEC
) },
167 { (unsigned char *)"90s", TALK_ID(90, UNIT_SEC
) }
170 static bool caption_backlight(void)
172 return set_bool( (char *)str(LANG_CAPTION_BACKLIGHT
),
173 &global_settings
.caption_backlight
);
177 static bool backlight_timer_plugged(void)
179 return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING
),
180 &global_settings
.backlight_timeout_plugged
,
181 INT
, backlight_timeouts
, 19,
182 backlight_set_timeout_plugged
);
186 static bool backlight_timer(void)
188 return set_option((char *)str(LANG_BACKLIGHT
),
189 &global_settings
.backlight_timeout
,
190 INT
, backlight_timeouts
, 19,
191 backlight_set_timeout
);
194 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
195 static bool backlight_fade_in(void)
197 static const struct opt_items names
[] = {
199 { (unsigned char *)"500ms", TALK_ID(500, UNIT_MS
) },
200 { (unsigned char *)"1s", TALK_ID(1, UNIT_SEC
) },
201 { (unsigned char *)"2s", TALK_ID(2, UNIT_SEC
) },
203 return set_option(str(LANG_BACKLIGHT_FADE_IN
),
204 &global_settings
.backlight_fade_in
,
205 INT
, names
, 4, backlight_set_fade_in
);
208 static bool backlight_fade_out(void)
210 static const struct opt_items names
[] = {
212 { (unsigned char *)"500ms", TALK_ID(500, UNIT_MS
) },
213 { (unsigned char *)"1s", TALK_ID(1, UNIT_SEC
) },
214 { (unsigned char *)"2s", TALK_ID(2, UNIT_SEC
) },
215 { (unsigned char *)"3s", TALK_ID(3, UNIT_SEC
) },
216 { (unsigned char *)"4s", TALK_ID(4, UNIT_SEC
) },
217 { (unsigned char *)"5s", TALK_ID(5, UNIT_SEC
) },
218 { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC
) },
220 return set_option(str(LANG_BACKLIGHT_FADE_OUT
),
221 &global_settings
.backlight_fade_out
,
222 INT
, names
, 8, backlight_set_fade_out
);
225 #endif /* CONFIG_BACKLIGHT */
227 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
228 static bool brightness(void)
230 return set_int( str(LANG_BRIGHTNESS
), "", UNIT_INT
,
231 &global_settings
.brightness
,
232 backlight_set_brightness
, 1, MIN_BRIGHTNESS_SETTING
,
233 MAX_BRIGHTNESS_SETTING
, NULL
);
237 #ifdef HAVE_REMOTE_LCD
239 static bool remote_backlight_timer(void)
241 return set_option((char *)str(LANG_BACKLIGHT
),
242 &global_settings
.remote_backlight_timeout
,
243 INT
, backlight_timeouts
, 19,
244 remote_backlight_set_timeout
);
248 static bool remote_backlight_timer_plugged(void)
250 return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING
),
251 &global_settings
.remote_backlight_timeout_plugged
,
252 INT
, backlight_timeouts
, 19,
253 remote_backlight_set_timeout_plugged
);
257 static bool remote_caption_backlight(void)
259 return set_bool((char *)str(LANG_CAPTION_BACKLIGHT
),
260 &global_settings
.remote_caption_backlight
);
262 #endif /* HAVE_REMOTE_LCD */
264 static bool contrast(void)
266 return set_int( str(LANG_CONTRAST
), "", UNIT_INT
,
267 &global_settings
.contrast
,
268 lcd_set_contrast
, 1, MIN_CONTRAST_SETTING
,
269 MAX_CONTRAST_SETTING
, NULL
);
272 #ifdef HAVE_LCD_BITMAP
275 * Menu to set LCD Mode (normal/inverse)
277 static bool invert(void)
279 bool rc
= set_bool_options(str(LANG_INVERT
),
280 &global_settings
.invert
,
281 (char *)STR(LANG_INVERT_LCD_INVERSE
),
282 STR(LANG_INVERT_LCD_NORMAL
),
283 lcd_set_invert_display
);
288 * Menu to turn the display+buttons by 180 degrees
290 static bool flip_display(void)
292 bool rc
= set_bool( str(LANG_FLIP_DISPLAY
),
293 &global_settings
.flip_display
);
295 button_set_flip(global_settings
.flip_display
);
296 lcd_set_flip(global_settings
.flip_display
);
302 * Menu to set Line Selector Type (Pointer/Bar)
304 static bool invert_cursor(void)
306 return set_bool_options(str(LANG_INVERT_CURSOR
),
307 &global_settings
.invert_cursor
,
308 STR(LANG_INVERT_CURSOR_BAR
),
309 STR(LANG_INVERT_CURSOR_POINTER
),
313 #ifdef HAVE_LCD_COLOR
315 * Menu to clear the backdrop image
317 static bool clear_main_backdrop(void)
319 global_settings
.backdrop_file
[0]=0;
320 lcd_set_backdrop(NULL
);
325 * Menu for fore/back colors
327 static bool set_fg_color(void)
331 res
= set_color(&screens
[SCREEN_MAIN
],str(LANG_FOREGROUND_COLOR
),
332 &global_settings
.fg_color
,global_settings
.bg_color
);
334 screens
[SCREEN_MAIN
].set_foreground(global_settings
.fg_color
);
339 static bool set_bg_color(void)
343 res
= set_color(&screens
[SCREEN_MAIN
],str(LANG_BACKGROUND_COLOR
),
344 &global_settings
.bg_color
,global_settings
.fg_color
);
346 screens
[SCREEN_MAIN
].set_background(global_settings
.bg_color
);
351 static bool reset_color(void)
353 global_settings
.fg_color
= LCD_DEFAULT_FG
;
354 global_settings
.bg_color
= LCD_DEFAULT_BG
;
356 screens
[SCREEN_MAIN
].set_foreground(global_settings
.fg_color
);
357 screens
[SCREEN_MAIN
].set_background(global_settings
.bg_color
);
363 * Menu to configure the battery display on status bar
365 static bool battery_display(void)
367 static const struct opt_items names
[] = {
368 { STR(LANG_DISPLAY_GRAPHIC
) },
369 { STR(LANG_DISPLAY_NUMERIC
) }
371 return set_option( str(LANG_BATTERY_DISPLAY
),
372 &global_settings
.battery_display
, INT
, names
, 2, NULL
);
376 * Menu to configure the volume display on status bar
378 static bool volume_type(void)
380 static const struct opt_items names
[] = {
381 { STR(LANG_DISPLAY_GRAPHIC
) },
382 { STR(LANG_DISPLAY_NUMERIC
) }
384 return set_option( str(LANG_VOLUME_DISPLAY
), &global_settings
.volume_type
,
385 INT
, names
, 2, NULL
);
389 * Menu to set the hold time of normal peaks.
391 static bool peak_meter_hold(void) {
393 static const struct opt_items names
[] = {
395 { "200 ms " , TALK_ID(200, UNIT_MS
) },
396 { "300 ms " , TALK_ID(300, UNIT_MS
) },
397 { "500 ms " , TALK_ID(500, UNIT_MS
) },
398 { "1 s" , TALK_ID(1, UNIT_SEC
) },
399 { "2 s" , TALK_ID(2, UNIT_SEC
) },
400 { "3 s" , TALK_ID(3, UNIT_SEC
) },
401 { "4 s" , TALK_ID(4, UNIT_SEC
) },
402 { "5 s" , TALK_ID(5, UNIT_SEC
) },
403 { "6 s" , TALK_ID(6, UNIT_SEC
) },
404 { "7 s" , TALK_ID(7, UNIT_SEC
) },
405 { "8 s" , TALK_ID(8, UNIT_SEC
) },
406 { "9 s" , TALK_ID(9, UNIT_SEC
) },
407 { "10 s" , TALK_ID(10, UNIT_SEC
) },
408 { "15 s" , TALK_ID(15, UNIT_SEC
) },
409 { "20 s" , TALK_ID(20, UNIT_SEC
) },
410 { "30 s" , TALK_ID(30, UNIT_SEC
) },
411 { "1 min" , TALK_ID(1, UNIT_MIN
) }
413 retval
= set_option( str(LANG_PM_PEAK_HOLD
),
414 &global_settings
.peak_meter_hold
, INT
, names
,
417 peak_meter_init_times(global_settings
.peak_meter_release
,
418 global_settings
.peak_meter_hold
,
419 global_settings
.peak_meter_clip_hold
);
425 * Menu to set the hold time of clips.
427 static bool peak_meter_clip_hold(void) {
430 static const struct opt_items names
[] = {
431 { STR(LANG_PM_ETERNAL
) },
432 { "1s " , TALK_ID(1, UNIT_SEC
) },
433 { "2s " , TALK_ID(2, UNIT_SEC
) },
434 { "3s " , TALK_ID(3, UNIT_SEC
) },
435 { "4s " , TALK_ID(4, UNIT_SEC
) },
436 { "5s " , TALK_ID(5, UNIT_SEC
) },
437 { "6s " , TALK_ID(6, UNIT_SEC
) },
438 { "7s " , TALK_ID(7, UNIT_SEC
) },
439 { "8s " , TALK_ID(8, UNIT_SEC
) },
440 { "9s " , TALK_ID(9, UNIT_SEC
) },
441 { "10s" , TALK_ID(10, UNIT_SEC
) },
442 { "15s" , TALK_ID(15, UNIT_SEC
) },
443 { "20s" , TALK_ID(20, UNIT_SEC
) },
444 { "25s" , TALK_ID(25, UNIT_SEC
) },
445 { "30s" , TALK_ID(30, UNIT_SEC
) },
446 { "45s" , TALK_ID(45, UNIT_SEC
) },
447 { "60s" , TALK_ID(60, UNIT_SEC
) },
448 { "90s" , TALK_ID(90, UNIT_SEC
) },
449 { "2min" , TALK_ID(2, UNIT_MIN
) },
450 { "3min" , TALK_ID(3, UNIT_MIN
) },
451 { "5min" , TALK_ID(5, UNIT_MIN
) },
452 { "10min" , TALK_ID(10, UNIT_MIN
) },
453 { "20min" , TALK_ID(20, UNIT_MIN
) },
454 { "45min" , TALK_ID(45, UNIT_MIN
) },
455 { "90min" , TALK_ID(90, UNIT_MIN
) }
457 retval
= set_option( str(LANG_PM_CLIP_HOLD
),
458 &global_settings
.peak_meter_clip_hold
, INT
, names
,
459 25, peak_meter_set_clip_hold
);
461 peak_meter_init_times(global_settings
.peak_meter_release
,
462 global_settings
.peak_meter_hold
,
463 global_settings
.peak_meter_clip_hold
);
469 * Menu to set the release time of the peak meter.
471 static bool peak_meter_release(void) {
474 /* The range of peak_meter_release is restricted so that it
475 fits into a 7 bit number. The 8th bit is used for storing
476 something else in the rtc ram.
477 Also, the max value is 0x7e, since the RTC value 0xff is reserved */
478 retval
= set_int( str(LANG_PM_RELEASE
), str(LANG_PM_UNITS_PER_READ
),
479 LANG_PM_UNITS_PER_READ
,
480 &global_settings
.peak_meter_release
,
481 NULL
, 1, 1, 0x7e, NULL
);
483 peak_meter_init_times(global_settings
.peak_meter_release
,
484 global_settings
.peak_meter_hold
,
485 global_settings
.peak_meter_clip_hold
);
491 * Menu to select wether the scale of the meter
492 * displays dBfs of linear values.
494 static bool peak_meter_scale(void) {
496 bool use_dbfs
= global_settings
.peak_meter_dbfs
;
497 retval
= set_bool_options(str(LANG_PM_SCALE
),
499 STR(LANG_PM_DBFS
), STR(LANG_PM_LINEAR
),
502 /* has the user really changed the scale? */
503 if (use_dbfs
!= global_settings
.peak_meter_dbfs
) {
505 /* store the change */
506 global_settings
.peak_meter_dbfs
= use_dbfs
;
507 peak_meter_set_use_dbfs(use_dbfs
);
509 /* If the user changed the scale mode the meaning of
510 peak_meter_min (peak_meter_max) has changed. Thus we have
511 to convert the values stored in global_settings. */
514 /* we only store -dBfs */
515 global_settings
.peak_meter_min
= -peak_meter_get_min() / 100;
516 global_settings
.peak_meter_max
= -peak_meter_get_max() / 100;
521 global_settings
.peak_meter_min
= peak_meter_get_min();
523 /* converting dBfs -> percent results in a precision loss.
524 I assume that the user doesn't bother that conversion
525 dBfs <-> percent isn't symmetrical for odd values but that
526 he wants 0 dBfs == 100%. Thus I 'correct' the percent value
527 resulting from dBfs -> percent manually here */
528 max
= peak_meter_get_max();
529 global_settings
.peak_meter_max
= max
< 99 ? max
: 100;
531 settings_apply_pm_range();
537 * Adjust the min value of the value range that
538 * the peak meter shall visualize.
540 static bool peak_meter_min(void) {
542 if (global_settings
.peak_meter_dbfs
) {
545 int range_max
= -global_settings
.peak_meter_max
;
546 int min
= -global_settings
.peak_meter_min
;
548 retval
= set_int(str(LANG_PM_MIN
), str(LANG_PM_DBFS
), UNIT_DB
,
549 &min
, NULL
, 1, -89, range_max
, NULL
);
551 global_settings
.peak_meter_min
= - min
;
554 /* for linear scale */
556 int min
= global_settings
.peak_meter_min
;
558 retval
= set_int(str(LANG_PM_MIN
), "%", UNIT_PERCENT
,
560 1, 0, global_settings
.peak_meter_max
- 1, NULL
);
562 global_settings
.peak_meter_min
= (unsigned char)min
;
565 settings_apply_pm_range();
571 * Adjust the max value of the value range that
572 * the peak meter shall visualize.
574 static bool peak_meter_max(void) {
576 if (global_settings
.peak_meter_dbfs
) {
579 int range_min
= -global_settings
.peak_meter_min
;
580 int max
= -global_settings
.peak_meter_max
;;
582 retval
= set_int(str(LANG_PM_MAX
), str(LANG_PM_DBFS
), UNIT_DB
,
583 &max
, NULL
, 1, range_min
, 0, NULL
);
585 global_settings
.peak_meter_max
= - max
;
589 /* for linear scale */
591 int max
= global_settings
.peak_meter_max
;
593 retval
= set_int(str(LANG_PM_MAX
), "%", UNIT_PERCENT
,
595 1, global_settings
.peak_meter_min
+ 1, 100, NULL
);
597 global_settings
.peak_meter_max
= (unsigned char)max
;
600 settings_apply_pm_range();
605 * Menu to configure the peak meter
607 static bool peak_meter_menu(void)
612 static const struct menu_item items
[] = {
613 { ID2P(LANG_PM_RELEASE
) , peak_meter_release
},
614 { ID2P(LANG_PM_PEAK_HOLD
), peak_meter_hold
},
615 { ID2P(LANG_PM_CLIP_HOLD
), peak_meter_clip_hold
},
616 { ID2P(LANG_PM_SCALE
) , peak_meter_scale
},
617 { ID2P(LANG_PM_MIN
) , peak_meter_min
},
618 { ID2P(LANG_PM_MAX
) , peak_meter_max
},
621 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
623 result
= menu_run(m
);
627 #endif /* HAVE_LCD_BITMAP */
629 static bool shuffle(void)
631 return set_bool( str(LANG_SHUFFLE
), &global_settings
.playlist_shuffle
);
634 static bool repeat_mode(void)
637 static const struct opt_items names
[] = {
639 { STR(LANG_REPEAT_ALL
) },
640 { STR(LANG_REPEAT_ONE
) },
641 { STR(LANG_SHUFFLE
) },
642 #if (AB_REPEAT_ENABLE == 1)
643 { STR(LANG_REPEAT_AB
) }
646 int old_repeat
= global_settings
.repeat_mode
;
648 result
= set_option( str(LANG_REPEAT
), &global_settings
.repeat_mode
,
649 INT
, names
, NUM_REPEAT_MODES
, NULL
);
651 if (old_repeat
!= global_settings
.repeat_mode
&&
652 (audio_status() & AUDIO_STATUS_PLAY
))
653 audio_flush_and_reload_tracks();
658 static bool play_selected(void)
660 return set_bool( str(LANG_PLAY_SELECTED
), &global_settings
.play_selected
);
663 static bool dir_filter(void)
665 static const struct opt_items names
[] = {
666 { STR(LANG_FILTER_ALL
) },
667 { STR(LANG_FILTER_SUPPORTED
) },
668 { STR(LANG_FILTER_MUSIC
) },
669 { STR(LANG_FILTER_PLAYLIST
) },
670 { STR(LANG_FILTER_ID3DB
) }
672 return set_option( str(LANG_FILTER
), &global_settings
.dirfilter
, INT
,
676 static bool sort_case(void)
678 return set_bool( str(LANG_SORT_CASE
), &global_settings
.sort_case
);
681 static bool sort_file(void)
683 int oldval
= global_settings
.sort_file
;
685 static const struct opt_items names
[] = {
686 { STR(LANG_SORT_ALPHA
) },
687 { STR(LANG_SORT_DATE
) },
688 { STR(LANG_SORT_DATE_REVERSE
) },
689 { STR(LANG_SORT_TYPE
) }
691 ret
= set_option( str(LANG_SORT_FILE
), &global_settings
.sort_file
, INT
,
693 if (global_settings
.sort_file
!= oldval
)
694 reload_directory(); /* force reload if this has changed */
698 static bool sort_dir(void)
700 int oldval
= global_settings
.sort_dir
;
702 static const struct opt_items names
[] = {
703 { STR(LANG_SORT_ALPHA
) },
704 { STR(LANG_SORT_DATE
) },
705 { STR(LANG_SORT_DATE_REVERSE
) }
707 ret
= set_option( str(LANG_SORT_DIR
), &global_settings
.sort_dir
, INT
,
709 if (global_settings
.sort_dir
!= oldval
)
710 reload_directory(); /* force reload if this has changed */
714 static bool resume(void)
716 return set_bool( str(LANG_RESUME
), &global_settings
.resume
);
719 #ifdef HAVE_SPDIF_POWER
720 static bool spdif(void)
722 bool rc
= set_bool_options(str(LANG_SPDIF_ENABLE
),
723 &global_settings
.spdif_enable
,
731 static bool autocreatebookmark(void)
734 static const struct opt_items names
[] = {
735 { STR(LANG_SET_BOOL_NO
) },
736 { STR(LANG_SET_BOOL_YES
) },
737 { STR(LANG_RESUME_SETTING_ASK
) },
738 { STR(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_YES
) },
739 { STR(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_ASK
) }
742 retval
= set_option( str(LANG_BOOKMARK_SETTINGS_AUTOCREATE
),
743 &global_settings
.autocreatebookmark
, INT
,
745 if(global_settings
.autocreatebookmark
== BOOKMARK_RECENT_ONLY_YES
||
746 global_settings
.autocreatebookmark
== BOOKMARK_RECENT_ONLY_ASK
)
748 if(global_settings
.usemrb
== BOOKMARK_NO
)
749 global_settings
.usemrb
= BOOKMARK_YES
;
755 static bool autoloadbookmark(void)
757 static const struct opt_items names
[] = {
758 { STR(LANG_SET_BOOL_NO
) },
759 { STR(LANG_SET_BOOL_YES
) },
760 { STR(LANG_RESUME_SETTING_ASK
) }
762 return set_option( str(LANG_BOOKMARK_SETTINGS_AUTOLOAD
),
763 &global_settings
.autoloadbookmark
, INT
,
767 static bool useMRB(void)
769 static const struct opt_items names
[] = {
770 { STR(LANG_SET_BOOL_NO
) },
771 { STR(LANG_SET_BOOL_YES
) },
772 { STR(LANG_BOOKMARK_SETTINGS_UNIQUE_ONLY
) }
774 return set_option( str(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS
),
775 &global_settings
.usemrb
, INT
,
779 static bool poweroff_idle_timer(void)
781 static const struct opt_items names
[] = {
783 { "1m ", TALK_ID(1, UNIT_MIN
) },
784 { "2m ", TALK_ID(2, UNIT_MIN
) },
785 { "3m ", TALK_ID(3, UNIT_MIN
) },
786 { "4m ", TALK_ID(4, UNIT_MIN
) },
787 { "5m ", TALK_ID(5, UNIT_MIN
) },
788 { "6m ", TALK_ID(6, UNIT_MIN
) },
789 { "7m ", TALK_ID(7, UNIT_MIN
) },
790 { "8m ", TALK_ID(8, UNIT_MIN
) },
791 { "9m ", TALK_ID(9, UNIT_MIN
) },
792 { "10m", TALK_ID(10, UNIT_MIN
) },
793 { "15m", TALK_ID(15, UNIT_MIN
) },
794 { "30m", TALK_ID(30, UNIT_MIN
) },
795 { "45m", TALK_ID(45, UNIT_MIN
) },
796 { "60m", TALK_ID(60, UNIT_MIN
) }
798 return set_option(str(LANG_POWEROFF_IDLE
), &global_settings
.poweroff
,
799 INT
, names
, 15, set_poweroff_timeout
);
802 static bool scroll_speed(void)
804 return set_int(str(LANG_SCROLL
), "", UNIT_INT
,
805 &global_settings
.scroll_speed
,
806 &lcd_scroll_speed
, 1, 0, 15, NULL
);
809 static bool scroll_delay(void)
811 int dummy
= global_settings
.scroll_delay
* (HZ
/10);
812 int rc
= set_int(str(LANG_SCROLL_DELAY
), "ms", UNIT_MS
,
814 &lcd_scroll_delay
, 100, 0, 2500, NULL
);
815 global_settings
.scroll_delay
= dummy
/ (HZ
/10);
819 #ifdef HAVE_LCD_BITMAP
820 static bool screen_scroll(void)
822 bool rc
= set_bool( str(LANG_SCREEN_SCROLL_VIEW
), &global_settings
.offset_out_of_view
);
823 gui_list_screen_scroll_out_of_view(global_settings
.offset_out_of_view
);
827 static bool screen_scroll_step(void)
829 return set_int(str(LANG_SCREEN_SCROLL_STEP
), "pixels", UNIT_PIXEL
,
830 &global_settings
.screen_scroll_step
,
831 &gui_list_screen_scroll_step
, 1, 1, LCD_WIDTH
, NULL
);
834 static bool scroll_step(void)
836 return set_int(str(LANG_SCROLL_STEP_EXAMPLE
), "pixels", UNIT_PIXEL
,
837 &global_settings
.scroll_step
,
838 &lcd_scroll_step
, 1, 1, LCD_WIDTH
, NULL
);
842 static bool bidir_limit(void)
844 return set_int(str(LANG_BIDIR_SCROLL
), "%", UNIT_PERCENT
,
845 &global_settings
.bidir_limit
,
846 &lcd_bidir_scroll
, 25, 0, 200, NULL
);
849 #ifdef HAVE_LCD_CHARCELLS
850 static bool jump_scroll(void)
852 static const struct opt_items names
[] = {
854 { STR(LANG_ONE_TIME
) },
855 { "2", TALK_ID(2, UNIT_INT
) },
856 { "3", TALK_ID(3, UNIT_INT
) },
857 { "4", TALK_ID(4, UNIT_INT
) },
861 ret
=set_option(str(LANG_JUMP_SCROLL
), &global_settings
.jump_scroll
,
862 INT
, names
, 6, lcd_jump_scroll
);
865 static bool jump_scroll_delay(void)
867 int dummy
= global_settings
.jump_scroll_delay
* (HZ
/10);
868 int rc
= set_int(str(LANG_JUMP_SCROLL_DELAY
), "ms", UNIT_MS
,
870 &lcd_jump_scroll_delay
, 100, 0, 2500, NULL
);
871 global_settings
.jump_scroll_delay
= dummy
/ (HZ
/10);
878 * Menu to set the battery capacity
880 static bool battery_capacity(void)
882 return set_int(str(LANG_BATTERY_CAPACITY
), "mAh", UNIT_MAH
,
883 &global_settings
.battery_capacity
,
884 &set_battery_capacity
, 50, BATTERY_CAPACITY_MIN
,
885 BATTERY_CAPACITY_MAX
, NULL
);
888 #if BATTERY_TYPES_COUNT > 1
889 static bool battery_type(void)
891 static const struct opt_items names
[] = {
892 { STR(LANG_BATTERY_TYPE_ALKALINE
) },
893 { STR(LANG_BATTERY_TYPE_NIMH
) }
896 return set_option(str(LANG_BATTERY_TYPE
), &global_settings
.battery_type
,
897 INT
, names
, 2, set_battery_type
);
903 static bool timedate_set(void)
908 /* Make a local copy of the time struct */
909 memcpy(&tm
, get_time(), sizeof(struct tm
));
911 /* do some range checks */
912 /* This prevents problems with time/date setting after a power loss */
913 if (!valid_time(&tm
))
925 result
= set_time_screen(str(LANG_TIME
), &tm
);
927 if(tm
.tm_year
!= -1) {
933 static bool timeformat_set(void)
935 static const struct opt_items names
[] = {
936 { STR(LANG_24_HOUR_CLOCK
) },
937 { STR(LANG_12_HOUR_CLOCK
) }
939 return set_option(str(LANG_TIMEFORMAT
), &global_settings
.timeformat
,
940 INT
, names
, 2, NULL
);
945 static bool spindown(void)
947 return set_int(str(LANG_SPINDOWN
), "s", UNIT_SEC
,
948 &global_settings
.disk_spindown
,
949 ata_spindown
, 1, 3, 254, NULL
);
952 #ifdef HAVE_ATA_POWER_OFF
953 static bool poweroff(void)
955 bool rc
= set_bool(str(LANG_POWEROFF
), &global_settings
.disk_poweroff
);
956 ata_poweroff(global_settings
.disk_poweroff
);
959 #endif /* HAVE_ATA_POWEROFF */
960 #endif /* !HAVE_MMC */
962 #if CONFIG_CODEC == MAS3507D
963 static bool line_in(void)
965 bool rc
= set_bool(str(LANG_LINE_IN
), &global_settings
.line_in
);
967 dac_line_in(global_settings
.line_in
);
973 static bool max_files_in_dir(void)
975 return set_int(str(LANG_MAX_FILES_IN_DIR
), "", UNIT_INT
,
976 &global_settings
.max_files_in_dir
,
977 NULL
, 50, 50, 10000, NULL
);
980 static bool max_files_in_playlist(void)
982 return set_int(str(LANG_MAX_FILES_IN_PLAYLIST
), "", UNIT_INT
,
983 &global_settings
.max_files_in_playlist
,
984 NULL
, 1000, 1000, 20000, NULL
);
987 #if CONFIG_CODEC == SWCODEC
988 static bool buffer_margin(void)
991 static const struct opt_items names
[] = {
992 { "5s", TALK_ID(5, UNIT_SEC
) },
993 { "15s", TALK_ID(15, UNIT_SEC
) },
994 { "30s", TALK_ID(30, UNIT_SEC
) },
995 { "1min", TALK_ID(1, UNIT_MIN
) },
996 { "2min", TALK_ID(2, UNIT_MIN
) },
997 { "3min", TALK_ID(3, UNIT_MIN
) },
998 { "5min", TALK_ID(5, UNIT_MIN
) },
999 { "10min", TALK_ID(10, UNIT_MIN
) }
1002 ret
= set_option(str(LANG_MP3BUFFER_MARGIN
), &global_settings
.buffer_margin
,
1003 INT
, names
, 8, NULL
);
1004 audio_set_buffer_margin(global_settings
.buffer_margin
);
1009 static bool buffer_margin(void)
1011 return set_int(str(LANG_MP3BUFFER_MARGIN
), "s", UNIT_SEC
,
1012 &global_settings
.buffer_margin
,
1013 audio_set_buffer_margin
, 1, 0, 7, NULL
);
1017 static bool ff_rewind_min_step(void)
1019 static const struct opt_items names
[] = {
1020 { "1s", TALK_ID(1, UNIT_SEC
) },
1021 { "2s", TALK_ID(2, UNIT_SEC
) },
1022 { "3s", TALK_ID(3, UNIT_SEC
) },
1023 { "4s", TALK_ID(4, UNIT_SEC
) },
1024 { "5s", TALK_ID(5, UNIT_SEC
) },
1025 { "6s", TALK_ID(6, UNIT_SEC
) },
1026 { "8s", TALK_ID(8, UNIT_SEC
) },
1027 { "10s", TALK_ID(10, UNIT_SEC
) },
1028 { "15s", TALK_ID(15, UNIT_SEC
) },
1029 { "20s", TALK_ID(20, UNIT_SEC
) },
1030 { "25s", TALK_ID(25, UNIT_SEC
) },
1031 { "30s", TALK_ID(30, UNIT_SEC
) },
1032 { "45s", TALK_ID(45, UNIT_SEC
) },
1033 { "60s", TALK_ID(60, UNIT_SEC
) }
1035 return set_option(str(LANG_FFRW_STEP
), &global_settings
.ff_rewind_min_step
,
1036 INT
, names
, 14, NULL
);
1039 static bool set_fade_on_stop(void)
1041 return set_bool( str(LANG_FADE_ON_STOP
), &global_settings
.fade_on_stop
);
1044 static bool set_party_mode(void)
1046 return set_bool( str(LANG_PARTY_MODE
), &global_settings
.party_mode
);
1050 static bool ff_rewind_accel(void)
1052 static const struct opt_items names
[] = {
1054 { "2x/1s", TALK_ID(1, UNIT_SEC
) },
1055 { "2x/2s", TALK_ID(2, UNIT_SEC
) },
1056 { "2x/3s", TALK_ID(3, UNIT_SEC
) },
1057 { "2x/4s", TALK_ID(4, UNIT_SEC
) },
1058 { "2x/5s", TALK_ID(5, UNIT_SEC
) },
1059 { "2x/6s", TALK_ID(6, UNIT_SEC
) },
1060 { "2x/7s", TALK_ID(7, UNIT_SEC
) },
1061 { "2x/8s", TALK_ID(8, UNIT_SEC
) },
1062 { "2x/9s", TALK_ID(9, UNIT_SEC
) },
1063 { "2x/10s", TALK_ID(10, UNIT_SEC
) },
1064 { "2x/11s", TALK_ID(11, UNIT_SEC
) },
1065 { "2x/12s", TALK_ID(12, UNIT_SEC
) },
1066 { "2x/13s", TALK_ID(13, UNIT_SEC
) },
1067 { "2x/14s", TALK_ID(14, UNIT_SEC
) },
1068 { "2x/15s", TALK_ID(15, UNIT_SEC
) }
1070 return set_option(str(LANG_FFRW_ACCEL
), &global_settings
.ff_rewind_accel
,
1071 INT
, names
, 16, NULL
);
1074 static bool browse_current(void)
1076 return set_bool( str(LANG_FOLLOW
), &global_settings
.browse_current
);
1079 static bool custom_wps_browse(void)
1081 return rockbox_browse(WPS_DIR
, SHOW_WPS
);
1084 #ifdef HAVE_REMOTE_LCD
1085 static bool custom_remote_wps_browse(void)
1087 return rockbox_browse(WPS_DIR
, SHOW_RWPS
);
1091 static bool custom_cfg_browse(void)
1093 return rockbox_browse(ROCKBOX_DIR
, SHOW_CFG
);
1096 static bool language_browse(void)
1098 return rockbox_browse(ROCKBOX_DIR LANG_DIR
, SHOW_LNG
);
1101 static bool voice_menus(void)
1104 bool temp
= global_settings
.talk_menu
;
1105 /* work on a temp variable first, avoid "life" disabling */
1106 ret
= set_bool( str(LANG_VOICE_MENU
), &temp
);
1107 global_settings
.talk_menu
= temp
;
1111 /* this is used 2 times below, so it saves memory to put it in global scope */
1112 static const struct opt_items voice_names
[] = {
1114 { STR(LANG_VOICE_NUMBER
) },
1115 { STR(LANG_VOICE_SPELL
) },
1116 { STR(LANG_VOICE_DIR_HOVER
) }
1119 static bool voice_dirs(void)
1121 return set_option( str(LANG_VOICE_DIR
),
1122 &global_settings
.talk_dir
, INT
, voice_names
, 4, NULL
);
1125 static bool voice_files(void)
1127 int oldval
= global_settings
.talk_file
;
1129 ret
= set_option( str(LANG_VOICE_FILE
),
1130 &global_settings
.talk_file
, INT
, voice_names
, 4, NULL
);
1131 if (oldval
!= 3 && global_settings
.talk_file
== 3)
1132 { /* force reload if newly talking thumbnails,
1133 because the clip presence is cached only if enabled */
1139 static bool voice_menu(void)
1144 static const struct menu_item items
[] = {
1145 { ID2P(LANG_VOICE_MENU
), voice_menus
},
1146 { ID2P(LANG_VOICE_DIR
), voice_dirs
},
1147 { ID2P(LANG_VOICE_FILE
), voice_files
}
1150 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1152 result
= menu_run(m
);
1157 #ifdef HAVE_LCD_BITMAP
1158 static bool font_browse(void)
1160 return rockbox_browse(ROCKBOX_DIR FONT_DIR
, SHOW_FONT
);
1163 static bool scroll_bar(void)
1165 return set_bool( str(LANG_SCROLL_BAR
), &global_settings
.scrollbar
);
1168 static bool status_bar(void)
1170 return set_bool( str(LANG_STATUS_BAR
), &global_settings
.statusbar
);
1173 #if CONFIG_KEYPAD == RECORDER_PAD
1174 static bool button_bar(void)
1176 return set_bool( str(LANG_BUTTON_BAR
), &global_settings
.buttonbar
);
1178 #endif /* CONFIG_KEYPAD == RECORDER_PAD */
1179 #endif /* HAVE_LCD_BITMAP */
1181 static bool ff_rewind_settings_menu(void)
1186 static const struct menu_item items
[] = {
1187 { ID2P(LANG_FFRW_STEP
), ff_rewind_min_step
},
1188 { ID2P(LANG_FFRW_ACCEL
), ff_rewind_accel
},
1191 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1193 result
= menu_run(m
);
1199 static bool id3_order(void)
1201 return set_bool_options( str(LANG_ID3_ORDER
),
1202 &global_settings
.id3_v1_first
,
1203 STR(LANG_ID3_V1_FIRST
),
1204 STR(LANG_ID3_V2_FIRST
),
1208 static bool next_folder(void)
1210 return set_bool( str(LANG_NEXT_FOLDER
), &global_settings
.next_folder
);
1213 static bool runtimedb(void)
1216 bool old
= global_settings
.runtimedb
;
1218 rc
= set_bool( str(LANG_RUNTIMEDB_ACTIVE
),
1219 &global_settings
.runtimedb
);
1220 if (old
&& !global_settings
.runtimedb
)
1222 if (!old
&& global_settings
.runtimedb
)
1228 static bool codepage_setting(void)
1230 static const struct opt_items names
[] = {
1231 { STR(LANG_CODEPAGE_LATIN1
) },
1232 { STR(LANG_CODEPAGE_GREEK
) },
1233 { STR(LANG_CODEPAGE_HEBREW
) },
1234 { STR(LANG_CODEPAGE_RUSSIAN
) },
1235 { STR(LANG_CODEPAGE_THAI
) },
1236 { STR(LANG_CODEPAGE_ARABIC
) },
1237 { STR(LANG_CODEPAGE_TURKISH
) },
1238 { STR(LANG_CODEPAGE_LATIN_EXTENDED
) },
1239 { STR(LANG_CODEPAGE_JAPANESE
) },
1240 { STR(LANG_CODEPAGE_SIMPLIFIED
) },
1241 { STR(LANG_CODEPAGE_KOREAN
) },
1242 { STR(LANG_CODEPAGE_TRADITIONAL
) },
1243 { STR(LANG_CODEPAGE_UTF8
) },
1245 return set_option(str(LANG_DEFAULT_CODEPAGE
),
1246 &global_settings
.default_codepage
,
1247 INT
, names
, 13, set_codepage
);
1250 #if CONFIG_CODEC == SWCODEC
1251 static bool replaygain(void)
1253 bool result
= set_bool(str(LANG_REPLAYGAIN_ENABLE
),
1254 &global_settings
.replaygain
);
1256 dsp_set_replaygain(true);
1260 static bool replaygain_mode(void)
1262 static const struct opt_items names
[] = {
1263 { STR(LANG_TRACK_GAIN
) },
1264 { STR(LANG_ALBUM_GAIN
) },
1265 { STR(LANG_SHUFFLE_GAIN
) },
1267 bool result
= set_option(str(LANG_REPLAYGAIN_MODE
),
1268 &global_settings
.replaygain_type
, INT
, names
, 3, NULL
);
1270 dsp_set_replaygain(true);
1274 static bool replaygain_noclip(void)
1276 bool result
= set_bool(str(LANG_REPLAYGAIN_NOCLIP
),
1277 &global_settings
.replaygain_noclip
);
1279 dsp_set_replaygain(true);
1283 void replaygain_preamp_format(char* buffer
, int buffer_size
, int value
,
1288 snprintf(buffer
, buffer_size
, "%s%d.%d %s", value
< 0 ? "-" : "",
1289 v
/ 10, v
% 10, unit
);
1292 static bool replaygain_preamp(void)
1294 bool result
= set_int(str(LANG_REPLAYGAIN_PREAMP
), str(LANG_UNIT_DB
),
1295 UNIT_DB
, &global_settings
.replaygain_preamp
, NULL
, 1, -120, 120,
1296 replaygain_preamp_format
);
1298 dsp_set_replaygain(true);
1302 static bool replaygain_settings_menu(void)
1307 static const struct menu_item items
[] = {
1308 { ID2P(LANG_REPLAYGAIN_ENABLE
), replaygain
},
1309 { ID2P(LANG_REPLAYGAIN_NOCLIP
), replaygain_noclip
},
1310 { ID2P(LANG_REPLAYGAIN_MODE
), replaygain_mode
},
1311 { ID2P(LANG_REPLAYGAIN_PREAMP
), replaygain_preamp
},
1314 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1316 result
= menu_run(m
);
1321 static bool crossfade(void)
1323 static const struct opt_items names
[] = {
1325 { STR(LANG_SHUFFLE
) },
1326 { STR(LANG_ALWAYS
) },
1331 ret
=set_option( str(LANG_CROSSFADE_ENABLE
),
1332 &global_settings
.crossfade
, INT
, names
, 3, NULL
);
1334 audio_set_crossfade(global_settings
.crossfade
);
1339 static bool crossfade_fade_in_delay(void)
1343 ret
= set_int(str(LANG_CROSSFADE_FADE_IN_DELAY
), "s", UNIT_SEC
,
1344 &global_settings
.crossfade_fade_in_delay
,
1345 NULL
, 1, 0, 7, NULL
);
1346 audio_set_crossfade(global_settings
.crossfade
);
1350 static bool crossfade_fade_out_delay(void)
1354 ret
= set_int(str(LANG_CROSSFADE_FADE_OUT_DELAY
), "s", UNIT_SEC
,
1355 &global_settings
.crossfade_fade_out_delay
,
1356 NULL
, 1, 0, 7, NULL
);
1357 audio_set_crossfade(global_settings
.crossfade
);
1361 static bool crossfade_fade_in_duration(void)
1365 ret
= set_int(str(LANG_CROSSFADE_FADE_IN_DURATION
), "s", UNIT_SEC
,
1366 &global_settings
.crossfade_fade_in_duration
,
1367 NULL
, 1, 0, 15, NULL
);
1368 audio_set_crossfade(global_settings
.crossfade
);
1372 static bool crossfade_fade_out_duration(void)
1376 ret
= set_int(str(LANG_CROSSFADE_FADE_OUT_DURATION
), "s", UNIT_SEC
,
1377 &global_settings
.crossfade_fade_out_duration
,
1378 NULL
, 1, 0, 15, NULL
);
1379 audio_set_crossfade(global_settings
.crossfade
);
1383 static bool crossfade_fade_out_mixmode(void)
1385 static const struct opt_items names
[] = {
1386 { STR(LANG_CROSSFADE
) },
1390 ret
=set_option( str(LANG_CROSSFADE_FADE_OUT_MODE
),
1391 &global_settings
.crossfade_fade_out_mixmode
, INT
, names
, 2, NULL
);
1397 * Menu to configure the crossfade settings.
1399 static bool crossfade_settings_menu(void)
1404 static const struct menu_item items
[] = {
1405 { ID2P(LANG_CROSSFADE_ENABLE
), crossfade
},
1406 { ID2P(LANG_CROSSFADE_FADE_IN_DELAY
), crossfade_fade_in_delay
},
1407 { ID2P(LANG_CROSSFADE_FADE_IN_DURATION
), crossfade_fade_in_duration
},
1408 { ID2P(LANG_CROSSFADE_FADE_OUT_DELAY
), crossfade_fade_out_delay
},
1409 { ID2P(LANG_CROSSFADE_FADE_OUT_DURATION
), crossfade_fade_out_duration
},
1410 { ID2P(LANG_CROSSFADE_FADE_OUT_MODE
), crossfade_fade_out_mixmode
},
1413 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1415 result
= menu_run(m
);
1420 static bool beep(void)
1422 static const struct opt_items names
[] = {
1425 { STR(LANG_MODERATE
) },
1426 { STR(LANG_STRONG
) },
1429 ret
=set_option( str(LANG_BEEP
),
1430 &global_settings
.beep
, INT
, names
, 4, NULL
);
1436 #ifdef HAVE_DIRCACHE
1437 static bool dircache(void)
1439 bool result
= set_bool_options(str(LANG_DIRCACHE_ENABLE
),
1440 &global_settings
.dircache
,
1445 if (!dircache_is_enabled() && global_settings
.dircache
)
1446 gui_syncsplash(HZ
*2, true, str(LANG_DIRCACHE_REBOOT
));
1454 #endif /* HAVE_DIRCACHE */
1456 static bool playback_settings_menu(void)
1461 static const struct menu_item items
[] = {
1462 { ID2P(LANG_SHUFFLE
), shuffle
},
1463 { ID2P(LANG_REPEAT
), repeat_mode
},
1464 { ID2P(LANG_PLAY_SELECTED
), play_selected
},
1465 { ID2P(LANG_RESUME
), resume
},
1466 { ID2P(LANG_WIND_MENU
), ff_rewind_settings_menu
},
1467 { ID2P(LANG_MP3BUFFER_MARGIN
), buffer_margin
},
1468 { ID2P(LANG_FADE_ON_STOP
), set_fade_on_stop
},
1469 { ID2P(LANG_PARTY_MODE
), set_party_mode
},
1470 #if CONFIG_CODEC == SWCODEC
1471 { ID2P(LANG_CROSSFADE
), crossfade_settings_menu
},
1472 { ID2P(LANG_REPLAYGAIN
), replaygain_settings_menu
},
1473 { ID2P(LANG_BEEP
), beep
},
1475 #ifdef HAVE_SPDIF_POWER
1476 { ID2P(LANG_SPDIF_ENABLE
), spdif
},
1478 { ID2P(LANG_ID3_ORDER
), id3_order
},
1479 { ID2P(LANG_NEXT_FOLDER
), next_folder
},
1480 { ID2P(LANG_RUNTIMEDB_ACTIVE
), runtimedb
},
1483 bool old_shuffle
= global_settings
.playlist_shuffle
;
1485 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1487 result
= menu_run(m
);
1490 if ((old_shuffle
!= global_settings
.playlist_shuffle
)
1491 && (audio_status() & AUDIO_STATUS_PLAY
))
1493 #if CONFIG_CODEC == SWCODEC
1494 dsp_set_replaygain(true);
1497 if (global_settings
.playlist_shuffle
)
1499 playlist_randomise(NULL
, current_tick
, true);
1503 playlist_sort(NULL
, true);
1509 static bool bookmark_settings_menu(void)
1514 static const struct menu_item items
[] = {
1515 { ID2P(LANG_BOOKMARK_SETTINGS_AUTOCREATE
), autocreatebookmark
},
1516 { ID2P(LANG_BOOKMARK_SETTINGS_AUTOLOAD
), autoloadbookmark
},
1517 { ID2P(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS
), useMRB
},
1520 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1522 result
= menu_run(m
);
1527 static bool reset_settings(void)
1529 unsigned char *lines
[]={str(LANG_RESET_ASK_RECORDER
)};
1530 unsigned char *yes_lines
[]={
1531 str(LANG_RESET_DONE_SETTING
),
1532 str(LANG_RESET_DONE_CLEAR
)
1534 unsigned char *no_lines
[]={yes_lines
[0], str(LANG_RESET_DONE_CANCEL
)};
1535 struct text_message message
={(char **)lines
, 1};
1536 struct text_message yes_message
={(char **)yes_lines
, 2};
1537 struct text_message no_message
={(char **)no_lines
, 2};
1539 switch(gui_syncyesno_run(&message
, &yes_message
, &no_message
))
1553 static bool fileview_settings_menu(void)
1558 static const struct menu_item items
[] = {
1559 { ID2P(LANG_SORT_CASE
), sort_case
},
1560 { ID2P(LANG_SORT_DIR
), sort_dir
},
1561 { ID2P(LANG_SORT_FILE
), sort_file
},
1562 { ID2P(LANG_FILTER
), dir_filter
},
1563 { ID2P(LANG_FOLLOW
), browse_current
},
1564 { ID2P(LANG_SHOW_ICONS
), show_icons
},
1567 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1569 result
= menu_run(m
);
1575 static bool scroll_settings_menu(void)
1580 static const struct menu_item items
[] = {
1581 { ID2P(LANG_SCROLL_SPEED
), scroll_speed
},
1582 { ID2P(LANG_SCROLL_DELAY
), scroll_delay
},
1583 #ifdef HAVE_LCD_BITMAP
1584 { ID2P(LANG_SCROLL_STEP
), scroll_step
},
1586 { ID2P(LANG_BIDIR_SCROLL
), bidir_limit
},
1587 #ifdef HAVE_LCD_CHARCELLS
1588 { ID2P(LANG_JUMP_SCROLL
), jump_scroll
},
1589 { ID2P(LANG_JUMP_SCROLL_DELAY
), jump_scroll_delay
},
1591 #ifdef HAVE_LCD_BITMAP
1592 { ID2P(LANG_SCREEN_SCROLL_VIEW
), screen_scroll
},
1593 { ID2P(LANG_SCREEN_SCROLL_STEP
), screen_scroll_step
},
1595 { ID2P(LANG_SCROLL_PAGINATED
), scroll_paginated
},
1598 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1600 result
= menu_run(m
);
1605 static bool lcd_settings_menu(void)
1610 static const struct menu_item items
[] = {
1611 #ifdef CONFIG_BACKLIGHT
1612 { ID2P(LANG_BACKLIGHT
), backlight_timer
},
1613 #ifdef HAVE_CHARGING
1614 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING
), backlight_timer_plugged
},
1616 { ID2P(LANG_CAPTION_BACKLIGHT
), caption_backlight
},
1617 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
1618 { ID2P(LANG_BACKLIGHT_FADE_IN
), backlight_fade_in
},
1619 { ID2P(LANG_BACKLIGHT_FADE_OUT
), backlight_fade_out
},
1621 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
1622 { ID2P(LANG_BRIGHTNESS
), brightness
},
1624 #endif /* CONFIG_BACKLIGHT */
1625 { ID2P(LANG_CONTRAST
), contrast
},
1626 #ifdef HAVE_LCD_BITMAP
1627 { ID2P(LANG_INVERT
), invert
},
1628 { ID2P(LANG_FLIP_DISPLAY
), flip_display
},
1629 { ID2P(LANG_INVERT_CURSOR
), invert_cursor
},
1631 #ifdef HAVE_LCD_COLOR
1632 { ID2P(LANG_CLEAR_BACKDROP
), clear_main_backdrop
},
1633 { ID2P(LANG_BACKGROUND_COLOR
), set_bg_color
},
1634 { ID2P(LANG_FOREGROUND_COLOR
), set_fg_color
},
1635 { ID2P(LANG_RESET_COLORS
), reset_color
},
1639 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1641 result
= menu_run(m
);
1646 #ifdef HAVE_REMOTE_LCD
1647 static bool lcd_remote_settings_menu(void)
1652 static const struct menu_item items
[] = {
1653 { ID2P(LANG_BACKLIGHT
), remote_backlight_timer
},
1654 #ifdef HAVE_CHARGING
1655 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING
),
1656 remote_backlight_timer_plugged
},
1658 { ID2P(LANG_CAPTION_BACKLIGHT
), remote_caption_backlight
},
1659 { ID2P(LANG_CONTRAST
), remote_contrast
},
1660 { ID2P(LANG_INVERT
), remote_invert
},
1661 { ID2P(LANG_FLIP_DISPLAY
), remote_flip_display
},
1662 #ifdef HAVE_REMOTE_LCD_TICKING
1663 { ID2P(LANG_REDUCE_TICKING
), remote_reduce_ticking
},
1667 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1669 result
= menu_run(m
);
1675 #ifdef HAVE_LCD_BITMAP
1676 static bool bars_settings_menu(void)
1681 static const struct menu_item items
[] = {
1682 { ID2P(LANG_SCROLL_BAR
), scroll_bar
},
1683 { ID2P(LANG_STATUS_BAR
), status_bar
},
1684 #if CONFIG_KEYPAD == RECORDER_PAD
1685 { ID2P(LANG_BUTTON_BAR
), button_bar
},
1687 { ID2P(LANG_VOLUME_DISPLAY
), volume_type
},
1688 { ID2P(LANG_BATTERY_DISPLAY
), battery_display
},
1691 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1693 result
= menu_run(m
);
1700 static bool display_settings_menu(void)
1705 static const struct menu_item items
[] = {
1706 #ifdef HAVE_LCD_BITMAP
1707 { ID2P(LANG_CUSTOM_FONT
), font_browse
},
1709 { ID2P(LANG_WHILE_PLAYING
), custom_wps_browse
},
1710 #ifdef HAVE_REMOTE_LCD
1711 { ID2P(LANG_REMOTE_WHILE_PLAYING
), custom_remote_wps_browse
},
1713 { ID2P(LANG_LCD_MENU
), lcd_settings_menu
},
1714 #ifdef HAVE_REMOTE_LCD
1715 { ID2P(LANG_LCD_REMOTE_MENU
), lcd_remote_settings_menu
},
1717 { ID2P(LANG_SCROLL_MENU
), scroll_settings_menu
},
1718 #ifdef HAVE_LCD_BITMAP
1719 { ID2P(LANG_BARS_MENU
), bars_settings_menu
},
1720 { ID2P(LANG_PM_MENU
), peak_meter_menu
},
1722 { ID2P(LANG_DEFAULT_CODEPAGE
), codepage_setting
},
1725 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1727 result
= menu_run(m
);
1733 static bool firmware_browse(void)
1735 return rockbox_browse(ROCKBOX_DIR
, SHOW_MOD
);
1738 static bool battery_settings_menu(void)
1743 static const struct menu_item items
[] = {
1745 { ID2P(LANG_BATTERY_CAPACITY
), battery_capacity
},
1746 #if BATTERY_TYPES_COUNT > 1
1747 { ID2P(LANG_BATTERY_TYPE
), battery_type
},
1750 #ifndef HAVE_CHARGE_CTRL
1751 { "Dummy", NULL
}, /* to have an entry at all, in the simulator */
1756 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1758 result
= menu_run(m
);
1764 static bool disk_settings_menu(void)
1769 static const struct menu_item items
[] = {
1770 { ID2P(LANG_SPINDOWN
), spindown
},
1771 #ifdef HAVE_ATA_POWER_OFF
1772 { ID2P(LANG_POWEROFF
), poweroff
},
1774 #ifdef HAVE_DIRCACHE
1775 { ID2P(LANG_DIRCACHE_ENABLE
), dircache
},
1779 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1781 result
= menu_run(m
);
1785 #endif /* !HAVE_MMC */
1788 static bool time_settings_menu(void)
1793 static const struct menu_item items
[] = {
1794 { ID2P(LANG_TIME
), timedate_set
},
1795 { ID2P(LANG_TIMEFORMAT
), timeformat_set
},
1798 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1800 result
= menu_run(m
);
1806 bool manage_settings_menu(void)
1811 static const struct menu_item items
[] = {
1812 { ID2P(LANG_CUSTOM_CFG
), custom_cfg_browse
},
1813 { ID2P(LANG_FIRMWARE
), firmware_browse
},
1814 { ID2P(LANG_RESET
), reset_settings
},
1815 { ID2P(LANG_SAVE_SETTINGS
), settings_save_config
},
1818 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1820 result
= menu_run(m
);
1825 static bool limits_settings_menu(void)
1830 static const struct menu_item items
[] = {
1831 { ID2P(LANG_MAX_FILES_IN_DIR
), max_files_in_dir
},
1832 { ID2P(LANG_MAX_FILES_IN_PLAYLIST
), max_files_in_playlist
},
1835 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1837 result
= menu_run(m
);
1843 static bool system_settings_menu(void)
1848 static const struct menu_item items
[] = {
1849 { ID2P(LANG_BATTERY_MENU
), battery_settings_menu
},
1851 { ID2P(LANG_DISK_MENU
), disk_settings_menu
},
1854 { ID2P(LANG_TIME_MENU
), time_settings_menu
},
1856 { ID2P(LANG_POWEROFF_IDLE
), poweroff_idle_timer
},
1857 { ID2P(LANG_SLEEP_TIMER
), sleeptimer_screen
},
1858 #ifdef HAVE_ALARM_MOD
1859 { ID2P(LANG_ALARM_MOD_ALARM_MENU
), alarm_screen
},
1861 { ID2P(LANG_LIMITS_MENU
), limits_settings_menu
},
1862 #if CONFIG_CODEC == MAS3507D
1863 { ID2P(LANG_LINE_IN
), line_in
},
1865 #ifdef HAVE_CHARGING
1866 { ID2P(LANG_CAR_ADAPTER_MODE
), car_adapter_mode
},
1870 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1872 result
= menu_run(m
);
1877 bool settings_menu(void)
1882 static const struct menu_item items
[] = {
1883 { ID2P(LANG_PLAYBACK
), playback_settings_menu
},
1884 { ID2P(LANG_FILE
), fileview_settings_menu
},
1885 { ID2P(LANG_DISPLAY
), display_settings_menu
},
1886 { ID2P(LANG_SYSTEM
), system_settings_menu
},
1887 { ID2P(LANG_BOOKMARK_SETTINGS
),bookmark_settings_menu
},
1888 { ID2P(LANG_LANGUAGE
), language_browse
},
1889 { ID2P(LANG_VOICE
), voice_menu
},
1892 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1894 result
= menu_run(m
);