From b0143e2a8c6a75da034d5cc38a757900bd8ecc40 Mon Sep 17 00:00:00 2001 From: steffen Date: Thu, 7 Mar 2013 23:09:33 +0000 Subject: [PATCH] softkey first steps.. --- gui/gui.c | 51 ++++++++++++++++++++++++++++++++++++------------- gui/gui.h | 4 ++-- main/osmroute.h | 12 +++++++++++- 3 files changed, 51 insertions(+), 16 deletions(-) diff --git a/gui/gui.c b/gui/gui.c index d1fed03..ba88f21 100644 --- a/gui/gui.c +++ b/gui/gui.c @@ -1,4 +1,4 @@ -/* $Id: gui.c,v 1.17 2013/03/06 23:27:25 steffen Exp $ */ +/* $Id: gui.c,v 1.18 2013/03/07 23:09:33 steffen Exp $ */ /*************************************************************************** * gui.c * @@ -112,8 +112,8 @@ void gui_draw () { case (GUI_LIST): gui_list_draw (currentwin->items[i]); break; - // case (GUI_ENTRY): - // gui_entry_draw ((GUIEntry*)currentwin->items[i].item); + // case (GUI_UNKNOWN): + // gui_UNKNOWN_draw ((GUIEntry*)currentwin->items[i].item); // break; default: break; @@ -122,15 +122,40 @@ void gui_draw () { } if (currentwin) { - if ((currentwin->style & WGUI_S_VCENTER) == WGUI_S_VCENTER) currentwin->x = gfx_screensize.x/2 - currentwin->w/2; - if ((currentwin->style & WGUI_S_VCENTER) == WGUI_S_VLEFT) currentwin->x = 0; - if ((currentwin->style & WGUI_S_VCENTER) == WGUI_S_VRIGHT) currentwin->x = gfx_screensize.x - currentwin->w; - - if ((currentwin->style & WGUI_S_HCENTER) == WGUI_S_HCENTER) currentwin->y = gfx_screensize.y/2 - currentwin->h/2; - if ((currentwin->style & WGUI_S_HCENTER) == WGUI_S_HTOP) currentwin->y = 0; - if ((currentwin->style & WGUI_S_HCENTER) == WGUI_S_HBOTTOM) currentwin->y = gfx_screensize.y - currentwin->h; - - gfx_draw_img (NULL, currentwin->x, currentwin->y, currentwin->w, currentwin->h, currentwin->screen, 0, 0); + if ((currentwin->style & WGUI_S_VCENTER) == WGUI_S_VCENTER) + currentwin->x = gfx_screensize.x/2 - currentwin->w/2; + if ((currentwin->style & WGUI_S_VCENTER) == WGUI_S_VLEFT) + currentwin->x = 0; + if ((currentwin->style & WGUI_S_VCENTER) == WGUI_S_VRIGHT) + currentwin->x = gfx_screensize.x - currentwin->w; + if ((currentwin->style & WGUI_S_HCENTER) == WGUI_S_HCENTER) + currentwin->y = gfx_screensize.y/2 - currentwin->h/2; + if ((currentwin->style & WGUI_S_HCENTER) == WGUI_S_HTOP) + currentwin->y = 0; + if ((currentwin->style & WGUI_S_HCENTER) == WGUI_S_HBOTTOM) + currentwin->y = gfx_screensize.y - currentwin->h; + + /* draw the windows or just the part of the entry which is focused + * and draw the softkeyb + */ + if (currentwin->focus && softkeyb && softkeyb->enabled) { + int ys, yh; + + /* drawing and display softkeyb */ + gui_softkeyb_draw (); + gfx_draw_img (NULL, + (gfx_screensize.x-softkeyb->screen->width)/2, + gfx_screensize.y-softkeyb->screen->height, + 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; + yh = gfx_screensize.y-softkeyb->screen->height; + currentwin->y = -ys; + if ((currentwin->h - currentwin->focus->y) < yh) yh = currentwin->h - currentwin->focus->y; + 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); } }; @@ -215,4 +240,4 @@ void gui_set_focus (GUIItem *item) { if (item == NULL || item->type != GUI_ENTRY) gui_softkeyb_show (FALSE); currentwin->focus = item; currentwin->screen_changed = 1; -}; \ No newline at end of file +}; diff --git a/gui/gui.h b/gui/gui.h index c5eafa7..63921af 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -167,8 +167,8 @@ extern void gui_window_close (GUIWindow *win); extern void gui_window_item_add (GUIWindow *win, GUIItem *item); /* softkeyboard functions. */ -void gui_softkeyb_show (int enable); - +extern void gui_softkeyb_show (int enable); +extern void gui_softkeyb_draw (); /* button functions */ #define GUI_BUTTON_T(_item_) ((GUIButton*)(_item_)->data) diff --git a/main/osmroute.h b/main/osmroute.h index e752a89..9a213b0 100644 --- a/main/osmroute.h +++ b/main/osmroute.h @@ -42,16 +42,26 @@ #include #include -#ifdef HAVE_SDL +#ifndef FALSE + #define FALSE 0 +#endif + +#ifndef TRUE + #define TRUE 1 +#endif + +/* #ifdef HAVE_SDL #include #define FALSE 0 #define TRUE 1 #endif + #ifdef ANDROID #define FALSE 0 #define TRUE 1 #endif +*/ /* * Standard gettext macros.