mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
do_menu pass internal synclist reference to callback
keep running into the rigid nature of do_menu it isn't too bad when you don't need voice but once you do the fun awaits do_menu likes to talk on menu enter which is in a loop when you use do_menu I would like to move the processing to the callback TOO BAD you only get an action and the menu_item_ex struct you sent it when calling the function Change-Id: Iaefd0cc133435d675b7dd27a558c504d6ccb327a
This commit is contained in:
parent
4663d94b4e
commit
c39f95465b
39 changed files with 343 additions and 110 deletions
20
apps/menu.c
20
apps/menu.c
|
@ -192,7 +192,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
|
|||
if (menu_callback)
|
||||
{
|
||||
if (menu_callback(ACTION_REQUEST_MENUITEM,
|
||||
type==MT_RETURN_ID ? (void*)(intptr_t)i: menu->submenus[i])
|
||||
type==MT_RETURN_ID ? (void*)(intptr_t)i: menu->submenus[i], lists)
|
||||
!= ACTION_EXIT_MENUITEM)
|
||||
{
|
||||
current_subitems[current_subitems_count] = i;
|
||||
|
@ -246,7 +246,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
|
|||
|
||||
get_menu_callback(menu,&menu_callback);
|
||||
if (callback && menu_callback)
|
||||
menu_callback(ACTION_ENTER_MENUITEM,menu);
|
||||
menu_callback(ACTION_ENTER_MENUITEM, menu, lists);
|
||||
}
|
||||
|
||||
static int talk_menu_item(int selected_item, void *data)
|
||||
|
@ -430,7 +430,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
if (menu_callback)
|
||||
{
|
||||
int old_action = action;
|
||||
action = menu_callback(action, menu);
|
||||
action = menu_callback(action, menu, &lists);
|
||||
if (action == ACTION_EXIT_AFTER_THIS_MENUITEM)
|
||||
{
|
||||
action = old_action;
|
||||
|
@ -560,7 +560,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
/* might be leaving list, so stop scrolling */
|
||||
gui_synclist_scroll_stop(&lists);
|
||||
if (menu_callback)
|
||||
menu_callback(ACTION_EXIT_MENUITEM, menu);
|
||||
menu_callback(ACTION_EXIT_MENUITEM, menu, &lists);
|
||||
|
||||
if (menu->flags&MENU_EXITAFTERTHISMENU)
|
||||
done = true;
|
||||
|
@ -612,7 +612,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
get_menu_callback(temp, &menu_callback);
|
||||
if (menu_callback)
|
||||
{
|
||||
action = menu_callback(ACTION_ENTER_MENUITEM,temp);
|
||||
action = menu_callback(ACTION_ENTER_MENUITEM, temp, &lists);
|
||||
if (action == ACTION_EXIT_MENUITEM)
|
||||
break;
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
if (type != MT_MENU)
|
||||
{
|
||||
if (menu_callback)
|
||||
menu_callback(ACTION_EXIT_MENUITEM,temp);
|
||||
menu_callback(ACTION_EXIT_MENUITEM, temp, &lists);
|
||||
}
|
||||
if (current_submenus_menu != menu)
|
||||
init_menu_lists(menu,&lists,selected,true,vps);
|
||||
|
@ -730,9 +730,11 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
if (redraw_lists && !done)
|
||||
{
|
||||
if (menu_callback)
|
||||
menu_callback(ACTION_REDRAW, menu);
|
||||
gui_synclist_draw(&lists);
|
||||
gui_synclist_speak_item(&lists);
|
||||
if (menu_callback(ACTION_REDRAW, menu, &lists) == ACTION_REDRAW)
|
||||
{
|
||||
gui_synclist_draw(&lists);
|
||||
gui_synclist_speak_item(&lists);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue