softkeyboard adding enter key.

master
steffen 13 years ago
parent 5e5ef1b898
commit f6afe7f426

@ -1,4 +1,4 @@
/* $Id: gui.c,v 1.23 2013/04/03 21:52:27 steffen Exp $ */ /* $Id: gui.c,v 1.24 2013/06/18 22:24:20 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui.c * gui.c
* *
@ -169,6 +169,10 @@ int gui_event (GUIEvent event) {
event.guiwin_mpos.y = event.scr_mpos.y - currentwin->y; event.guiwin_mpos.y = event.scr_mpos.y - currentwin->y;
if (gui_window_event (currentwin, &event)) return 1; if (gui_window_event (currentwin, &event)) return 1;
} }
else {
event.guiwin_mpos.x = -1;
event.guiwin_mpos.y = -1;
}
/* no gui active nor any window is responsible.. */ /* no gui active nor any window is responsible.. */
// d_printf ("no event.."); // d_printf ("no event..");

@ -157,7 +157,7 @@ struct _GUISoftkeyboard_ {
int mode; int mode;
int enabled; int enabled;
int linepos[2][4]; /* y positions of lines */ int linepos[2][4]; /* y positions of lines */
int btnpos[2][7]; /* holds position keys: Left, Right, Shift, Symbols, Space, Del, Close */ int btnpos[2][8]; /* holds position keys: Left, Right, Shift, Symbols, Space, Del, Close */
iPoint offset; /* screenoffset .. will be set during last draw */ iPoint offset; /* screenoffset .. will be set during last draw */
struct image *screen; struct image *screen;
int last_col; int last_col;
@ -228,5 +228,5 @@ extern void gui_mainmenu_show ();
extern void gui_buttons_show (); extern void gui_buttons_show ();
extern void gui_config_show (); extern void gui_config_show ();
extern void gpswin_show (); extern void gpswin_show ();
extern void wnd_routing_show ();
#endif #endif

@ -1,4 +1,4 @@
/* $Id: gui_softkeyboard.c,v 1.9 2013/06/17 20:42:58 steffen Exp $ */ /* $Id: gui_softkeyboard.c,v 1.10 2013/06/18 22:24:21 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][7] = { { 2.0, 6.0, 12.0, 20.0, 32.0, 70.0, 80.0 }, static float _btnpos[2][8] = { { 2.0, 6.0, 10.0, 16.0, 28.0, 70.0, 80.0, 90.0 },
{ 6.0, 10.0, 18.0, 30.0, 68.0, 78.0, 98.0 } }; { 6.0, 10.0, 16.0, 26.0, 68.0, 80.0, 90.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) {
@ -136,7 +136,7 @@ void gui_softkeyb_draw () {
} }
/* draw the last keys */ /* draw the last keys */
for (j = 3, i = 0; i < 7; i++) { for (j = 3, i = 0; i < 8; 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]);
@ -161,6 +161,9 @@ void gui_softkeyb_draw () {
snprintf (c, 16, _("Del")); snprintf (c, 16, _("Del"));
break; break;
case (6): case (6):
snprintf (c, 16, _("Enter"));
break;
case (7):
snprintf (c, 16, _("Close")); snprintf (c, 16, _("Close"));
break; break;
} }
@ -202,7 +205,7 @@ int gui_softkeyb_event (GUIEvent *event) {
} }
} }
for (i = 0; i < 7; i++) { for (i = 0; i < 8; 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) {
@ -250,6 +253,15 @@ int gui_softkeyb_event (GUIEvent *event) {
return 1; return 1;
break; break;
case (6): case (6):
newevent.key = 0x0d;
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);
return 1;
break;
case (7):
softkeyb->enabled = 0; softkeyb->enabled = 0;
currentwin->screen_changed = 1; currentwin->screen_changed = 1;
draw (); draw ();

@ -1,4 +1,4 @@
/* $Id: gui_window.c,v 1.8 2013/04/03 21:52:27 steffen Exp $ */ /* $Id: gui_window.c,v 1.9 2013/06/18 22:24:21 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui_window.c * gui_window.c
* *
@ -148,5 +148,12 @@ int gui_window_event (GUIWindow *win, GUIEvent *event) {
} }
win->event_called = 0; win->event_called = 0;
if (event->event == EGUI_MOUSERELEASED || event->event == EGUI_MOUSEPRESSED) {
if (event->guiwin_mpos.x >=0 && event->guiwin_mpos.x < win->w
&& event->guiwin_mpos.y >=0 && event->guiwin_mpos.y < win->h)
return 1;
}
return 0; return 0;
}; };

@ -3,7 +3,7 @@ include ../Makefile.rules
OBJBASE = favorites.o main.o OBJBASE = favorites.o main.o
ifeq "$(GTKVERSION)" "1" ifeq "$(GTKVERSION)" "1"
GTK = linux_gps.o gps.o routing.o gui_selectdir.o gui_config.o gui_buttons.o gui_favorites.o gui_mainmenu.o gui_search.o guiw_gpsfile.o GTK = linux_gps.o gps.o routing.o gui_selectdir.o gui_config.o gui_buttons.o gui_favorites.o gui_mainmenu.o gui_search.o guiw_gpsfile.o wnd_routing.o
endif endif
ifeq "$(NCURSESVERSION)" "1" ifeq "$(NCURSESVERSION)" "1"
@ -11,15 +11,15 @@ CURSES = ncurses_main.o
endif endif
ifeq "$(WINVERSION)" "1" ifeq "$(WINVERSION)" "1"
WIN = gps.o routing.o gui_buttons.o gui_config.o gui_selectdir.o gui_favorites.o gui_mainmenu.o gui_search.o guiw_gpsfile.o WIN = gps.o routing.o gui_buttons.o gui_config.o gui_selectdir.o gui_favorites.o gui_mainmenu.o gui_search.o guiw_gpsfile.o wnd_routing.o
endif endif
ifeq "$(WINCEVERSION)" "1" ifeq "$(WINCEVERSION)" "1"
WIN = gps.o routing.o gui_buttons.o gui_config.o gui_favorites.o gui_selectdir.o gui_mainmenu.o gui_search.o guiw_gpsfile.o WIN = gps.o routing.o gui_buttons.o gui_config.o gui_favorites.o gui_selectdir.o gui_mainmenu.o gui_search.o guiw_gpsfile.o wnd_routing.o
endif endif
ifeq "$(SDLGLVERSION)" "1" ifeq "$(SDLGLVERSION)" "1"
SDLGL = linux_gps.o gps.o routing.o gui_config.o gui_buttons.o gui_favorites.o gui_selectdir.o gui_mainmenu.o gui_search.o guiw_gpsfile.o SDLGL = linux_gps.o gps.o routing.o gui_config.o gui_buttons.o gui_favorites.o gui_selectdir.o gui_mainmenu.o gui_search.o guiw_gpsfile.o wnd_routing.o
endif endif

@ -1,4 +1,4 @@
/* $Id: gui_mainmenu.c,v 1.11 2013/05/29 14:08:41 steffen Exp $ */ /* $Id: gui_mainmenu.c,v 1.13 2013/06/18 22:25:57 steffen Exp $ */
/*************************************************************************** /***************************************************************************
* gui_mainmenu.c * gui_mainmenu.c
* *
@ -105,6 +105,8 @@ void gui_mainmenu_close () {
void gui_mainmenu_routing () { void gui_mainmenu_routing () {
gui_close ();
wnd_routing_show ();
}; };

@ -0,0 +1,38 @@
/* $Id: wnd_routing.c,v 1.2 2013/06/18 22:26:16 steffen Exp $ */
/***************************************************************************
* wnd_routing.c
*
* Created on: 18.06.2013
* Copyright (C) 2011 Steffen Pohle
* steffen@gulpe.de
****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* main.c is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "osmroute.h"
#include "draw.h"
#include "gui.h"
#include "system.h"
static GUIWindow wrouting = {0};
void wnd_routing_show () {
if (wrouting.screen == NULL) gui_window_new (&wrouting, 220, 260, _("Routing.."));
wrouting.screen_changed = 1;
wrouting.style = WGUI_S_VCENTER | WGUI_S_HCENTER;
gui_show (&wrouting);
};
Loading…
Cancel
Save