|
|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: gui_softkeyboard.c,v 1.1 2013/03/06 23:28:15 steffen Exp $ */
|
|
|
|
|
/* $Id: gui_softkeyboard.c,v 1.2 2013/03/09 00:02:30 steffen Exp $ */
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
* gui_softkeyboard.c
|
|
|
|
|
*
|
|
|
|
|
@ -31,6 +31,9 @@
|
|
|
|
|
|
|
|
|
|
GUISoftkeyboard *softkeyb = NULL;
|
|
|
|
|
|
|
|
|
|
void gui_softkeyb_getpos (int row, int btnnr, int *x1, int *x2, int *y1, int *y2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void gui_softkeyb_show (int enable) {
|
|
|
|
|
/* keys which are displayed.. */
|
|
|
|
|
char line[GUI_SOFTKEYB_MODE_MAX][GUI_SOFTKEYB_X][GUI_SOFTKEYB_X] = {
|
|
|
|
|
@ -67,12 +70,52 @@ void gui_softkeyb_show (int enable) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 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 },
|
|
|
|
|
{ 20.0, 40.0, 60.0, 95.0 } };
|
|
|
|
|
static float _btnpos[2][4] = { { 5.0, 20.0, 35.0, 65.0 },
|
|
|
|
|
{ 15.0, 30.0, 60.0, 95.0 } };
|
|
|
|
|
|
|
|
|
|
void gui_softkeyb_getpos (int row, int btnnr, int *x1, int *y1, int *x2, int *y2) {
|
|
|
|
|
if (row < 3) {
|
|
|
|
|
*x1 = 5 + (btnnr * (softkeyb->screen->width - 10)) / GUI_SOFTKEYB_X;
|
|
|
|
|
*x2 = 5 + ((btnnr + 1) * (softkeyb->screen->width - 10)) / GUI_SOFTKEYB_X;
|
|
|
|
|
*y1 = (_linepos[0][row] * softkeyb->screen->height)/100;
|
|
|
|
|
*y2 = (_linepos[1][row] * softkeyb->screen->height)/100;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void gui_softkeyb_draw () {
|
|
|
|
|
struct line_style ls;
|
|
|
|
|
int i, j, x1, x2, y1, y2;
|
|
|
|
|
|
|
|
|
|
if (softkeyb == NULL || gfx_screensize.x < 0 || softkeyb->enabled == FALSE) return;
|
|
|
|
|
if (softkeyb->screen == NULL || softkeyb->screen->width != gfx_screensize.x) {
|
|
|
|
|
if (softkeyb->screen) gfx_img_free (softkeyb->screen);
|
|
|
|
|
softkeyb->screen = gfx_img_alloc (gfx_screensize.x, gfx_screensize.y * 0.8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* setup the lines... */
|
|
|
|
|
for (j = 0; j < 2; j++) for (i = 0; i < 4; i++) {
|
|
|
|
|
softkeyb->linepos[j][i] = _linepos[j][i] * softkeyb->screen->width;
|
|
|
|
|
softkeyb->btnpos[j][i] = _btnpos[j][i] * softkeyb->screen->height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* draw border */
|
|
|
|
|
ls.c = color[COLOR_white][2];
|
|
|
|
|
ls.width = 1;
|
|
|
|
|
gfx_clear (softkeyb->screen, &color[COLOR_white][1]);
|
|
|
|
|
draw_rectangle (softkeyb->screen, 1, 1, softkeyb->screen->width-2, softkeyb->screen->height-2, ls);
|
|
|
|
|
|
|
|
|
|
/* draw 3 key rows.. */
|
|
|
|
|
ls.c = color[COLOR_blue][2];
|
|
|
|
|
ls.width = 1;
|
|
|
|
|
for (j = 0; j < 3; j++) {
|
|
|
|
|
for (i = 0; i < GUI_SOFTKEYB_X; i++) {
|
|
|
|
|
gui_softkeyb_getpos (j, i, &x1, &y1, &x2, &y2);
|
|
|
|
|
draw_rectangle (softkeyb->screen, x1, y1, x2, y2, ls);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* draw the last keys */
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|