diff options
| author | Kevin Ferrare <kevin@rockbox.org> | 2005-11-03 11:56:21 +0000 |
|---|---|---|
| committer | Kevin Ferrare <kevin@rockbox.org> | 2005-11-03 11:56:21 +0000 |
| commit | c43822d1027db7a12f37c822d77e6fe644fab0de (patch) | |
| tree | 5a7d0c06b4172fe2ab7eb2e28c536a78935e02e5 /apps | |
| parent | e4ca732722fb0725ff3d35f20252d571a4228261 (diff) | |
| download | rockbox-c43822d1027db7a12f37c822d77e6fe644fab0de.zip rockbox-c43822d1027db7a12f37c822d77e6fe644fab0de.tar.gz rockbox-c43822d1027db7a12f37c822d77e6fe644fab0de.tar.bz2 rockbox-c43822d1027db7a12f37c822d77e6fe644fab0de.tar.xz | |
Fixed a bug whith the multi-screen menus : when entering / leaving a menu, the selected item was not voiced
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7739 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/menu.c | 39 | ||||
| -rw-r--r-- | apps/menu.h | 1 |
2 files changed, 22 insertions, 18 deletions
diff --git a/apps/menu.c b/apps/menu.c index 90a3c89..83826e3 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -125,9 +125,9 @@ int menu_show(int m) int key; gui_synclist_draw(&(menus[m].synclist)); + menu_talk_selected(m); while (!exit) { key = button_get_w_tmo(HZ/2); - /* * "short-circuit" the default keypresses by running the * callback function @@ -137,17 +137,9 @@ int menu_show(int m) */ if( menus[m].callback != NULL ) key = menus[m].callback(key, m); + /* If moved, "say" the entry under the cursor */ if(gui_synclist_do_button(&(menus[m].synclist), key)) - { - /* If moved, "say" the entry under the cursor */ - if(global_settings.talk_menu) - { - int selected=gui_synclist_get_sel_pos(&(menus[m].synclist)); - int voice_id = P2ID(menus[m].items[selected].desc); - if (voice_id >= 0) /* valid ID given? */ - talk_id(voice_id, false); /* say it */ - } - } + menu_talk_selected(m); switch( key ) { case MENU_ENTER: #ifdef MENU_ENTER2 @@ -265,7 +257,7 @@ void menu_insert(int menu, int position, char *desc, bool (*function) (void)) } /* - * Property function - return the "count" of menu items in "menu" + * Property function - return the "count" of menu items in "menu" */ int menu_count(int menu) @@ -309,7 +301,7 @@ bool menu_movedown(int menu) if( selected == nb_items - 1) return false; - /* use a temporary variable to do the swap */ + /* use a temporary variable to do the swap */ swap = menus[menu].items[selected + 1]; menus[menu].items[selected + 1] = menus[menu].items[selected]; menus[menu].items[selected] = swap; @@ -327,6 +319,22 @@ void menu_set_cursor(int menu, int position) gui_synclist_select_item(&(menus[menu].synclist), position); } +void menu_talk_selected(int m) +{ + if(global_settings.talk_menu) + { + int selected=gui_synclist_get_sel_pos(&(menus[m].synclist)); + int voice_id = P2ID(menus[m].items[selected].desc); + if (voice_id >= 0) /* valid ID given? */ + talk_id(voice_id, false); /* say it */ + } +} + +void menu_draw(int m) +{ + gui_synclist_draw(&(menus[m].synclist)); +} + /* count in letter positions, NOT pixels */ void put_cursorxy(int x, int y, bool on) { @@ -364,8 +372,3 @@ void put_cursorxy(int x, int y, bool on) #endif } } - -void menu_draw(int m) -{ - gui_synclist_draw(&(menus[m].synclist)); -} diff --git a/apps/menu.h b/apps/menu.h index 08cd70f..c163e35 100644 --- a/apps/menu.h +++ b/apps/menu.h @@ -96,5 +96,6 @@ bool menu_movedown(int menu); void menu_draw(int menu); void menu_insert(int menu, int position, char *desc, bool (*function) (void)); void menu_set_cursor(int menu, int position); +void menu_talk_selected(int m); #endif /* End __MENU_H__ */ |