summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ferrare <kevin@rockbox.org>2005-11-03 11:56:21 +0000
committerKevin Ferrare <kevin@rockbox.org>2005-11-03 11:56:21 +0000
commitc43822d1027db7a12f37c822d77e6fe644fab0de (patch)
tree5a7d0c06b4172fe2ab7eb2e28c536a78935e02e5
parente4ca732722fb0725ff3d35f20252d571a4228261 (diff)
downloadrockbox-c43822d1027db7a12f37c822d77e6fe644fab0de.tar.gz
rockbox-c43822d1027db7a12f37c822d77e6fe644fab0de.zip
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
-rw-r--r--apps/menu.c39
-rw-r--r--apps/menu.h1
2 files changed, 22 insertions, 18 deletions
diff --git a/apps/menu.c b/apps/menu.c
index 90a3c89d75..83826e33f9 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -125,9 +125,9 @@ int menu_show(int m)
125 int key; 125 int key;
126 126
127 gui_synclist_draw(&(menus[m].synclist)); 127 gui_synclist_draw(&(menus[m].synclist));
128 menu_talk_selected(m);
128 while (!exit) { 129 while (!exit) {
129 key = button_get_w_tmo(HZ/2); 130 key = button_get_w_tmo(HZ/2);
130
131 /* 131 /*
132 * "short-circuit" the default keypresses by running the 132 * "short-circuit" the default keypresses by running the
133 * callback function 133 * callback function
@@ -137,17 +137,9 @@ int menu_show(int m)
137 */ 137 */
138 if( menus[m].callback != NULL ) 138 if( menus[m].callback != NULL )
139 key = menus[m].callback(key, m); 139 key = menus[m].callback(key, m);
140 /* If moved, "say" the entry under the cursor */
140 if(gui_synclist_do_button(&(menus[m].synclist), key)) 141 if(gui_synclist_do_button(&(menus[m].synclist), key))
141 { 142 menu_talk_selected(m);
142 /* If moved, "say" the entry under the cursor */
143 if(global_settings.talk_menu)
144 {
145 int selected=gui_synclist_get_sel_pos(&(menus[m].synclist));
146 int voice_id = P2ID(menus[m].items[selected].desc);
147 if (voice_id >= 0) /* valid ID given? */
148 talk_id(voice_id, false); /* say it */
149 }
150 }
151 switch( key ) { 143 switch( key ) {
152 case MENU_ENTER: 144 case MENU_ENTER:
153#ifdef MENU_ENTER2 145#ifdef MENU_ENTER2
@@ -265,7 +257,7 @@ void menu_insert(int menu, int position, char *desc, bool (*function) (void))
265} 257}
266 258
267/* 259/*
268 * Property function - return the "count" of menu items in "menu" 260 * Property function - return the "count" of menu items in "menu"
269 */ 261 */
270 262
271int menu_count(int menu) 263int menu_count(int menu)
@@ -309,7 +301,7 @@ bool menu_movedown(int menu)
309 if( selected == nb_items - 1) 301 if( selected == nb_items - 1)
310 return false; 302 return false;
311 303
312 /* use a temporary variable to do the swap */ 304 /* use a temporary variable to do the swap */
313 swap = menus[menu].items[selected + 1]; 305 swap = menus[menu].items[selected + 1];
314 menus[menu].items[selected + 1] = menus[menu].items[selected]; 306 menus[menu].items[selected + 1] = menus[menu].items[selected];
315 menus[menu].items[selected] = swap; 307 menus[menu].items[selected] = swap;
@@ -327,6 +319,22 @@ void menu_set_cursor(int menu, int position)
327 gui_synclist_select_item(&(menus[menu].synclist), position); 319 gui_synclist_select_item(&(menus[menu].synclist), position);
328} 320}
329 321
322void menu_talk_selected(int m)
323{
324 if(global_settings.talk_menu)
325 {
326 int selected=gui_synclist_get_sel_pos(&(menus[m].synclist));
327 int voice_id = P2ID(menus[m].items[selected].desc);
328 if (voice_id >= 0) /* valid ID given? */
329 talk_id(voice_id, false); /* say it */
330 }
331}
332
333void menu_draw(int m)
334{
335 gui_synclist_draw(&(menus[m].synclist));
336}
337
330/* count in letter positions, NOT pixels */ 338/* count in letter positions, NOT pixels */
331void put_cursorxy(int x, int y, bool on) 339void put_cursorxy(int x, int y, bool on)
332{ 340{
@@ -364,8 +372,3 @@ void put_cursorxy(int x, int y, bool on)
364#endif 372#endif
365 } 373 }
366} 374}
367
368void menu_draw(int m)
369{
370 gui_synclist_draw(&(menus[m].synclist));
371}
diff --git a/apps/menu.h b/apps/menu.h
index 08cd70fcda..c163e35ccc 100644
--- a/apps/menu.h
+++ b/apps/menu.h
@@ -96,5 +96,6 @@ bool menu_movedown(int menu);
96void menu_draw(int menu); 96void menu_draw(int menu);
97void menu_insert(int menu, int position, char *desc, bool (*function) (void)); 97void menu_insert(int menu, int position, char *desc, bool (*function) (void));
98void menu_set_cursor(int menu, int position); 98void menu_set_cursor(int menu, int position);
99void menu_talk_selected(int m);
99 100
100#endif /* End __MENU_H__ */ 101#endif /* End __MENU_H__ */