|
|
|
@ -1,4 +1,4 @@
|
|
|
|
/* $Id: gui_softkeyboard.c,v 1.8 2013/06/17 20:13:37 steffen Exp $ */
|
|
|
|
/* $Id: gui_softkeyboard.c,v 1.9 2013/06/17 20:42:58 steffen Exp $ */
|
|
|
|
/***************************************************************************
|
|
|
|
/***************************************************************************
|
|
|
|
* gui_softkeyboard.c
|
|
|
|
* gui_softkeyboard.c
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@ -80,8 +80,8 @@ void gui_softkeyb_show (int enable) {
|
|
|
|
/* only preparing the screen image... copying to the screen will be done later... */
|
|
|
|
/* only preparing the screen image... copying to the screen will be done later... */
|
|
|
|
static float _linepos[2][4] = { { 5.0, 25.0, 45.0, 65.0 },
|
|
|
|
static float _linepos[2][4] = { { 5.0, 25.0, 45.0, 65.0 },
|
|
|
|
{ 20.0, 40.0, 60.0, 95.0 } };
|
|
|
|
{ 20.0, 40.0, 60.0, 95.0 } };
|
|
|
|
static float _btnpos[2][5] = { { 2.0, 16.0, 35.0, 62.0, 79.0 },
|
|
|
|
static float _btnpos[2][7] = { { 2.0, 6.0, 12.0, 20.0, 32.0, 70.0, 80.0 },
|
|
|
|
{ 14.0, 33.0, 60.0, 77.0, 98.0 } };
|
|
|
|
{ 6.0, 10.0, 18.0, 30.0, 68.0, 78.0, 98.0 } };
|
|
|
|
|
|
|
|
|
|
|
|
void gui_softkeyb_getpos (int row, int btnnr, int *x1, int *y1, int *x2, int *y2) {
|
|
|
|
void gui_softkeyb_getpos (int row, int btnnr, int *x1, int *y1, int *x2, int *y2) {
|
|
|
|
if (row < 3) {
|
|
|
|
if (row < 3) {
|
|
|
|
@ -130,31 +130,37 @@ void gui_softkeyb_draw () {
|
|
|
|
if (softkeyb->last_col == i && softkeyb->last_line == j)
|
|
|
|
if (softkeyb->last_col == i && softkeyb->last_line == j)
|
|
|
|
draw_fillrectangle (softkeyb->screen, x1, y1, x2, y2, &color[COLOR_white][0]);
|
|
|
|
draw_fillrectangle (softkeyb->screen, x1, y1, x2, y2, &color[COLOR_white][0]);
|
|
|
|
draw_rectangle (softkeyb->screen, x1, y1, x2, y2, ls);
|
|
|
|
draw_rectangle (softkeyb->screen, x1, y1, x2, y2, ls);
|
|
|
|
u8_encode (&c, softkeyb->keys[softkeyb->mode][j][i]);
|
|
|
|
u8_encode (c, softkeyb->keys[softkeyb->mode][j][i]);
|
|
|
|
gfx_draw_text (softkeyb->screen, x1+(x2-x1-12)/2, y1+(y2-y1-12)/2, c, &color[COLOR_white][3]);
|
|
|
|
gfx_draw_text (softkeyb->screen, x1+(x2-x1-12)/2, y1+(y2-y1-12)/2, c, &color[COLOR_white][3]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* draw the last keys */
|
|
|
|
/* draw the last keys */
|
|
|
|
for (j = 3, i = 0; i < 5; i++) {
|
|
|
|
for (j = 3, i = 0; i < 7; i++) {
|
|
|
|
gui_softkeyb_getpos (j, i, &x1, &y1, &x2, &y2);
|
|
|
|
gui_softkeyb_getpos (j, i, &x1, &y1, &x2, &y2);
|
|
|
|
if (softkeyb->last_col == i && softkeyb->last_line == 3)
|
|
|
|
if (softkeyb->last_col == i && softkeyb->last_line == 3)
|
|
|
|
draw_fillrectangle (softkeyb->screen, x1, y1, x2, y2, &color[COLOR_white][0]);
|
|
|
|
draw_fillrectangle (softkeyb->screen, x1, y1, x2, y2, &color[COLOR_white][0]);
|
|
|
|
draw_rectangle (softkeyb->screen, x1, y1, x2, y2, ls);
|
|
|
|
draw_rectangle (softkeyb->screen, x1, y1, x2, y2, ls);
|
|
|
|
switch (i) {
|
|
|
|
switch (i) {
|
|
|
|
case (0):
|
|
|
|
case (0):
|
|
|
|
snprintf (c, 16, _("SYM"));
|
|
|
|
snprintf (c, 16, _("<"));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case (1):
|
|
|
|
case (1):
|
|
|
|
snprintf (c, 16, _("SHIFT"));
|
|
|
|
snprintf (c, 16, _(">"));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case (2):
|
|
|
|
case (2):
|
|
|
|
snprintf (c, 16, _(" "));
|
|
|
|
snprintf (c, 16, _("SYM"));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case (3):
|
|
|
|
case (3):
|
|
|
|
snprintf (c, 16, _("Del"));
|
|
|
|
snprintf (c, 16, _("SHIFT"));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case (4):
|
|
|
|
case (4):
|
|
|
|
|
|
|
|
snprintf (c, 16, _(" "));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case (5):
|
|
|
|
|
|
|
|
snprintf (c, 16, _("Del"));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case (6):
|
|
|
|
snprintf (c, 16, _("Close"));
|
|
|
|
snprintf (c, 16, _("Close"));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -196,7 +202,7 @@ int gui_softkeyb_event (GUIEvent *event) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
for (i = 0; i < 7; i++) {
|
|
|
|
gui_softkeyb_getpos (3, i, &x1, &y1, &x2, &y2);
|
|
|
|
gui_softkeyb_getpos (3, i, &x1, &y1, &x2, &y2);
|
|
|
|
if (x1 <= mp.x && mp.x <= x2 && y1 <= mp.y && mp.y <= y2) {
|
|
|
|
if (x1 <= mp.x && mp.x <= x2 && y1 <= mp.y && mp.y <= y2) {
|
|
|
|
if (event->event == EGUI_MOUSEPRESSED) {
|
|
|
|
if (event->event == EGUI_MOUSEPRESSED) {
|
|
|
|
@ -204,28 +210,46 @@ int gui_softkeyb_event (GUIEvent *event) {
|
|
|
|
softkeyb->last_col = i;
|
|
|
|
softkeyb->last_col = i;
|
|
|
|
switch (i) {
|
|
|
|
switch (i) {
|
|
|
|
case (0):
|
|
|
|
case (0):
|
|
|
|
softkeyb->mode = (softkeyb->mode == GUI_SOFTKEYB_MODE_SYMBOL) ? 0 : GUI_SOFTKEYB_MODE_SYMBOL;
|
|
|
|
newevent.key = GUIKEY_LEFT;
|
|
|
|
|
|
|
|
newevent.keychar = 0x0;
|
|
|
|
|
|
|
|
newevent.event = EGUI_KEYCHAR;
|
|
|
|
|
|
|
|
newevent.guiwin_mpos.x = newevent.scr_mpos.x = -1;
|
|
|
|
|
|
|
|
newevent.guiwin_mpos.y = newevent.scr_mpos.y = -1;
|
|
|
|
|
|
|
|
gui_entry_event (currentwin->focus, &newevent);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case (1):
|
|
|
|
case (1):
|
|
|
|
softkeyb->mode = (softkeyb->mode == GUI_SOFTKEYB_MODE_SHIFT) ? 0 : GUI_SOFTKEYB_MODE_SHIFT;
|
|
|
|
newevent.key = GUIKEY_RIGHT;
|
|
|
|
|
|
|
|
newevent.keychar = 0x0;
|
|
|
|
|
|
|
|
newevent.event = EGUI_KEYCHAR;
|
|
|
|
|
|
|
|
newevent.guiwin_mpos.x = newevent.scr_mpos.x = -1;
|
|
|
|
|
|
|
|
newevent.guiwin_mpos.y = newevent.scr_mpos.y = -1;
|
|
|
|
|
|
|
|
gui_entry_event (currentwin->focus, &newevent);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case (2):
|
|
|
|
case (2):
|
|
|
|
// newevent.keyval = ' ';
|
|
|
|
softkeyb->mode = (softkeyb->mode == GUI_SOFTKEYB_MODE_SYMBOL) ? 0 : GUI_SOFTKEYB_MODE_SYMBOL;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case (3):
|
|
|
|
|
|
|
|
softkeyb->mode = (softkeyb->mode == GUI_SOFTKEYB_MODE_SHIFT) ? 0 : GUI_SOFTKEYB_MODE_SHIFT;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case (4):
|
|
|
|
|
|
|
|
newevent.key = ' ';
|
|
|
|
|
|
|
|
newevent.keychar = u8_decode (" ", NULL);
|
|
|
|
newevent.event = EGUI_KEYCHAR;
|
|
|
|
newevent.event = EGUI_KEYCHAR;
|
|
|
|
newevent.guiwin_mpos.x = newevent.scr_mpos.x = -1;
|
|
|
|
newevent.guiwin_mpos.x = newevent.scr_mpos.x = -1;
|
|
|
|
newevent.guiwin_mpos.y = newevent.scr_mpos.y = -1;
|
|
|
|
newevent.guiwin_mpos.y = newevent.scr_mpos.y = -1;
|
|
|
|
gui_entry_event (currentwin->focus, &newevent);
|
|
|
|
gui_entry_event (currentwin->focus, &newevent);
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case (3):
|
|
|
|
case (5):
|
|
|
|
// newevent.keyval = 0x08;
|
|
|
|
newevent.key = 0x08;
|
|
|
|
|
|
|
|
newevent.keychar = 0x0;
|
|
|
|
newevent.event = EGUI_KEYCHAR;
|
|
|
|
newevent.event = EGUI_KEYCHAR;
|
|
|
|
newevent.guiwin_mpos.x = newevent.scr_mpos.x = -1;
|
|
|
|
newevent.guiwin_mpos.x = newevent.scr_mpos.x = -1;
|
|
|
|
newevent.guiwin_mpos.y = newevent.scr_mpos.y = -1;
|
|
|
|
newevent.guiwin_mpos.y = newevent.scr_mpos.y = -1;
|
|
|
|
gui_entry_event (currentwin->focus, &newevent);
|
|
|
|
gui_entry_event (currentwin->focus, &newevent);
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case (4):
|
|
|
|
case (6):
|
|
|
|
softkeyb->enabled = 0;
|
|
|
|
softkeyb->enabled = 0;
|
|
|
|
currentwin->screen_changed = 1;
|
|
|
|
currentwin->screen_changed = 1;
|
|
|
|
draw ();
|
|
|
|
draw ();
|
|
|
|
|