diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-07-19 13:42:04 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2020-07-19 22:10:26 +0000 |
commit | c39f95465b9844f70f375f1690e0bf75c7ee7cc1 (patch) | |
tree | 2fda6bd805a74f41dd4303c7699eabb9e1aa4a1c /apps/menu.c | |
parent | 4663d94b4e4edec609b6a24581ee345f2a1bedaa (diff) | |
download | rockbox-c39f95465b9844f70f375f1690e0bf75c7ee7cc1.tar.gz rockbox-c39f95465b9844f70f375f1690e0bf75c7ee7cc1.zip |
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
Diffstat (limited to 'apps/menu.c')
-rw-r--r-- | apps/menu.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/apps/menu.c b/apps/menu.c index 929a14e9f0..5a388522fa 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -192,7 +192,7 @@ static void init_menu_lists(const struct menu_item_ex *menu, | |||
192 | if (menu_callback) | 192 | if (menu_callback) |
193 | { | 193 | { |
194 | if (menu_callback(ACTION_REQUEST_MENUITEM, | 194 | if (menu_callback(ACTION_REQUEST_MENUITEM, |
195 | type==MT_RETURN_ID ? (void*)(intptr_t)i: menu->submenus[i]) | 195 | type==MT_RETURN_ID ? (void*)(intptr_t)i: menu->submenus[i], lists) |
196 | != ACTION_EXIT_MENUITEM) | 196 | != ACTION_EXIT_MENUITEM) |
197 | { | 197 | { |
198 | current_subitems[current_subitems_count] = i; | 198 | current_subitems[current_subitems_count] = i; |
@@ -246,7 +246,7 @@ static void init_menu_lists(const struct menu_item_ex *menu, | |||
246 | 246 | ||
247 | get_menu_callback(menu,&menu_callback); | 247 | get_menu_callback(menu,&menu_callback); |
248 | if (callback && menu_callback) | 248 | if (callback && menu_callback) |
249 | menu_callback(ACTION_ENTER_MENUITEM,menu); | 249 | menu_callback(ACTION_ENTER_MENUITEM, menu, lists); |
250 | } | 250 | } |
251 | 251 | ||
252 | static int talk_menu_item(int selected_item, void *data) | 252 | 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, | |||
430 | if (menu_callback) | 430 | if (menu_callback) |
431 | { | 431 | { |
432 | int old_action = action; | 432 | int old_action = action; |
433 | action = menu_callback(action, menu); | 433 | action = menu_callback(action, menu, &lists); |
434 | if (action == ACTION_EXIT_AFTER_THIS_MENUITEM) | 434 | if (action == ACTION_EXIT_AFTER_THIS_MENUITEM) |
435 | { | 435 | { |
436 | action = old_action; | 436 | action = old_action; |
@@ -560,7 +560,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
560 | /* might be leaving list, so stop scrolling */ | 560 | /* might be leaving list, so stop scrolling */ |
561 | gui_synclist_scroll_stop(&lists); | 561 | gui_synclist_scroll_stop(&lists); |
562 | if (menu_callback) | 562 | if (menu_callback) |
563 | menu_callback(ACTION_EXIT_MENUITEM, menu); | 563 | menu_callback(ACTION_EXIT_MENUITEM, menu, &lists); |
564 | 564 | ||
565 | if (menu->flags&MENU_EXITAFTERTHISMENU) | 565 | if (menu->flags&MENU_EXITAFTERTHISMENU) |
566 | done = true; | 566 | done = true; |
@@ -612,7 +612,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
612 | get_menu_callback(temp, &menu_callback); | 612 | get_menu_callback(temp, &menu_callback); |
613 | if (menu_callback) | 613 | if (menu_callback) |
614 | { | 614 | { |
615 | action = menu_callback(ACTION_ENTER_MENUITEM,temp); | 615 | action = menu_callback(ACTION_ENTER_MENUITEM, temp, &lists); |
616 | if (action == ACTION_EXIT_MENUITEM) | 616 | if (action == ACTION_EXIT_MENUITEM) |
617 | break; | 617 | break; |
618 | } | 618 | } |
@@ -688,7 +688,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
688 | if (type != MT_MENU) | 688 | if (type != MT_MENU) |
689 | { | 689 | { |
690 | if (menu_callback) | 690 | if (menu_callback) |
691 | menu_callback(ACTION_EXIT_MENUITEM,temp); | 691 | menu_callback(ACTION_EXIT_MENUITEM, temp, &lists); |
692 | } | 692 | } |
693 | if (current_submenus_menu != menu) | 693 | if (current_submenus_menu != menu) |
694 | init_menu_lists(menu,&lists,selected,true,vps); | 694 | 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, | |||
730 | if (redraw_lists && !done) | 730 | if (redraw_lists && !done) |
731 | { | 731 | { |
732 | if (menu_callback) | 732 | if (menu_callback) |
733 | menu_callback(ACTION_REDRAW, menu); | 733 | if (menu_callback(ACTION_REDRAW, menu, &lists) == ACTION_REDRAW) |
734 | gui_synclist_draw(&lists); | 734 | { |
735 | gui_synclist_speak_item(&lists); | 735 | gui_synclist_draw(&lists); |
736 | gui_synclist_speak_item(&lists); | ||
737 | } | ||
736 | } | 738 | } |
737 | } | 739 | } |
738 | 740 | ||