From d529a3845b1eefd396b0c0dbf177740357d03c0b Mon Sep 17 00:00:00 2001 From: Stéphane Doyon Date: Wed, 10 Oct 2007 02:28:58 +0000 Subject: Make the virtual keyboard easier to use for blind users. From FS#6324 When moving up/down and landing on the edit line, say "edit". Otherwise it gets quite confusing. When moving left and right on the edit line, sound a beep when the left or right end is reached. Before, it would say nothing either when the cursor is over a blank or a char it doesn't know how to spell. So if we're on a blank spot, say "blank". Pass the whole utf8 char to be spelled. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15060 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 28 ++++++++++++++++++++++++++++ apps/recorder/keyboard.c | 44 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index abe70b4d9f..f6829e92fa 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -11389,3 +11389,31 @@ lcd_color: "Line Selector Colours" + + id: VOICE_EDIT + desc: keyboard + user: + + *: "" + + + *: "" + + + *: "Edit" + + + + id: VOICE_BLANK + desc: keyboard + user: + + *: "" + + + *: "" + + + *: "Blank" + + diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index d3658c1bc7..eb49140f8c 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c @@ -32,6 +32,8 @@ #include "hangul.h" #include "action.h" #include "icon.h" +#include "pcmbuf.h" +#include "lang.h" #ifndef O_BINARY #define O_BINARY 0 @@ -188,15 +190,27 @@ int load_kbd(unsigned char* filename) /* helper function to spell a char if voice UI is enabled */ static void kbd_spellchar(unsigned short c) { - static char spell_char[2] = "\0\0"; /* store char to pass to talk_spell */ - - if (talk_menus_enabled() && c < 128) /* voice UI? */ + if (talk_menus_enabled()) /* voice UI? */ { - spell_char[0] = (char)c; - talk_spell(spell_char, false); + unsigned char tmp[5]; + /* store char to pass to talk_spell */ + unsigned char* utf8 = utf8encode(c, tmp); + *utf8 = 0; + + if(c == ' ') + talk_id(VOICE_BLANK, false); + else talk_spell(tmp, false); } } +#ifdef KBD_MODES +static void say_edit(void) +{ + if(talk_menus_enabled()) + talk_id(VOICE_EDIT, false); +} +#endif + static void kbd_inschar(unsigned char* text, int buflen, int* editpos, unsigned short ch) { @@ -814,7 +828,8 @@ int kbd_input(char* text, int buflen) { int c = utf8seek(text, ++editpos); kbd_spellchar(text[c]); - } + } else if(global_settings.beep) + pcmbuf_beep(1000, 150, 1500*global_settings.beep); } else #endif /* KBD_MODES */ @@ -855,7 +870,8 @@ int kbd_input(char* text, int buflen) { int c = utf8seek(text, --editpos); kbd_spellchar(text[c]); - } + } else if(global_settings.beep) + pcmbuf_beep(1000, 150, 1500*global_settings.beep); } else #endif /* KBD_MODES */ @@ -884,7 +900,11 @@ int kbd_input(char* text, int buflen) #ifdef KBD_MORSE_INPUT #ifdef KBD_MODES if (morse_mode) + { pm->line_edit = !pm->line_edit; + if(pm->line_edit) + say_edit(); + } else #else if (morse_mode) @@ -902,7 +922,10 @@ int kbd_input(char* text, int buflen) #endif if (++pm->y >= pm->lines) #ifdef KBD_MODES + { pm->line_edit = true; + say_edit(); + } #else pm->y = 0; #endif @@ -920,7 +943,11 @@ int kbd_input(char* text, int buflen) #ifdef KBD_MORSE_INPUT #ifdef KBD_MODES if (morse_mode) + { pm->line_edit = !pm->line_edit; + if(pm->line_edit) + say_edit(); + } else #else if (morse_mode) @@ -938,7 +965,10 @@ int kbd_input(char* text, int buflen) #endif if (--pm->y < 0) #ifdef KBD_MODES + { pm->line_edit = true; + say_edit(); + } #else pm->y = pm->lines - 1; #endif -- cgit v1.2.3