gui_list fixed, quit during routign fixed.

master
steffen 12 years ago
parent 3c01d729cd
commit e93500869a

@ -1,6 +1,11 @@
Version 0.0.2: name changed to spOSMroute, since on there had been another
OSMroute already.
=============================================================================
(2014-02-12):
- fixed: quiting while in routing did not work.
- fixed: gui_list elements where almost unable use.
(2014-02-05):
- fixed: windowsCE version is running again.
- fixed: pressing the button long time did not work.

@ -39,7 +39,7 @@ sposmroutegl:
do if ! make -C $$i; then \
exit -2; \
fi done
$(CC) -o sposmroute -lsdlgl -lm -lmain -lgui -lmain -lmapsys -ldraw -lsdlgl -lbase -Lbase -Lmain -Lsdlgl -Ldraw -Lgui -Lmapsys -lbz2 $(DEBUG) `sdl-config --libs` `pkg-config --libs freetype2 libpng` -lGL -lGLU -L/usr/X11R6/lib -L/usr/lib
$(CC) -o sposmroute -lsdlgl -lm -lmain -lgui -lmain -lmapsys -ldraw -lsdlgl -lbase -lmain -Lbase -Lmain -Lsdlgl -Ldraw -Lgui -Lmapsys -lbz2 $(DEBUG) `sdl-config --libs` `pkg-config --libs freetype2 libpng` -lGL -lGLU -L/usr/X11R6/lib -L/usr/lib
cleanapp:
rm -rf sposmroutegl
endif

@ -82,7 +82,8 @@ LOCAL_SRC_FILES := \
main/favorites.c main/gui_buttons.c main/gui_mainmenu.c main/guiw_gpsfile.c \
main/main.c main/routing.c main/gps.c main/gui_favorites.c \
main/gui_search.c main/gui_config.c main/gui_selectdir.c main/gui_selectfile.c \
main/linux_gps.c main/wnd_routing.c
main/linux_gps.c main/wnd_routing.c main/wnd_mapcontext.c
# LOCAL_LDLIBS := -shared -llog -landroid -lEGL -lGLESv1_CM -lz
LOCAL_LDLIBS := -shared -llog -landroid -lEGL -lGLESv2 -lz
LOCAL_STATIC_LIBRARIES := android_native_app_glue zlib png freetype2-static

@ -90,6 +90,7 @@ void draw_mousebtnup (int x, int y, int btn)
{
time_t t = time(NULL);
float lon, lat;
int dx, dy;
if (!mousebtn) return; /* button is no longer pressed */
mousebtn = 0;
@ -105,14 +106,13 @@ void draw_mousebtnup (int x, int y, int btn)
{
lat = -map_km2lat(((float)(y-gfx_screensize.y/2)) * view_scale);
lon = map_km2lon(((float)(x-gfx_screensize.x/2)) * view_scale, view_lat + lat);
dx = abs (mousebtnpresspos.x-x)*100/gfx_screensize.x;
dy = abs (mousebtnpresspos.y-y)*100/gfx_screensize.y;
/* short time button pressing */
if (t - mousebtnpresstime <= 1)
{
/* check for movement? */
int dx = abs (mousebtnpresspos.x-x)*100/gfx_screensize.x;
int dy = abs (mousebtnpresspos.y-y)*100/gfx_screensize.y;
if (dx < 10 && dy < 10)
{
if (select_enabled)
@ -127,9 +127,10 @@ void draw_mousebtnup (int x, int y, int btn)
}
}
}
else
else if (mousebtnpresslongtime && dx < 10 && dy < 10)
{
/* long time button pressed */
wnd_mapcontext_show ();
}
}

@ -231,4 +231,6 @@ extern char *gui_sfile_show (char *startpath);
extern void gui_config_show ();
extern void gpswin_show ();
extern void wnd_routing_show ();
extern void wnd_mapcontext_show ();
#endif

@ -1,4 +1,4 @@
/* $Id: gui_list.c,v 1.12 2013/06/14 23:03:05 steffen Exp $ */
/* $Id: gui_list.c,v 1.13 2014/02/12 21:21:07 steffen Exp $ */
/***************************************************************************
* gui_list.c
*
@ -28,6 +28,8 @@
#include "gui.h"
#include "system.h"
#define GUI_ARROW_WIDTH 16
#define GUI_ARROW_HEIGHT 16
/****************************************************************************
* list
@ -70,9 +72,9 @@ void gui_list_draw (GUIItem *item) {
if (i < 0) y = item->y + item->h;
else y = item->y;
x = item->x + item->w;
for (j = 0; j <= 10; j++) {
gfx_draw_line (currentwin->screen, x - 10, y, x-j, y + i*10, ls);
gfx_draw_line (currentwin->screen, x - 10 -j, y+ i*10, x-10, y, ls);
for (j = 0; j <= GUI_ARROW_WIDTH/2; j++) {
gfx_draw_line (currentwin->screen, x - GUI_ARROW_WIDTH/2, y, x-j, y + i*GUI_ARROW_HEIGHT, ls);
gfx_draw_line (currentwin->screen, x - GUI_ARROW_WIDTH/2 -j, y+ i*GUI_ARROW_HEIGHT, x-GUI_ARROW_WIDTH/2, y, ls);
}
}
};
@ -100,8 +102,8 @@ int gui_list_event (GUIItem *item, GUIEvent *event) {
gui_set_focus (item);
if (y <= 10 && x >= item->w - 10) list->vs--;
else if (y >= item->h - 10 && x >= item->w - 10) list->vs++;
if (y <= GUI_ARROW_HEIGHT && x >= item->w - GUI_ARROW_WIDTH) list->vs--;
else if (y >= item->h - GUI_ARROW_HEIGHT && x >= item->w - GUI_ARROW_WIDTH) list->vs++;
else { /* select entry */
i = (y-5)/16 + list->vs;
list->selected = i;

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

@ -1,4 +1,4 @@
/* %Id: Exp $ */
/* $Id: gui_selectfile.c,v 1.3 2014/02/12 21:23:06 steffen Exp $ */
/***************************************************************************
* gui_selectdir.c
*

@ -1,3 +1,5 @@
/* $Id: routing.c,v 1.4 2014/02/12 21:23:06 steffen Exp $ */
/***************************************************************************
* routing.c
*
@ -968,6 +970,8 @@ void route_start (struct map_pos dest) {
}
}
if (app.status == APPSTATUS_quit) route_stop ();
if (route->state == ROUTING_CALC) {
if ((++calcto) % 200 == 0) main_wnd_update ();
}

@ -0,0 +1,100 @@
/* $Id: wnd_mapcontext.c,v 1.1 2014/02/12 21:21:08 steffen Exp $ */
/***************************************************************************
* wnd_mapcontext.c
*
* 2014-02-12
* Copyright (C) 2014 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.
*
* sposmroute 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"
#include "routing.h"
void wnd_mapcontext_close ();
void wnd_mapcontext_addfav ();
void wnd_mapcontext_setdest ();
GUIItem *mcbtn_close = NULL;
GUIItem *mcbtn_addfav = NULL;
GUIItem *mcbtn_setdest = NULL;
static GUIWindow wmmapc = {0};
void wnd_mapcontext_show () {
if (wmmapc.screen == NULL) gui_window_new (&wmmapc, 200, 200, _("Map Menu"));
wmmapc.screen_changed = 1;
wmmapc.style = WGUI_S_VCENTER | WGUI_S_HCENTER;
/* add buttons */
if (mcbtn_addfav == NULL) mcbtn_addfav = gui_button_new (_("Add Favorites"), 5, 30, 110, 20);
if (mcbtn_setdest == NULL) mcbtn_setdest = gui_button_new (_("Set Destination"), 5, 60, 110, 20);
if (select_enabled) {
GUI_BUTTON_T(mcbtn_setdest)->col = GUI_BUTTON_T(mcbtn_addfav)->col = &color[COLOR_white][1];
GUI_BUTTON_T(mcbtn_setdest)->textcol = GUI_BUTTON_T(mcbtn_addfav)->textcol = &color[COLOR_white][3];
GUI_BUTTON_T(mcbtn_addfav)->callback_clicked = (void*)wnd_mapcontext_addfav;
GUI_BUTTON_T(mcbtn_setdest)->callback_clicked = (void*)wnd_mapcontext_setdest;
}
else {
GUI_BUTTON_T(mcbtn_setdest)->col = GUI_BUTTON_T(mcbtn_addfav)->col = &color[COLOR_white][1];
GUI_BUTTON_T(mcbtn_setdest)->textcol = GUI_BUTTON_T(mcbtn_addfav)->textcol = &color[COLOR_white][2];
GUI_BUTTON_T(mcbtn_addfav)->callback_clicked = NULL;
GUI_BUTTON_T(mcbtn_setdest)->callback_clicked = NULL;
}
gui_window_item_add (&wmmapc, mcbtn_addfav);
gui_window_item_add (&wmmapc, mcbtn_setdest);
if (mcbtn_close == NULL) {
mcbtn_close = gui_button_new (_("Close"), 5, 90, 110, 20);
GUI_BUTTON_T(mcbtn_close)->callback_clicked = (void*)wnd_mapcontext_close;
}
gui_window_item_add (&wmmapc, mcbtn_close);
gui_show (&wmmapc);
};
void wnd_mapcontext_close () {
d_printf ("gui_mapcontext_close");
gui_close ();
};
void wnd_mapcontext_setdest () {
static int _setdest = 0;
d_printf ("gui_mapcontext_setdest");
d_printf ("set destination routing start");
gui_close ();
if (select_enabled == 0) d_printf ("no destination selected.");
if (_setdest == 1) d_printf ("routing already active");
else {
_setdest = 1;
route_start (select_pos);
_setdest = 0;
}
};
void wnd_mapcontext_addfav () {
d_printf ("gui_mapcontext_addfav");
gui_close ();
};

@ -1,4 +1,4 @@
/* $Id: sdl_main.c,v 1.15 2014/02/12 21:23:06 steffen Exp $ */
#include <SDL.h>
#include "osmroute.h"
#include "system.h"
@ -295,7 +295,7 @@ int main (int argc, char **argv) {
void main_wnd_update () {
d_printf ("main_wnd_update");
d_printf ("main_wnd_update : %d", app.status);
while (msdl_eventloop ());
}

Loading…
Cancel
Save