diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-01-29 15:01:28 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-01-29 15:01:28 +0000 |
commit | 2bb81f70f5a0be8b8b0dc27aaf2d6d5e611686c4 (patch) | |
tree | add258b45e7ed447074e0d1b19b391fff7cc4725 /apps | |
parent | aa9a68a69011219f11d7e6a0fb89b7a51493759f (diff) | |
download | rockbox-2bb81f70f5a0be8b8b0dc27aaf2d6d5e611686c4.tar.gz rockbox-2bb81f70f5a0be8b8b0dc27aaf2d6d5e611686c4.zip |
Move fm radio related menus out of radio.c into apps/menus/.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29162 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SOURCES | 3 | ||||
-rw-r--r-- | apps/menus/exported_menus.h | 3 | ||||
-rw-r--r-- | apps/menus/radio_menu.c | 145 | ||||
-rw-r--r-- | apps/radio/radio.c | 152 | ||||
-rw-r--r-- | apps/root_menu.c | 3 |
5 files changed, 156 insertions, 150 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index 364faa3205..39b68ce6a6 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -16,6 +16,9 @@ menus/menu_common.c | |||
16 | menus/display_menu.c | 16 | menus/display_menu.c |
17 | menus/theme_menu.c | 17 | menus/theme_menu.c |
18 | menus/plugin_menu.c | 18 | menus/plugin_menu.c |
19 | #if CONFIG_TUNER | ||
20 | menus/radio_menu.c | ||
21 | #endif | ||
19 | #if CONFIG_CODEC == SWCODEC | 22 | #if CONFIG_CODEC == SWCODEC |
20 | #ifdef HAVE_WM8978 | 23 | #ifdef HAVE_WM8978 |
21 | menus/audiohw_eq_menu.c | 24 | menus/audiohw_eq_menu.c |
diff --git a/apps/menus/exported_menus.h b/apps/menus/exported_menus.h index 3d253e7dd9..568791b1f0 100644 --- a/apps/menus/exported_menus.h +++ b/apps/menus/exported_menus.h | |||
@@ -30,17 +30,20 @@ extern const struct menu_item_ex | |||
30 | playback_settings, /* playback_menu.c */ | 30 | playback_settings, /* playback_menu.c */ |
31 | #ifdef HAVE_RECORDING | 31 | #ifdef HAVE_RECORDING |
32 | recording_settings, /* recording_menu.c */ | 32 | recording_settings, /* recording_menu.c */ |
33 | recording_settings_menu, | ||
33 | #ifdef HAVE_LCD_BITMAP | 34 | #ifdef HAVE_LCD_BITMAP |
34 | peak_meter_menu, /* also used from within recording_menu */ | 35 | peak_meter_menu, /* also used from within recording_menu */ |
35 | #endif | 36 | #endif |
36 | #endif | 37 | #endif |
37 | sound_settings, /* sound_menu.c */ | 38 | sound_settings, /* sound_menu.c */ |
38 | settings_menu_item, /* settings_menu.c */ | 39 | settings_menu_item, /* settings_menu.c */ |
40 | bookmark_settings_menu, | ||
39 | playlist_settings, /* playlist_menu.c */ | 41 | playlist_settings, /* playlist_menu.c */ |
40 | equalizer_menu, /* eq_menu.c */ | 42 | equalizer_menu, /* eq_menu.c */ |
41 | #ifdef AUDIOHW_HAVE_EQ | 43 | #ifdef AUDIOHW_HAVE_EQ |
42 | audiohw_eq_tone_controls, /* audiohw_eq_menu.c */ | 44 | audiohw_eq_tone_controls, /* audiohw_eq_menu.c */ |
43 | #endif | 45 | #endif |
46 | radio_settings_menu, /* radio_menu.c */ | ||
44 | theme_menu; /* theme_menu.c */ | 47 | theme_menu; /* theme_menu.c */ |
45 | 48 | ||
46 | struct browse_folder_info { | 49 | struct browse_folder_info { |
diff --git a/apps/menus/radio_menu.c b/apps/menus/radio_menu.c new file mode 100644 index 0000000000..2a15fe8ee5 --- /dev/null +++ b/apps/menus/radio_menu.c | |||
@@ -0,0 +1,145 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2003 Linus Nielsen Feltzing | ||
11 | * | ||
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. | ||
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 <stdio.h> | ||
23 | #include "config.h" | ||
24 | #include "menu.h" | ||
25 | #include "icon.h" | ||
26 | #include "radio.h" | ||
27 | #include "lang.h" | ||
28 | #include "settings.h" | ||
29 | #include "presets.h" | ||
30 | #include "exported_menus.h" | ||
31 | #include "recording.h" /* recording_screen() */ | ||
32 | #include "sound_menu.h" /* recording_menu() */ | ||
33 | |||
34 | |||
35 | #if defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC | ||
36 | #define FM_RECORDING_SCREEN | ||
37 | static int fm_recording_screen(void) | ||
38 | { | ||
39 | bool ret; | ||
40 | |||
41 | /* switch recording source to FMRADIO for the duration */ | ||
42 | int rec_source = global_settings.rec_source; | ||
43 | global_settings.rec_source = AUDIO_SRC_FMRADIO; | ||
44 | ret = recording_screen(true); | ||
45 | |||
46 | /* safe to reset as changing sources is prohibited here */ | ||
47 | global_settings.rec_source = rec_source; | ||
48 | |||
49 | return ret; | ||
50 | } | ||
51 | |||
52 | MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING), | ||
53 | fm_recording_screen, NULL, NULL, Icon_Recording); | ||
54 | #endif /* defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC */ | ||
55 | |||
56 | #if defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC | ||
57 | #define FM_RECORDING_SETTINGS | ||
58 | static int fm_recording_settings(void) | ||
59 | { | ||
60 | bool ret = recording_menu(true); | ||
61 | |||
62 | #if CONFIG_CODEC != SWCODEC | ||
63 | if (!ret) | ||
64 | { | ||
65 | struct audio_recording_options rec_options; | ||
66 | rec_init_recording_options(&rec_options); | ||
67 | rec_options.rec_source = AUDIO_SRC_LINEIN; | ||
68 | rec_set_recording_options(&rec_options); | ||
69 | } | ||
70 | #endif | ||
71 | |||
72 | return ret; | ||
73 | } | ||
74 | |||
75 | MENUITEM_FUNCTION(recsettings_item, 0, ID2P(LANG_RECORDING_SETTINGS), | ||
76 | fm_recording_settings, NULL, NULL, Icon_Recording); | ||
77 | #endif /* defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC */ | ||
78 | |||
79 | #ifndef FM_PRESET | ||
80 | MENUITEM_FUNCTION(radio_presets_item, 0, ID2P(LANG_PRESET), | ||
81 | handle_radio_presets, NULL, NULL, Icon_NOICON); | ||
82 | #endif | ||
83 | #ifndef FM_PRESET_ADD | ||
84 | MENUITEM_FUNCTION(radio_addpreset_item, 0, ID2P(LANG_FM_ADD_PRESET), | ||
85 | handle_radio_add_preset, NULL, NULL, Icon_NOICON); | ||
86 | #endif | ||
87 | |||
88 | MENUITEM_FUNCTION(presetload_item, 0, ID2P(LANG_FM_PRESET_LOAD), | ||
89 | preset_list_load, NULL, NULL, Icon_NOICON); | ||
90 | MENUITEM_FUNCTION(presetsave_item, 0, ID2P(LANG_FM_PRESET_SAVE), | ||
91 | preset_list_save, NULL, NULL, Icon_NOICON); | ||
92 | MENUITEM_FUNCTION(presetclear_item, 0, ID2P(LANG_FM_PRESET_CLEAR), | ||
93 | preset_list_clear, NULL, NULL, Icon_NOICON); | ||
94 | |||
95 | MENUITEM_SETTING(set_region, &global_settings.fm_region, NULL); | ||
96 | MENUITEM_SETTING(force_mono, &global_settings.fm_force_mono, NULL); | ||
97 | |||
98 | #ifndef FM_MODE | ||
99 | extern int radio_mode; | ||
100 | static char* get_mode_text(int selected_item, void * data, char *buffer) | ||
101 | { | ||
102 | (void)selected_item; | ||
103 | (void)data; | ||
104 | snprintf(buffer, MAX_PATH, "%s %s", str(LANG_MODE), | ||
105 | radio_mode ? str(LANG_PRESET) : | ||
106 | str(LANG_RADIO_SCAN_MODE)); | ||
107 | return buffer; | ||
108 | } | ||
109 | static int toggle_radio_mode(void) | ||
110 | { | ||
111 | radio_mode = (radio_mode == RADIO_SCAN_MODE) ? | ||
112 | RADIO_PRESET_MODE : RADIO_SCAN_MODE; | ||
113 | return 0; | ||
114 | } | ||
115 | MENUITEM_FUNCTION_DYNTEXT(radio_mode_item, 0, | ||
116 | toggle_radio_mode, NULL, | ||
117 | get_mode_text, NULL, NULL, NULL, Icon_NOICON); | ||
118 | #endif | ||
119 | |||
120 | MENUITEM_FUNCTION(scan_presets_item, MENU_FUNC_USEPARAM, | ||
121 | ID2P(LANG_FM_SCAN_PRESETS), | ||
122 | presets_scan, NULL, NULL, Icon_NOICON); | ||
123 | |||
124 | MAKE_MENU(radio_settings_menu, ID2P(LANG_FM_MENU), NULL, | ||
125 | Icon_Radio_screen, | ||
126 | #ifndef FM_PRESET | ||
127 | &radio_presets_item, | ||
128 | #endif | ||
129 | #ifndef FM_PRESET_ADD | ||
130 | &radio_addpreset_item, | ||
131 | #endif | ||
132 | &presetload_item, &presetsave_item, &presetclear_item, | ||
133 | &force_mono, | ||
134 | #ifndef FM_MODE | ||
135 | &radio_mode_item, | ||
136 | #endif | ||
137 | &set_region, &sound_settings, | ||
138 | #ifdef FM_RECORDING_SCREEN | ||
139 | &recscreen_item, | ||
140 | #endif | ||
141 | #ifdef FM_RECORDING_SETTINGS | ||
142 | &recsettings_item, | ||
143 | #endif | ||
144 | &scan_presets_item); | ||
145 | |||
diff --git a/apps/radio/radio.c b/apps/radio/radio.c index 7cc676b9a4..d1a94ac295 100644 --- a/apps/radio/radio.c +++ b/apps/radio/radio.c | |||
@@ -19,38 +19,28 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "config.h" | ||
23 | #include <stdio.h> | 22 | #include <stdio.h> |
24 | #include <stdbool.h> | 23 | #include <stdbool.h> |
25 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | #include "config.h" | ||
26 | #include "system.h" | ||
26 | #include "settings.h" | 27 | #include "settings.h" |
27 | #include "button.h" | ||
28 | #include "status.h" | 28 | #include "status.h" |
29 | #include "thread.h" | ||
30 | #include "audio.h" | 29 | #include "audio.h" |
31 | #include "mp3_playback.h" | ||
32 | #include "ctype.h" | ||
33 | #include "file.h" | ||
34 | #include "general.h" | 30 | #include "general.h" |
35 | #include "errno.h" | ||
36 | #include "string-extra.h" | ||
37 | #include "system.h" | ||
38 | #include "radio.h" | 31 | #include "radio.h" |
39 | #include "menu.h" | 32 | #include "menu.h" |
33 | #include "menus/exported_menus.h" | ||
40 | #include "misc.h" | 34 | #include "misc.h" |
41 | #include "keyboard.h" | ||
42 | #include "screens.h" | 35 | #include "screens.h" |
43 | #include "peakmeter.h" | 36 | #include "peakmeter.h" |
44 | #include "lang.h" | 37 | #include "lang.h" |
45 | #include "font.h" | ||
46 | #include "sound_menu.h" | ||
47 | #ifdef HAVE_RECORDING | 38 | #ifdef HAVE_RECORDING |
48 | #include "recording.h" | 39 | #include "recording.h" |
49 | #endif | 40 | #endif |
50 | #ifdef IPOD_ACCESSORY_PROTOCOL | 41 | #ifdef IPOD_ACCESSORY_PROTOCOL |
51 | #include "iap.h" | 42 | #include "iap.h" |
52 | #endif | 43 | #endif |
53 | #include "appevents.h" | ||
54 | #include "talk.h" | 44 | #include "talk.h" |
55 | #include "tuner.h" | 45 | #include "tuner.h" |
56 | #include "power.h" | 46 | #include "power.h" |
@@ -58,17 +48,12 @@ | |||
58 | #include "screen_access.h" | 48 | #include "screen_access.h" |
59 | #include "splash.h" | 49 | #include "splash.h" |
60 | #include "yesno.h" | 50 | #include "yesno.h" |
61 | #include "buttonbar.h" | ||
62 | #include "tree.h" | 51 | #include "tree.h" |
63 | #include "dir.h" | 52 | #include "dir.h" |
64 | #include "action.h" | 53 | #include "action.h" |
65 | #include "list.h" | ||
66 | #include "menus/exported_menus.h" | ||
67 | #include "root_menu.h" | ||
68 | #include "viewport.h" | 54 | #include "viewport.h" |
69 | #include "skin_engine/skin_engine.h" | 55 | #include "skin_engine/skin_engine.h" |
70 | #include "statusbar-skinned.h" | 56 | #include "statusbar-skinned.h" |
71 | #include "buffering.h" | ||
72 | #if CONFIG_CODEC == SWCODEC | 57 | #if CONFIG_CODEC == SWCODEC |
73 | #include "playback.h" | 58 | #include "playback.h" |
74 | #endif | 59 | #endif |
@@ -146,12 +131,9 @@ | |||
146 | 131 | ||
147 | /* presets.c needs these so keep unstatic or redo the whole thing! */ | 132 | /* presets.c needs these so keep unstatic or redo the whole thing! */ |
148 | int curr_freq; /* current frequency in Hz */ | 133 | int curr_freq; /* current frequency in Hz */ |
149 | |||
150 | static bool radio_menu(void); | ||
151 | |||
152 | int radio_mode = RADIO_SCAN_MODE; | 134 | int radio_mode = RADIO_SCAN_MODE; |
153 | static int search_dir = 0; | ||
154 | 135 | ||
136 | static int search_dir = 0; | ||
155 | static int radio_status = FMRADIO_OFF; | 137 | static int radio_status = FMRADIO_OFF; |
156 | static bool in_screen = false; | 138 | static bool in_screen = false; |
157 | 139 | ||
@@ -642,7 +624,7 @@ void radio_screen(void) | |||
642 | 624 | ||
643 | case ACTION_FM_MENU: | 625 | case ACTION_FM_MENU: |
644 | fms_fix_displays(FMS_EXIT); | 626 | fms_fix_displays(FMS_EXIT); |
645 | radio_menu(); | 627 | do_menu(&radio_settings_menu, NULL, NULL, false); |
646 | preset_set_current(preset_find(curr_freq)); | 628 | preset_set_current(preset_find(curr_freq)); |
647 | fms_fix_displays(FMS_ENTER); | 629 | fms_fix_displays(FMS_ENTER); |
648 | update_type = SKIN_REFRESH_ALL; | 630 | update_type = SKIN_REFRESH_ALL; |
@@ -902,128 +884,4 @@ void set_radio_region(int region) | |||
902 | (void)region; | 884 | (void)region; |
903 | } | 885 | } |
904 | 886 | ||
905 | MENUITEM_SETTING(set_region, &global_settings.fm_region, NULL); | ||
906 | MENUITEM_SETTING(force_mono, &global_settings.fm_force_mono, NULL); | ||
907 | |||
908 | #ifndef FM_MODE | ||
909 | static char* get_mode_text(int selected_item, void * data, char *buffer) | ||
910 | { | ||
911 | (void)selected_item; | ||
912 | (void)data; | ||
913 | snprintf(buffer, MAX_PATH, "%s %s", str(LANG_MODE), | ||
914 | radio_mode ? str(LANG_PRESET) : | ||
915 | str(LANG_RADIO_SCAN_MODE)); | ||
916 | return buffer; | ||
917 | } | ||
918 | static int toggle_radio_mode(void) | ||
919 | { | ||
920 | radio_mode = (radio_mode == RADIO_SCAN_MODE) ? | ||
921 | RADIO_PRESET_MODE : RADIO_SCAN_MODE; | ||
922 | return 0; | ||
923 | } | ||
924 | MENUITEM_FUNCTION_DYNTEXT(radio_mode_item, 0, | ||
925 | toggle_radio_mode, NULL, | ||
926 | get_mode_text, NULL, NULL, NULL, Icon_NOICON); | ||
927 | #endif | ||
928 | |||
929 | |||
930 | |||
931 | #ifdef HAVE_RECORDING | ||
932 | |||
933 | #if defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC | ||
934 | #define FM_RECORDING_SCREEN | ||
935 | static int fm_recording_screen(void) | ||
936 | { | ||
937 | bool ret; | ||
938 | |||
939 | /* switch recording source to FMRADIO for the duration */ | ||
940 | int rec_source = global_settings.rec_source; | ||
941 | global_settings.rec_source = AUDIO_SRC_FMRADIO; | ||
942 | ret = recording_screen(true); | ||
943 | |||
944 | /* safe to reset as changing sources is prohibited here */ | ||
945 | global_settings.rec_source = rec_source; | ||
946 | |||
947 | return ret; | ||
948 | } | ||
949 | |||
950 | #endif /* defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC */ | ||
951 | |||
952 | #if defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC | ||
953 | #define FM_RECORDING_SETTINGS | ||
954 | static int fm_recording_settings(void) | ||
955 | { | ||
956 | bool ret = recording_menu(true); | ||
957 | |||
958 | #if CONFIG_CODEC != SWCODEC | ||
959 | if (!ret) | ||
960 | { | ||
961 | struct audio_recording_options rec_options; | ||
962 | rec_init_recording_options(&rec_options); | ||
963 | rec_options.rec_source = AUDIO_SRC_LINEIN; | ||
964 | rec_set_recording_options(&rec_options); | ||
965 | } | ||
966 | #endif | ||
967 | |||
968 | return ret; | ||
969 | } | ||
970 | |||
971 | #endif /* defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC */ | ||
972 | #endif /* HAVE_RECORDING */ | ||
973 | |||
974 | #ifdef FM_RECORDING_SCREEN | ||
975 | MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING), | ||
976 | fm_recording_screen, NULL, NULL, Icon_Recording); | ||
977 | #endif | ||
978 | #ifdef FM_RECORDING_SETTINGS | ||
979 | MENUITEM_FUNCTION(recsettings_item, 0, ID2P(LANG_RECORDING_SETTINGS), | ||
980 | fm_recording_settings, NULL, NULL, Icon_Recording); | ||
981 | #endif | ||
982 | #ifndef FM_PRESET | ||
983 | MENUITEM_FUNCTION(radio_presets_item, 0, ID2P(LANG_PRESET), | ||
984 | handle_radio_presets, NULL, NULL, Icon_NOICON); | ||
985 | #endif | ||
986 | #ifndef FM_PRESET_ADD | ||
987 | MENUITEM_FUNCTION(radio_addpreset_item, 0, ID2P(LANG_FM_ADD_PRESET), | ||
988 | handle_radio_add_preset, NULL, NULL, Icon_NOICON); | ||
989 | #endif | ||
990 | |||
991 | MENUITEM_FUNCTION(presetload_item, 0, ID2P(LANG_FM_PRESET_LOAD), | ||
992 | preset_list_load, NULL, NULL, Icon_NOICON); | ||
993 | MENUITEM_FUNCTION(presetsave_item, 0, ID2P(LANG_FM_PRESET_SAVE), | ||
994 | preset_list_save, NULL, NULL, Icon_NOICON); | ||
995 | MENUITEM_FUNCTION(presetclear_item, 0, ID2P(LANG_FM_PRESET_CLEAR), | ||
996 | preset_list_clear, NULL, NULL, Icon_NOICON); | ||
997 | MENUITEM_FUNCTION(scan_presets_item, MENU_FUNC_USEPARAM, | ||
998 | ID2P(LANG_FM_SCAN_PRESETS), | ||
999 | presets_scan, NULL, NULL, Icon_NOICON); | ||
1000 | |||
1001 | MAKE_MENU(radio_settings_menu, ID2P(LANG_FM_MENU), NULL, | ||
1002 | Icon_Radio_screen, | ||
1003 | #ifndef FM_PRESET | ||
1004 | &radio_presets_item, | ||
1005 | #endif | ||
1006 | #ifndef FM_PRESET_ADD | ||
1007 | &radio_addpreset_item, | ||
1008 | #endif | ||
1009 | &presetload_item, &presetsave_item, &presetclear_item, | ||
1010 | &force_mono, | ||
1011 | #ifndef FM_MODE | ||
1012 | &radio_mode_item, | ||
1013 | #endif | ||
1014 | &set_region, &sound_settings, | ||
1015 | #ifdef FM_RECORDING_SCREEN | ||
1016 | &recscreen_item, | ||
1017 | #endif | ||
1018 | #ifdef FM_RECORDING_SETTINGS | ||
1019 | &recsettings_item, | ||
1020 | #endif | ||
1021 | &scan_presets_item); | ||
1022 | /* main menu of the radio screen */ | ||
1023 | static bool radio_menu(void) | ||
1024 | { | ||
1025 | return do_menu(&radio_settings_menu, NULL, NULL, false) == | ||
1026 | MENU_ATTACHED_USB; | ||
1027 | } | ||
1028 | |||
1029 | #endif | 887 | #endif |
diff --git a/apps/root_menu.c b/apps/root_menu.c index 79b7afffe8..7d2c800e61 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -363,9 +363,6 @@ extern struct menu_item_ex | |||
363 | #endif | 363 | #endif |
364 | main_menu_, | 364 | main_menu_, |
365 | manage_settings, | 365 | manage_settings, |
366 | recording_settings_menu, | ||
367 | radio_settings_menu, | ||
368 | bookmark_settings_menu, | ||
369 | plugin_menu, | 366 | plugin_menu, |
370 | playlist_options, | 367 | playlist_options, |
371 | info_menu, | 368 | info_menu, |