summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-04-12 15:28:51 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-04-12 15:28:51 +0000
commitf9fb49284ef3c9ba03d33f3555f61ab5a1be9143 (patch)
tree20927fdcc20d78ad7a2bbb91fe465851c6fd3e89 /apps
parent88c05bd3c1fc32a90bc092a9843311a262ad1334 (diff)
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')
-rw-r--r--apps/menu.c6
-rw-r--r--apps/root_menu.c51
-rw-r--r--apps/root_menu.h1
3 files changed, 47 insertions, 11 deletions
diff --git a/apps/menu.c b/apps/menu.c
index 6340185e07..ecbf3ddb4c 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -477,6 +477,12 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
{
list_stop_handler();
}
+ else if (action == ACTION_STD_CONTEXT &&
+ menu == &root_menu_)
+ {
+ ret = GO_TO_ROOTITEM_CONTEXT;
+ done = true;
+ }
else if (action == ACTION_STD_MENU)
{
if ((menu->flags&MENU_TYPE_MASK) == MT_OLD_MENU)
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 @@
struct root_items {
int (*function)(void* param);
void* param;
+ const struct menu_item_ex *context_menu;
};
static int last_screen = GO_TO_ROOT; /* unfortunatly needed so we can resume
or goto current track based on previous
@@ -250,23 +251,31 @@ static int load_bmarks(void* param)
bookmark_mrb_load();
return GO_TO_PREVIOUS;
}
-
+/* These are all static const'd from apps/menus/ *.c
+ so little hack so we can use them */
+extern struct menu_item_ex
+ file_menu,
+ tagcache_menu,
+ manage_settings,
+ recording_setting_menu,
+ bookmark_settings_menu,
+ system_menu;
static const struct root_items items[] = {
- [GO_TO_FILEBROWSER] = { browser, (void*)GO_TO_FILEBROWSER },
- [GO_TO_DBBROWSER] = { browser, (void*)GO_TO_DBBROWSER },
- [GO_TO_WPS] = { wpsscrn, NULL },
- [GO_TO_MAINMENU] = { menu, NULL },
+ [GO_TO_FILEBROWSER] = { browser, (void*)GO_TO_FILEBROWSER, &file_menu},
+ [GO_TO_DBBROWSER] = { browser, (void*)GO_TO_DBBROWSER, &tagcache_menu },
+ [GO_TO_WPS] = { wpsscrn, NULL, &playback_menu_item },
+ [GO_TO_MAINMENU] = { menu, NULL, &manage_settings },
#ifdef HAVE_RECORDING
- [GO_TO_RECSCREEN] = { recscrn, NULL },
+ [GO_TO_RECSCREEN] = { recscrn, NULL, &recording_setting_menu },
#endif
#if CONFIG_TUNER
- [GO_TO_FM] = { radio, NULL },
+ [GO_TO_FM] = { radio, NULL, NULL },
#endif
- [GO_TO_RECENTBMARKS] = { load_bmarks, NULL },
- [GO_TO_BROWSEPLUGINS] = { browser, (void*)GO_TO_BROWSEPLUGINS },
+ [GO_TO_RECENTBMARKS] = { load_bmarks, NULL, &bookmark_settings_menu },
+ [GO_TO_BROWSEPLUGINS] = { browser, (void*)GO_TO_BROWSEPLUGINS, NULL },
};
static const int nb_items = sizeof(items)/sizeof(*items);
@@ -392,7 +401,25 @@ static inline int load_screen(int screen)
last_screen = old_previous;
return ret_val;
}
-
+static int load_context_screen(int selection)
+{
+ const struct menu_item_ex *context_menu = NULL;
+ if (root_menu__[selection]->flags&MT_RETURN_VALUE)
+ {
+ int item = root_menu__[selection]->value;
+ context_menu = items[item].context_menu;
+ }
+ /* special cases */
+ else if (root_menu__[selection] == &info_menu)
+ {
+ context_menu = &system_menu;
+ }
+
+ if (context_menu)
+ return do_menu(context_menu, NULL);
+ else
+ return GO_TO_PREVIOUS;
+}
void root_menu(void)
{
int previous_browser = GO_TO_FILEBROWSER;
@@ -455,7 +482,9 @@ void root_menu(void)
case GO_TO_PREVIOUS_MUSIC:
next_screen = previous_music;
break;
-
+ case GO_TO_ROOTITEM_CONTEXT:
+ next_screen = load_context_screen(selected);
+ break;
default:
if (next_screen == GO_TO_FILEBROWSER
#ifdef HAVE_TAGCACHE
diff --git a/apps/root_menu.h b/apps/root_menu.h
index ee82357103..0e189f84fc 100644
--- a/apps/root_menu.h
+++ b/apps/root_menu.h
@@ -27,6 +27,7 @@ enum {
MENU_ATTACHED_USB = -10,
MENU_SELECTED_EXIT = -9,
+ GO_TO_ROOTITEM_CONTEXT = -5,
GO_TO_PREVIOUS_MUSIC = -4,
GO_TO_PREVIOUS_BROWSER = -3,
GO_TO_PREVIOUS = -2,