forked from len0rd/rockbox
FS#12251 - User shortcuts in the main menu.
Custom shortcuts which give the user fast access to regularly used files/folders/settings/whatever. Thanks to Alexander Levin for the manual part of the patch git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30990 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e7e4b131d0
commit
101693fd30
17 changed files with 628 additions and 22 deletions
|
|
@ -25,6 +25,7 @@
|
|||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include "lcd.h"
|
||||
#include "lang.h"
|
||||
#include "menu.h"
|
||||
#include "debug_menu.h"
|
||||
#include "kernel.h"
|
||||
|
|
@ -45,6 +46,7 @@
|
|||
#include "screens.h"
|
||||
#include "misc.h"
|
||||
#include "splash.h"
|
||||
#include "shortcuts.h"
|
||||
#include "dircache.h"
|
||||
#include "viewport.h"
|
||||
#ifdef HAVE_TAGCACHE
|
||||
|
|
@ -2120,15 +2122,23 @@ static const struct the_menu_item menuitems[] = {
|
|||
};
|
||||
static int menu_action_callback(int btn, struct gui_synclist *lists)
|
||||
{
|
||||
int selection = gui_synclist_get_sel_pos(lists);
|
||||
if (btn == ACTION_STD_OK)
|
||||
{
|
||||
FOR_NB_SCREENS(i)
|
||||
viewportmanager_theme_enable(i, false, NULL);
|
||||
menuitems[gui_synclist_get_sel_pos(lists)].function();
|
||||
menuitems[selection].function();
|
||||
btn = ACTION_REDRAW;
|
||||
FOR_NB_SCREENS(i)
|
||||
viewportmanager_theme_undo(i, false);
|
||||
}
|
||||
else if (btn == ACTION_STD_CONTEXT)
|
||||
{
|
||||
MENUITEM_STRINGLIST(menu_items, "Debug Menu", NULL, ID2P(LANG_ADD_TO_FAVES));
|
||||
if (do_menu(&menu_items, NULL, NULL, false) == 0)
|
||||
shortcuts_add(SHORTCUT_DEBUGITEM, menuitems[selection].desc);
|
||||
return ACTION_STD_CANCEL;
|
||||
}
|
||||
return btn;
|
||||
}
|
||||
|
||||
|
|
@ -2148,3 +2158,22 @@ bool debug_menu(void)
|
|||
info.get_name = dbg_menu_getname;
|
||||
return simplelist_show_list(&info);
|
||||
}
|
||||
|
||||
bool run_debug_screen(char* screen)
|
||||
{
|
||||
unsigned i;
|
||||
for (i=0; i<ARRAYLEN(menuitems); i++)
|
||||
{
|
||||
if (!strcmp(screen, menuitems[i].desc))
|
||||
{
|
||||
FOR_NB_SCREENS(j)
|
||||
viewportmanager_theme_enable(j, false, NULL);
|
||||
menuitems[i].function();
|
||||
FOR_NB_SCREENS(j)
|
||||
viewportmanager_theme_undo(j, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue