Add platform file for Iaudio M5.
[Rockbox.git] / apps / main_menu.c
blobec139466cb322f6e4f3bf7b9b01fe3adadf6337b
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 Björn Stenberg
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 ****************************************************************************/
19 #include <timefuncs.h>
20 #include "config.h"
21 #include "options.h"
23 #include "menu.h"
24 #include "tree.h"
25 #include "lcd.h"
26 #include "font.h"
27 #include "action.h"
28 #include "kernel.h"
29 #include "main_menu.h"
30 #include "debug_menu.h"
31 #include "sprintf.h"
32 #include <string.h>
33 #include "settings.h"
34 #include "settings_menu.h"
35 #include "power.h"
36 #include "powermgmt.h"
37 #include "sound_menu.h"
38 #include "status.h"
39 #include "fat.h"
40 #include "bookmark.h"
41 #include "buffer.h"
42 #include "screens.h"
43 #include "playlist_menu.h"
44 #include "talk.h"
45 #if CONFIG_TUNER
46 #include "radio.h"
47 #endif
48 #include "misc.h"
49 #include "lang.h"
50 #include "logfdisp.h"
51 #include "plugin.h"
52 #include "filetypes.h"
53 #include "splash.h"
55 #ifdef HAVE_RECORDING
56 #include "recording.h"
57 #endif
59 #ifdef HAVE_RECORDING
61 static bool rec_menu_recording_screen(void)
63 return recording_screen(false);
66 static bool recording_settings(void)
68 bool ret;
69 #ifdef HAVE_FMRADIO_IN
70 int rec_source = global_settings.rec_source;
71 #endif
73 ret = recording_menu(false);
75 #ifdef HAVE_FMRADIO_IN
76 if (rec_source != global_settings.rec_source)
78 if (rec_source == AUDIO_SRC_FMRADIO)
79 radio_stop();
80 /* If AUDIO_SRC_FMRADIO was selected from something else,
81 the recording screen will start the radio */
83 #endif
85 return ret;
88 bool rec_menu(void)
90 int m;
91 bool result;
93 /* recording menu */
94 static const struct menu_item items[] = {
95 { ID2P(LANG_RECORDING_MENU), rec_menu_recording_screen },
96 { ID2P(LANG_RECORDING_SETTINGS), recording_settings},
99 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
100 NULL, NULL, NULL);
101 result = menu_run(m);
102 menu_exit(m);
104 return result;
106 #endif
109 #if 0
110 #ifdef HAVE_LCD_CHARCELLS
111 static bool do_shutdown(void)
113 sys_poweroff();
114 return false;
116 #endif
117 bool main_menu(void)
119 int m;
120 bool result;
121 int i = 0;
122 static bool inside_menu = false;
125 /* main menu */
126 struct menu_item items[11];
128 if(inside_menu) return false;
129 inside_menu = true;
131 items[i].desc = ID2P(LANG_SOUND_SETTINGS);
132 items[i++].function = sound_menu;
134 items[i].desc = ID2P(LANG_GENERAL_SETTINGS);
135 items[i++].function = settings_menu;
137 items[i].desc = ID2P(LANG_MANAGE_MENU);
138 items[i++].function = manage_settings_menu;
140 items[i].desc = ID2P(LANG_CUSTOM_THEME);
141 items[i++].function = custom_theme_browse;
143 #if CONFIG_TUNER
144 if(radio_hardware_present()) {
145 items[i].desc = ID2P(LANG_FM_RADIO);
146 items[i++].function = radio_screen;
148 #endif
150 #ifdef HAVE_RECORDING
151 items[i].desc = ID2P(LANG_RECORDING);
152 items[i++].function = rec_menu;
153 #endif
155 items[i].desc = ID2P(LANG_PLAYLIST_MENU);
156 items[i++].function = playlist_menu;
158 items[i].desc = ID2P(LANG_PLUGINS);
159 items[i++].function = plugin_browse;
161 items[i].desc = ID2P(LANG_INFO);
162 items[i++].function = info_menu;
164 #ifdef HAVE_LCD_CHARCELLS
165 items[i].desc = ID2P(LANG_SHUTDOWN);
166 items[i++].function = do_shutdown;
167 #endif
169 m=menu_init( items, i, NULL, NULL, NULL, NULL );
170 #ifdef HAVE_LCD_CHARCELLS
171 status_set_param(true);
172 #endif
173 result = menu_run(m);
174 #ifdef HAVE_LCD_CHARCELLS
175 status_set_param(false);
176 #endif
177 menu_exit(m);
179 inside_menu = false;
181 return result;
183 #endif
184 /* -----------------------------------------------------------------
185 * vim: et sw=4 ts=8 sts=4 tw=78