diff options
author | Stéphane Doyon <s.doyon@videotron.ca> | 2007-10-10 02:28:58 +0000 |
---|---|---|
committer | Stéphane Doyon <s.doyon@videotron.ca> | 2007-10-10 02:28:58 +0000 |
commit | d529a3845b1eefd396b0c0dbf177740357d03c0b (patch) | |
tree | 8fe83e397bc66ac3f25d946bdb83016cef8a8929 /apps/recorder | |
parent | 0279c71a92cd54210b91e80541c0688fb55c3a19 (diff) | |
download | rockbox-d529a3845b1eefd396b0c0dbf177740357d03c0b.tar.gz rockbox-d529a3845b1eefd396b0c0dbf177740357d03c0b.zip |
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
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/keyboard.c | 44 |
1 files changed, 37 insertions, 7 deletions
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 @@ | |||
32 | #include "hangul.h" | 32 | #include "hangul.h" |
33 | #include "action.h" | 33 | #include "action.h" |
34 | #include "icon.h" | 34 | #include "icon.h" |
35 | #include "pcmbuf.h" | ||
36 | #include "lang.h" | ||
35 | 37 | ||
36 | #ifndef O_BINARY | 38 | #ifndef O_BINARY |
37 | #define O_BINARY 0 | 39 | #define O_BINARY 0 |
@@ -188,15 +190,27 @@ int load_kbd(unsigned char* filename) | |||
188 | /* helper function to spell a char if voice UI is enabled */ | 190 | /* helper function to spell a char if voice UI is enabled */ |
189 | static void kbd_spellchar(unsigned short c) | 191 | static void kbd_spellchar(unsigned short c) |
190 | { | 192 | { |
191 | static char spell_char[2] = "\0\0"; /* store char to pass to talk_spell */ | 193 | if (talk_menus_enabled()) /* voice UI? */ |
192 | |||
193 | if (talk_menus_enabled() && c < 128) /* voice UI? */ | ||
194 | { | 194 | { |
195 | spell_char[0] = (char)c; | 195 | unsigned char tmp[5]; |
196 | talk_spell(spell_char, false); | 196 | /* store char to pass to talk_spell */ |
197 | unsigned char* utf8 = utf8encode(c, tmp); | ||
198 | *utf8 = 0; | ||
199 | |||
200 | if(c == ' ') | ||
201 | talk_id(VOICE_BLANK, false); | ||
202 | else talk_spell(tmp, false); | ||
197 | } | 203 | } |
198 | } | 204 | } |
199 | 205 | ||
206 | #ifdef KBD_MODES | ||
207 | static void say_edit(void) | ||
208 | { | ||
209 | if(talk_menus_enabled()) | ||
210 | talk_id(VOICE_EDIT, false); | ||
211 | } | ||
212 | #endif | ||
213 | |||
200 | static void kbd_inschar(unsigned char* text, int buflen, | 214 | static void kbd_inschar(unsigned char* text, int buflen, |
201 | int* editpos, unsigned short ch) | 215 | int* editpos, unsigned short ch) |
202 | { | 216 | { |
@@ -814,7 +828,8 @@ int kbd_input(char* text, int buflen) | |||
814 | { | 828 | { |
815 | int c = utf8seek(text, ++editpos); | 829 | int c = utf8seek(text, ++editpos); |
816 | kbd_spellchar(text[c]); | 830 | kbd_spellchar(text[c]); |
817 | } | 831 | } else if(global_settings.beep) |
832 | pcmbuf_beep(1000, 150, 1500*global_settings.beep); | ||
818 | } | 833 | } |
819 | else | 834 | else |
820 | #endif /* KBD_MODES */ | 835 | #endif /* KBD_MODES */ |
@@ -855,7 +870,8 @@ int kbd_input(char* text, int buflen) | |||
855 | { | 870 | { |
856 | int c = utf8seek(text, --editpos); | 871 | int c = utf8seek(text, --editpos); |
857 | kbd_spellchar(text[c]); | 872 | kbd_spellchar(text[c]); |
858 | } | 873 | } else if(global_settings.beep) |
874 | pcmbuf_beep(1000, 150, 1500*global_settings.beep); | ||
859 | } | 875 | } |
860 | else | 876 | else |
861 | #endif /* KBD_MODES */ | 877 | #endif /* KBD_MODES */ |
@@ -884,7 +900,11 @@ int kbd_input(char* text, int buflen) | |||
884 | #ifdef KBD_MORSE_INPUT | 900 | #ifdef KBD_MORSE_INPUT |
885 | #ifdef KBD_MODES | 901 | #ifdef KBD_MODES |
886 | if (morse_mode) | 902 | if (morse_mode) |
903 | { | ||
887 | pm->line_edit = !pm->line_edit; | 904 | pm->line_edit = !pm->line_edit; |
905 | if(pm->line_edit) | ||
906 | say_edit(); | ||
907 | } | ||
888 | else | 908 | else |
889 | #else | 909 | #else |
890 | if (morse_mode) | 910 | if (morse_mode) |
@@ -902,7 +922,10 @@ int kbd_input(char* text, int buflen) | |||
902 | #endif | 922 | #endif |
903 | if (++pm->y >= pm->lines) | 923 | if (++pm->y >= pm->lines) |
904 | #ifdef KBD_MODES | 924 | #ifdef KBD_MODES |
925 | { | ||
905 | pm->line_edit = true; | 926 | pm->line_edit = true; |
927 | say_edit(); | ||
928 | } | ||
906 | #else | 929 | #else |
907 | pm->y = 0; | 930 | pm->y = 0; |
908 | #endif | 931 | #endif |
@@ -920,7 +943,11 @@ int kbd_input(char* text, int buflen) | |||
920 | #ifdef KBD_MORSE_INPUT | 943 | #ifdef KBD_MORSE_INPUT |
921 | #ifdef KBD_MODES | 944 | #ifdef KBD_MODES |
922 | if (morse_mode) | 945 | if (morse_mode) |
946 | { | ||
923 | pm->line_edit = !pm->line_edit; | 947 | pm->line_edit = !pm->line_edit; |
948 | if(pm->line_edit) | ||
949 | say_edit(); | ||
950 | } | ||
924 | else | 951 | else |
925 | #else | 952 | #else |
926 | if (morse_mode) | 953 | if (morse_mode) |
@@ -938,7 +965,10 @@ int kbd_input(char* text, int buflen) | |||
938 | #endif | 965 | #endif |
939 | if (--pm->y < 0) | 966 | if (--pm->y < 0) |
940 | #ifdef KBD_MODES | 967 | #ifdef KBD_MODES |
968 | { | ||
941 | pm->line_edit = true; | 969 | pm->line_edit = true; |
970 | say_edit(); | ||
971 | } | ||
942 | #else | 972 | #else |
943 | pm->y = pm->lines - 1; | 973 | pm->y = pm->lines - 1; |
944 | #endif | 974 | #endif |