diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-05-21 06:29:55 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-05-21 06:29:55 +0000 |
commit | 9e0495711aa8bdc6d8413e447c984e178bbbceae (patch) | |
tree | 15e8abbf1e72558fd6bcd08d8a3309632bda9058 /apps/recorder/keyboard.c | |
parent | 4c67f0f3bbc3507c2cb06090d86c874a9d7f662d (diff) | |
download | rockbox-9e0495711aa8bdc6d8413e447c984e178bbbceae.tar.gz rockbox-9e0495711aa8bdc6d8413e447c984e178bbbceae.zip |
voice in keyboard, inspired by Christopher Moore
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4657 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/keyboard.c')
-rw-r--r-- | apps/recorder/keyboard.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index b39a3aeec8..32a1d8b735 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include "font.h" | 26 | #include "font.h" |
27 | #include "screens.h" | 27 | #include "screens.h" |
28 | #include "status.h" | 28 | #include "status.h" |
29 | #include "talk.h" | ||
30 | #include "settings.h" | ||
29 | 31 | ||
30 | #define KEYBOARD_LINES 4 | 32 | #define KEYBOARD_LINES 4 |
31 | #define KEYBOARD_PAGES 3 | 33 | #define KEYBOARD_PAGES 3 |
@@ -56,6 +58,20 @@ static void kbd_setupkeys(char* line[KEYBOARD_LINES], int page) | |||
56 | } | 58 | } |
57 | } | 59 | } |
58 | 60 | ||
61 | /* helper function to spell a char if voice UI is enabled */ | ||
62 | void kbd_spellchar(char c) | ||
63 | { | ||
64 | char spell_char[2]; /* store char to pass to talk_spell */ | ||
65 | |||
66 | if (global_settings.talk_menu) /* voice UI? */ | ||
67 | { | ||
68 | spell_char[0] = c; | ||
69 | spell_char[1] = '\0'; /* mark end of char string */ | ||
70 | |||
71 | talk_spell(spell_char, false); | ||
72 | } | ||
73 | } | ||
74 | |||
59 | int kbd_input(char* text, int buflen) | 75 | int kbd_input(char* text, int buflen) |
60 | { | 76 | { |
61 | bool done = false; | 77 | bool done = false; |
@@ -89,6 +105,9 @@ int kbd_input(char* text, int buflen) | |||
89 | max_chars = LCD_WIDTH / font_w; | 105 | max_chars = LCD_WIDTH / font_w; |
90 | kbd_setupkeys(line, page); | 106 | kbd_setupkeys(line, page); |
91 | 107 | ||
108 | if (global_settings.talk_menu) /* voice UI? */ | ||
109 | talk_spell(text, true); /* spell initial text */ | ||
110 | |||
92 | while(!done) | 111 | while(!done) |
93 | { | 112 | { |
94 | len = strlen(text); | 113 | len = strlen(text); |
@@ -188,6 +207,7 @@ int kbd_input(char* text, int buflen) | |||
188 | if (++page == KEYBOARD_PAGES) | 207 | if (++page == KEYBOARD_PAGES) |
189 | page = 0; | 208 | page = 0; |
190 | kbd_setupkeys(line, page); | 209 | kbd_setupkeys(line, page); |
210 | kbd_spellchar(line[y][x]); | ||
191 | break; | 211 | break; |
192 | 212 | ||
193 | case BUTTON_RIGHT: | 213 | case BUTTON_RIGHT: |
@@ -196,6 +216,7 @@ int kbd_input(char* text, int buflen) | |||
196 | x++; | 216 | x++; |
197 | else | 217 | else |
198 | x = 0; | 218 | x = 0; |
219 | kbd_spellchar(line[y][x]); | ||
199 | break; | 220 | break; |
200 | 221 | ||
201 | case BUTTON_LEFT: | 222 | case BUTTON_LEFT: |
@@ -204,6 +225,7 @@ int kbd_input(char* text, int buflen) | |||
204 | x--; | 225 | x--; |
205 | else | 226 | else |
206 | x = strlen(line[y]) - 1; | 227 | x = strlen(line[y]) - 1; |
228 | kbd_spellchar(line[y][x]); | ||
207 | break; | 229 | break; |
208 | 230 | ||
209 | case BUTTON_DOWN: | 231 | case BUTTON_DOWN: |
@@ -212,6 +234,7 @@ int kbd_input(char* text, int buflen) | |||
212 | y++; | 234 | y++; |
213 | else | 235 | else |
214 | y=0; | 236 | y=0; |
237 | kbd_spellchar(line[y][x]); | ||
215 | break; | 238 | break; |
216 | 239 | ||
217 | case BUTTON_UP: | 240 | case BUTTON_UP: |
@@ -220,6 +243,7 @@ int kbd_input(char* text, int buflen) | |||
220 | y--; | 243 | y--; |
221 | else | 244 | else |
222 | y = KEYBOARD_LINES - 1; | 245 | y = KEYBOARD_LINES - 1; |
246 | kbd_spellchar(line[y][x]); | ||
223 | break; | 247 | break; |
224 | 248 | ||
225 | case BUTTON_F3: | 249 | case BUTTON_F3: |
@@ -261,6 +285,8 @@ int kbd_input(char* text, int buflen) | |||
261 | } | 285 | } |
262 | editpos++; | 286 | editpos++; |
263 | } | 287 | } |
288 | if (global_settings.talk_menu) /* voice UI? */ | ||
289 | talk_spell(text, false); /* speak revised text */ | ||
264 | break; | 290 | break; |
265 | 291 | ||
266 | case BUTTON_ON | BUTTON_RIGHT: | 292 | case BUTTON_ON | BUTTON_RIGHT: |
@@ -269,6 +295,8 @@ int kbd_input(char* text, int buflen) | |||
269 | editpos++; | 295 | editpos++; |
270 | if (editpos > len) | 296 | if (editpos > len) |
271 | editpos = len; | 297 | editpos = len; |
298 | else | ||
299 | kbd_spellchar(text[editpos]); | ||
272 | break; | 300 | break; |
273 | 301 | ||
274 | case BUTTON_ON | BUTTON_LEFT: | 302 | case BUTTON_ON | BUTTON_LEFT: |
@@ -277,6 +305,8 @@ int kbd_input(char* text, int buflen) | |||
277 | editpos--; | 305 | editpos--; |
278 | if (editpos < 0) | 306 | if (editpos < 0) |
279 | editpos = 0; | 307 | editpos = 0; |
308 | else | ||
309 | kbd_spellchar(text[editpos]); | ||
280 | break; | 310 | break; |
281 | 311 | ||
282 | case SYS_USB_CONNECTED: | 312 | case SYS_USB_CONNECTED: |