summaryrefslogtreecommitdiff
path: root/apps/player
diff options
context:
space:
mode:
Diffstat (limited to 'apps/player')
-rw-r--r--apps/player/icons.h4
-rw-r--r--apps/player/keyboard.c66
2 files changed, 28 insertions, 42 deletions
diff --git a/apps/player/icons.h b/apps/player/icons.h
index 32a6adf75a..5df94b09e3 100644
--- a/apps/player/icons.h
+++ b/apps/player/icons.h
@@ -30,8 +30,8 @@
30enum { 30enum {
31 Icon_Queued = 'Q', 31 Icon_Queued = 'Q',
32 Icon_Moving = 'M', 32 Icon_Moving = 'M',
33 Icon_Unknown = 0x90, 33 Icon_Unknown = 0xe100,
34 Icon_Bookmark = 0x16, 34 Icon_Bookmark,
35 Icon_Plugin, 35 Icon_Plugin,
36 Icon_Folder, 36 Icon_Folder,
37 Icon_Firmware, 37 Icon_Firmware,
diff --git a/apps/player/keyboard.c b/apps/player/keyboard.c
index 380edd5e95..791693f9fe 100644
--- a/apps/player/keyboard.c
+++ b/apps/player/keyboard.c
@@ -31,53 +31,46 @@
31#include "misc.h" 31#include "misc.h"
32#include "rbunicode.h" 32#include "rbunicode.h"
33 33
34#define KBD_BUF_SIZE 64
34#define KEYBOARD_PAGES 3 35#define KEYBOARD_PAGES 3
35 36
36extern unsigned short *lcd_ascii; 37static unsigned short *kbd_setupkeys(int page, int* len)
37
38static unsigned char* kbd_setupkeys(int page, int* len)
39{ 38{
40 static unsigned char lines[128]; 39 static unsigned short kbdline[KBD_BUF_SIZE];
41 40 const unsigned char *p;
42 unsigned ch;
43 int i = 0; 41 int i = 0;
44 42
45 switch (page) 43 switch (page)
46 { 44 {
47 case 0: /* Capitals */ 45 case 0: /* Capitals */
48 for (ch = 'A'; ch <= 'Z'; ch++) 46 p = "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅ"
49 lines[i++] = ch; 47 "ÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÝ";
50 for (ch = 0xc0; ch <= 0xdd; ch++)
51 if (lcd_ascii[ch] != NOCHAR_NEW && lcd_ascii[ch] != NOCHAR_OLD)
52 lines[i++] = ch;
53 break; 48 break;
54 49
55 case 1: /* Small */ 50 case 1: /* Small */
56 for (ch = 'a'; ch <= 'z'; ch++) 51 p = "abcdefghijklmnopqrstuvwxyzßàáâãä"
57 lines[i++] = ch; 52 "åçèéêëìíîïñòóôöøùúûüýÿ";
58 for (ch = 0xdf; ch <= 0xff; ch++)
59 if (lcd_ascii[ch] != NOCHAR_NEW && lcd_ascii[ch] != NOCHAR_OLD)
60 lines[i++] = ch;
61 break; 53 break;
62 54
63 case 2: /* Others */ 55 default: /* Others */
64 for (ch = ' '; ch <= '@'; ch++) 56 p = " !\"#$%&'()*+,-./0123456789:;<=>?@[]_{}~";
65 lines[i++] = ch;
66 break; 57 break;
67 } 58 }
68 59
69 lines[i] = 0; 60 while (*p)
61 p = utf8decode(p, &kbdline[i++]);
62
70 *len = i; 63 *len = i;
71 64
72 return lines; 65 return kbdline;
73} 66}
74 67
75/* Delimiters for highlighting the character selected for insertion */ 68/* Delimiters for highlighting the character selected for insertion */
76#define KEYBOARD_INSERT_LEFT 0x81 69#define KEYBOARD_INSERT_LEFT 0xe110
77#define KEYBOARD_INSERT_RIGHT 0x82 70#define KEYBOARD_INSERT_RIGHT 0xe10f
78 71
79#define KEYBOARD_CURSOR 0x7f 72#define KEYBOARD_CURSOR 0x7f
80#define KEYBOARD_ARROW 0x92 73#define KEYBOARD_ARROW 0xe10c
81 74
82/* helper function to spell a char if voice UI is enabled */ 75/* helper function to spell a char if voice UI is enabled */
83static void kbd_spellchar(char c) 76static void kbd_spellchar(char c)
@@ -101,9 +94,8 @@ int kbd_input(char* text, int buflen)
101 94
102 int len, len_utf8, i, j; 95 int len, len_utf8, i, j;
103 int editpos, curpos, leftpos; 96 int editpos, curpos, leftpos;
104 unsigned char *line = kbd_setupkeys(page, &linelen); 97 unsigned short *line = kbd_setupkeys(page, &linelen);
105 unsigned char temptext[36]; 98 unsigned char temptext[36];
106 unsigned char tmp;
107 unsigned char *utf8; 99 unsigned char *utf8;
108 100
109 int button, lastbutton = 0; 101 int button, lastbutton = 0;
@@ -130,20 +122,14 @@ int kbd_input(char* text, int buflen)
130 lcd_putc(0, 0, KEYBOARD_ARROW); 122 lcd_putc(0, 0, KEYBOARD_ARROW);
131 lcd_putc(0, 1, ' '); 123 lcd_putc(0, 1, ' ');
132 } 124 }
133 125
134 /* Draw insert chars */ 126 lcd_putc(1, 0, KEYBOARD_INSERT_LEFT);
135 utf8 = temptext; 127 lcd_putc(2, 0, line[x]);
136 tmp = KEYBOARD_INSERT_LEFT; 128 lcd_putc(3, 0, KEYBOARD_INSERT_RIGHT);
137 utf8 = iso_decode(&tmp, utf8, 0, 1);
138 utf8 = iso_decode(&line[x], utf8, 0, 1);
139 tmp = KEYBOARD_INSERT_RIGHT;
140 utf8 = iso_decode(&tmp, utf8, 0, 1);
141 for (i = 1; i < 8; i++) 129 for (i = 1; i < 8; i++)
142 { 130 {
143 utf8 = iso_decode(&line[(x+i)%linelen], utf8, 0, 1); 131 lcd_putc(i + 3, 0, line[(x+i)%linelen]);
144 } 132 }
145 *utf8 = 0;
146 lcd_puts(1, 0, temptext);
147 133
148 /* write out the text */ 134 /* write out the text */
149 curpos = MIN(MIN(editpos, 10 - MIN(len_utf8 - editpos, 3)), 9); 135 curpos = MIN(MIN(editpos, 10 - MIN(len_utf8 - editpos, 3)), 9);
@@ -175,7 +161,7 @@ int kbd_input(char* text, int buflen)
175 lcd_remove_cursor(); 161 lcd_remove_cursor();
176 lcd_puts(1, 1, temptext); 162 lcd_puts(1, 1, temptext);
177 lcd_put_cursor(curpos + 1, 1, KEYBOARD_CURSOR); 163 lcd_put_cursor(curpos + 1, 1, KEYBOARD_CURSOR);
178 164
179 gui_syncstatusbar_draw(&statusbars, true); 165 gui_syncstatusbar_draw(&statusbars, true);
180 } 166 }
181 167
@@ -270,7 +256,7 @@ int kbd_input(char* text, int buflen)
270 } 256 }
271 else /* inserts the selected char */ 257 else /* inserts the selected char */
272 { 258 {
273 utf8 = iso_decode((unsigned char*)&line[x], temptext, 0, 1); 259 utf8 = utf8encode(line[x], temptext);
274 *utf8 = 0; 260 *utf8 = 0;
275 j = strlen(temptext); 261 j = strlen(temptext);
276 if (len + j < buflen) 262 if (len + j < buflen)