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
This commit is contained in:
Kevin Ferrare 2005-11-03 11:56:21 +00:00
parent e4ca732722
commit c43822d102
2 changed files with 22 additions and 18 deletions

View file

@ -125,9 +125,9 @@ int menu_show(int m)
int key; int key;
gui_synclist_draw(&(menus[m].synclist)); gui_synclist_draw(&(menus[m].synclist));
menu_talk_selected(m);
while (!exit) { while (!exit) {
key = button_get_w_tmo(HZ/2); key = button_get_w_tmo(HZ/2);
/* /*
* "short-circuit" the default keypresses by running the * "short-circuit" the default keypresses by running the
* callback function * callback function
@ -137,17 +137,9 @@ int menu_show(int m)
*/ */
if( menus[m].callback != NULL ) if( menus[m].callback != NULL )
key = menus[m].callback(key, m); key = menus[m].callback(key, m);
if(gui_synclist_do_button(&(menus[m].synclist), key))
{
/* If moved, "say" the entry under the cursor */ /* If moved, "say" the entry under the cursor */
if(global_settings.talk_menu) if(gui_synclist_do_button(&(menus[m].synclist), key))
{ menu_talk_selected(m);
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 */
}
}
switch( key ) { switch( key ) {
case MENU_ENTER: case MENU_ENTER:
#ifdef MENU_ENTER2 #ifdef MENU_ENTER2
@ -327,6 +319,22 @@ void menu_set_cursor(int menu, int position)
gui_synclist_select_item(&(menus[menu].synclist), 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 */ /* count in letter positions, NOT pixels */
void put_cursorxy(int x, int y, bool on) void put_cursorxy(int x, int y, bool on)
{ {
@ -364,8 +372,3 @@ void put_cursorxy(int x, int y, bool on)
#endif #endif
} }
} }
void menu_draw(int m)
{
gui_synclist_draw(&(menus[m].synclist));
}

View file

@ -96,5 +96,6 @@ bool menu_movedown(int menu);
void menu_draw(int menu); void menu_draw(int menu);
void menu_insert(int menu, int position, char *desc, bool (*function) (void)); void menu_insert(int menu, int position, char *desc, bool (*function) (void));
void menu_set_cursor(int menu, int position); void menu_set_cursor(int menu, int position);
void menu_talk_selected(int m);
#endif /* End __MENU_H__ */ #endif /* End __MENU_H__ */