X5: Assembler optimised remote LCD update. Speedup: 3 times @11MHz, 3.3 times @45MHz...
[Rockbox.git] / apps / settings_menu.c
blob5f84dc1d34a87ee2e3d3f88cc8437468811a5b3e
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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 ****************************************************************************/
20 #include "config.h"
22 #include <stdio.h>
23 #include <stdbool.h>
24 #include <string.h>
26 #include "lcd.h"
27 #include "menu.h"
28 #include "mpeg.h"
29 #include "audio.h"
30 #include "button.h"
31 #include "kernel.h"
32 #include "thread.h"
33 #include "sprintf.h"
34 #include "settings.h"
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"
40 #include "rtc.h"
41 #include "ata.h"
42 #include "tree.h"
43 #include "screens.h"
44 #include "talk.h"
45 #include "timefuncs.h"
46 #include "misc.h"
47 #include "abrepeat.h"
48 #include "power.h"
49 #include "database.h"
50 #include "dir.h"
51 #include "dircache.h"
52 #include "tagcache.h"
53 #include "tagtree.h"
54 #include "rbunicode.h"
55 #include "splash.h"
56 #include "yesno.h"
57 #include "list.h"
58 #include "color_picker.h"
60 #ifdef HAVE_LCD_BITMAP
61 #include "peakmeter.h"
62 #endif
63 #include "lang.h"
64 #if CONFIG_CODEC == MAS3507D
65 void dac_line_in(bool enable);
66 #endif
67 #ifdef HAVE_ALARM_MOD
68 #include "alarm_menu.h"
69 #endif
71 #ifdef HAVE_REMOTE_LCD
72 #include "lcd-remote.h"
73 #endif
75 #if CONFIG_CODEC == SWCODEC
76 #include "pcmbuf.h"
77 #include "pcm_playback.h"
78 #include "dsp.h"
79 #endif
81 #ifdef HAVE_LCD_COLOR
82 #include "backdrop.h"
83 #endif
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 );
91 #endif
93 /**
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] = {
104 { STR(LANG_OFF) },
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);
138 return rc;
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);
147 lcd_remote_update();
149 return rc;
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);
160 return rc;
162 #endif
163 #endif
165 #ifdef CONFIG_BACKLIGHT
166 static const struct opt_items backlight_timeouts[] = {
167 { STR(LANG_OFF) },
168 { STR(LANG_ON) },
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 );
202 #endif
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) },
217 { STR(LANG_OFF) },
218 { STR(LANG_ON) },
220 return set_option(str(LANG_BACKLIGHT_ON_BUTTON_HOLD),
221 &global_settings.backlight_on_button_hold,
222 INT, names, 3,
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[] = {
231 { STR(LANG_OFF) },
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[] = {
244 { STR(LANG_OFF) },
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 );
257 #endif
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) },
264 { STR(LANG_NEVER) },
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,
277 INT, names, 10,
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 );
291 #endif
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);
342 return rc;
344 #endif /* HAVE_LCD_COLOR */
346 #ifdef HAVE_LCD_FLIP
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);
358 return rc;
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),
369 &type,
370 STR(LANG_INVERT_CURSOR_BAR),
371 STR(LANG_INVERT_CURSOR_POINTER),
372 NULL);
373 global_settings.invert_cursor = type;
374 return rc;
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();
386 return false;
390 * Menu for fore/back colors
392 static bool set_fg_color(void)
394 bool res;
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);
401 return res;
404 static bool set_bg_color(void)
406 bool res;
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);
413 return res;
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);
423 return false;
425 #endif
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) {
457 bool retval = false;
458 static const struct opt_items names[] = {
459 { STR(LANG_OFF) },
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,
480 18, NULL);
482 peak_meter_init_times(global_settings.peak_meter_release,
483 global_settings.peak_meter_hold,
484 global_settings.peak_meter_clip_hold);
486 return retval;
490 * Menu to set the hold time of clips.
492 static bool peak_meter_clip_hold(void) {
493 bool retval = false;
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);
530 return retval;
534 * Menu to set the release time of the peak meter.
536 static bool peak_meter_release(void) {
537 bool retval = false;
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);
552 return retval;
556 * Menu to select wether the scale of the meter
557 * displays dBfs of linear values.
559 static bool peak_meter_scale(void) {
560 bool retval = false;
561 bool use_dbfs = global_settings.peak_meter_dbfs;
562 retval = set_bool_options(str(LANG_PM_SCALE),
563 &use_dbfs,
564 STR(LANG_PM_DBFS), STR(LANG_PM_LINEAR),
565 NULL);
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. */
577 if (use_dbfs) {
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;
582 } else {
583 int max;
585 /* linear percent */
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();
598 return retval;
602 * Adjust the min value of the value range that
603 * the peak meter shall visualize.
605 static bool peak_meter_min(void) {
606 bool retval = false;
607 if (global_settings.peak_meter_dbfs) {
609 /* for dBfs scale */
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 */
620 else {
621 int min = global_settings.peak_meter_min;
623 retval = set_int(str(LANG_PM_MIN), "%", UNIT_PERCENT,
624 &min, NULL,
625 1, 0, global_settings.peak_meter_max - 1, NULL);
627 global_settings.peak_meter_min = (unsigned char)min;
630 settings_apply_pm_range();
631 return retval;
636 * Adjust the max value of the value range that
637 * the peak meter shall visualize.
639 static bool peak_meter_max(void) {
640 bool retval = false;
641 if (global_settings.peak_meter_dbfs) {
643 /* for dBfs scale */
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 */
655 else {
656 int max = global_settings.peak_meter_max;
658 retval = set_int(str(LANG_PM_MAX), "%", UNIT_PERCENT,
659 &max, NULL,
660 1, global_settings.peak_meter_min + 1, 100, NULL);
662 global_settings.peak_meter_max = (unsigned char)max;
665 settings_apply_pm_range();
666 return retval;
670 * Menu to configure the peak meter
672 static bool peak_meter_menu(void)
674 int m;
675 bool result;
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,
687 NULL, NULL, NULL );
688 result = menu_run(m);
689 menu_exit(m);
690 return result;
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)
701 bool result;
702 static const struct opt_items names[] = {
703 { STR(LANG_OFF) },
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) }
709 #endif
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();
720 return result;
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,
738 names, 5, NULL );
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;
749 bool ret;
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,
757 names, 4, NULL );
758 if (global_settings.sort_file != oldval)
759 reload_directory(); /* force reload if this has changed */
760 return ret;
763 static bool sort_dir(void)
765 int oldval = global_settings.sort_dir;
766 bool ret;
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,
773 names, 3, NULL );
774 if (global_settings.sort_dir != oldval)
775 reload_directory(); /* force reload if this has changed */
776 return ret;
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,
789 STR(LANG_ON),
790 STR(LANG_OFF),
791 spdif_power_enable);
792 return rc;
794 #endif
796 static bool autocreatebookmark(void)
798 bool retval = false;
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,
809 names, 5, NULL );
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;
817 return retval;
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,
829 names, 3, NULL );
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,
841 names, 3, NULL );
844 static bool poweroff_idle_timer(void)
846 static const struct opt_items names[] = {
847 { STR(LANG_OFF) },
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,
868 const char* unit)
870 int minutes, hours;
872 (void) unit;
874 if (value) {
875 hours = value / 60;
876 minutes = value - (hours * 60);
877 snprintf(buffer, buffer_size, "%d:%02d", hours, minutes);
878 } else {
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,
907 &dummy,
908 &lcd_scroll_delay, 100, 0, 2500, NULL );
909 global_settings.scroll_delay = dummy / (HZ/10);
910 return rc;
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,
932 &dummy,
933 &lcd_remote_scroll_delay, 100, 0, 2500, NULL );
934 global_settings.remote_scroll_delay = dummy / (HZ/10);
935 return rc;
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 );
945 #endif
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);
952 return rc;
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 );
968 #endif
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[] = {
981 { STR(LANG_OFF) },
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) },
986 { STR(LANG_ALWAYS) }
988 bool ret;
989 ret=set_option(str(LANG_JUMP_SCROLL), &global_settings.jump_scroll,
990 INT, names, 6, lcd_jump_scroll);
991 return ret;
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,
997 &dummy,
998 &lcd_jump_scroll_delay, 100, 0, 2500, NULL );
999 global_settings.jump_scroll_delay = dummy / (HZ/10);
1000 return rc;
1002 #endif
1004 #ifndef SIMULATOR
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);
1027 #endif
1028 #endif
1030 #ifdef CONFIG_RTC
1031 static bool timedate_set(void)
1033 struct tm tm;
1034 bool result;
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))
1043 /* hour */
1044 tm.tm_hour = 0;
1045 tm.tm_min = 0;
1046 tm.tm_sec = 0;
1047 tm.tm_mday = 1;
1048 tm.tm_mon = 0;
1049 tm.tm_wday = 1;
1050 tm.tm_year = 100;
1053 result = set_time_screen(str(LANG_TIME), &tm);
1055 if(tm.tm_year != -1) {
1056 set_time(&tm);
1058 return result;
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);
1070 #endif
1072 #ifndef HAVE_MMC
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);
1085 return rc;
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);
1094 #ifndef SIMULATOR
1095 dac_line_in(global_settings.line_in);
1096 #endif
1097 return rc;
1099 #endif
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)
1118 int ret;
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);
1134 return ret;
1136 #else
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 );
1143 #endif
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);
1183 return result;
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);
1191 return result;
1193 #endif
1194 #endif
1196 static bool ff_rewind_accel(void)
1198 static const struct opt_items names[] = {
1199 { STR(LANG_OFF) },
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);
1235 #endif
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)
1249 bool ret;
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;
1254 return ret;
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[] = {
1259 { STR(LANG_OFF) },
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);
1271 #endif
1272 return ret;
1275 static bool voice_files(void)
1277 int oldval = global_settings.talk_file;
1278 bool ret;
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);
1284 #endif
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 */
1288 reload_directory();
1290 return ret;
1293 static bool voice_menu(void)
1295 int m;
1296 bool result;
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,
1305 NULL, NULL, NULL);
1306 result = menu_run(m);
1307 menu_exit(m);
1308 return result;
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)
1337 int m;
1338 bool result;
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,
1346 NULL, NULL, NULL);
1347 result = menu_run(m);
1348 menu_exit(m);
1350 return result;
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),
1359 mpeg_id3_options);
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);
1396 return result;
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);
1410 return result;
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);
1419 return result;
1422 void replaygain_preamp_format(char* buffer, int buffer_size, int value,
1423 const char* unit)
1425 int v = abs(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);
1438 return result;
1441 static bool replaygain_settings_menu(void)
1443 int m;
1444 bool result;
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,
1454 NULL, NULL, NULL);
1455 result = menu_run(m);
1456 menu_exit(m);
1457 return result;
1460 static bool crossfade(void)
1462 static const struct opt_items names[] = {
1463 { STR(LANG_OFF) },
1464 { STR(LANG_SHUFFLE) },
1465 { STR(LANG_TRACKSKIP) },
1466 { STR(LANG_ALWAYS) },
1469 bool ret;
1471 ret=set_option( str(LANG_CROSSFADE_ENABLE),
1472 &global_settings.crossfade, INT, names, 4, NULL);
1473 audio_set_crossfade(global_settings.crossfade);
1474 return ret;
1477 static bool crossfade_fade_in_delay(void)
1479 bool ret;
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);
1485 return ret;
1488 static bool crossfade_fade_out_delay(void)
1490 bool ret;
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);
1496 return ret;
1499 static bool crossfade_fade_in_duration(void)
1501 bool ret;
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);
1507 return ret;
1510 static bool crossfade_fade_out_duration(void)
1512 bool ret;
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);
1518 return ret;
1521 static bool crossfade_fade_out_mixmode(void)
1523 static const struct opt_items names[] = {
1524 { STR(LANG_CROSSFADE) },
1525 { STR(LANG_MIX) },
1527 bool ret;
1528 ret=set_option( str(LANG_CROSSFADE_FADE_OUT_MODE),
1529 &global_settings.crossfade_fade_out_mixmode, INT, names, 2, NULL);
1531 return ret;
1535 * Menu to configure the crossfade settings.
1537 static bool crossfade_settings_menu(void)
1539 int m;
1540 bool result;
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,
1552 NULL, NULL, NULL);
1553 result = menu_run(m);
1554 menu_exit(m);
1555 return result;
1558 static bool beep(void)
1560 static const struct opt_items names[] = {
1561 { STR(LANG_OFF) },
1562 { STR(LANG_WEAK) },
1563 { STR(LANG_MODERATE) },
1564 { STR(LANG_STRONG) },
1566 bool ret;
1567 ret=set_option( str(LANG_BEEP),
1568 &global_settings.beep, INT, names, 4, NULL);
1570 return ret;
1572 #endif
1575 #ifdef HAVE_DIRCACHE
1576 static bool dircache(void)
1578 bool result = set_bool_options(str(LANG_DIRCACHE_ENABLE),
1579 &global_settings.dircache,
1580 STR(LANG_ON),
1581 STR(LANG_OFF),
1582 NULL);
1584 if (!dircache_is_enabled() && global_settings.dircache)
1585 gui_syncsplash(HZ*2, true, str(LANG_DIRCACHE_REBOOT));
1587 if (!result)
1588 dircache_disable();
1590 return result;
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),
1601 NULL);
1603 return result;
1605 #endif
1607 static bool tagcache_autoupdate(void)
1609 bool rc = set_bool_options(str(LANG_TAGCACHE_AUTOUPDATE),
1610 &global_settings.tagcache_autoupdate,
1611 STR(LANG_ON),
1612 STR(LANG_OFF),
1613 NULL);
1614 return rc;
1617 static bool tagcache_runtimedb(void)
1619 bool rc = set_bool_options(str(LANG_RUNTIMEDB_ACTIVE),
1620 &global_settings.runtimedb,
1621 STR(LANG_ON),
1622 STR(LANG_OFF),
1623 NULL);
1624 return rc;
1627 static bool tagcache_settings_menu(void)
1629 int m;
1630 bool result;
1632 static const struct menu_item items[] = {
1633 #ifdef HAVE_TC_RAMCACHE
1634 { ID2P(LANG_TAGCACHE_RAM), tagcache_ram },
1635 #endif
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,
1645 NULL, NULL, NULL);
1646 result = menu_run(m);
1647 menu_exit(m);
1648 return result;
1651 static bool playback_settings_menu(void)
1653 int m;
1654 bool result;
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 },
1669 #endif
1670 #ifdef HAVE_SPDIF_POWER
1671 { ID2P(LANG_SPDIF_ENABLE), spdif },
1672 #endif
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,
1680 NULL, NULL, NULL);
1681 result = menu_run(m);
1682 menu_exit(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);
1689 #endif
1691 if (global_settings.playlist_shuffle)
1693 playlist_randomise(NULL, current_tick, true);
1695 else
1697 playlist_sort(NULL, true);
1700 return result;
1703 static bool bookmark_settings_menu(void)
1705 int m;
1706 bool result;
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,
1715 NULL, NULL, NULL);
1716 result = menu_run(m);
1717 menu_exit(m);
1719 return result;
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))
1735 case YESNO_YES:
1736 settings_reset();
1737 settings_apply();
1738 break;
1739 case YESNO_NO:
1740 break;
1741 case YESNO_USB:
1742 return true;
1744 return false;
1747 static bool fileview_settings_menu(void)
1749 int m;
1750 bool result;
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,
1764 NULL, NULL, NULL);
1765 result = menu_run(m);
1766 menu_exit(m);
1767 return result;
1770 #ifdef HAVE_REMOTE_LCD
1771 static bool remote_scroll_sets(void)
1773 int m;
1774 bool result;
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,
1784 NULL, NULL, NULL);
1785 result = menu_run(m);
1786 menu_exit(m);
1787 return result;
1789 #endif
1791 static bool scroll_settings_menu(void)
1793 int m;
1794 bool result;
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 },
1801 #endif
1802 { ID2P(LANG_BIDIR_SCROLL), bidir_limit },
1803 #ifdef HAVE_REMOTE_LCD
1804 { ID2P(LANG_REMOTE_SCROLL_SETS), remote_scroll_sets },
1805 #endif
1806 #ifdef HAVE_LCD_CHARCELLS
1807 { ID2P(LANG_JUMP_SCROLL), jump_scroll },
1808 { ID2P(LANG_JUMP_SCROLL_DELAY), jump_scroll_delay },
1809 #endif
1810 #ifdef HAVE_LCD_BITMAP
1811 { ID2P(LANG_SCREEN_SCROLL_VIEW), screen_scroll },
1812 { ID2P(LANG_SCREEN_SCROLL_STEP), screen_scroll_step },
1813 #endif
1814 { ID2P(LANG_SCROLL_PAGINATED), scroll_paginated },
1817 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1818 NULL, NULL, NULL);
1819 result = menu_run(m);
1820 menu_exit(m);
1821 return result;
1824 static bool lcd_settings_menu(void)
1826 int m;
1827 bool result;
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 },
1834 #endif
1835 #ifdef HAS_BUTTON_HOLD
1836 { ID2P(LANG_BACKLIGHT_ON_BUTTON_HOLD), backlight_on_button_hold },
1837 #endif
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 },
1842 #endif
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 },
1846 #endif
1847 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
1848 { ID2P(LANG_BRIGHTNESS), brightness },
1849 #endif
1850 #endif /* CONFIG_BACKLIGHT */
1851 #ifdef HAVE_LCD_CONTRAST
1852 { ID2P(LANG_CONTRAST), contrast },
1853 #endif
1854 #ifdef HAVE_LCD_BITMAP
1855 #ifndef HAVE_LCD_COLOR
1856 { ID2P(LANG_INVERT), invert },
1857 #endif
1858 #ifdef HAVE_LCD_FLIP
1859 { ID2P(LANG_FLIP_DISPLAY), flip_display },
1860 #endif
1861 { ID2P(LANG_INVERT_CURSOR), invert_cursor },
1862 #endif
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 },
1868 #endif
1871 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1872 NULL, NULL, NULL);
1873 result = menu_run(m);
1874 menu_exit(m);
1875 return result;
1878 #ifdef HAVE_REMOTE_LCD
1879 static bool lcd_remote_settings_menu(void)
1881 int m;
1882 bool result;
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 },
1889 #endif
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 },
1897 #endif
1900 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1901 NULL, NULL, NULL);
1902 result = menu_run(m);
1903 menu_exit(m);
1904 return result;
1906 #endif
1908 #ifdef HAVE_LCD_BITMAP
1909 static bool bars_settings_menu(void)
1911 int m;
1912 bool result;
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 },
1919 #endif
1920 { ID2P(LANG_VOLUME_DISPLAY), volume_type },
1921 { ID2P(LANG_BATTERY_DISPLAY), battery_display },
1924 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1925 NULL, NULL, NULL);
1926 result = menu_run(m);
1927 menu_exit(m);
1928 return result;
1930 #endif
1933 static bool display_settings_menu(void)
1935 int m;
1936 bool result;
1938 static const struct menu_item items[] = {
1939 #ifdef HAVE_LCD_BITMAP
1940 { ID2P(LANG_CUSTOM_FONT), font_browse },
1941 #endif
1942 { ID2P(LANG_WHILE_PLAYING), custom_wps_browse },
1943 #ifdef HAVE_REMOTE_LCD
1944 { ID2P(LANG_REMOTE_WHILE_PLAYING), custom_remote_wps_browse },
1945 #endif
1946 { ID2P(LANG_LCD_MENU), lcd_settings_menu },
1947 #ifdef HAVE_REMOTE_LCD
1948 { ID2P(LANG_LCD_REMOTE_MENU), lcd_remote_settings_menu },
1949 #endif
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 },
1954 #endif
1955 { ID2P(LANG_DEFAULT_CODEPAGE), codepage_setting },
1958 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1959 NULL, NULL, NULL);
1960 result = menu_run(m);
1961 menu_exit(m);
1962 return result;
1966 static bool firmware_browse(void)
1968 return rockbox_browse(ROCKBOX_DIR, SHOW_MOD);
1971 static bool battery_settings_menu(void)
1973 int m;
1974 bool result;
1976 static const struct menu_item items[] = {
1977 #ifndef SIMULATOR
1978 { ID2P(LANG_BATTERY_CAPACITY), battery_capacity },
1979 #if BATTERY_TYPES_COUNT > 1
1980 { ID2P(LANG_BATTERY_TYPE), battery_type },
1981 #endif
1982 #else
1983 { "Dummy", NULL }, /* to have an entry at all, in the simulator */
1984 #endif
1987 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1988 NULL, NULL, NULL);
1989 result = menu_run(m);
1990 menu_exit(m);
1991 return result;
1994 #ifndef HAVE_MMC
1995 static bool disk_settings_menu(void)
1997 int m;
1998 bool result;
2000 static const struct menu_item items[] = {
2001 { ID2P(LANG_SPINDOWN), spindown },
2002 #ifdef HAVE_ATA_POWER_OFF
2003 { ID2P(LANG_POWEROFF), poweroff },
2004 #endif
2005 #ifdef HAVE_DIRCACHE
2006 { ID2P(LANG_DIRCACHE_ENABLE), dircache },
2007 #endif
2010 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
2011 NULL, NULL, NULL);
2012 result = menu_run(m);
2013 menu_exit(m);
2014 return result;
2016 #endif /* !HAVE_MMC */
2018 #ifdef CONFIG_RTC
2019 static bool time_settings_menu(void)
2021 int m;
2022 bool result;
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,
2030 NULL, NULL, NULL);
2031 result = menu_run(m);
2032 menu_exit(m);
2033 return result;
2035 #endif
2037 bool manage_settings_menu(void)
2039 int m;
2040 bool result;
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,
2050 NULL, NULL, NULL);
2051 result = menu_run(m);
2052 menu_exit(m);
2053 return result;
2056 static bool limits_settings_menu(void)
2058 int m;
2059 bool result;
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,
2067 NULL, NULL, NULL);
2068 result = menu_run(m);
2069 menu_exit(m);
2070 return result;
2074 static bool system_settings_menu(void)
2076 int m;
2077 bool result;
2079 static const struct menu_item items[] = {
2080 { ID2P(LANG_BATTERY_MENU), battery_settings_menu },
2081 #ifndef HAVE_MMC
2082 { ID2P(LANG_DISK_MENU), disk_settings_menu },
2083 #endif
2084 #ifdef CONFIG_RTC
2085 { ID2P(LANG_TIME_MENU), time_settings_menu },
2086 #endif
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 },
2091 #endif
2092 { ID2P(LANG_LIMITS_MENU), limits_settings_menu },
2093 #if CONFIG_CODEC == MAS3507D
2094 { ID2P(LANG_LINE_IN), line_in },
2095 #endif
2096 #ifdef CONFIG_CHARGING
2097 { ID2P(LANG_CAR_ADAPTER_MODE), car_adapter_mode },
2098 #endif
2101 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
2102 NULL, NULL, NULL);
2103 result = menu_run(m);
2104 menu_exit(m);
2105 return result;
2108 bool settings_menu(void)
2110 int m;
2111 bool result;
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,
2124 NULL, NULL, NULL);
2125 result = menu_run(m);
2126 menu_exit(m);
2127 return result;