summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStéphane Doyon <s.doyon@videotron.ca>2007-10-10 02:28:58 +0000
committerStéphane Doyon <s.doyon@videotron.ca>2007-10-10 02:28:58 +0000
commitd529a3845b1eefd396b0c0dbf177740357d03c0b (patch)
tree8fe83e397bc66ac3f25d946bdb83016cef8a8929
parent0279c71a92cd54210b91e80541c0688fb55c3a19 (diff)
downloadrockbox-d529a3845b1eefd396b0c0dbf177740357d03c0b.zip
rockbox-d529a3845b1eefd396b0c0dbf177740357d03c0b.tar.gz
rockbox-d529a3845b1eefd396b0c0dbf177740357d03c0b.tar.bz2
rockbox-d529a3845b1eefd396b0c0dbf177740357d03c0b.tar.xz
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
-rw-r--r--apps/lang/english.lang28
-rw-r--r--apps/recorder/keyboard.c44
2 files changed, 65 insertions, 7 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index abe70b4..f6829e9 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -11389,3 +11389,31 @@
lcd_color: "Line Selector Colours"
</voice>
</phrase>
+<phrase>
+ id: VOICE_EDIT
+ desc: keyboard
+ user:
+ <source>
+ *: ""
+ </source>
+ <dest>
+ *: ""
+ </dest>
+ <voice>
+ *: "Edit"
+ </voice>
+</phrase>
+<phrase>
+ id: VOICE_BLANK
+ desc: keyboard
+ user:
+ <source>
+ *: ""
+ </source>
+ <dest>
+ *: ""
+ </dest>
+ <voice>
+ *: "Blank"
+ </voice>
+</phrase>
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index d3658c1..eb49140 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