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 "powermgmt.h"
45 #include "timefuncs.h"
54 #include "rbunicode.h"
58 #include "color_picker.h"
60 #ifdef HAVE_LCD_BITMAP
61 #include "peakmeter.h"
64 #if CONFIG_CODEC == MAS3507D
65 void dac_line_in(bool enable
);
68 #include "alarm_menu.h"
71 #ifdef HAVE_REMOTE_LCD
72 #include "lcd-remote.h"
75 #if CONFIG_CODEC == SWCODEC
77 #include "pcm_playback.h"
85 #ifdef CONFIG_CHARGING
86 static bool car_adapter_mode(void)
88 return set_bool( str(LANG_CAR_ADAPTER_MODE
),
89 &global_settings
.car_adapter_mode
);
94 * Menu to set icon visibility
96 static bool show_icons(void)
98 return set_bool( (char *)str(LANG_SHOW_ICONS
), &global_settings
.show_icons
);
101 static bool show_path(void)
103 static const struct opt_items names
[3] = {
105 { STR(LANG_SHOW_PATH_CURRENT
) },
106 { STR(LANG_SHOW_PATH_FULL
) },
109 return set_option(str(LANG_SHOW_PATH
),
110 &global_settings
.show_path_in_browser
,
111 INT
, names
, 3, NULL
);
115 * Menu to set the option to scroll paginated
117 static bool scroll_paginated(void)
119 return set_bool( (char *)str(LANG_SCROLL_PAGINATED
), &global_settings
.scroll_paginated
);
122 #ifdef HAVE_REMOTE_LCD
123 static bool remote_contrast(void)
125 return set_int( str(LANG_CONTRAST
), "", UNIT_INT
,
126 &global_settings
.remote_contrast
,
127 lcd_remote_set_contrast
, 1, MIN_CONTRAST_SETTING
,
128 MAX_CONTRAST_SETTING
, NULL
);
131 static bool remote_invert(void)
133 bool rc
= set_bool_options((char *)str(LANG_INVERT
),
134 &global_settings
.remote_invert
,
135 (char *)STR(LANG_INVERT_LCD_INVERSE
),
136 STR(LANG_INVERT_LCD_NORMAL
),
137 lcd_remote_set_invert_display
);
141 static bool remote_flip_display(void)
143 bool rc
= set_bool( (char *)str(LANG_FLIP_DISPLAY
),
144 &global_settings
.remote_flip_display
);
146 lcd_remote_set_flip(global_settings
.remote_flip_display
);
152 #ifdef HAVE_REMOTE_LCD_TICKING
153 static bool remote_reduce_ticking(void)
155 bool rc
= set_bool( str(LANG_REDUCE_TICKING
),
156 &global_settings
.remote_reduce_ticking
);
158 lcd_remote_emireduce(global_settings
.remote_reduce_ticking
);
165 #ifdef CONFIG_BACKLIGHT
166 static const struct opt_items backlight_timeouts
[] = {
169 { (unsigned char *)"1s ", TALK_ID(1, UNIT_SEC
) },
170 { (unsigned char *)"2s ", TALK_ID(2, UNIT_SEC
) },
171 { (unsigned char *)"3s ", TALK_ID(3, UNIT_SEC
) },
172 { (unsigned char *)"4s ", TALK_ID(4, UNIT_SEC
) },
173 { (unsigned char *)"5s ", TALK_ID(5, UNIT_SEC
) },
174 { (unsigned char *)"6s ", TALK_ID(6, UNIT_SEC
) },
175 { (unsigned char *)"7s ", TALK_ID(7, UNIT_SEC
) },
176 { (unsigned char *)"8s ", TALK_ID(8, UNIT_SEC
) },
177 { (unsigned char *)"9s ", TALK_ID(9, UNIT_SEC
) },
178 { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC
) },
179 { (unsigned char *)"15s", TALK_ID(15, UNIT_SEC
) },
180 { (unsigned char *)"20s", TALK_ID(20, UNIT_SEC
) },
181 { (unsigned char *)"25s", TALK_ID(25, UNIT_SEC
) },
182 { (unsigned char *)"30s", TALK_ID(30, UNIT_SEC
) },
183 { (unsigned char *)"45s", TALK_ID(45, UNIT_SEC
) },
184 { (unsigned char *)"60s", TALK_ID(60, UNIT_SEC
) },
185 { (unsigned char *)"90s", TALK_ID(90, UNIT_SEC
) }
188 static bool caption_backlight(void)
190 return set_bool( (char *)str(LANG_CAPTION_BACKLIGHT
),
191 &global_settings
.caption_backlight
);
194 #ifdef CONFIG_CHARGING
195 static bool backlight_timer_plugged(void)
197 return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING
),
198 &global_settings
.backlight_timeout_plugged
,
199 INT
, backlight_timeouts
, 19,
200 backlight_set_timeout_plugged
);
204 static bool backlight_timer(void)
206 return set_option((char *)str(LANG_BACKLIGHT
),
207 &global_settings
.backlight_timeout
,
208 INT
, backlight_timeouts
, 19,
209 backlight_set_timeout
);
212 #ifdef HAS_BUTTON_HOLD
213 static bool backlight_on_button_hold(void)
215 static const struct opt_items names
[3] = {
216 { STR(LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL
) },
220 return set_option(str(LANG_BACKLIGHT_ON_BUTTON_HOLD
),
221 &global_settings
.backlight_on_button_hold
,
223 backlight_set_on_button_hold
);
225 #endif /* HAS_BUTTON_HOLD */
227 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
228 static bool backlight_fade_in(void)
230 static const struct opt_items names
[] = {
232 { (unsigned char *)"500ms", TALK_ID(500, UNIT_MS
) },
233 { (unsigned char *)"1s", TALK_ID(1, UNIT_SEC
) },
234 { (unsigned char *)"2s", TALK_ID(2, UNIT_SEC
) },
236 return set_option(str(LANG_BACKLIGHT_FADE_IN
),
237 &global_settings
.backlight_fade_in
,
238 INT
, names
, 4, backlight_set_fade_in
);
241 static bool backlight_fade_out(void)
243 static const struct opt_items names
[] = {
245 { (unsigned char *)"500ms", TALK_ID(500, UNIT_MS
) },
246 { (unsigned char *)"1s", TALK_ID(1, UNIT_SEC
) },
247 { (unsigned char *)"2s", TALK_ID(2, UNIT_SEC
) },
248 { (unsigned char *)"3s", TALK_ID(3, UNIT_SEC
) },
249 { (unsigned char *)"4s", TALK_ID(4, UNIT_SEC
) },
250 { (unsigned char *)"5s", TALK_ID(5, UNIT_SEC
) },
251 { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC
) },
253 return set_option(str(LANG_BACKLIGHT_FADE_OUT
),
254 &global_settings
.backlight_fade_out
,
255 INT
, names
, 8, backlight_set_fade_out
);
259 #ifdef HAVE_LCD_SLEEP
260 static bool lcd_sleep_after_backlight_off(void)
262 static const struct opt_items names
[] = {
263 { STR(LANG_ALWAYS
) },
265 { (unsigned char *)"5s", TALK_ID(5, UNIT_SEC
) },
266 { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC
) },
267 { (unsigned char *)"15s", TALK_ID(15, UNIT_SEC
) },
268 { (unsigned char *)"20s", TALK_ID(20, UNIT_SEC
) },
269 { (unsigned char *)"30s", TALK_ID(30, UNIT_SEC
) },
270 { (unsigned char *)"45s", TALK_ID(45, UNIT_SEC
) },
271 { (unsigned char *)"60s", TALK_ID(60, UNIT_SEC
) },
272 { (unsigned char *)"90s", TALK_ID(90, UNIT_SEC
) },
275 return set_option(str(LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF
),
276 &global_settings
.lcd_sleep_after_backlight_off
,
278 lcd_set_sleep_after_backlight_off
);
280 #endif /* HAVE_LCD_SLEEP */
281 #endif /* CONFIG_BACKLIGHT */
283 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
284 static bool brightness(void)
286 return set_int( str(LANG_BRIGHTNESS
), "", UNIT_INT
,
287 &global_settings
.brightness
,
288 backlight_set_brightness
, 1, MIN_BRIGHTNESS_SETTING
,
289 MAX_BRIGHTNESS_SETTING
, NULL
);
293 #ifdef HAVE_REMOTE_LCD
295 static bool remote_backlight_timer(void)
297 return set_option((char *)str(LANG_BACKLIGHT
),
298 &global_settings
.remote_backlight_timeout
,
299 INT
, backlight_timeouts
, 19,
300 remote_backlight_set_timeout
);
303 #ifdef CONFIG_CHARGING
304 static bool remote_backlight_timer_plugged(void)
306 return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING
),
307 &global_settings
.remote_backlight_timeout_plugged
,
308 INT
, backlight_timeouts
, 19,
309 remote_backlight_set_timeout_plugged
);
311 #endif /* HAVE_REMOTE_LCD */
313 static bool remote_caption_backlight(void)
315 return set_bool((char *)str(LANG_CAPTION_BACKLIGHT
),
316 &global_settings
.remote_caption_backlight
);
318 #endif /* HAVE_REMOTE_LCD */
320 #ifdef HAVE_LCD_CONTRAST
321 static bool contrast(void)
323 return set_int( str(LANG_CONTRAST
), "", UNIT_INT
,
324 &global_settings
.contrast
,
325 lcd_set_contrast
, 1, MIN_CONTRAST_SETTING
,
326 MAX_CONTRAST_SETTING
, NULL
);
328 #endif /* HAVE_LCD_CONTRAST */
330 #ifdef HAVE_LCD_BITMAP
331 #ifndef HAVE_LCD_COLOR
333 * Menu to set LCD Mode (normal/inverse)
335 static bool invert(void)
337 bool rc
= set_bool_options(str(LANG_INVERT
),
338 &global_settings
.invert
,
339 (char *)STR(LANG_INVERT_LCD_INVERSE
),
340 STR(LANG_INVERT_LCD_NORMAL
),
341 lcd_set_invert_display
);
344 #endif /* HAVE_LCD_COLOR */
348 * Menu to turn the display+buttons by 180 degrees
350 static bool flip_display(void)
352 bool rc
= set_bool( str(LANG_FLIP_DISPLAY
),
353 &global_settings
.flip_display
);
355 button_set_flip(global_settings
.flip_display
);
356 lcd_set_flip(global_settings
.flip_display
);
360 #endif /* HAVE_LCD_FLIP */
363 * Menu to set Line Selector Type (Pointer/Bar)
365 static bool invert_cursor(void)
367 bool type
= global_settings
.invert_cursor
;
368 bool rc
= set_bool_options(str(LANG_INVERT_CURSOR
),
370 STR(LANG_INVERT_CURSOR_BAR
),
371 STR(LANG_INVERT_CURSOR_POINTER
),
373 global_settings
.invert_cursor
= type
;
377 #ifdef HAVE_LCD_COLOR
379 * Menu to clear the backdrop image
381 static bool clear_main_backdrop(void)
383 global_settings
.backdrop_file
[0]=0;
384 unload_main_backdrop();
385 show_main_backdrop();
390 * Menu for fore/back colors
392 static bool set_fg_color(void)
396 res
= set_color(&screens
[SCREEN_MAIN
],str(LANG_FOREGROUND_COLOR
),
397 &global_settings
.fg_color
,global_settings
.bg_color
);
399 screens
[SCREEN_MAIN
].set_foreground(global_settings
.fg_color
);
404 static bool set_bg_color(void)
408 res
= set_color(&screens
[SCREEN_MAIN
],str(LANG_BACKGROUND_COLOR
),
409 &global_settings
.bg_color
,global_settings
.fg_color
);
411 screens
[SCREEN_MAIN
].set_background(global_settings
.bg_color
);
416 static bool reset_color(void)
418 global_settings
.fg_color
= LCD_DEFAULT_FG
;
419 global_settings
.bg_color
= LCD_DEFAULT_BG
;
421 screens
[SCREEN_MAIN
].set_foreground(global_settings
.fg_color
);
422 screens
[SCREEN_MAIN
].set_background(global_settings
.bg_color
);
428 * Menu to configure the battery display on status bar
430 static bool battery_display(void)
432 static const struct opt_items names
[] = {
433 { STR(LANG_DISPLAY_GRAPHIC
) },
434 { STR(LANG_DISPLAY_NUMERIC
) }
436 return set_option( str(LANG_BATTERY_DISPLAY
),
437 &global_settings
.battery_display
, INT
, names
, 2, NULL
);
441 * Menu to configure the volume display on status bar
443 static bool volume_type(void)
445 static const struct opt_items names
[] = {
446 { STR(LANG_DISPLAY_GRAPHIC
) },
447 { STR(LANG_DISPLAY_NUMERIC
) }
449 return set_option( str(LANG_VOLUME_DISPLAY
), &global_settings
.volume_type
,
450 INT
, names
, 2, NULL
);
454 * Menu to set the hold time of normal peaks.
456 static bool peak_meter_hold(void) {
458 static const struct opt_items names
[] = {
460 { "200 ms " , TALK_ID(200, UNIT_MS
) },
461 { "300 ms " , TALK_ID(300, UNIT_MS
) },
462 { "500 ms " , TALK_ID(500, UNIT_MS
) },
463 { "1 s" , TALK_ID(1, UNIT_SEC
) },
464 { "2 s" , TALK_ID(2, UNIT_SEC
) },
465 { "3 s" , TALK_ID(3, UNIT_SEC
) },
466 { "4 s" , TALK_ID(4, UNIT_SEC
) },
467 { "5 s" , TALK_ID(5, UNIT_SEC
) },
468 { "6 s" , TALK_ID(6, UNIT_SEC
) },
469 { "7 s" , TALK_ID(7, UNIT_SEC
) },
470 { "8 s" , TALK_ID(8, UNIT_SEC
) },
471 { "9 s" , TALK_ID(9, UNIT_SEC
) },
472 { "10 s" , TALK_ID(10, UNIT_SEC
) },
473 { "15 s" , TALK_ID(15, UNIT_SEC
) },
474 { "20 s" , TALK_ID(20, UNIT_SEC
) },
475 { "30 s" , TALK_ID(30, UNIT_SEC
) },
476 { "1 min" , TALK_ID(1, UNIT_MIN
) }
478 retval
= set_option( str(LANG_PM_PEAK_HOLD
),
479 &global_settings
.peak_meter_hold
, INT
, names
,
482 peak_meter_init_times(global_settings
.peak_meter_release
,
483 global_settings
.peak_meter_hold
,
484 global_settings
.peak_meter_clip_hold
);
490 * Menu to set the hold time of clips.
492 static bool peak_meter_clip_hold(void) {
495 static const struct opt_items names
[] = {
496 { STR(LANG_PM_ETERNAL
) },
497 { "1s " , TALK_ID(1, UNIT_SEC
) },
498 { "2s " , TALK_ID(2, UNIT_SEC
) },
499 { "3s " , TALK_ID(3, UNIT_SEC
) },
500 { "4s " , TALK_ID(4, UNIT_SEC
) },
501 { "5s " , TALK_ID(5, UNIT_SEC
) },
502 { "6s " , TALK_ID(6, UNIT_SEC
) },
503 { "7s " , TALK_ID(7, UNIT_SEC
) },
504 { "8s " , TALK_ID(8, UNIT_SEC
) },
505 { "9s " , TALK_ID(9, UNIT_SEC
) },
506 { "10s" , TALK_ID(10, UNIT_SEC
) },
507 { "15s" , TALK_ID(15, UNIT_SEC
) },
508 { "20s" , TALK_ID(20, UNIT_SEC
) },
509 { "25s" , TALK_ID(25, UNIT_SEC
) },
510 { "30s" , TALK_ID(30, UNIT_SEC
) },
511 { "45s" , TALK_ID(45, UNIT_SEC
) },
512 { "60s" , TALK_ID(60, UNIT_SEC
) },
513 { "90s" , TALK_ID(90, UNIT_SEC
) },
514 { "2min" , TALK_ID(2, UNIT_MIN
) },
515 { "3min" , TALK_ID(3, UNIT_MIN
) },
516 { "5min" , TALK_ID(5, UNIT_MIN
) },
517 { "10min" , TALK_ID(10, UNIT_MIN
) },
518 { "20min" , TALK_ID(20, UNIT_MIN
) },
519 { "45min" , TALK_ID(45, UNIT_MIN
) },
520 { "90min" , TALK_ID(90, UNIT_MIN
) }
522 retval
= set_option( str(LANG_PM_CLIP_HOLD
),
523 &global_settings
.peak_meter_clip_hold
, INT
, names
,
524 25, peak_meter_set_clip_hold
);
526 peak_meter_init_times(global_settings
.peak_meter_release
,
527 global_settings
.peak_meter_hold
,
528 global_settings
.peak_meter_clip_hold
);
534 * Menu to set the release time of the peak meter.
536 static bool peak_meter_release(void) {
539 /* The range of peak_meter_release is restricted so that it
540 fits into a 7 bit number. The 8th bit is used for storing
541 something else in the rtc ram.
542 Also, the max value is 0x7e, since the RTC value 0xff is reserved */
543 retval
= set_int( str(LANG_PM_RELEASE
), str(LANG_PM_UNITS_PER_READ
),
544 LANG_PM_UNITS_PER_READ
,
545 &global_settings
.peak_meter_release
,
546 NULL
, 1, 1, 0x7e, NULL
);
548 peak_meter_init_times(global_settings
.peak_meter_release
,
549 global_settings
.peak_meter_hold
,
550 global_settings
.peak_meter_clip_hold
);
556 * Menu to select wether the scale of the meter
557 * displays dBfs of linear values.
559 static bool peak_meter_scale(void) {
561 bool use_dbfs
= global_settings
.peak_meter_dbfs
;
562 retval
= set_bool_options(str(LANG_PM_SCALE
),
564 STR(LANG_PM_DBFS
), STR(LANG_PM_LINEAR
),
567 /* has the user really changed the scale? */
568 if (use_dbfs
!= global_settings
.peak_meter_dbfs
) {
570 /* store the change */
571 global_settings
.peak_meter_dbfs
= use_dbfs
;
572 peak_meter_set_use_dbfs(use_dbfs
);
574 /* If the user changed the scale mode the meaning of
575 peak_meter_min (peak_meter_max) has changed. Thus we have
576 to convert the values stored in global_settings. */
579 /* we only store -dBfs */
580 global_settings
.peak_meter_min
= -peak_meter_get_min() / 100;
581 global_settings
.peak_meter_max
= -peak_meter_get_max() / 100;
586 global_settings
.peak_meter_min
= peak_meter_get_min();
588 /* converting dBfs -> percent results in a precision loss.
589 I assume that the user doesn't bother that conversion
590 dBfs <-> percent isn't symmetrical for odd values but that
591 he wants 0 dBfs == 100%. Thus I 'correct' the percent value
592 resulting from dBfs -> percent manually here */
593 max
= peak_meter_get_max();
594 global_settings
.peak_meter_max
= max
< 99 ? max
: 100;
596 settings_apply_pm_range();
602 * Adjust the min value of the value range that
603 * the peak meter shall visualize.
605 static bool peak_meter_min(void) {
607 if (global_settings
.peak_meter_dbfs
) {
610 int range_max
= -global_settings
.peak_meter_max
;
611 int min
= -global_settings
.peak_meter_min
;
613 retval
= set_int(str(LANG_PM_MIN
), str(LANG_PM_DBFS
), UNIT_DB
,
614 &min
, NULL
, 1, -89, range_max
, NULL
);
616 global_settings
.peak_meter_min
= - min
;
619 /* for linear scale */
621 int min
= global_settings
.peak_meter_min
;
623 retval
= set_int(str(LANG_PM_MIN
), "%", UNIT_PERCENT
,
625 1, 0, global_settings
.peak_meter_max
- 1, NULL
);
627 global_settings
.peak_meter_min
= (unsigned char)min
;
630 settings_apply_pm_range();
636 * Adjust the max value of the value range that
637 * the peak meter shall visualize.
639 static bool peak_meter_max(void) {
641 if (global_settings
.peak_meter_dbfs
) {
644 int range_min
= -global_settings
.peak_meter_min
;
645 int max
= -global_settings
.peak_meter_max
;;
647 retval
= set_int(str(LANG_PM_MAX
), str(LANG_PM_DBFS
), UNIT_DB
,
648 &max
, NULL
, 1, range_min
, 0, NULL
);
650 global_settings
.peak_meter_max
= - max
;
654 /* for linear scale */
656 int max
= global_settings
.peak_meter_max
;
658 retval
= set_int(str(LANG_PM_MAX
), "%", UNIT_PERCENT
,
660 1, global_settings
.peak_meter_min
+ 1, 100, NULL
);
662 global_settings
.peak_meter_max
= (unsigned char)max
;
665 settings_apply_pm_range();
670 * Menu to configure the peak meter
672 static bool peak_meter_menu(void)
677 static const struct menu_item items
[] = {
678 { ID2P(LANG_PM_RELEASE
) , peak_meter_release
},
679 { ID2P(LANG_PM_PEAK_HOLD
), peak_meter_hold
},
680 { ID2P(LANG_PM_CLIP_HOLD
), peak_meter_clip_hold
},
681 { ID2P(LANG_PM_SCALE
) , peak_meter_scale
},
682 { ID2P(LANG_PM_MIN
) , peak_meter_min
},
683 { ID2P(LANG_PM_MAX
) , peak_meter_max
},
686 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
688 result
= menu_run(m
);
692 #endif /* HAVE_LCD_BITMAP */
694 static bool shuffle(void)
696 return set_bool( str(LANG_SHUFFLE
), &global_settings
.playlist_shuffle
);
699 static bool repeat_mode(void)
702 static const struct opt_items names
[] = {
704 { STR(LANG_REPEAT_ALL
) },
705 { STR(LANG_REPEAT_ONE
) },
706 { STR(LANG_SHUFFLE
) },
707 #if (AB_REPEAT_ENABLE == 1)
708 { STR(LANG_REPEAT_AB
) }
711 int old_repeat
= global_settings
.repeat_mode
;
713 result
= set_option( str(LANG_REPEAT
), &global_settings
.repeat_mode
,
714 INT
, names
, NUM_REPEAT_MODES
, NULL
);
716 if (old_repeat
!= global_settings
.repeat_mode
&&
717 (audio_status() & AUDIO_STATUS_PLAY
))
718 audio_flush_and_reload_tracks();
723 static bool play_selected(void)
725 return set_bool( str(LANG_PLAY_SELECTED
), &global_settings
.play_selected
);
728 static bool dir_filter(void)
730 static const struct opt_items names
[] = {
731 { STR(LANG_FILTER_ALL
) },
732 { STR(LANG_FILTER_SUPPORTED
) },
733 { STR(LANG_FILTER_MUSIC
) },
734 { STR(LANG_FILTER_PLAYLIST
) },
735 { STR(LANG_FILTER_ID3DB
) }
737 return set_option( str(LANG_FILTER
), &global_settings
.dirfilter
, INT
,
741 static bool sort_case(void)
743 return set_bool( str(LANG_SORT_CASE
), &global_settings
.sort_case
);
746 static bool sort_file(void)
748 int oldval
= global_settings
.sort_file
;
750 static const struct opt_items names
[] = {
751 { STR(LANG_SORT_ALPHA
) },
752 { STR(LANG_SORT_DATE
) },
753 { STR(LANG_SORT_DATE_REVERSE
) },
754 { STR(LANG_SORT_TYPE
) }
756 ret
= set_option( str(LANG_SORT_FILE
), &global_settings
.sort_file
, INT
,
758 if (global_settings
.sort_file
!= oldval
)
759 reload_directory(); /* force reload if this has changed */
763 static bool sort_dir(void)
765 int oldval
= global_settings
.sort_dir
;
767 static const struct opt_items names
[] = {
768 { STR(LANG_SORT_ALPHA
) },
769 { STR(LANG_SORT_DATE
) },
770 { STR(LANG_SORT_DATE_REVERSE
) }
772 ret
= set_option( str(LANG_SORT_DIR
), &global_settings
.sort_dir
, INT
,
774 if (global_settings
.sort_dir
!= oldval
)
775 reload_directory(); /* force reload if this has changed */
779 static bool resume(void)
781 return set_bool( str(LANG_RESUME
), &global_settings
.resume
);
784 #ifdef HAVE_SPDIF_POWER
785 static bool spdif(void)
787 bool rc
= set_bool_options(str(LANG_SPDIF_ENABLE
),
788 &global_settings
.spdif_enable
,
796 static bool autocreatebookmark(void)
799 static const struct opt_items names
[] = {
800 { STR(LANG_SET_BOOL_NO
) },
801 { STR(LANG_SET_BOOL_YES
) },
802 { STR(LANG_RESUME_SETTING_ASK
) },
803 { STR(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_YES
) },
804 { STR(LANG_BOOKMARK_SETTINGS_RECENT_ONLY_ASK
) }
807 retval
= set_option( str(LANG_BOOKMARK_SETTINGS_AUTOCREATE
),
808 &global_settings
.autocreatebookmark
, INT
,
810 if(global_settings
.autocreatebookmark
== BOOKMARK_RECENT_ONLY_YES
||
811 global_settings
.autocreatebookmark
== BOOKMARK_RECENT_ONLY_ASK
)
813 if(global_settings
.usemrb
== BOOKMARK_NO
)
814 global_settings
.usemrb
= BOOKMARK_YES
;
820 static bool autoloadbookmark(void)
822 static const struct opt_items names
[] = {
823 { STR(LANG_SET_BOOL_NO
) },
824 { STR(LANG_SET_BOOL_YES
) },
825 { STR(LANG_RESUME_SETTING_ASK
) }
827 return set_option( str(LANG_BOOKMARK_SETTINGS_AUTOLOAD
),
828 &global_settings
.autoloadbookmark
, INT
,
832 static bool useMRB(void)
834 static const struct opt_items names
[] = {
835 { STR(LANG_SET_BOOL_NO
) },
836 { STR(LANG_SET_BOOL_YES
) },
837 { STR(LANG_BOOKMARK_SETTINGS_UNIQUE_ONLY
) }
839 return set_option( str(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS
),
840 &global_settings
.usemrb
, INT
,
844 static bool poweroff_idle_timer(void)
846 static const struct opt_items names
[] = {
848 { "1m ", TALK_ID(1, UNIT_MIN
) },
849 { "2m ", TALK_ID(2, UNIT_MIN
) },
850 { "3m ", TALK_ID(3, UNIT_MIN
) },
851 { "4m ", TALK_ID(4, UNIT_MIN
) },
852 { "5m ", TALK_ID(5, UNIT_MIN
) },
853 { "6m ", TALK_ID(6, UNIT_MIN
) },
854 { "7m ", TALK_ID(7, UNIT_MIN
) },
855 { "8m ", TALK_ID(8, UNIT_MIN
) },
856 { "9m ", TALK_ID(9, UNIT_MIN
) },
857 { "10m", TALK_ID(10, UNIT_MIN
) },
858 { "15m", TALK_ID(15, UNIT_MIN
) },
859 { "30m", TALK_ID(30, UNIT_MIN
) },
860 { "45m", TALK_ID(45, UNIT_MIN
) },
861 { "60m", TALK_ID(60, UNIT_MIN
) }
863 return set_option(str(LANG_POWEROFF_IDLE
), &global_settings
.poweroff
,
864 INT
, names
, 15, set_poweroff_timeout
);
867 static void sleep_timer_formatter(char* buffer
, int buffer_size
, int value
,
876 minutes
= value
- (hours
* 60);
877 snprintf(buffer
, buffer_size
, "%d:%02d", hours
, minutes
);
879 snprintf(buffer
, buffer_size
, "%s", str(LANG_OFF
));
883 static void sleep_timer_set(int minutes
)
885 set_sleep_timer(minutes
* 60);
888 static bool sleep_timer(void)
890 int minutes
= (get_sleep_timer() + 59) / 60; /* round up */
892 return set_int(str(LANG_SLEEP_TIMER
), "", UNIT_MIN
, &minutes
,
893 &sleep_timer_set
, 5, 0, 300, sleep_timer_formatter
);
896 static bool scroll_speed(void)
898 return set_int(str(LANG_SCROLL
), "", UNIT_INT
,
899 &global_settings
.scroll_speed
,
900 &lcd_scroll_speed
, 1, 0, 15, NULL
);
903 static bool scroll_delay(void)
905 int dummy
= global_settings
.scroll_delay
* (HZ
/10);
906 int rc
= set_int(str(LANG_SCROLL_DELAY
), "ms", UNIT_MS
,
908 &lcd_scroll_delay
, 100, 0, 2500, NULL
);
909 global_settings
.scroll_delay
= dummy
/ (HZ
/10);
913 #ifdef HAVE_REMOTE_LCD
914 static bool remote_scroll_speed(void)
916 return set_int(str(LANG_SCROLL
), "", UNIT_INT
,
917 &global_settings
.remote_scroll_speed
,
918 &lcd_remote_scroll_speed
, 1, 0, 15, NULL
);
921 static bool remote_scroll_step(void)
923 return set_int(str(LANG_SCROLL_STEP_EXAMPLE
), str(LANG_PIXELS
), UNIT_PIXEL
,
924 &global_settings
.remote_scroll_step
,
925 &lcd_remote_scroll_step
, 1, 1, LCD_WIDTH
, NULL
);
928 static bool remote_scroll_delay(void)
930 int dummy
= global_settings
.remote_scroll_delay
* (HZ
/10);
931 int rc
= set_int(str(LANG_SCROLL_DELAY
), "ms", UNIT_MS
,
933 &lcd_remote_scroll_delay
, 100, 0, 2500, NULL
);
934 global_settings
.remote_scroll_delay
= dummy
/ (HZ
/10);
938 static bool remote_bidir_limit(void)
940 return set_int(str(LANG_BIDIR_SCROLL
), "%", UNIT_PERCENT
,
941 &global_settings
.remote_bidir_limit
,
942 &lcd_remote_bidir_scroll
, 25, 0, 200, NULL
);
947 #ifdef HAVE_LCD_BITMAP
948 static bool screen_scroll(void)
950 bool rc
= set_bool( str(LANG_SCREEN_SCROLL_VIEW
), &global_settings
.offset_out_of_view
);
951 gui_list_screen_scroll_out_of_view(global_settings
.offset_out_of_view
);
955 static bool screen_scroll_step(void)
957 return set_int(str(LANG_SCREEN_SCROLL_STEP
), str(LANG_PIXELS
), UNIT_PIXEL
,
958 &global_settings
.screen_scroll_step
,
959 &gui_list_screen_scroll_step
, 1, 1, LCD_WIDTH
, NULL
);
962 static bool scroll_step(void)
964 return set_int(str(LANG_SCROLL_STEP_EXAMPLE
), str(LANG_PIXELS
), UNIT_PIXEL
,
965 &global_settings
.scroll_step
,
966 &lcd_scroll_step
, 1, 1, LCD_WIDTH
, NULL
);
970 static bool bidir_limit(void)
972 return set_int(str(LANG_BIDIR_SCROLL
), "%", UNIT_PERCENT
,
973 &global_settings
.bidir_limit
,
974 &lcd_bidir_scroll
, 25, 0, 200, NULL
);
977 #ifdef HAVE_LCD_CHARCELLS
978 static bool jump_scroll(void)
980 static const struct opt_items names
[] = {
982 { STR(LANG_ONE_TIME
) },
983 { "2", TALK_ID(2, UNIT_INT
) },
984 { "3", TALK_ID(3, UNIT_INT
) },
985 { "4", TALK_ID(4, UNIT_INT
) },
989 ret
=set_option(str(LANG_JUMP_SCROLL
), &global_settings
.jump_scroll
,
990 INT
, names
, 6, lcd_jump_scroll
);
993 static bool jump_scroll_delay(void)
995 int dummy
= global_settings
.jump_scroll_delay
* (HZ
/10);
996 int rc
= set_int(str(LANG_JUMP_SCROLL_DELAY
), "ms", UNIT_MS
,
998 &lcd_jump_scroll_delay
, 100, 0, 2500, NULL
);
999 global_settings
.jump_scroll_delay
= dummy
/ (HZ
/10);
1006 * Menu to set the battery capacity
1008 static bool battery_capacity(void)
1010 return set_int(str(LANG_BATTERY_CAPACITY
), "mAh", UNIT_MAH
,
1011 &global_settings
.battery_capacity
,
1012 &set_battery_capacity
, BATTERY_CAPACITY_INC
, BATTERY_CAPACITY_MIN
,
1013 BATTERY_CAPACITY_MAX
, NULL
);
1016 #if BATTERY_TYPES_COUNT > 1
1017 static bool battery_type(void)
1019 static const struct opt_items names
[] = {
1020 { STR(LANG_BATTERY_TYPE_ALKALINE
) },
1021 { STR(LANG_BATTERY_TYPE_NIMH
) }
1024 return set_option(str(LANG_BATTERY_TYPE
), &global_settings
.battery_type
,
1025 INT
, names
, 2, set_battery_type
);
1031 static bool timedate_set(void)
1036 /* Make a local copy of the time struct */
1037 memcpy(&tm
, get_time(), sizeof(struct tm
));
1039 /* do some range checks */
1040 /* This prevents problems with time/date setting after a power loss */
1041 if (!valid_time(&tm
))
1053 result
= set_time_screen(str(LANG_TIME
), &tm
);
1055 if(tm
.tm_year
!= -1) {
1061 static bool timeformat_set(void)
1063 static const struct opt_items names
[] = {
1064 { STR(LANG_24_HOUR_CLOCK
) },
1065 { STR(LANG_12_HOUR_CLOCK
) }
1067 return set_option(str(LANG_TIMEFORMAT
), &global_settings
.timeformat
,
1068 INT
, names
, 2, NULL
);
1073 static bool spindown(void)
1075 return set_int(str(LANG_SPINDOWN
), "s", UNIT_SEC
,
1076 &global_settings
.disk_spindown
,
1077 ata_spindown
, 1, 3, 254, NULL
);
1080 #ifdef HAVE_ATA_POWER_OFF
1081 static bool poweroff(void)
1083 bool rc
= set_bool(str(LANG_POWEROFF
), &global_settings
.disk_poweroff
);
1084 ata_poweroff(global_settings
.disk_poweroff
);
1087 #endif /* HAVE_ATA_POWEROFF */
1088 #endif /* !HAVE_MMC */
1090 #if CONFIG_CODEC == MAS3507D
1091 static bool line_in(void)
1093 bool rc
= set_bool(str(LANG_LINE_IN
), &global_settings
.line_in
);
1095 dac_line_in(global_settings
.line_in
);
1101 static bool max_files_in_dir(void)
1103 return set_int(str(LANG_MAX_FILES_IN_DIR
), "", UNIT_INT
,
1104 &global_settings
.max_files_in_dir
,
1105 NULL
, 50, 50, 10000, NULL
);
1108 static bool max_files_in_playlist(void)
1110 return set_int(str(LANG_MAX_FILES_IN_PLAYLIST
), "", UNIT_INT
,
1111 &global_settings
.max_files_in_playlist
,
1112 NULL
, 1000, 1000, 20000, NULL
);
1115 #if CONFIG_CODEC == SWCODEC
1116 static bool buffer_margin(void)
1119 static const struct opt_items names
[] = {
1120 { "5s", TALK_ID(5, UNIT_SEC
) },
1121 { "15s", TALK_ID(15, UNIT_SEC
) },
1122 { "30s", TALK_ID(30, UNIT_SEC
) },
1123 { "1min", TALK_ID(1, UNIT_MIN
) },
1124 { "2min", TALK_ID(2, UNIT_MIN
) },
1125 { "3min", TALK_ID(3, UNIT_MIN
) },
1126 { "5min", TALK_ID(5, UNIT_MIN
) },
1127 { "10min", TALK_ID(10, UNIT_MIN
) }
1130 ret
= set_option(str(LANG_MP3BUFFER_MARGIN
), &global_settings
.buffer_margin
,
1131 INT
, names
, 8, NULL
);
1132 audio_set_buffer_margin(global_settings
.buffer_margin
);
1137 static bool buffer_margin(void)
1139 return set_int(str(LANG_MP3BUFFER_MARGIN
), "s", UNIT_SEC
,
1140 &global_settings
.buffer_margin
,
1141 audio_set_buffer_margin
, 1, 0, 7, NULL
);
1145 static bool ff_rewind_min_step(void)
1147 static const struct opt_items names
[] = {
1148 { "1s", TALK_ID(1, UNIT_SEC
) },
1149 { "2s", TALK_ID(2, UNIT_SEC
) },
1150 { "3s", TALK_ID(3, UNIT_SEC
) },
1151 { "4s", TALK_ID(4, UNIT_SEC
) },
1152 { "5s", TALK_ID(5, UNIT_SEC
) },
1153 { "6s", TALK_ID(6, UNIT_SEC
) },
1154 { "8s", TALK_ID(8, UNIT_SEC
) },
1155 { "10s", TALK_ID(10, UNIT_SEC
) },
1156 { "15s", TALK_ID(15, UNIT_SEC
) },
1157 { "20s", TALK_ID(20, UNIT_SEC
) },
1158 { "25s", TALK_ID(25, UNIT_SEC
) },
1159 { "30s", TALK_ID(30, UNIT_SEC
) },
1160 { "45s", TALK_ID(45, UNIT_SEC
) },
1161 { "60s", TALK_ID(60, UNIT_SEC
) }
1163 return set_option(str(LANG_FFRW_STEP
), &global_settings
.ff_rewind_min_step
,
1164 INT
, names
, 14, NULL
);
1167 static bool set_fade_on_stop(void)
1169 return set_bool( str(LANG_FADE_ON_STOP
), &global_settings
.fade_on_stop
);
1172 static bool set_party_mode(void)
1174 return set_bool( str(LANG_PARTY_MODE
), &global_settings
.party_mode
);
1177 #ifdef CONFIG_BACKLIGHT
1178 static bool set_bl_filter_first_keypress(void)
1180 bool result
= set_bool( str(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS
),
1181 &global_settings
.bl_filter_first_keypress
);
1182 set_backlight_filter_keypress(global_settings
.bl_filter_first_keypress
);
1185 #ifdef HAVE_REMOTE_LCD
1186 static bool set_remote_bl_filter_first_keypress(void)
1188 bool result
= set_bool( str(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS
),
1189 &global_settings
.remote_bl_filter_first_keypress
);
1190 set_remote_backlight_filter_keypress(global_settings
.remote_bl_filter_first_keypress
);
1196 static bool ff_rewind_accel(void)
1198 static const struct opt_items names
[] = {
1200 { "2x/1s", TALK_ID(1, UNIT_SEC
) },
1201 { "2x/2s", TALK_ID(2, UNIT_SEC
) },
1202 { "2x/3s", TALK_ID(3, UNIT_SEC
) },
1203 { "2x/4s", TALK_ID(4, UNIT_SEC
) },
1204 { "2x/5s", TALK_ID(5, UNIT_SEC
) },
1205 { "2x/6s", TALK_ID(6, UNIT_SEC
) },
1206 { "2x/7s", TALK_ID(7, UNIT_SEC
) },
1207 { "2x/8s", TALK_ID(8, UNIT_SEC
) },
1208 { "2x/9s", TALK_ID(9, UNIT_SEC
) },
1209 { "2x/10s", TALK_ID(10, UNIT_SEC
) },
1210 { "2x/11s", TALK_ID(11, UNIT_SEC
) },
1211 { "2x/12s", TALK_ID(12, UNIT_SEC
) },
1212 { "2x/13s", TALK_ID(13, UNIT_SEC
) },
1213 { "2x/14s", TALK_ID(14, UNIT_SEC
) },
1214 { "2x/15s", TALK_ID(15, UNIT_SEC
) }
1216 return set_option(str(LANG_FFRW_ACCEL
), &global_settings
.ff_rewind_accel
,
1217 INT
, names
, 16, NULL
);
1220 static bool browse_current(void)
1222 return set_bool( str(LANG_FOLLOW
), &global_settings
.browse_current
);
1225 static bool custom_wps_browse(void)
1227 return rockbox_browse(WPS_DIR
, SHOW_WPS
);
1230 #ifdef HAVE_REMOTE_LCD
1231 static bool custom_remote_wps_browse(void)
1233 return rockbox_browse(WPS_DIR
, SHOW_RWPS
);
1237 static bool custom_cfg_browse(void)
1239 return rockbox_browse(ROCKBOX_DIR
, SHOW_CFG
);
1242 static bool language_browse(void)
1244 return rockbox_browse(ROCKBOX_DIR LANG_DIR
, SHOW_LNG
);
1247 static bool voice_menus(void)
1250 bool temp
= global_settings
.talk_menu
;
1251 /* work on a temp variable first, avoid "life" disabling */
1252 ret
= set_bool( str(LANG_VOICE_MENU
), &temp
);
1253 global_settings
.talk_menu
= temp
;
1257 /* this is used 2 times below, so it saves memory to put it in global scope */
1258 static const struct opt_items voice_names
[] = {
1260 { STR(LANG_VOICE_NUMBER
) },
1261 { STR(LANG_VOICE_SPELL
) },
1262 { STR(LANG_VOICE_DIR_HOVER
) }
1265 static bool voice_dirs(void)
1267 bool ret
= set_option( str(LANG_VOICE_DIR
),
1268 &global_settings
.talk_dir
, INT
, voice_names
, 4, NULL
);
1269 #if CONFIG_CODEC == SWCODEC
1270 audio_set_crossfade(global_settings
.crossfade
);
1275 static bool voice_files(void)
1277 int oldval
= global_settings
.talk_file
;
1280 ret
= set_option( str(LANG_VOICE_FILE
),
1281 &global_settings
.talk_file
, INT
, voice_names
, 4, NULL
);
1282 #if CONFIG_CODEC == SWCODEC
1283 audio_set_crossfade(global_settings
.crossfade
);
1285 if (oldval
!= 3 && global_settings
.talk_file
== 3)
1286 { /* force reload if newly talking thumbnails,
1287 because the clip presence is cached only if enabled */
1293 static bool voice_menu(void)
1298 static const struct menu_item items
[] = {
1299 { ID2P(LANG_VOICE_MENU
), voice_menus
},
1300 { ID2P(LANG_VOICE_DIR
), voice_dirs
},
1301 { ID2P(LANG_VOICE_FILE
), voice_files
}
1304 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1306 result
= menu_run(m
);
1311 #ifdef HAVE_LCD_BITMAP
1312 static bool font_browse(void)
1314 return rockbox_browse(ROCKBOX_DIR FONT_DIR
, SHOW_FONT
);
1317 static bool scroll_bar(void)
1319 return set_bool( str(LANG_SCROLL_BAR
), &global_settings
.scrollbar
);
1322 static bool status_bar(void)
1324 return set_bool( str(LANG_STATUS_BAR
), &global_settings
.statusbar
);
1327 #if CONFIG_KEYPAD == RECORDER_PAD
1328 static bool button_bar(void)
1330 return set_bool( str(LANG_BUTTON_BAR
), &global_settings
.buttonbar
);
1332 #endif /* CONFIG_KEYPAD == RECORDER_PAD */
1333 #endif /* HAVE_LCD_BITMAP */
1335 static bool ff_rewind_settings_menu(void)
1340 static const struct menu_item items
[] = {
1341 { ID2P(LANG_FFRW_STEP
), ff_rewind_min_step
},
1342 { ID2P(LANG_FFRW_ACCEL
), ff_rewind_accel
},
1345 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1347 result
= menu_run(m
);
1353 static bool id3_order(void)
1355 return set_bool_options( str(LANG_ID3_ORDER
),
1356 &global_settings
.id3_v1_first
,
1357 STR(LANG_ID3_V1_FIRST
),
1358 STR(LANG_ID3_V2_FIRST
),
1362 static bool next_folder(void)
1364 return set_bool( str(LANG_NEXT_FOLDER
), &global_settings
.next_folder
);
1367 static bool codepage_setting(void)
1369 static const struct opt_items names
[] = {
1370 { STR(LANG_CODEPAGE_LATIN1
) },
1371 { STR(LANG_CODEPAGE_GREEK
) },
1372 { STR(LANG_CODEPAGE_HEBREW
) },
1373 { STR(LANG_CODEPAGE_CYRILLIC
) },
1374 { STR(LANG_CODEPAGE_THAI
) },
1375 { STR(LANG_CODEPAGE_ARABIC
) },
1376 { STR(LANG_CODEPAGE_TURKISH
) },
1377 { STR(LANG_CODEPAGE_LATIN_EXTENDED
) },
1378 { STR(LANG_CODEPAGE_JAPANESE
) },
1379 { STR(LANG_CODEPAGE_SIMPLIFIED
) },
1380 { STR(LANG_CODEPAGE_KOREAN
) },
1381 { STR(LANG_CODEPAGE_TRADITIONAL
) },
1382 { STR(LANG_CODEPAGE_UTF8
) },
1384 return set_option(str(LANG_DEFAULT_CODEPAGE
),
1385 &global_settings
.default_codepage
,
1386 INT
, names
, 13, set_codepage
);
1389 #if CONFIG_CODEC == SWCODEC
1390 static bool replaygain(void)
1392 bool result
= set_bool(str(LANG_REPLAYGAIN_ENABLE
),
1393 &global_settings
.replaygain
);
1395 dsp_set_replaygain(true);
1399 static bool replaygain_mode(void)
1401 static const struct opt_items names
[] = {
1402 { STR(LANG_TRACK_GAIN
) },
1403 { STR(LANG_ALBUM_GAIN
) },
1404 { STR(LANG_SHUFFLE_GAIN
) },
1406 bool result
= set_option(str(LANG_REPLAYGAIN_MODE
),
1407 &global_settings
.replaygain_type
, INT
, names
, 3, NULL
);
1409 dsp_set_replaygain(true);
1413 static bool replaygain_noclip(void)
1415 bool result
= set_bool(str(LANG_REPLAYGAIN_NOCLIP
),
1416 &global_settings
.replaygain_noclip
);
1418 dsp_set_replaygain(true);
1422 void replaygain_preamp_format(char* buffer
, int buffer_size
, int value
,
1427 snprintf(buffer
, buffer_size
, "%s%d.%d %s", value
< 0 ? "-" : "",
1428 v
/ 10, v
% 10, unit
);
1431 static bool replaygain_preamp(void)
1433 bool result
= set_int(str(LANG_REPLAYGAIN_PREAMP
), str(LANG_UNIT_DB
),
1434 UNIT_DB
, &global_settings
.replaygain_preamp
, NULL
, 1, -120, 120,
1435 replaygain_preamp_format
);
1437 dsp_set_replaygain(true);
1441 static bool replaygain_settings_menu(void)
1446 static const struct menu_item items
[] = {
1447 { ID2P(LANG_REPLAYGAIN_ENABLE
), replaygain
},
1448 { ID2P(LANG_REPLAYGAIN_NOCLIP
), replaygain_noclip
},
1449 { ID2P(LANG_REPLAYGAIN_MODE
), replaygain_mode
},
1450 { ID2P(LANG_REPLAYGAIN_PREAMP
), replaygain_preamp
},
1453 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1455 result
= menu_run(m
);
1460 static bool crossfade(void)
1462 static const struct opt_items names
[] = {
1464 { STR(LANG_SHUFFLE
) },
1465 { STR(LANG_TRACKSKIP
) },
1466 { STR(LANG_ALWAYS
) },
1471 ret
=set_option( str(LANG_CROSSFADE_ENABLE
),
1472 &global_settings
.crossfade
, INT
, names
, 4, NULL
);
1473 audio_set_crossfade(global_settings
.crossfade
);
1477 static bool crossfade_fade_in_delay(void)
1481 ret
= set_int(str(LANG_CROSSFADE_FADE_IN_DELAY
), "s", UNIT_SEC
,
1482 &global_settings
.crossfade_fade_in_delay
,
1483 NULL
, 1, 0, 7, NULL
);
1484 audio_set_crossfade(global_settings
.crossfade
);
1488 static bool crossfade_fade_out_delay(void)
1492 ret
= set_int(str(LANG_CROSSFADE_FADE_OUT_DELAY
), "s", UNIT_SEC
,
1493 &global_settings
.crossfade_fade_out_delay
,
1494 NULL
, 1, 0, 7, NULL
);
1495 audio_set_crossfade(global_settings
.crossfade
);
1499 static bool crossfade_fade_in_duration(void)
1503 ret
= set_int(str(LANG_CROSSFADE_FADE_IN_DURATION
), "s", UNIT_SEC
,
1504 &global_settings
.crossfade_fade_in_duration
,
1505 NULL
, 1, 0, 15, NULL
);
1506 audio_set_crossfade(global_settings
.crossfade
);
1510 static bool crossfade_fade_out_duration(void)
1514 ret
= set_int(str(LANG_CROSSFADE_FADE_OUT_DURATION
), "s", UNIT_SEC
,
1515 &global_settings
.crossfade_fade_out_duration
,
1516 NULL
, 1, 0, 15, NULL
);
1517 audio_set_crossfade(global_settings
.crossfade
);
1521 static bool crossfade_fade_out_mixmode(void)
1523 static const struct opt_items names
[] = {
1524 { STR(LANG_CROSSFADE
) },
1528 ret
=set_option( str(LANG_CROSSFADE_FADE_OUT_MODE
),
1529 &global_settings
.crossfade_fade_out_mixmode
, INT
, names
, 2, NULL
);
1535 * Menu to configure the crossfade settings.
1537 static bool crossfade_settings_menu(void)
1542 static const struct menu_item items
[] = {
1543 { ID2P(LANG_CROSSFADE_ENABLE
), crossfade
},
1544 { ID2P(LANG_CROSSFADE_FADE_IN_DELAY
), crossfade_fade_in_delay
},
1545 { ID2P(LANG_CROSSFADE_FADE_IN_DURATION
), crossfade_fade_in_duration
},
1546 { ID2P(LANG_CROSSFADE_FADE_OUT_DELAY
), crossfade_fade_out_delay
},
1547 { ID2P(LANG_CROSSFADE_FADE_OUT_DURATION
), crossfade_fade_out_duration
},
1548 { ID2P(LANG_CROSSFADE_FADE_OUT_MODE
), crossfade_fade_out_mixmode
},
1551 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1553 result
= menu_run(m
);
1558 static bool beep(void)
1560 static const struct opt_items names
[] = {
1563 { STR(LANG_MODERATE
) },
1564 { STR(LANG_STRONG
) },
1567 ret
=set_option( str(LANG_BEEP
),
1568 &global_settings
.beep
, INT
, names
, 4, NULL
);
1575 #ifdef HAVE_DIRCACHE
1576 static bool dircache(void)
1578 bool result
= set_bool_options(str(LANG_DIRCACHE_ENABLE
),
1579 &global_settings
.dircache
,
1584 if (!dircache_is_enabled() && global_settings
.dircache
)
1585 gui_syncsplash(HZ
*2, true, str(LANG_DIRCACHE_REBOOT
));
1592 #endif /* HAVE_DIRCACHE */
1594 #ifdef HAVE_TC_RAMCACHE
1595 static bool tagcache_ram(void)
1597 bool result
= set_bool_options(str(LANG_TAGCACHE_RAM
),
1598 &global_settings
.tagcache_ram
,
1599 STR(LANG_SET_BOOL_YES
),
1600 STR(LANG_SET_BOOL_NO
),
1607 static bool tagcache_autoupdate(void)
1609 bool rc
= set_bool_options(str(LANG_TAGCACHE_AUTOUPDATE
),
1610 &global_settings
.tagcache_autoupdate
,
1617 static bool tagcache_runtimedb(void)
1619 bool rc
= set_bool_options(str(LANG_RUNTIMEDB_ACTIVE
),
1620 &global_settings
.runtimedb
,
1627 static bool tagcache_settings_menu(void)
1632 static const struct menu_item items
[] = {
1633 #ifdef HAVE_TC_RAMCACHE
1634 { ID2P(LANG_TAGCACHE_RAM
), tagcache_ram
},
1636 { ID2P(LANG_TAGCACHE_AUTOUPDATE
), tagcache_autoupdate
},
1637 { ID2P(LANG_TAGCACHE_FORCE_UPDATE
), tagcache_rebuild
},
1638 { ID2P(LANG_TAGCACHE_UPDATE
), tagcache_update
},
1639 { ID2P(LANG_RUNTIMEDB_ACTIVE
), tagcache_runtimedb
},
1640 { ID2P(LANG_TAGCACHE_EXPORT
), tagtree_export
},
1641 { ID2P(LANG_TAGCACHE_IMPORT
), tagtree_import
},
1644 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1646 result
= menu_run(m
);
1651 static bool playback_settings_menu(void)
1656 static const struct menu_item items
[] = {
1657 { ID2P(LANG_SHUFFLE
), shuffle
},
1658 { ID2P(LANG_REPEAT
), repeat_mode
},
1659 { ID2P(LANG_PLAY_SELECTED
), play_selected
},
1660 { ID2P(LANG_RESUME
), resume
},
1661 { ID2P(LANG_WIND_MENU
), ff_rewind_settings_menu
},
1662 { ID2P(LANG_MP3BUFFER_MARGIN
), buffer_margin
},
1663 { ID2P(LANG_FADE_ON_STOP
), set_fade_on_stop
},
1664 { ID2P(LANG_PARTY_MODE
), set_party_mode
},
1665 #if CONFIG_CODEC == SWCODEC
1666 { ID2P(LANG_CROSSFADE
), crossfade_settings_menu
},
1667 { ID2P(LANG_REPLAYGAIN
), replaygain_settings_menu
},
1668 { ID2P(LANG_BEEP
), beep
},
1670 #ifdef HAVE_SPDIF_POWER
1671 { ID2P(LANG_SPDIF_ENABLE
), spdif
},
1673 { ID2P(LANG_ID3_ORDER
), id3_order
},
1674 { ID2P(LANG_NEXT_FOLDER
), next_folder
}
1677 bool old_shuffle
= global_settings
.playlist_shuffle
;
1679 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1681 result
= menu_run(m
);
1684 if ((old_shuffle
!= global_settings
.playlist_shuffle
)
1685 && (audio_status() & AUDIO_STATUS_PLAY
))
1687 #if CONFIG_CODEC == SWCODEC
1688 dsp_set_replaygain(true);
1691 if (global_settings
.playlist_shuffle
)
1693 playlist_randomise(NULL
, current_tick
, true);
1697 playlist_sort(NULL
, true);
1703 static bool bookmark_settings_menu(void)
1708 static const struct menu_item items
[] = {
1709 { ID2P(LANG_BOOKMARK_SETTINGS_AUTOCREATE
), autocreatebookmark
},
1710 { ID2P(LANG_BOOKMARK_SETTINGS_AUTOLOAD
), autoloadbookmark
},
1711 { ID2P(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS
), useMRB
},
1714 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1716 result
= menu_run(m
);
1721 static bool reset_settings(void)
1723 unsigned char *lines
[]={str(LANG_RESET_ASK_RECORDER
)};
1724 unsigned char *yes_lines
[]={
1725 str(LANG_RESET_DONE_SETTING
),
1726 str(LANG_RESET_DONE_CLEAR
)
1728 unsigned char *no_lines
[]={yes_lines
[0], str(LANG_RESET_DONE_CANCEL
)};
1729 struct text_message message
={(char **)lines
, 1};
1730 struct text_message yes_message
={(char **)yes_lines
, 2};
1731 struct text_message no_message
={(char **)no_lines
, 2};
1733 switch(gui_syncyesno_run(&message
, &yes_message
, &no_message
))
1747 static bool fileview_settings_menu(void)
1752 static const struct menu_item items
[] = {
1753 { ID2P(LANG_SORT_CASE
), sort_case
},
1754 { ID2P(LANG_SORT_DIR
), sort_dir
},
1755 { ID2P(LANG_SORT_FILE
), sort_file
},
1756 { ID2P(LANG_FILTER
), dir_filter
},
1757 { ID2P(LANG_FOLLOW
), browse_current
},
1758 { ID2P(LANG_SHOW_ICONS
), show_icons
},
1759 { ID2P(LANG_SHOW_PATH
), show_path
},
1760 { ID2P(LANG_TAGCACHE
), tagcache_settings_menu
},
1763 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1765 result
= menu_run(m
);
1770 #ifdef HAVE_REMOTE_LCD
1771 static bool remote_scroll_sets(void)
1776 static const struct menu_item items
[] = {
1777 { ID2P(LANG_SCROLL_SPEED
), remote_scroll_speed
},
1778 { ID2P(LANG_SCROLL_DELAY
), remote_scroll_delay
},
1779 { ID2P(LANG_SCROLL_STEP
), remote_scroll_step
},
1780 { ID2P(LANG_BIDIR_SCROLL
), remote_bidir_limit
},
1783 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1785 result
= menu_run(m
);
1791 static bool scroll_settings_menu(void)
1796 static const struct menu_item items
[] = {
1797 { ID2P(LANG_SCROLL_SPEED
), scroll_speed
},
1798 { ID2P(LANG_SCROLL_DELAY
), scroll_delay
},
1799 #ifdef HAVE_LCD_BITMAP
1800 { ID2P(LANG_SCROLL_STEP
), scroll_step
},
1802 { ID2P(LANG_BIDIR_SCROLL
), bidir_limit
},
1803 #ifdef HAVE_REMOTE_LCD
1804 { ID2P(LANG_REMOTE_SCROLL_SETS
), remote_scroll_sets
},
1806 #ifdef HAVE_LCD_CHARCELLS
1807 { ID2P(LANG_JUMP_SCROLL
), jump_scroll
},
1808 { ID2P(LANG_JUMP_SCROLL_DELAY
), jump_scroll_delay
},
1810 #ifdef HAVE_LCD_BITMAP
1811 { ID2P(LANG_SCREEN_SCROLL_VIEW
), screen_scroll
},
1812 { ID2P(LANG_SCREEN_SCROLL_STEP
), screen_scroll_step
},
1814 { ID2P(LANG_SCROLL_PAGINATED
), scroll_paginated
},
1817 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1819 result
= menu_run(m
);
1824 static bool lcd_settings_menu(void)
1829 static const struct menu_item items
[] = {
1830 #ifdef CONFIG_BACKLIGHT
1831 { ID2P(LANG_BACKLIGHT
), backlight_timer
},
1832 #ifdef CONFIG_CHARGING
1833 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING
), backlight_timer_plugged
},
1835 #ifdef HAS_BUTTON_HOLD
1836 { ID2P(LANG_BACKLIGHT_ON_BUTTON_HOLD
), backlight_on_button_hold
},
1838 { ID2P(LANG_CAPTION_BACKLIGHT
), caption_backlight
},
1839 #if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
1840 { ID2P(LANG_BACKLIGHT_FADE_IN
), backlight_fade_in
},
1841 { ID2P(LANG_BACKLIGHT_FADE_OUT
), backlight_fade_out
},
1843 { ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS
), set_bl_filter_first_keypress
},
1844 #ifdef HAVE_LCD_SLEEP
1845 { ID2P(LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF
), lcd_sleep_after_backlight_off
},
1847 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
1848 { ID2P(LANG_BRIGHTNESS
), brightness
},
1850 #endif /* CONFIG_BACKLIGHT */
1851 #ifdef HAVE_LCD_CONTRAST
1852 { ID2P(LANG_CONTRAST
), contrast
},
1854 #ifdef HAVE_LCD_BITMAP
1855 #ifndef HAVE_LCD_COLOR
1856 { ID2P(LANG_INVERT
), invert
},
1858 #ifdef HAVE_LCD_FLIP
1859 { ID2P(LANG_FLIP_DISPLAY
), flip_display
},
1861 { ID2P(LANG_INVERT_CURSOR
), invert_cursor
},
1863 #ifdef HAVE_LCD_COLOR
1864 { ID2P(LANG_CLEAR_BACKDROP
), clear_main_backdrop
},
1865 { ID2P(LANG_BACKGROUND_COLOR
), set_bg_color
},
1866 { ID2P(LANG_FOREGROUND_COLOR
), set_fg_color
},
1867 { ID2P(LANG_RESET_COLORS
), reset_color
},
1871 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1873 result
= menu_run(m
);
1878 #ifdef HAVE_REMOTE_LCD
1879 static bool lcd_remote_settings_menu(void)
1884 static const struct menu_item items
[] = {
1885 { ID2P(LANG_BACKLIGHT
), remote_backlight_timer
},
1886 #ifdef CONFIG_CHARGING
1887 { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING
),
1888 remote_backlight_timer_plugged
},
1890 { ID2P(LANG_CAPTION_BACKLIGHT
), remote_caption_backlight
},
1891 { ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS
), set_remote_bl_filter_first_keypress
},
1892 { ID2P(LANG_CONTRAST
), remote_contrast
},
1893 { ID2P(LANG_INVERT
), remote_invert
},
1894 { ID2P(LANG_FLIP_DISPLAY
), remote_flip_display
},
1895 #ifdef HAVE_REMOTE_LCD_TICKING
1896 { ID2P(LANG_REDUCE_TICKING
), remote_reduce_ticking
},
1900 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1902 result
= menu_run(m
);
1908 #ifdef HAVE_LCD_BITMAP
1909 static bool bars_settings_menu(void)
1914 static const struct menu_item items
[] = {
1915 { ID2P(LANG_SCROLL_BAR
), scroll_bar
},
1916 { ID2P(LANG_STATUS_BAR
), status_bar
},
1917 #if CONFIG_KEYPAD == RECORDER_PAD
1918 { ID2P(LANG_BUTTON_BAR
), button_bar
},
1920 { ID2P(LANG_VOLUME_DISPLAY
), volume_type
},
1921 { ID2P(LANG_BATTERY_DISPLAY
), battery_display
},
1924 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1926 result
= menu_run(m
);
1933 static bool display_settings_menu(void)
1938 static const struct menu_item items
[] = {
1939 #ifdef HAVE_LCD_BITMAP
1940 { ID2P(LANG_CUSTOM_FONT
), font_browse
},
1942 { ID2P(LANG_WHILE_PLAYING
), custom_wps_browse
},
1943 #ifdef HAVE_REMOTE_LCD
1944 { ID2P(LANG_REMOTE_WHILE_PLAYING
), custom_remote_wps_browse
},
1946 { ID2P(LANG_LCD_MENU
), lcd_settings_menu
},
1947 #ifdef HAVE_REMOTE_LCD
1948 { ID2P(LANG_LCD_REMOTE_MENU
), lcd_remote_settings_menu
},
1950 { ID2P(LANG_SCROLL_MENU
), scroll_settings_menu
},
1951 #ifdef HAVE_LCD_BITMAP
1952 { ID2P(LANG_BARS_MENU
), bars_settings_menu
},
1953 { ID2P(LANG_PM_MENU
), peak_meter_menu
},
1955 { ID2P(LANG_DEFAULT_CODEPAGE
), codepage_setting
},
1958 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1960 result
= menu_run(m
);
1966 static bool firmware_browse(void)
1968 return rockbox_browse(ROCKBOX_DIR
, SHOW_MOD
);
1971 static bool battery_settings_menu(void)
1976 static const struct menu_item items
[] = {
1978 { ID2P(LANG_BATTERY_CAPACITY
), battery_capacity
},
1979 #if BATTERY_TYPES_COUNT > 1
1980 { ID2P(LANG_BATTERY_TYPE
), battery_type
},
1983 { "Dummy", NULL
}, /* to have an entry at all, in the simulator */
1987 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
1989 result
= menu_run(m
);
1995 static bool disk_settings_menu(void)
2000 static const struct menu_item items
[] = {
2001 { ID2P(LANG_SPINDOWN
), spindown
},
2002 #ifdef HAVE_ATA_POWER_OFF
2003 { ID2P(LANG_POWEROFF
), poweroff
},
2005 #ifdef HAVE_DIRCACHE
2006 { ID2P(LANG_DIRCACHE_ENABLE
), dircache
},
2010 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
2012 result
= menu_run(m
);
2016 #endif /* !HAVE_MMC */
2019 static bool time_settings_menu(void)
2024 static const struct menu_item items
[] = {
2025 { ID2P(LANG_TIME
), timedate_set
},
2026 { ID2P(LANG_TIMEFORMAT
), timeformat_set
},
2029 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
2031 result
= menu_run(m
);
2037 bool manage_settings_menu(void)
2042 static const struct menu_item items
[] = {
2043 { ID2P(LANG_CUSTOM_CFG
), custom_cfg_browse
},
2044 { ID2P(LANG_FIRMWARE
), firmware_browse
},
2045 { ID2P(LANG_RESET
), reset_settings
},
2046 { ID2P(LANG_SAVE_SETTINGS
), settings_save_config
},
2049 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
2051 result
= menu_run(m
);
2056 static bool limits_settings_menu(void)
2061 static const struct menu_item items
[] = {
2062 { ID2P(LANG_MAX_FILES_IN_DIR
), max_files_in_dir
},
2063 { ID2P(LANG_MAX_FILES_IN_PLAYLIST
), max_files_in_playlist
},
2066 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
2068 result
= menu_run(m
);
2074 static bool system_settings_menu(void)
2079 static const struct menu_item items
[] = {
2080 { ID2P(LANG_BATTERY_MENU
), battery_settings_menu
},
2082 { ID2P(LANG_DISK_MENU
), disk_settings_menu
},
2085 { ID2P(LANG_TIME_MENU
), time_settings_menu
},
2087 { ID2P(LANG_POWEROFF_IDLE
), poweroff_idle_timer
},
2088 { ID2P(LANG_SLEEP_TIMER
), sleep_timer
},
2089 #ifdef HAVE_ALARM_MOD
2090 { ID2P(LANG_ALARM_MOD_ALARM_MENU
), alarm_screen
},
2092 { ID2P(LANG_LIMITS_MENU
), limits_settings_menu
},
2093 #if CONFIG_CODEC == MAS3507D
2094 { ID2P(LANG_LINE_IN
), line_in
},
2096 #ifdef CONFIG_CHARGING
2097 { ID2P(LANG_CAR_ADAPTER_MODE
), car_adapter_mode
},
2101 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
2103 result
= menu_run(m
);
2108 bool settings_menu(void)
2113 static const struct menu_item items
[] = {
2114 { ID2P(LANG_PLAYBACK
), playback_settings_menu
},
2115 { ID2P(LANG_FILE
), fileview_settings_menu
},
2116 { ID2P(LANG_DISPLAY
), display_settings_menu
},
2117 { ID2P(LANG_SYSTEM
), system_settings_menu
},
2118 { ID2P(LANG_BOOKMARK_SETTINGS
),bookmark_settings_menu
},
2119 { ID2P(LANG_LANGUAGE
), language_browse
},
2120 { ID2P(LANG_VOICE
), voice_menu
},
2123 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
2125 result
= menu_run(m
);