1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
31 #include "sound_menu.h"
32 #include "exported_menus.h"
39 #include "powermgmt.h"
40 #if CONFIG_CODEC == SWCODEC
46 #include "quickscreen.h"
52 #include "settings_list.h"
56 /***********************************/
60 static void tagcache_rebuild_with_splash(void)
63 splash(HZ
*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH
));
66 static void tagcache_update_with_splash(void)
69 splash(HZ
*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH
));
72 #ifdef HAVE_TC_RAMCACHE
73 MENUITEM_SETTING(tagcache_ram
, &global_settings
.tagcache_ram
, NULL
);
75 MENUITEM_SETTING(tagcache_autoupdate
, &global_settings
.tagcache_autoupdate
, NULL
);
76 MENUITEM_FUNCTION(tc_init
, 0, ID2P(LANG_TAGCACHE_FORCE_UPDATE
),
77 (int(*)(void))tagcache_rebuild_with_splash
,
78 NULL
, NULL
, Icon_NOICON
);
79 MENUITEM_FUNCTION(tc_update
, 0, ID2P(LANG_TAGCACHE_UPDATE
),
80 (int(*)(void))tagcache_update_with_splash
,
81 NULL
, NULL
, Icon_NOICON
);
82 MENUITEM_SETTING(runtimedb
, &global_settings
.runtimedb
, NULL
);
83 MENUITEM_FUNCTION(tc_export
, 0, ID2P(LANG_TAGCACHE_EXPORT
),
84 (int(*)(void))tagtree_export
, NULL
,
86 MENUITEM_FUNCTION(tc_import
, 0, ID2P(LANG_TAGCACHE_IMPORT
),
87 (int(*)(void))tagtree_import
, NULL
,
89 MAKE_MENU(tagcache_menu
, ID2P(LANG_TAGCACHE
), 0, Icon_NOICON
,
90 #ifdef HAVE_TC_RAMCACHE
93 &tagcache_autoupdate
, &tc_init
, &tc_update
, &runtimedb
,
94 &tc_export
, &tc_import
);
95 #endif /* HAVE_TAGCACHE */
97 /***********************************/
99 /***********************************/
101 static int fileview_callback(int action
,const struct menu_item_ex
*this_item
);
102 MENUITEM_SETTING(sort_case
, &global_settings
.sort_case
, NULL
);
103 MENUITEM_SETTING(sort_dir
, &global_settings
.sort_dir
, fileview_callback
);
104 MENUITEM_SETTING(sort_file
, &global_settings
.sort_file
, fileview_callback
);
105 MENUITEM_SETTING(interpret_numbers
, &global_settings
.interpret_numbers
, fileview_callback
);
106 MENUITEM_SETTING(dirfilter
, &global_settings
.dirfilter
, NULL
);
107 MENUITEM_SETTING(show_filename_ext
, &global_settings
.show_filename_ext
, NULL
);
108 MENUITEM_SETTING(browse_current
, &global_settings
.browse_current
, NULL
);
109 #ifdef HAVE_LCD_BITMAP
110 MENUITEM_SETTING(show_path_in_browser
, &global_settings
.show_path_in_browser
, NULL
);
112 static int fileview_callback(int action
,const struct menu_item_ex
*this_item
)
115 int *variable
= this_item
->variable
;
118 case ACTION_ENTER_MENUITEM
: /* on entering an item */
121 case ACTION_EXIT_MENUITEM
: /* on exit */
122 if (*variable
!= oldval
)
123 reload_directory(); /* force reload if this has changed */
129 MAKE_MENU(file_menu
, ID2P(LANG_FILE
), 0, Icon_file_view_menu
,
130 &sort_case
, &sort_dir
, &sort_file
, &interpret_numbers
,
131 &dirfilter
, &show_filename_ext
, &browse_current
,
132 #ifdef HAVE_LCD_BITMAP
133 &show_path_in_browser
137 /***********************************/
140 /***********************************/
144 #if BATTERY_CAPACITY_INC > 0
145 MENUITEM_SETTING(battery_capacity
, &global_settings
.battery_capacity
, NULL
);
147 #if BATTERY_TYPES_COUNT > 1
148 MENUITEM_SETTING(battery_type
, &global_settings
.battery_type
, NULL
);
150 #ifdef HAVE_USB_CHARGING_ENABLE
151 static int usbcharging_callback(int action
,const struct menu_item_ex
*this_item
)
156 case ACTION_EXIT_MENUITEM
: /* on exit */
157 usb_charging_enable(global_settings
.usb_charging
);
162 MENUITEM_SETTING(usb_charging
, &global_settings
.usb_charging
, usbcharging_callback
);
163 #endif /* HAVE_USB_CHARGING_ENABLE */
164 MAKE_MENU(battery_menu
, ID2P(LANG_BATTERY_MENU
), 0, Icon_NOICON
,
165 #if BATTERY_CAPACITY_INC > 0
168 #if BATTERY_TYPES_COUNT > 1
171 #ifdef HAVE_USB_CHARGING_ENABLE
176 #ifdef HAVE_DISK_STORAGE
177 MENUITEM_SETTING(disk_spindown
, &global_settings
.disk_spindown
, NULL
);
180 static int dircache_callback(int action
,const struct menu_item_ex
*this_item
)
185 case ACTION_EXIT_MENUITEM
: /* on exit */
186 switch (global_settings
.dircache
)
189 if (!dircache_is_enabled())
190 splash(HZ
*2, ID2P(LANG_PLEASE_REBOOT
));
193 if (dircache_is_enabled())
201 MENUITEM_SETTING(dircache
, &global_settings
.dircache
, dircache_callback
);
203 #if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE)
204 MAKE_MENU(disk_menu
, ID2P(LANG_DISK_MENU
), 0, Icon_NOICON
,
205 #ifdef HAVE_DISK_STORAGE
215 MENUITEM_SETTING(poweroff
, &global_settings
.poweroff
, NULL
);
218 MENUITEM_SETTING(max_files_in_dir
, &global_settings
.max_files_in_dir
, NULL
);
219 MENUITEM_SETTING(max_files_in_playlist
, &global_settings
.max_files_in_playlist
, NULL
);
220 MAKE_MENU(limits_menu
, ID2P(LANG_LIMITS_MENU
), 0, Icon_NOICON
,
221 &max_files_in_dir
, &max_files_in_playlist
);
225 #if CONFIG_CODEC == SWCODEC
226 MENUITEM_SETTING(keyclick
, &global_settings
.keyclick
, NULL
);
227 MENUITEM_SETTING(keyclick_repeats
, &global_settings
.keyclick_repeats
, NULL
);
228 MAKE_MENU(keyclick_menu
, ID2P(LANG_KEYCLICK
), 0, Icon_NOICON
,
229 &keyclick
, &keyclick_repeats
);
233 #if CONFIG_CODEC == MAS3507D
234 void dac_line_in(bool enable
);
235 static int linein_callback(int action
,const struct menu_item_ex
*this_item
)
240 case ACTION_EXIT_MENUITEM
: /* on exit */
242 dac_line_in(global_settings
.line_in
);
248 MENUITEM_SETTING(line_in
, &global_settings
.line_in
, linein_callback
);
251 MENUITEM_SETTING(car_adapter_mode
, &global_settings
.car_adapter_mode
, NULL
);
253 #ifdef IPOD_ACCESSORY_PROTOCOL
254 MENUITEM_SETTING(serial_bitrate
, &global_settings
.serial_bitrate
, NULL
);
256 #ifdef HAVE_ACCESSORY_SUPPLY
257 MENUITEM_SETTING(accessory_supply
, &global_settings
.accessory_supply
, NULL
);
259 #ifdef HAVE_LINEOUT_POWEROFF
260 MENUITEM_SETTING(lineout_onoff
, &global_settings
.lineout_active
, NULL
);
262 MENUITEM_SETTING(start_screen
, &global_settings
.start_in_screen
, NULL
);
263 #ifdef USB_ENABLE_HID
264 MENUITEM_SETTING(usb_hid
, &global_settings
.usb_hid
, NULL
);
265 MENUITEM_SETTING(usb_keypad_mode
, &global_settings
.usb_keypad_mode
, NULL
);
268 #ifdef HAVE_MORSE_INPUT
269 MENUITEM_SETTING(morse_input
, &global_settings
.morse_input
, NULL
);
272 #ifdef HAVE_BUTTON_LIGHT
273 MENUITEM_SETTING(buttonlight_timeout
, &global_settings
.buttonlight_timeout
, NULL
);
276 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
277 MENUITEM_SETTING(buttonlight_brightness
, &global_settings
.buttonlight_brightness
, NULL
);
280 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
281 MENUITEM_SETTING(touchpad_sensitivity
, &global_settings
.touchpad_sensitivity
, NULL
);
284 MAKE_MENU(system_menu
, ID2P(LANG_SYSTEM
),
287 #if (BATTERY_CAPACITY_INC > 0) || (BATTERY_TYPES_COUNT > 1)
290 #if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE)
295 #ifdef HAVE_MORSE_INPUT
298 #if CONFIG_CODEC == MAS3507D
304 #ifdef IPOD_ACCESSORY_PROTOCOL
307 #ifdef HAVE_ACCESSORY_SUPPLY
310 #ifdef HAVE_LINEOUT_POWEROFF
313 #ifdef HAVE_BUTTON_LIGHT
314 &buttonlight_timeout
,
316 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
317 &buttonlight_brightness
,
319 #if CONFIG_CODEC == SWCODEC
322 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
323 &touchpad_sensitivity
,
325 #ifdef USB_ENABLE_HID
332 /***********************************/
335 /***********************************/
337 static int bmark_callback(int action
,const struct menu_item_ex
*this_item
)
342 case ACTION_EXIT_MENUITEM
: /* on exit */
343 if(global_settings
.autocreatebookmark
== BOOKMARK_RECENT_ONLY_YES
||
344 global_settings
.autocreatebookmark
== BOOKMARK_RECENT_ONLY_ASK
)
346 if(global_settings
.usemrb
== BOOKMARK_NO
)
347 global_settings
.usemrb
= BOOKMARK_YES
;
354 MENUITEM_SETTING(autocreatebookmark
,
355 &global_settings
.autocreatebookmark
, bmark_callback
);
356 MENUITEM_SETTING(autoloadbookmark
, &global_settings
.autoloadbookmark
, NULL
);
357 MENUITEM_SETTING(usemrb
, &global_settings
.usemrb
, NULL
);
358 MAKE_MENU(bookmark_settings_menu
, ID2P(LANG_BOOKMARK_SETTINGS
), 0,
360 &autocreatebookmark
, &autoloadbookmark
, &usemrb
);
362 /***********************************/
364 /***********************************/
366 static int talk_callback(int action
,const struct menu_item_ex
*this_item
);
367 MENUITEM_SETTING(talk_menu_item
, &global_settings
.talk_menu
, NULL
);
368 MENUITEM_SETTING(talk_dir_item
, &global_settings
.talk_dir
, NULL
);
369 MENUITEM_SETTING(talk_dir_clip_item
, &global_settings
.talk_dir_clip
, talk_callback
);
370 MENUITEM_SETTING(talk_file_item
, &global_settings
.talk_file
, NULL
);
371 MENUITEM_SETTING(talk_file_clip_item
, &global_settings
.talk_file_clip
, talk_callback
);
372 static int talk_callback(int action
,const struct menu_item_ex
*this_item
)
374 static int oldval
= 0;
377 case ACTION_ENTER_MENUITEM
:
378 oldval
= global_settings
.talk_file_clip
;
380 case ACTION_EXIT_MENUITEM
:
381 #ifdef HAVE_CROSSFADE
382 audio_set_crossfade(global_settings
.crossfade
);
384 if (this_item
== &talk_dir_clip_item
)
386 if (!oldval
&& global_settings
.talk_file_clip
)
388 /* force reload if newly talking thumbnails,
389 because the clip presence is cached only if enabled */
396 MENUITEM_SETTING(talk_filetype_item
, &global_settings
.talk_filetype
, NULL
);
397 MENUITEM_SETTING(talk_battery_level_item
,
398 &global_settings
.talk_battery_level
, NULL
);
399 MAKE_MENU(voice_settings_menu
, ID2P(LANG_VOICE
), 0, Icon_Voice
,
400 &talk_menu_item
, &talk_dir_item
, &talk_dir_clip_item
,
401 &talk_file_item
, &talk_file_clip_item
, &talk_filetype_item
,
402 &talk_battery_level_item
);
404 /***********************************/
407 /***********************************/
410 static void view_hotkey_info(void)
412 struct simplelist_info info
;
413 simplelist_info_init(&info
, str(LANG_VIEW_HOTKEY
), 0, NULL
);
414 info
.hide_selection
= true;
415 info
.scroll_all
= true;
416 simplelist_addline(SIMPLELIST_ADD_LINE
, str(LANG_HOTKEY_VIEW_WPS
),
417 get_hotkey_desc(global_settings
.hotkey_wps
));
418 simplelist_addline(SIMPLELIST_ADD_LINE
, str(LANG_HOTKEY_VIEW_FILE_BROWSER
),
419 get_hotkey_desc(global_settings
.hotkey_tree
));
420 simplelist_show_list(&info
);
423 /* reset hotkey settings to their defaults */
424 static void reset_hotkey_settings(void)
427 const struct settings_list
*setting
=
428 find_setting(&global_settings
.hotkey_wps
, NULL
);
429 reset_setting(setting
, setting
->setting
);
432 const struct settings_list
*setting
=
433 find_setting(&global_settings
.hotkey_tree
, NULL
);
434 reset_setting(setting
, setting
->setting
);
437 splash(HZ
, str(LANG_RESET_DONE_CLEAR
));
440 MENUITEM_FUNCTION(hotkey_view
, 0, ID2P(LANG_VIEW_HOTKEY
),
441 (int(*)(void))view_hotkey_info
, NULL
,
443 MENUITEM_FUNCTION(hotkey_reset
, 0, ID2P(LANG_RESET
),
444 (int(*)(void))reset_hotkey_settings
, NULL
,
446 MAKE_MENU(hotkey_menu
, ID2P(LANG_HOTKEY
), 0, Icon_NOICON
,
447 &hotkey_view
, &hotkey_reset
);
448 #endif /*have_hotkey */
450 /***********************************/
453 /***********************************/
455 static int language_browse(void)
457 return (int)rockbox_browse(LANG_DIR
, SHOW_LNG
);
459 MENUITEM_FUNCTION(browse_langs
, 0, ID2P(LANG_LANGUAGE
), language_browse
,
460 NULL
, NULL
, Icon_Language
);
462 MAKE_MENU(settings_menu_item
, ID2P(LANG_GENERAL_SETTINGS
), 0,
463 Icon_General_settings_menu
,
464 &playlist_settings
, &file_menu
,
468 &display_menu
, &system_menu
,
469 &bookmark_settings_menu
, &browse_langs
, &voice_settings_menu
,
475 /***********************************/