forked from len0rd/rockbox
Updated vkeyboard. For players that require the user to scroll the cursor off the keyboard in order to edit the line itself (iPods, iAudio..), the line is now inverted when in line-edit mode. For all models: blinking line cursor.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9756 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9f34872df0
commit
a1db431d50
1 changed files with 23 additions and 27 deletions
|
|
@ -151,20 +151,6 @@
|
||||||
#define KBD_UP BUTTON_UP
|
#define KBD_UP BUTTON_UP
|
||||||
#define KBD_DOWN BUTTON_DOWN
|
#define KBD_DOWN BUTTON_DOWN
|
||||||
|
|
||||||
#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
|
|
||||||
|
|
||||||
/* TODO: Check keyboard mappings */
|
|
||||||
|
|
||||||
#define KBD_MODES /* iAudio X5 uses 2 modes, picker and line edit */
|
|
||||||
#define KBD_SELECT (BUTTON_MENU | BUTTON_REL) /* backspace in line edit */
|
|
||||||
#define KBD_SELECT_PRE BUTTON_MENU
|
|
||||||
#define KBD_DONE BUTTON_PLAY
|
|
||||||
#define KBD_ABORT BUTTON_REC
|
|
||||||
#define KBD_LEFT BUTTON_LEFT
|
|
||||||
#define KBD_RIGHT BUTTON_RIGHT
|
|
||||||
#define KBD_UP BUTTON_UP
|
|
||||||
#define KBD_DOWN BUTTON_DOWN
|
|
||||||
|
|
||||||
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
||||||
|
|
||||||
/* TODO: Check keyboard mappings */
|
/* TODO: Check keyboard mappings */
|
||||||
|
|
@ -182,7 +168,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 96)
|
#if (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 96)
|
||||||
static const unsigned char * default_kbd =
|
static const unsigned char * default_kbd =
|
||||||
"ABCDEFG abcdefg !?\" @#$%+'\n"
|
"ABCDEFG abcdefg !?\" @#$%+'\n"
|
||||||
"HIJKLMN hijklmn 789 &_()-`\n"
|
"HIJKLMN hijklmn 789 &_()-`\n"
|
||||||
"OPQRSTU opqrstu 456 §|{}/<\n"
|
"OPQRSTU opqrstu 456 §|{}/<\n"
|
||||||
|
|
@ -192,7 +178,7 @@ static const unsigned char * default_kbd =
|
||||||
"ÓÒÔÕÖØ ÇÐÞÝß ÙÚÛÜ ¯±×÷¡¿µ·\n"
|
"ÓÒÔÕÖØ ÇÐÞÝß ÙÚÛÜ ¯±×÷¡¿µ·\n"
|
||||||
"òóôõöø çðþýÿ ùúûü ¼½¾¬¶¨";
|
"òóôõöø çðþýÿ ùúûü ¼½¾¬¶¨";
|
||||||
#else
|
#else
|
||||||
static const unsigned char * default_kbd =
|
static const unsigned char * default_kbd =
|
||||||
"ABCDEFG !?\" @#$%+'\n"
|
"ABCDEFG !?\" @#$%+'\n"
|
||||||
"HIJKLMN 789 &_()-`\n"
|
"HIJKLMN 789 &_()-`\n"
|
||||||
"OPQRSTU 456 §|{}/<\n"
|
"OPQRSTU 456 §|{}/<\n"
|
||||||
|
|
@ -215,7 +201,7 @@ static int nchars = 0;
|
||||||
|
|
||||||
#ifdef KBD_MORSE_INPUT
|
#ifdef KBD_MORSE_INPUT
|
||||||
/* FIXME: We should put this to a configuration file. */
|
/* FIXME: We should put this to a configuration file. */
|
||||||
static const char *morse_alphabets =
|
static const char *morse_alphabets =
|
||||||
"abcdefghijklmnopqrstuvwxyz1234567890,.?-@ ";
|
"abcdefghijklmnopqrstuvwxyz1234567890,.?-@ ";
|
||||||
static const unsigned char morse_codes[] = {
|
static const unsigned char morse_codes[] = {
|
||||||
0x05,0x18,0x1a,0x0c,0x02,0x12,0x0e,0x10,0x04,0x17,0x0d,0x14,0x07,
|
0x05,0x18,0x1a,0x0c,0x02,0x12,0x0e,0x10,0x04,0x17,0x0d,0x14,0x07,
|
||||||
|
|
@ -265,7 +251,7 @@ int load_kbd(unsigned char* filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
utf8decode(buf, &kbd_buf[i]);
|
utf8decode(buf, &kbd_buf[i]);
|
||||||
if (kbd_buf[i] != 0xFEFF && kbd_buf[i] != '\n' &&
|
if (kbd_buf[i] != 0xFEFF && kbd_buf[i] != '\n' &&
|
||||||
kbd_buf[i] != '\r') /*skip BOM & newlines */
|
kbd_buf[i] != '\r') /*skip BOM & newlines */
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
@ -355,6 +341,7 @@ int kbd_input(char* text, int buflen)
|
||||||
bool redraw = true;
|
bool redraw = true;
|
||||||
unsigned char *utf8;
|
unsigned char *utf8;
|
||||||
const unsigned char *p;
|
const unsigned char *p;
|
||||||
|
int cur_blink = current_tick;
|
||||||
#ifdef KBD_MORSE_INPUT
|
#ifdef KBD_MORSE_INPUT
|
||||||
bool morse_reading = false;
|
bool morse_reading = false;
|
||||||
unsigned char morse_code = 0;
|
unsigned char morse_code = 0;
|
||||||
|
|
@ -490,7 +477,7 @@ int kbd_input(char* text, int buflen)
|
||||||
else
|
else
|
||||||
lcd_fillrect(x + j*4, y + 3, 1, 2);
|
lcd_fillrect(x + j*4, y + 3, 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
x += w * 5 - 3;
|
x += w * 5 - 3;
|
||||||
if (x >= LCD_WIDTH - (w*6))
|
if (x >= LCD_WIDTH - (w*6))
|
||||||
{
|
{
|
||||||
|
|
@ -547,9 +534,11 @@ int kbd_input(char* text, int buflen)
|
||||||
|
|
||||||
/* cursor */
|
/* cursor */
|
||||||
i = (curpos + 1) * text_w;
|
i = (curpos + 1) * text_w;
|
||||||
lcd_vline(i, main_y, main_y + font_h);
|
if(cur_blink%125 > 50)
|
||||||
|
lcd_vline(i, main_y, main_y + font_h-1);
|
||||||
if (hangul) /* draw underbar */
|
if (hangul) /* draw underbar */
|
||||||
lcd_hline(curpos*text_w, (curpos+1)*text_w, main_y+font_h-1);
|
lcd_hline(curpos*text_w, (curpos+1)*text_w, main_y+font_h-1);
|
||||||
|
cur_blink = current_tick;
|
||||||
|
|
||||||
#ifdef HAS_BUTTONBAR
|
#ifdef HAS_BUTTONBAR
|
||||||
/* draw the status bar */
|
/* draw the status bar */
|
||||||
|
|
@ -566,6 +555,14 @@ int kbd_input(char* text, int buflen)
|
||||||
lcd_fillrect(font_w * x, statusbar_size + font_h * y, font_w, font_h);
|
lcd_fillrect(font_w * x, statusbar_size + font_h * y, font_w, font_h);
|
||||||
lcd_set_drawmode(DRMODE_SOLID);
|
lcd_set_drawmode(DRMODE_SOLID);
|
||||||
}
|
}
|
||||||
|
#ifdef KBD_MODES
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lcd_set_drawmode(DRMODE_COMPLEMENT);
|
||||||
|
lcd_fillrect(0, main_y - keyboard_margin + 2, LCD_WIDTH, font_h+2);
|
||||||
|
lcd_set_drawmode(DRMODE_SOLID);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
gui_syncstatusbar_draw(&statusbars, true);
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
@ -574,7 +571,7 @@ int kbd_input(char* text, int buflen)
|
||||||
/* The default action is to redraw */
|
/* The default action is to redraw */
|
||||||
redraw = true;
|
redraw = true;
|
||||||
|
|
||||||
button = button_get_w_tmo(HZ/2);
|
button = button_get(false);
|
||||||
#ifdef KBD_MORSE_INPUT
|
#ifdef KBD_MORSE_INPUT
|
||||||
if (morse_mode)
|
if (morse_mode)
|
||||||
{
|
{
|
||||||
|
|
@ -585,7 +582,7 @@ int kbd_input(char* text, int buflen)
|
||||||
button = KBD_CURSOR_RIGHT;
|
button = KBD_CURSOR_RIGHT;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch ( button ) {
|
switch ( button ) {
|
||||||
|
|
||||||
case KBD_ABORT:
|
case KBD_ABORT:
|
||||||
|
|
@ -641,7 +638,7 @@ int kbd_input(char* text, int buflen)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (++x == max_chars) {
|
if (++x == max_chars) {
|
||||||
x = 0;
|
x = 0;
|
||||||
#if !defined(KBD_PAGE_FLIP)
|
#if !defined(KBD_PAGE_FLIP)
|
||||||
|
|
@ -771,10 +768,10 @@ int kbd_input(char* text, int buflen)
|
||||||
if ((current_tick - morse_tick) > HZ/5)
|
if ((current_tick - morse_tick) > HZ/5)
|
||||||
morse_code |= 0x01;
|
morse_code |= 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case KBD_SELECT:
|
case KBD_SELECT:
|
||||||
#ifdef KBD_MORSE_INPUT
|
#ifdef KBD_MORSE_INPUT
|
||||||
if (morse_mode)
|
if (morse_mode)
|
||||||
|
|
@ -788,7 +785,7 @@ int kbd_input(char* text, int buflen)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* inserts the selected char */
|
/* inserts the selected char */
|
||||||
#ifdef KBD_SELECT_PRE
|
#ifdef KBD_SELECT_PRE
|
||||||
if (lastbutton != KBD_SELECT_PRE)
|
if (lastbutton != KBD_SELECT_PRE)
|
||||||
|
|
@ -917,7 +914,6 @@ int kbd_input(char* text, int buflen)
|
||||||
|
|
||||||
case BUTTON_NONE:
|
case BUTTON_NONE:
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
gui_syncstatusbar_draw(&statusbars, false);
|
||||||
redraw = false;
|
|
||||||
#ifdef KBD_MORSE_INPUT
|
#ifdef KBD_MORSE_INPUT
|
||||||
if (morse_reading)
|
if (morse_reading)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue