From 5cd393c772ce6d9f8f7eff5dc97b007b8249d9f6 Mon Sep 17 00:00:00 2001 From: Kjell Ericson Date: Wed, 29 Jan 2003 08:26:11 +0000 Subject: New onplay-menu for the Player. The menu_run() function is split into two functions, where the new menu_run() works like before, and the new function menu_show() returns the menu item number you selected. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3180 a1c6a512-1295-4272-9138-f99709370657 --- apps/menu.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'apps/menu.c') diff --git a/apps/menu.c b/apps/menu.c index 9cedbebed8..4f15b4b8ae 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -231,7 +231,7 @@ void menu_exit(int m) inuse[m] = false; } -bool menu_run(int m) +int menu_show(int m) { bool exit = false; @@ -289,17 +289,7 @@ bool menu_run(int m) case BUTTON_PLAY: /* Erase current display state */ lcd_clear_display(); - - /* if a child returns that USB was used, - we return immediately */ - if (menus[m].items[menus[m].cursor].function()) { - lcd_stop_scroll(); /* just in case */ - return true; - } - - /* Return to previous display state */ - menu_draw(m); - break; + return menus[m].cursor; #ifdef HAVE_RECORDER_KEYPAD case BUTTON_LEFT: @@ -331,11 +321,27 @@ bool menu_run(int m) #ifdef HAVE_LCD_CHARCELLS status_set_param(false); #endif - return true; + return MENU_ATTACHED_USB; } status_draw(); } + return MENU_SELECTED_EXIT; +} + - return false; +bool menu_run(int m) +{ + bool stop=false; + while (!stop) { + int result=menu_show(m); + if (result == MENU_SELECTED_EXIT) + return false; + else if (result == MENU_ATTACHED_USB) + return true; + if (menus[m].items[menus[m].cursor].function()) { + return true; + } + } + return false; } -- cgit v1.2.3