Jonathan Gordon | 4718a1e | 2007-02-08 04:33:41 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
Jonathan Gordon | 4e73b53 | 2007-02-13 00:32:17 +0000 | [diff] [blame] | 8 | * $Id$ |
Jonathan Gordon | 4718a1e | 2007-02-08 04:33:41 +0000 | [diff] [blame] | 9 | * |
| 10 | * Copyright (C) 2007 Jonathan Gordon |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 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. |
Jonathan Gordon | 4718a1e | 2007-02-08 04:33:41 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | |
| 22 | #include <stdbool.h> |
| 23 | #include <stddef.h> |
| 24 | #include <limits.h> |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 25 | #include <string.h> |
Jonathan Gordon | 4718a1e | 2007-02-08 04:33:41 +0000 | [diff] [blame] | 26 | #include "config.h" |
| 27 | #include "lang.h" |
| 28 | #include "action.h" |
| 29 | #include "settings.h" |
| 30 | #include "menu.h" |
| 31 | #include "sound_menu.h" |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 32 | #include "exported_menus.h" |
| 33 | #include "tree.h" |
| 34 | #include "tagtree.h" |
| 35 | #include "usb.h" |
| 36 | #include "splash.h" |
| 37 | #include "talk.h" |
| 38 | #include "sprintf.h" |
Andree Buschmann | 850a112 | 2008-04-20 18:28:25 +0000 | [diff] [blame] | 39 | #include "powermgmt.h" |
| 40 | #if CONFIG_CODEC == SWCODEC |
| 41 | #include "playback.h" |
| 42 | #endif |
Andree Buschmann | 850a112 | 2008-04-20 18:28:25 +0000 | [diff] [blame] | 43 | #if CONFIG_RTC |
| 44 | #include "screens.h" |
| 45 | #endif |
Jonathan Gordon | edcacaa | 2008-11-03 11:11:07 +0000 | [diff] [blame] | 46 | #include "quickscreen.h" |
Bertrik Sikken | b24fafb | 2009-03-08 20:28:15 +0000 | [diff] [blame] | 47 | #ifdef HAVE_DIRCACHE |
| 48 | #include "dircache.h" |
| 49 | #endif |
Jonathan Gordon | 4718a1e | 2007-02-08 04:33:41 +0000 | [diff] [blame] | 50 | |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 51 | /***********************************/ |
| 52 | /* TAGCACHE MENU */ |
| 53 | #ifdef HAVE_TAGCACHE |
Steve Bavin | 8137489 | 2007-03-07 19:56:15 +0000 | [diff] [blame] | 54 | |
| 55 | static void tagcache_rebuild_with_splash(void) |
| 56 | { |
| 57 | tagcache_rebuild(); |
Michael Giacomelli | e25f1f9 | 2008-12-25 03:23:22 +0000 | [diff] [blame] | 58 | splash(HZ*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH)); |
Steve Bavin | 8137489 | 2007-03-07 19:56:15 +0000 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | static void tagcache_update_with_splash(void) |
| 62 | { |
| 63 | tagcache_update(); |
Nils Wallménius | 01729e7 | 2008-08-15 08:27:39 +0000 | [diff] [blame] | 64 | splash(HZ*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH)); |
Steve Bavin | 8137489 | 2007-03-07 19:56:15 +0000 | [diff] [blame] | 65 | } |
| 66 | |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 67 | #ifdef HAVE_TC_RAMCACHE |
| 68 | MENUITEM_SETTING(tagcache_ram, &global_settings.tagcache_ram, NULL); |
| 69 | #endif |
| 70 | MENUITEM_SETTING(tagcache_autoupdate, &global_settings.tagcache_autoupdate, NULL); |
Jonathan Gordon | daf6694 | 2007-03-17 12:33:34 +0000 | [diff] [blame] | 71 | MENUITEM_FUNCTION(tc_init, 0, ID2P(LANG_TAGCACHE_FORCE_UPDATE), |
Michael Giacomelli | e25f1f9 | 2008-12-25 03:23:22 +0000 | [diff] [blame] | 72 | (int(*)(void))tagcache_rebuild_with_splash, |
Jonathan Gordon | e54d8e1 | 2007-03-18 07:03:43 +0000 | [diff] [blame] | 73 | NULL, NULL, Icon_NOICON); |
Jonathan Gordon | daf6694 | 2007-03-17 12:33:34 +0000 | [diff] [blame] | 74 | MENUITEM_FUNCTION(tc_update, 0, ID2P(LANG_TAGCACHE_UPDATE), |
Michael Giacomelli | e25f1f9 | 2008-12-25 03:23:22 +0000 | [diff] [blame] | 75 | (int(*)(void))tagcache_update_with_splash, |
Jonathan Gordon | e54d8e1 | 2007-03-18 07:03:43 +0000 | [diff] [blame] | 76 | NULL, NULL, Icon_NOICON); |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 77 | MENUITEM_SETTING(runtimedb, &global_settings.runtimedb, NULL); |
Jonathan Gordon | daf6694 | 2007-03-17 12:33:34 +0000 | [diff] [blame] | 78 | MENUITEM_FUNCTION(tc_export, 0, ID2P(LANG_TAGCACHE_EXPORT), |
Michael Giacomelli | e25f1f9 | 2008-12-25 03:23:22 +0000 | [diff] [blame] | 79 | (int(*)(void))tagtree_export, NULL, |
Jonathan Gordon | daf6694 | 2007-03-17 12:33:34 +0000 | [diff] [blame] | 80 | NULL, Icon_NOICON); |
| 81 | MENUITEM_FUNCTION(tc_import, 0, ID2P(LANG_TAGCACHE_IMPORT), |
Michael Giacomelli | e25f1f9 | 2008-12-25 03:23:22 +0000 | [diff] [blame] | 82 | (int(*)(void))tagtree_import, NULL, |
Jonathan Gordon | daf6694 | 2007-03-17 12:33:34 +0000 | [diff] [blame] | 83 | NULL, Icon_NOICON); |
Jonathan Gordon | 02a8717 | 2007-03-03 13:52:14 +0000 | [diff] [blame] | 84 | MAKE_MENU(tagcache_menu, ID2P(LANG_TAGCACHE), 0, Icon_NOICON, |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 85 | #ifdef HAVE_TC_RAMCACHE |
| 86 | &tagcache_ram, |
| 87 | #endif |
| 88 | &tagcache_autoupdate, &tc_init, &tc_update, &runtimedb, |
| 89 | &tc_export, &tc_import); |
| 90 | #endif /* HAVE_TAGCACHE */ |
| 91 | /* TAGCACHE MENU */ |
| 92 | /***********************************/ |
| 93 | |
| 94 | /***********************************/ |
| 95 | /* FILE VIEW MENU */ |
| 96 | static int fileview_callback(int action,const struct menu_item_ex *this_item); |
| 97 | MENUITEM_SETTING(sort_case, &global_settings.sort_case, NULL); |
| 98 | MENUITEM_SETTING(sort_dir, &global_settings.sort_dir, fileview_callback); |
| 99 | MENUITEM_SETTING(sort_file, &global_settings.sort_file, fileview_callback); |
Thomas Martitz | d13f1a4 | 2009-03-01 17:55:59 +0000 | [diff] [blame] | 100 | MENUITEM_SETTING(interpret_numbers, &global_settings.interpret_numbers, fileview_callback); |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 101 | MENUITEM_SETTING(dirfilter, &global_settings.dirfilter, NULL); |
Peter D'Hoye | 37fd439 | 2007-08-13 19:29:49 +0000 | [diff] [blame] | 102 | MENUITEM_SETTING(show_filename_ext, &global_settings.show_filename_ext, NULL); |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 103 | MENUITEM_SETTING(browse_current, &global_settings.browse_current, NULL); |
Jonathan Gordon | 189f9e2 | 2008-01-13 09:29:45 +0000 | [diff] [blame] | 104 | #ifdef HAVE_LCD_BITMAP |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 105 | MENUITEM_SETTING(show_path_in_browser, &global_settings.show_path_in_browser, NULL); |
Jonathan Gordon | 189f9e2 | 2008-01-13 09:29:45 +0000 | [diff] [blame] | 106 | #endif |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 107 | static int fileview_callback(int action,const struct menu_item_ex *this_item) |
| 108 | { |
| 109 | static int oldval; |
| 110 | int *variable = this_item->variable; |
| 111 | switch (action) |
| 112 | { |
| 113 | case ACTION_ENTER_MENUITEM: /* on entering an item */ |
| 114 | oldval = *variable; |
| 115 | break; |
| 116 | case ACTION_EXIT_MENUITEM: /* on exit */ |
| 117 | if (*variable != oldval) |
| 118 | reload_directory(); /* force reload if this has changed */ |
| 119 | break; |
| 120 | } |
| 121 | return action; |
| 122 | } |
| 123 | |
Jonathan Gordon | 02a8717 | 2007-03-03 13:52:14 +0000 | [diff] [blame] | 124 | MAKE_MENU(file_menu, ID2P(LANG_FILE), 0, Icon_file_view_menu, |
Thomas Martitz | d13f1a4 | 2009-03-01 17:55:59 +0000 | [diff] [blame] | 125 | &sort_case, &sort_dir, &sort_file, &interpret_numbers, |
Peter D'Hoye | 37fd439 | 2007-08-13 19:29:49 +0000 | [diff] [blame] | 126 | &dirfilter, &show_filename_ext, &browse_current, |
Jonathan Gordon | 189f9e2 | 2008-01-13 09:29:45 +0000 | [diff] [blame] | 127 | #ifdef HAVE_LCD_BITMAP |
| 128 | &show_path_in_browser |
| 129 | #endif |
| 130 | ); |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 131 | /* FILE VIEW MENU */ |
| 132 | /***********************************/ |
| 133 | |
| 134 | |
| 135 | /***********************************/ |
| 136 | /* SYSTEM MENU */ |
| 137 | |
| 138 | /* Battery */ |
Jonathan Gordon | b43bf7e | 2007-07-15 03:56:04 +0000 | [diff] [blame] | 139 | #if BATTERY_CAPACITY_INC > 0 |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 140 | MENUITEM_SETTING(battery_capacity, &global_settings.battery_capacity, NULL); |
Jonathan Gordon | b43bf7e | 2007-07-15 03:56:04 +0000 | [diff] [blame] | 141 | #endif |
| 142 | #if BATTERY_TYPES_COUNT > 1 |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 143 | MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL); |
Jonathan Gordon | b43bf7e | 2007-07-15 03:56:04 +0000 | [diff] [blame] | 144 | #endif |
Michael Sevakis | 58eb784 | 2008-12-03 19:54:25 +0000 | [diff] [blame] | 145 | #ifdef HAVE_USB_CHARGING_ENABLE |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 146 | static int usbcharging_callback(int action,const struct menu_item_ex *this_item) |
| 147 | { |
| 148 | (void)this_item; |
| 149 | switch (action) |
| 150 | { |
| 151 | case ACTION_EXIT_MENUITEM: /* on exit */ |
| 152 | usb_charging_enable(global_settings.usb_charging); |
| 153 | break; |
| 154 | } |
| 155 | return action; |
| 156 | } |
| 157 | MENUITEM_SETTING(usb_charging, &global_settings.usb_charging, usbcharging_callback); |
Michael Sevakis | 58eb784 | 2008-12-03 19:54:25 +0000 | [diff] [blame] | 158 | #endif /* HAVE_USB_CHARGING_ENABLE */ |
Jonathan Gordon | 02a8717 | 2007-03-03 13:52:14 +0000 | [diff] [blame] | 159 | MAKE_MENU(battery_menu, ID2P(LANG_BATTERY_MENU), 0, Icon_NOICON, |
Jonathan Gordon | b43bf7e | 2007-07-15 03:56:04 +0000 | [diff] [blame] | 160 | #if BATTERY_CAPACITY_INC > 0 |
| 161 | &battery_capacity, |
| 162 | #endif |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 163 | #if BATTERY_TYPES_COUNT > 1 |
| 164 | &battery_type, |
| 165 | #endif |
Michael Sevakis | 58eb784 | 2008-12-03 19:54:25 +0000 | [diff] [blame] | 166 | #ifdef HAVE_USB_CHARGING_ENABLE |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 167 | &usb_charging, |
| 168 | #endif |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 169 | ); |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 170 | /* Disk */ |
Frank Gevaerts | 4657301 | 2008-10-07 19:37:33 +0000 | [diff] [blame] | 171 | #ifdef HAVE_DISK_STORAGE |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 172 | MENUITEM_SETTING(disk_spindown, &global_settings.disk_spindown, NULL); |
Nils Wallménius | 0bfa3e7 | 2007-08-01 08:50:44 +0000 | [diff] [blame] | 173 | #endif |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 174 | #ifdef HAVE_DIRCACHE |
| 175 | static int dircache_callback(int action,const struct menu_item_ex *this_item) |
| 176 | { |
| 177 | (void)this_item; |
| 178 | switch (action) |
| 179 | { |
| 180 | case ACTION_EXIT_MENUITEM: /* on exit */ |
| 181 | switch (global_settings.dircache) |
| 182 | { |
| 183 | case true: |
| 184 | if (!dircache_is_enabled()) |
Nils Wallménius | 01729e7 | 2008-08-15 08:27:39 +0000 | [diff] [blame] | 185 | splash(HZ*2, ID2P(LANG_PLEASE_REBOOT)); |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 186 | break; |
| 187 | case false: |
| 188 | if (dircache_is_enabled()) |
| 189 | dircache_disable(); |
| 190 | break; |
| 191 | } |
| 192 | break; |
| 193 | } |
| 194 | return action; |
| 195 | } |
| 196 | MENUITEM_SETTING(dircache, &global_settings.dircache, dircache_callback); |
| 197 | #endif |
Frank Gevaerts | 4657301 | 2008-10-07 19:37:33 +0000 | [diff] [blame] | 198 | #if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE) |
Jonathan Gordon | 02a8717 | 2007-03-03 13:52:14 +0000 | [diff] [blame] | 199 | MAKE_MENU(disk_menu, ID2P(LANG_DISK_MENU), 0, Icon_NOICON, |
Frank Gevaerts | 4657301 | 2008-10-07 19:37:33 +0000 | [diff] [blame] | 200 | #ifdef HAVE_DISK_STORAGE |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 201 | &disk_spindown, |
Nils Wallménius | 0bfa3e7 | 2007-08-01 08:50:44 +0000 | [diff] [blame] | 202 | #endif |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 203 | #ifdef HAVE_DIRCACHE |
| 204 | &dircache, |
| 205 | #endif |
| 206 | ); |
| 207 | #endif |
| 208 | |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 209 | /* System menu */ |
| 210 | MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL); |
| 211 | |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 212 | /* Limits menu */ |
| 213 | MENUITEM_SETTING(max_files_in_dir, &global_settings.max_files_in_dir, NULL); |
| 214 | MENUITEM_SETTING(max_files_in_playlist, &global_settings.max_files_in_playlist, NULL); |
Jonathan Gordon | 02a8717 | 2007-03-03 13:52:14 +0000 | [diff] [blame] | 215 | MAKE_MENU(limits_menu, ID2P(LANG_LIMITS_MENU), 0, Icon_NOICON, |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 216 | &max_files_in_dir, &max_files_in_playlist); |
| 217 | |
Steve Bavin | ea358a1 | 2008-01-21 09:48:44 +0000 | [diff] [blame] | 218 | |
| 219 | /* Keyclick menu */ |
| 220 | #if CONFIG_CODEC == SWCODEC |
| 221 | MENUITEM_SETTING(keyclick, &global_settings.keyclick, NULL); |
| 222 | MENUITEM_SETTING(keyclick_repeats, &global_settings.keyclick_repeats, NULL); |
| 223 | MAKE_MENU(keyclick_menu, ID2P(LANG_KEYCLICK), 0, Icon_NOICON, |
| 224 | &keyclick, &keyclick_repeats); |
| 225 | #endif |
| 226 | |
| 227 | |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 228 | #if CONFIG_CODEC == MAS3507D |
| 229 | void dac_line_in(bool enable); |
| 230 | static int linein_callback(int action,const struct menu_item_ex *this_item) |
| 231 | { |
| 232 | (void)this_item; |
| 233 | switch (action) |
| 234 | { |
| 235 | case ACTION_EXIT_MENUITEM: /* on exit */ |
| 236 | #ifndef SIMULATOR |
| 237 | dac_line_in(global_settings.line_in); |
| 238 | #endif |
| 239 | break; |
| 240 | } |
| 241 | return action; |
| 242 | } |
| 243 | MENUITEM_SETTING(line_in, &global_settings.line_in, linein_callback); |
| 244 | #endif |
Jonathan Gordon | 9a6f419 | 2007-02-18 05:32:06 +0000 | [diff] [blame] | 245 | #if CONFIG_CHARGING |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 246 | MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL); |
| 247 | #endif |
Michael Giacomelli | 70e9c7a | 2008-12-25 01:46:16 +0000 | [diff] [blame] | 248 | #ifdef IPOD_ACCESSORY_PROTOCOL |
| 249 | MENUITEM_SETTING(serial_bitrate, &global_settings.serial_bitrate, NULL); |
| 250 | #endif |
Andree Buschmann | 850a112 | 2008-04-20 18:28:25 +0000 | [diff] [blame] | 251 | #ifdef HAVE_ACCESSORY_SUPPLY |
| 252 | MENUITEM_SETTING(accessory_supply, &global_settings.accessory_supply, NULL); |
| 253 | #endif |
Jonathan Gordon | 91cb68a | 2007-03-01 11:14:46 +0000 | [diff] [blame] | 254 | MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL); |
Tomer Shalev | 8c5141b | 2009-09-30 10:06:04 +0000 | [diff] [blame] | 255 | #ifdef USB_ENABLE_HID |
Tomer Shalev | 83d24f8 | 2009-10-23 13:29:19 +0000 | [diff] [blame] | 256 | MENUITEM_SETTING(usb_hid, &global_settings.usb_hid, NULL); |
Tomer Shalev | 8c5141b | 2009-09-30 10:06:04 +0000 | [diff] [blame] | 257 | MENUITEM_SETTING(usb_keypad_mode, &global_settings.usb_keypad_mode, NULL); |
| 258 | #endif |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 259 | |
Teruaki Kawashima | 92fb1df | 2009-11-08 13:14:50 +0000 | [diff] [blame] | 260 | #ifdef HAVE_MORSE_INPUT |
| 261 | MENUITEM_SETTING(morse_input, &global_settings.morse_input, NULL); |
| 262 | #endif |
| 263 | |
Jonathan Gordon | 4b1d1b4 | 2007-04-22 13:02:24 +0000 | [diff] [blame] | 264 | #ifdef HAVE_BUTTON_LIGHT |
Jens Arnold | 5f1ec30 | 2007-10-07 15:02:02 +0000 | [diff] [blame] | 265 | MENUITEM_SETTING(buttonlight_timeout, &global_settings.buttonlight_timeout, NULL); |
Jonathan Gordon | 4b1d1b4 | 2007-04-22 13:02:24 +0000 | [diff] [blame] | 266 | #endif |
| 267 | |
Karl Kurbjun | 6f95ab7 | 2007-05-08 06:45:38 +0000 | [diff] [blame] | 268 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS |
| 269 | MENUITEM_SETTING(buttonlight_brightness, &global_settings.buttonlight_brightness, NULL); |
| 270 | #endif |
| 271 | |
Michael Sevakis | c541e04 | 2008-05-29 21:27:44 +0000 | [diff] [blame] | 272 | #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING |
| 273 | MENUITEM_SETTING(touchpad_sensitivity, &global_settings.touchpad_sensitivity, NULL); |
| 274 | #endif |
| 275 | |
Michael Giacomelli | e25f1f9 | 2008-12-25 03:23:22 +0000 | [diff] [blame] | 276 | MAKE_MENU(system_menu, ID2P(LANG_SYSTEM), |
Jonathan Gordon | 02a8717 | 2007-03-03 13:52:14 +0000 | [diff] [blame] | 277 | 0, Icon_System_menu, |
Jonathan Gordon | 91cb68a | 2007-03-01 11:14:46 +0000 | [diff] [blame] | 278 | &start_screen, |
Nils Wallménius | f28da1a | 2007-08-12 19:49:03 +0000 | [diff] [blame] | 279 | #if (BATTERY_CAPACITY_INC > 0) || (BATTERY_TYPES_COUNT > 1) |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 280 | &battery_menu, |
| 281 | #endif |
Frank Gevaerts | 4657301 | 2008-10-07 19:37:33 +0000 | [diff] [blame] | 282 | #if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE) |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 283 | &disk_menu, |
| 284 | #endif |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 285 | &poweroff, |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 286 | &limits_menu, |
Teruaki Kawashima | 92fb1df | 2009-11-08 13:14:50 +0000 | [diff] [blame] | 287 | #ifdef HAVE_MORSE_INPUT |
| 288 | &morse_input, |
| 289 | #endif |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 290 | #if CONFIG_CODEC == MAS3507D |
| 291 | &line_in, |
| 292 | #endif |
Jonathan Gordon | 9a6f419 | 2007-02-18 05:32:06 +0000 | [diff] [blame] | 293 | #if CONFIG_CHARGING |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 294 | &car_adapter_mode, |
| 295 | #endif |
Michael Giacomelli | e25f1f9 | 2008-12-25 03:23:22 +0000 | [diff] [blame] | 296 | #ifdef IPOD_ACCESSORY_PROTOCOL |
Teruaki Kawashima | 92fb1df | 2009-11-08 13:14:50 +0000 | [diff] [blame] | 297 | &serial_bitrate, |
Michael Giacomelli | 70e9c7a | 2008-12-25 01:46:16 +0000 | [diff] [blame] | 298 | #endif |
Andree Buschmann | 850a112 | 2008-04-20 18:28:25 +0000 | [diff] [blame] | 299 | #ifdef HAVE_ACCESSORY_SUPPLY |
| 300 | &accessory_supply, |
| 301 | #endif |
Jonathan Gordon | 4b1d1b4 | 2007-04-22 13:02:24 +0000 | [diff] [blame] | 302 | #ifdef HAVE_BUTTON_LIGHT |
Jens Arnold | 5f1ec30 | 2007-10-07 15:02:02 +0000 | [diff] [blame] | 303 | &buttonlight_timeout, |
Jonathan Gordon | 4b1d1b4 | 2007-04-22 13:02:24 +0000 | [diff] [blame] | 304 | #endif |
Karl Kurbjun | 6f95ab7 | 2007-05-08 06:45:38 +0000 | [diff] [blame] | 305 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS |
Steve Bavin | ea358a1 | 2008-01-21 09:48:44 +0000 | [diff] [blame] | 306 | &buttonlight_brightness, |
| 307 | #endif |
| 308 | #if CONFIG_CODEC == SWCODEC |
| 309 | &keyclick_menu, |
Karl Kurbjun | 6f95ab7 | 2007-05-08 06:45:38 +0000 | [diff] [blame] | 310 | #endif |
Michael Sevakis | c541e04 | 2008-05-29 21:27:44 +0000 | [diff] [blame] | 311 | #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING |
| 312 | &touchpad_sensitivity, |
| 313 | #endif |
Tomer Shalev | 8c5141b | 2009-09-30 10:06:04 +0000 | [diff] [blame] | 314 | #ifdef USB_ENABLE_HID |
Tomer Shalev | 83d24f8 | 2009-10-23 13:29:19 +0000 | [diff] [blame] | 315 | &usb_hid, |
Tomer Shalev | 8c5141b | 2009-09-30 10:06:04 +0000 | [diff] [blame] | 316 | &usb_keypad_mode, |
| 317 | #endif |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 318 | ); |
| 319 | |
| 320 | /* SYSTEM MENU */ |
| 321 | /***********************************/ |
| 322 | |
| 323 | |
| 324 | /***********************************/ |
| 325 | /* BOOKMARK MENU */ |
| 326 | static int bmark_callback(int action,const struct menu_item_ex *this_item) |
| 327 | { |
| 328 | (void)this_item; |
| 329 | switch (action) |
| 330 | { |
| 331 | case ACTION_EXIT_MENUITEM: /* on exit */ |
| 332 | if(global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_YES || |
| 333 | global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK) |
| 334 | { |
| 335 | if(global_settings.usemrb == BOOKMARK_NO) |
| 336 | global_settings.usemrb = BOOKMARK_YES; |
Michael Giacomelli | e25f1f9 | 2008-12-25 03:23:22 +0000 | [diff] [blame] | 337 | |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 338 | } |
| 339 | break; |
| 340 | } |
| 341 | return action; |
| 342 | } |
| 343 | MENUITEM_SETTING(autocreatebookmark, |
| 344 | &global_settings.autocreatebookmark, bmark_callback); |
| 345 | MENUITEM_SETTING(autoloadbookmark, &global_settings.autoloadbookmark, NULL); |
| 346 | MENUITEM_SETTING(usemrb, &global_settings.usemrb, NULL); |
| 347 | MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0, |
Jonathan Gordon | 02a8717 | 2007-03-03 13:52:14 +0000 | [diff] [blame] | 348 | Icon_Bookmark, |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 349 | &autocreatebookmark, &autoloadbookmark, &usemrb); |
| 350 | /* BOOKMARK MENU */ |
| 351 | /***********************************/ |
| 352 | |
| 353 | /***********************************/ |
| 354 | /* VOICE MENU */ |
| 355 | static int talk_callback(int action,const struct menu_item_ex *this_item); |
Steve Bavin | 6fd10ba | 2007-06-07 09:24:53 +0000 | [diff] [blame] | 356 | MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL); |
| 357 | MENUITEM_SETTING(talk_dir_item, &global_settings.talk_dir, NULL); |
| 358 | MENUITEM_SETTING(talk_dir_clip_item, &global_settings.talk_dir_clip, talk_callback); |
| 359 | MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, NULL); |
| 360 | MENUITEM_SETTING(talk_file_clip_item, &global_settings.talk_file_clip, talk_callback); |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 361 | static int talk_callback(int action,const struct menu_item_ex *this_item) |
| 362 | { |
| 363 | static int oldval = 0; |
| 364 | switch (action) |
| 365 | { |
| 366 | case ACTION_ENTER_MENUITEM: |
Steve Bavin | 6fd10ba | 2007-06-07 09:24:53 +0000 | [diff] [blame] | 367 | oldval = global_settings.talk_file_clip; |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 368 | break; |
| 369 | case ACTION_EXIT_MENUITEM: |
| 370 | #if CONFIG_CODEC == SWCODEC |
| 371 | audio_set_crossfade(global_settings.crossfade); |
| 372 | #endif |
Steve Bavin | 6fd10ba | 2007-06-07 09:24:53 +0000 | [diff] [blame] | 373 | if (this_item == &talk_dir_clip_item) |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 374 | break; |
Steve Bavin | 6fd10ba | 2007-06-07 09:24:53 +0000 | [diff] [blame] | 375 | if (!oldval && global_settings.talk_file_clip) |
Michael Giacomelli | e25f1f9 | 2008-12-25 03:23:22 +0000 | [diff] [blame] | 376 | { |
Steve Bavin | 6fd10ba | 2007-06-07 09:24:53 +0000 | [diff] [blame] | 377 | /* force reload if newly talking thumbnails, |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 378 | because the clip presence is cached only if enabled */ |
| 379 | reload_directory(); |
| 380 | } |
| 381 | break; |
| 382 | } |
| 383 | return action; |
| 384 | } |
Stéphane Doyon | a4f491c | 2007-11-07 03:25:33 +0000 | [diff] [blame] | 385 | MENUITEM_SETTING(talk_filetype_item, &global_settings.talk_filetype, NULL); |
Stéphane Doyon | da93299 | 2007-11-03 05:00:49 +0000 | [diff] [blame] | 386 | MENUITEM_SETTING(talk_battery_level_item, |
| 387 | &global_settings.talk_battery_level, NULL); |
Jonathan Gordon | 02a8717 | 2007-03-03 13:52:14 +0000 | [diff] [blame] | 388 | MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice, |
Michael Giacomelli | e25f1f9 | 2008-12-25 03:23:22 +0000 | [diff] [blame] | 389 | &talk_menu_item, &talk_dir_item, &talk_dir_clip_item, |
Stéphane Doyon | a4f491c | 2007-11-07 03:25:33 +0000 | [diff] [blame] | 390 | &talk_file_item, &talk_file_clip_item, &talk_filetype_item, |
Stéphane Doyon | da93299 | 2007-11-03 05:00:49 +0000 | [diff] [blame] | 391 | &talk_battery_level_item); |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 392 | /* VOICE MENU */ |
| 393 | /***********************************/ |
| 394 | |
Christian Gmeiner | 8181a0c | 2007-08-27 16:04:32 +0000 | [diff] [blame] | 395 | |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 396 | /***********************************/ |
| 397 | /* SETTINGS MENU */ |
| 398 | static int language_browse(void) |
| 399 | { |
| 400 | return (int)rockbox_browse(LANG_DIR, SHOW_LNG); |
| 401 | } |
Jonathan Gordon | daf6694 | 2007-03-17 12:33:34 +0000 | [diff] [blame] | 402 | MENUITEM_FUNCTION(browse_langs, 0, ID2P(LANG_LANGUAGE), language_browse, |
Jonathan Gordon | e54d8e1 | 2007-03-18 07:03:43 +0000 | [diff] [blame] | 403 | NULL, NULL, Icon_Language); |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 404 | |
| 405 | MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0, |
Jonathan Gordon | 02a8717 | 2007-03-03 13:52:14 +0000 | [diff] [blame] | 406 | Icon_General_settings_menu, |
Nils Wallménius | 5aa0665 | 2008-10-13 15:11:11 +0000 | [diff] [blame] | 407 | &playlist_settings, &file_menu, |
Marcoen Hirschberg | 44c510e | 2007-03-01 17:39:15 +0000 | [diff] [blame] | 408 | #ifdef HAVE_TAGCACHE |
| 409 | &tagcache_menu, |
| 410 | #endif |
Jonathan Gordon | 91cb68a | 2007-03-01 11:14:46 +0000 | [diff] [blame] | 411 | &display_menu, &system_menu, |
Christian Gmeiner | 8181a0c | 2007-08-27 16:04:32 +0000 | [diff] [blame] | 412 | &bookmark_settings_menu, &browse_langs, &voice_settings_menu |
Christian Gmeiner | 8181a0c | 2007-08-27 16:04:32 +0000 | [diff] [blame] | 413 | ); |
Jonathan Gordon | cd2d62c | 2007-02-13 07:50:47 +0000 | [diff] [blame] | 414 | /* SETTINGS MENU */ |
| 415 | /***********************************/ |