diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-07-23 23:01:20 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-07-23 23:01:20 +0000 |
commit | b1403ee024f81ced657261441571ee5e8bab71ce (patch) | |
tree | 3a7e1651d37bd35e801a331416654760cb61a075 /apps/main_menu.c | |
parent | 15d04fdb00e7f94aef49cf9a70e73c5a46e21536 (diff) | |
download | rockbox-b1403ee024f81ced657261441571ee5e8bab71ce.tar.gz rockbox-b1403ee024f81ced657261441571ee5e8bab71ce.zip |
New way of defining menus and options allows to declare them static const, which saves the code to runtime-assemble them. Rockbox just got 6 KB smaller.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4931 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/main_menu.c')
-rw-r--r-- | apps/main_menu.c | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/apps/main_menu.c b/apps/main_menu.c index cdf8c575e3..462d10df0d 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -278,9 +278,9 @@ bool rec_menu(void) | |||
278 | bool result; | 278 | bool result; |
279 | 279 | ||
280 | /* recording menu */ | 280 | /* recording menu */ |
281 | struct menu_item items[] = { | 281 | static const struct menu_item items[] = { |
282 | { STR(LANG_RECORDING_MENU), recording_screen }, | 282 | { ID2P(LANG_RECORDING_MENU), recording_screen }, |
283 | { STR(LANG_RECORDING_SETTINGS), recording_settings}, | 283 | { ID2P(LANG_RECORDING_SETTINGS), recording_settings}, |
284 | }; | 284 | }; |
285 | 285 | ||
286 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 286 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -298,14 +298,14 @@ bool info_menu(void) | |||
298 | bool result; | 298 | bool result; |
299 | 299 | ||
300 | /* info menu */ | 300 | /* info menu */ |
301 | struct menu_item items[] = { | 301 | static const struct menu_item items[] = { |
302 | { STR(LANG_MENU_SHOW_ID3_INFO), browse_id3 }, | 302 | { ID2P(LANG_MENU_SHOW_ID3_INFO), browse_id3 }, |
303 | { STR(LANG_INFO_MENU), show_info }, | 303 | { ID2P(LANG_INFO_MENU), show_info }, |
304 | { STR(LANG_VERSION), show_credits }, | 304 | { ID2P(LANG_VERSION), show_credits }, |
305 | #ifndef SIMULATOR | 305 | #ifndef SIMULATOR |
306 | { STR(LANG_DEBUG), debug_menu }, | 306 | { ID2P(LANG_DEBUG), debug_menu }, |
307 | #else | 307 | #else |
308 | { STR(LANG_USB), simulate_usb }, | 308 | { ID2P(LANG_USB), simulate_usb }, |
309 | #endif | 309 | #endif |
310 | }; | 310 | }; |
311 | 311 | ||
@@ -326,42 +326,34 @@ bool main_menu(void) | |||
326 | /* main menu */ | 326 | /* main menu */ |
327 | struct menu_item items[8]; | 327 | struct menu_item items[8]; |
328 | 328 | ||
329 | items[i].desc = str(LANG_BOOKMARK_MENU); | 329 | items[i].desc = ID2P(LANG_BOOKMARK_MENU); |
330 | items[i].voice_id = LANG_BOOKMARK_MENU; | ||
331 | items[i++].function = bookmark_menu; | 330 | items[i++].function = bookmark_menu; |
332 | 331 | ||
333 | items[i].desc = str(LANG_SOUND_SETTINGS); | 332 | items[i].desc = ID2P(LANG_SOUND_SETTINGS); |
334 | items[i].voice_id = LANG_SOUND_SETTINGS; | ||
335 | items[i++].function = sound_menu; | 333 | items[i++].function = sound_menu; |
336 | 334 | ||
337 | items[i].desc = str(LANG_GENERAL_SETTINGS); | 335 | items[i].desc = ID2P(LANG_GENERAL_SETTINGS); |
338 | items[i].voice_id = LANG_GENERAL_SETTINGS; | ||
339 | items[i++].function = settings_menu; | 336 | items[i++].function = settings_menu; |
340 | 337 | ||
341 | #ifdef HAVE_FMRADIO | 338 | #ifdef HAVE_FMRADIO |
342 | if(radio_hardware_present()) { | 339 | if(radio_hardware_present()) { |
343 | items[i].desc = str(LANG_FM_RADIO); | 340 | items[i].desc = ID2P(LANG_FM_RADIO); |
344 | items[i].voice_id = LANG_FM_RADIO; | ||
345 | items[i++].function = radio_screen; | 341 | items[i++].function = radio_screen; |
346 | } | 342 | } |
347 | #endif | 343 | #endif |
348 | 344 | ||
349 | #ifdef HAVE_MAS3587F | 345 | #ifdef HAVE_MAS3587F |
350 | items[i].desc = str(LANG_RECORDING); | 346 | items[i].desc = ID2P(LANG_RECORDING); |
351 | items[i].voice_id = LANG_RECORDING; | ||
352 | items[i++].function = rec_menu; | 347 | items[i++].function = rec_menu; |
353 | #endif | 348 | #endif |
354 | 349 | ||
355 | items[i].desc = str(LANG_PLAYLIST_MENU); | 350 | items[i].desc = ID2P(LANG_PLAYLIST_MENU); |
356 | items[i].voice_id = LANG_PLAYLIST_MENU; | ||
357 | items[i++].function = playlist_menu; | 351 | items[i++].function = playlist_menu; |
358 | 352 | ||
359 | items[i].desc = str(LANG_PLUGINS); | 353 | items[i].desc = ID2P(LANG_PLUGINS); |
360 | items[i].voice_id = LANG_PLUGINS; | ||
361 | items[i++].function = plugin_browse; | 354 | items[i++].function = plugin_browse; |
362 | 355 | ||
363 | items[i].desc = str(LANG_INFO); | 356 | items[i].desc = ID2P(LANG_INFO); |
364 | items[i].voice_id = LANG_INFO; | ||
365 | items[i++].function = info_menu; | 357 | items[i++].function = info_menu; |
366 | 358 | ||
367 | m=menu_init( items, i, NULL, NULL, NULL, NULL ); | 359 | m=menu_init( items, i, NULL, NULL, NULL, NULL ); |