summaryrefslogtreecommitdiff
path: root/apps/menu.c
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2004-03-14 21:33:53 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2004-03-14 21:33:53 +0000
commit4f36ea8fbf877e8af938c0bb16591f3c6cffd4f8 (patch)
treec0dbd4a148a54c8c2851d95149ed6d4e91053bd6 /apps/menu.c
parent62b095d02972ac8c6fb63ab0a38d1fa0c483b85b (diff)
downloadrockbox-4f36ea8fbf877e8af938c0bb16591f3c6cffd4f8.tar.gz
rockbox-4f36ea8fbf877e8af938c0bb16591f3c6cffd4f8.zip
First step of the voice-UI: the menus can talk. You need a "voicefont" file in .rockbox to use this.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4381 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menu.c')
-rw-r--r--apps/menu.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/menu.c b/apps/menu.c
index f187b5d82b..f9443548f6 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -32,6 +32,7 @@
32#include "settings.h" 32#include "settings.h"
33#include "status.h" 33#include "status.h"
34#include "screens.h" 34#include "screens.h"
35#include "talk.h"
35 36
36#ifdef HAVE_LCD_BITMAP 37#ifdef HAVE_LCD_BITMAP
37#include "icons.h" 38#include "icons.h"
@@ -216,6 +217,13 @@ static void put_cursor(int m, int target)
216 lcd_update(); 217 lcd_update();
217 } 218 }
218 219
220 if (do_update)
221 { /* "say" the entry under the cursor */
222 int voice_id = menus[m].items[menus[m].cursor].voice_id;
223 if (voice_id >= 0) /* valid ID given? */
224 talk_id(voice_id, false); /* say it */
225 }
226
219} 227}
220 228
221int menu_init(struct menu_items* mitems, int count, int (*callback)(int, int)) 229int menu_init(struct menu_items* mitems, int count, int (*callback)(int, int))
@@ -250,6 +258,7 @@ int menu_show(int m)
250{ 258{
251 bool exit = false; 259 bool exit = false;
252 int key; 260 int key;
261 int voice_id;
253#ifdef HAVE_LCD_BITMAP 262#ifdef HAVE_LCD_BITMAP
254 int fw, fh; 263 int fw, fh;
255 int menu_lines; 264 int menu_lines;
@@ -263,9 +272,16 @@ int menu_show(int m)
263 272
264 menu_draw(m); 273 menu_draw(m);
265 274
275 /* say current entry */
276 voice_id = menus[m].items[menus[m].cursor].voice_id;
277 if (voice_id >= 0) /* valid ID given? */
278 talk_id(voice_id, false); /* say it */
279
266 while (!exit) { 280 while (!exit) {
267 key = button_get_w_tmo(HZ/2); 281 key = button_get_w_tmo(HZ/2);
282
268 283
284
269 /* 285 /*
270 * "short-circuit" the default keypresses by running the callback function 286 * "short-circuit" the default keypresses by running the callback function
271 */ 287 */
@@ -274,6 +290,7 @@ int menu_show(int m)
274 key = menus[m].callback(key, m); /* make sure there's no match in the switch */ 290 key = menus[m].callback(key, m); /* make sure there's no match in the switch */
275 291
276 switch( key ) { 292 switch( key ) {
293
277#ifdef HAVE_RECORDER_KEYPAD 294#ifdef HAVE_RECORDER_KEYPAD
278 case BUTTON_UP: 295 case BUTTON_UP:
279 case BUTTON_UP | BUTTON_REPEAT: 296 case BUTTON_UP | BUTTON_REPEAT: