diff --git a/draw/draw.h b/draw/draw.h index 7f3934f..e64c39c 100644 --- a/draw/draw.h +++ b/draw/draw.h @@ -156,7 +156,7 @@ extern void gfx_draw_img (struct image *dimg, int dx, int dy, int dw, int dh, st extern void gfx_draw_line (struct image *dimg, int x1, int y1, int x2, int y2, struct line_style style); extern void gfx_draw_text (struct image *dimg, int x, int y, char *text, struct color *c); extern void gfx_draw_polygon (struct image *dimg, iPoint *p, int pcnt, struct line_style style, struct color c); -extern void gfx_draw_rect (struct image *dimg, int x1, int y1, int x2, int y2, struct color *c); +// extern void gfx_draw_rect (struct image *dimg, int x1, int y1, int x2, int y2, struct color *c); extern void gfx_clear (struct image *dimg, struct color *c); extern struct image *gfx_img_alloc (int w, int h); diff --git a/gui/gui.c b/gui/gui.c index ba88f21..3797c93 100644 --- a/gui/gui.c +++ b/gui/gui.c @@ -1,4 +1,4 @@ -/* $Id: gui.c,v 1.18 2013/03/07 23:09:33 steffen Exp $ */ +/* $Id: gui.c,v 1.19 2013/03/09 00:02:30 steffen Exp $ */ /*************************************************************************** * gui.c * @@ -149,10 +149,10 @@ void gui_draw () { softkeyb->screen->width, softkeyb->screen->height, softkeyb->screen, 0, 0); /* drawing part of the screen where the entry element is set up.. */ - ys = currentwin->focus->y; + ys = currentwin->focus->y- 16; yh = gfx_screensize.y-softkeyb->screen->height; currentwin->y = -ys; - if ((currentwin->h - currentwin->focus->y) < yh) yh = currentwin->h - currentwin->focus->y; + if ((currentwin->h - (currentwin->focus->y-16)) < yh) yh = currentwin->h - (currentwin->focus->y - 16); gfx_draw_img (NULL, currentwin->x, 0, currentwin->w, yh, currentwin->screen, 0, ys); } else gfx_draw_img (NULL, currentwin->x, currentwin->y, currentwin->w, currentwin->h, currentwin->screen, 0, 0); diff --git a/gui/gui.h b/gui/gui.h index 63921af..26e0872 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -148,6 +148,8 @@ enum { struct _GUISoftkeyboard_ { int mode; int enabled; + int linepos[2][4]; /* y positions of lines */ + int btnpos[2][4]; /* holds position keys: Shift, Symbols, Space, Close */ struct image *screen; char keys[GUI_SOFTKEYB_MODE_MAX][GUI_SOFTKEYB_Y][GUI_SOFTKEYB_X]; } typedef GUISoftkeyboard; diff --git a/gui/gui_softkeyboard.c b/gui/gui_softkeyboard.c index 5d0dd04..33da5d8 100644 --- a/gui/gui_softkeyboard.c +++ b/gui/gui_softkeyboard.c @@ -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 */ + }; diff --git a/sdlgl/sdl_gfx.c b/sdlgl/sdl_gfx.c index aedf662..3080e2b 100644 --- a/sdlgl/sdl_gfx.c +++ b/sdlgl/sdl_gfx.c @@ -297,6 +297,7 @@ void gfx_img_free (struct image *img) { }; +/* void gfx_draw_rect (struct image *dimg, int x1, int y1, int x2, int y2, struct color *c) { d_printf ("rect..."); // int i; @@ -315,7 +316,7 @@ void gfx_draw_rect (struct image *dimg, int x1, int y1, int x2, int y2, struct c // glVertex2i (p[i].x, p[i].y); // glEnd (); }; - +*/ #define HEADER_SIZE 8 diff --git a/sdlgl/sdl_port.h b/sdlgl/sdl_port.h index cb4caf6..2bf4667 100644 --- a/sdlgl/sdl_port.h +++ b/sdlgl/sdl_port.h @@ -34,6 +34,8 @@ #include #include FT_FREETYPE_H +#include + /***************************************************************************** * gfx stuff...