diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-04-12 15:28:51 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-04-12 15:28:51 +0000 |
commit | f9fb49284ef3c9ba03d33f3555f61ab5a1be9143 (patch) | |
tree | 20927fdcc20d78ad7a2bbb91fe465851c6fd3e89 /apps/root_menu.c | |
parent | 88c05bd3c1fc32a90bc092a9843311a262ad1334 (diff) | |
download | rockbox-f9fb49284ef3c9ba03d33f3555f61ab5a1be9143.tar.gz rockbox-f9fb49284ef3c9ba03d33f3555f61ab5a1be9143.zip |
Give most of the items in the main menu a context menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13126 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/root_menu.c')
-rw-r--r-- | apps/root_menu.c | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c index 606735f67c..d11714bd99 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -70,6 +70,7 @@ | |||
70 | struct root_items { | 70 | struct root_items { |
71 | int (*function)(void* param); | 71 | int (*function)(void* param); |
72 | void* param; | 72 | void* param; |
73 | const struct menu_item_ex *context_menu; | ||
73 | }; | 74 | }; |
74 | static int last_screen = GO_TO_ROOT; /* unfortunatly needed so we can resume | 75 | static int last_screen = GO_TO_ROOT; /* unfortunatly needed so we can resume |
75 | or goto current track based on previous | 76 | or goto current track based on previous |
@@ -250,23 +251,31 @@ static int load_bmarks(void* param) | |||
250 | bookmark_mrb_load(); | 251 | bookmark_mrb_load(); |
251 | return GO_TO_PREVIOUS; | 252 | return GO_TO_PREVIOUS; |
252 | } | 253 | } |
253 | 254 | /* These are all static const'd from apps/menus/ *.c | |
255 | so little hack so we can use them */ | ||
256 | extern struct menu_item_ex | ||
257 | file_menu, | ||
258 | tagcache_menu, | ||
259 | manage_settings, | ||
260 | recording_setting_menu, | ||
261 | bookmark_settings_menu, | ||
262 | system_menu; | ||
254 | static const struct root_items items[] = { | 263 | static const struct root_items items[] = { |
255 | [GO_TO_FILEBROWSER] = { browser, (void*)GO_TO_FILEBROWSER }, | 264 | [GO_TO_FILEBROWSER] = { browser, (void*)GO_TO_FILEBROWSER, &file_menu}, |
256 | [GO_TO_DBBROWSER] = { browser, (void*)GO_TO_DBBROWSER }, | 265 | [GO_TO_DBBROWSER] = { browser, (void*)GO_TO_DBBROWSER, &tagcache_menu }, |
257 | [GO_TO_WPS] = { wpsscrn, NULL }, | 266 | [GO_TO_WPS] = { wpsscrn, NULL, &playback_menu_item }, |
258 | [GO_TO_MAINMENU] = { menu, NULL }, | 267 | [GO_TO_MAINMENU] = { menu, NULL, &manage_settings }, |
259 | 268 | ||
260 | #ifdef HAVE_RECORDING | 269 | #ifdef HAVE_RECORDING |
261 | [GO_TO_RECSCREEN] = { recscrn, NULL }, | 270 | [GO_TO_RECSCREEN] = { recscrn, NULL, &recording_setting_menu }, |
262 | #endif | 271 | #endif |
263 | 272 | ||
264 | #if CONFIG_TUNER | 273 | #if CONFIG_TUNER |
265 | [GO_TO_FM] = { radio, NULL }, | 274 | [GO_TO_FM] = { radio, NULL, NULL }, |
266 | #endif | 275 | #endif |
267 | 276 | ||
268 | [GO_TO_RECENTBMARKS] = { load_bmarks, NULL }, | 277 | [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu }, |
269 | [GO_TO_BROWSEPLUGINS] = { browser, (void*)GO_TO_BROWSEPLUGINS }, | 278 | [GO_TO_BROWSEPLUGINS] = { browser, (void*)GO_TO_BROWSEPLUGINS, NULL }, |
270 | 279 | ||
271 | }; | 280 | }; |
272 | static const int nb_items = sizeof(items)/sizeof(*items); | 281 | static const int nb_items = sizeof(items)/sizeof(*items); |
@@ -392,7 +401,25 @@ static inline int load_screen(int screen) | |||
392 | last_screen = old_previous; | 401 | last_screen = old_previous; |
393 | return ret_val; | 402 | return ret_val; |
394 | } | 403 | } |
395 | 404 | static int load_context_screen(int selection) | |
405 | { | ||
406 | const struct menu_item_ex *context_menu = NULL; | ||
407 | if (root_menu__[selection]->flags&MT_RETURN_VALUE) | ||
408 | { | ||
409 | int item = root_menu__[selection]->value; | ||
410 | context_menu = items[item].context_menu; | ||
411 | } | ||
412 | /* special cases */ | ||
413 | else if (root_menu__[selection] == &info_menu) | ||
414 | { | ||
415 | context_menu = &system_menu; | ||
416 | } | ||
417 | |||
418 | if (context_menu) | ||
419 | return do_menu(context_menu, NULL); | ||
420 | else | ||
421 | return GO_TO_PREVIOUS; | ||
422 | } | ||
396 | void root_menu(void) | 423 | void root_menu(void) |
397 | { | 424 | { |
398 | int previous_browser = GO_TO_FILEBROWSER; | 425 | int previous_browser = GO_TO_FILEBROWSER; |
@@ -455,7 +482,9 @@ void root_menu(void) | |||
455 | case GO_TO_PREVIOUS_MUSIC: | 482 | case GO_TO_PREVIOUS_MUSIC: |
456 | next_screen = previous_music; | 483 | next_screen = previous_music; |
457 | break; | 484 | break; |
458 | 485 | case GO_TO_ROOTITEM_CONTEXT: | |
486 | next_screen = load_context_screen(selected); | ||
487 | break; | ||
459 | default: | 488 | default: |
460 | if (next_screen == GO_TO_FILEBROWSER | 489 | if (next_screen == GO_TO_FILEBROWSER |
461 | #ifdef HAVE_TAGCACHE | 490 | #ifdef HAVE_TAGCACHE |