diff options
author | Mats Lidell <matsl@rockbox.org> | 2003-01-20 12:25:28 +0000 |
---|---|---|
committer | Mats Lidell <matsl@rockbox.org> | 2003-01-20 12:25:28 +0000 |
commit | f3313da2da8350ce7fc1228aaae706aacd9763ad (patch) | |
tree | 0ec6790f0ae5f9acc013aecb25e9d9b38deff854 /apps | |
parent | bd1fa21cc054c6b69ae35ec845b4623405c32d33 (diff) |
First attempt in rocklatin1 input for player.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3134 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/player/keyboard.c | 64 |
1 files changed, 50 insertions, 14 deletions
diff --git a/apps/player/keyboard.c b/apps/player/keyboard.c index 543720fa65..342172d44a 100644 --- a/apps/player/keyboard.c +++ b/apps/player/keyboard.c @@ -23,27 +23,59 @@ #include "debug_menu.h" #include "sprintf.h" #include <string.h> +#include "lcd-player-charset.h" -#define KEYBOARD_PAGES 4 +#include "debug.h" -static char* kbd_setupkeys(int page) +#define KEYBOARD_PAGES 3 + +unsigned short *lcd_ascii; + +static unsigned short* kbd_setupkeys(int page, int* len) { - static char* lines[] = { - "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "abcdefghijklmnopqrstuvwxyz", - "01234567890!@#$%&/(){}[]<>", - " +-*_.,:;!?' " - }; - - return lines[page]; + static unsigned short lines[256]; + + unsigned short ch; + int i = 0; + + switch (page) { + case 0: /* Capitals */ + for (ch = 'A'; ch <= 'Z'; ch++) lines[i++] = ch; + for (ch = 0xc0; ch <= 0xdd; ch++) + if (lcd_ascii[ch] != NOCHAR_NEW && lcd_ascii[ch] != NOCHAR_OLD) + lines[i++] = ch; + break; + + case 1: /* Small */ + for (ch = 'a'; ch <= 'z'; ch++) lines[i++] = ch; + for (ch = 0xdf; ch <= 0xff; ch++) + if (lcd_ascii[ch] != NOCHAR_NEW && lcd_ascii[ch] != NOCHAR_OLD) + lines[i++] = ch; + break; + + case 2: /* Others */ + for (ch = ' '; ch <= '@'; ch++) lines[i++] = ch; + for (ch = 0x5b; ch <= 0x60; ch++) + if (lcd_ascii[ch] != NOCHAR_NEW && lcd_ascii[ch] != NOCHAR_OLD) + lines[i++] = ch; + for (ch = 0x07b; ch <= 0x0bf; ch++) + if (lcd_ascii[ch] != NOCHAR_NEW && lcd_ascii[ch] != NOCHAR_OLD) + lines[i++] = ch; + break; + } + + lines[i] = 0; + *len = i; + + return lines; } int kbd_input(char* text, int buflen) { bool done = false; int page=0, x=0; - char* line = kbd_setupkeys(page); - int linelen = strlen(line); + int linelen; + unsigned short* line = kbd_setupkeys(page, &linelen); while(!done) { @@ -74,12 +106,16 @@ int kbd_input(char* text, int buflen) switch ( button_get(true) ) { + case BUTTON_MENU | BUTTON_STOP: + /* abort */ + return -1; + break; + case BUTTON_MENU: /* shift */ if (++page == KEYBOARD_PAGES) page = 0; - line = kbd_setupkeys(page); - linelen = strlen(line); + line = kbd_setupkeys(page, &linelen); break; case BUTTON_RIGHT: |