diff --git a/ChangeLog b/ChangeLog index 35f678e..c3ddc63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ Version 0.0.2: name changed to spOSMroute, since on there had been another OSMroute already. ============================================================================= +(2014-02-27): +- fixed: progressbar is back working again. +- fixed: during start up the draw_setscalef function wasn't called. +- got all systems back working again: Windows, WindowsCE, SDLGL, Android + and GTK + (2014-02-12): - fixed: quiting while in routing did not work. - fixed: gui_list elements where almost unable use. diff --git a/Makefile b/Makefile index 674df66..9bde60e 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ sposmedit: do if ! make -C $$i; then \ exit -2; \ fi done - $(CC) -o sposmedit -lmain -lncurses -lmapsys -lbase -lmain -Lbase -Lmapsys -Lmain `pkg-config --libs libxml-2.0` -lbz2 -ggdb -pg $(DEBUG) + $(CC) -o sposmedit -lm -lmain -lncurses -lmapsys -lbase -lmain -Lbase -Lmapsys -Lmain `pkg-config --libs libxml-2.0` -lbz2 -ggdb -pg $(DEBUG) cleanapp: rm -rf sposmedit diff --git a/doc/TechDoc.odt b/doc/TechDoc.odt index 3e18af2..8780dc0 100644 Binary files a/doc/TechDoc.odt and b/doc/TechDoc.odt differ diff --git a/draw/draw.c b/draw/draw.c index 3c60bf0..ac4d983 100644 --- a/draw/draw.c +++ b/draw/draw.c @@ -198,7 +198,7 @@ void draw_init () { view_lon = cfg.last_lon; view_lat = cfg.last_lat; - view_scale = cfg.last_scale; + draw_setscalef (cfg.last_scale); }; void draw_init_color () { @@ -284,7 +284,7 @@ void draw_init_color () { case (MWAY_unknown): case (MWAY_unknown_way): default: - gfx_color_alloc (&draw_linestyle[n].c, 0x7000,0x5000,0x5000); + gfx_color_alloc (&draw_linestyle[n].c, 0xA000,0x5000,0x5000); break; } } diff --git a/draw/draw_gui.c b/draw/draw_gui.c index 2c070b7..745c87d 100644 --- a/draw/draw_gui.c +++ b/draw/draw_gui.c @@ -215,18 +215,31 @@ void draw_gui () { ls.width = 1.0; ls.c = ls.borderc = color[COLOR_white][3]; - p1.x = gfx_screensize.x/2-100; - p2.x = gfx_screensize.x/2+100; + p1.x = gfx_screensize.x/2-101; + p2.x = gfx_screensize.x/2+101; p1.y = gfx_screensize.y-32; p2.y = gfx_screensize.y-10; - + + draw_polygonstart (); + draw_polygonadd (p1.x, p1.y); + draw_polygonadd (p2.x, p1.y); + draw_polygonadd (p2.x, p2.y); + draw_polygonadd (p1.x, p2.y); + draw_polygonfinish (NULL, ls, &color[COLOR_white][0], 1); + + p1.x = gfx_screensize.x/2-(float)(100.0*app.statusline_progress); + p2.x = gfx_screensize.x/2+(float)(100.0*app.statusline_progress); + p1.y = gfx_screensize.y-31; + p2.y = gfx_screensize.y-11; + draw_polygonstart (); draw_polygonadd (p1.x, p1.y); draw_polygonadd (p2.x, p1.y); draw_polygonadd (p2.x, p2.y); draw_polygonadd (p1.x, p2.y); - draw_polygonfinish (NULL, ls, &color[COLOR_blue][3], 1); - gfx_draw_text (NULL, p1.x + 2, p1.y + 2, app.statusline_text, &color[COLOR_white][3]); + draw_polygonfinish (NULL, ls, &color[COLOR_blue][3], 0); + + gfx_draw_text (NULL, gfx_screensize.x/2-98, p1.y + 2, app.statusline_text, &color[COLOR_white][3]); } /* diff --git a/gtk/gtk_main_menu.c b/gtk/gtk_main_menu.c index 35e0d97..5520ef6 100644 --- a/gtk/gtk_main_menu.c +++ b/gtk/gtk_main_menu.c @@ -63,7 +63,7 @@ void main_menu_refresh () { he.lon = view_lon + 2.0 * map_km2lon(view_scale * ((float)ss.x/10), he.lat); map_load_web (hs, he); - app_status ("", -1); + app_status (-1, "", 0.0); draw (); } }; @@ -80,9 +80,9 @@ void main_menu_mapdefrag () { void main_menu_saveall () { - app_status (_("save all"), -1); + app_status (-1,_("save all"), 0.0); map_save_all(); - app_status ("", -1); + app_status (-1, "", 0.0); }; @@ -127,14 +127,13 @@ void main_menu_osmimport () { osm_loadfile (fn); draw_redrawmap (); } - app_status ("", -1); - app.status = APPSTATUS_nothing; + app_status (APPSTATUS_nothing, "", 0.0); }; void main_menu_map_searchsort () { map_search_sort (); - app_status ("", -1); + app_status (-1, "", 0.0); }; @@ -145,7 +144,7 @@ void main_menu_map_searchrefresh () { map_search_get_filename (lfn, LEN_FILENAME); map_webload (rfn, lfn, NULL); - app_status ("", -1); + app_status (-1, "", 0.0); }; diff --git a/gtk/gtk_main_wnd.c b/gtk/gtk_main_wnd.c index 024e977..fd50747 100644 --- a/gtk/gtk_main_wnd.c +++ b/gtk/gtk_main_wnd.c @@ -211,7 +211,7 @@ void main_wnd_loop (long long int cur, long long int max) { t1 = time (NULL); if (to != t1) { - app_status (NULL, 0); + app_status (-1, NULL, 0.0); to = t1; } diff --git a/main/gui_search.c b/main/gui_search.c index d1b6a58..388af9c 100644 --- a/main/gui_search.c +++ b/main/gui_search.c @@ -29,9 +29,6 @@ #define SEARCH_MAXRESULT 32 void gui_search_close (); -void gui_search_refresh (); -void gui_search_next (); -void gui_search_prev (); void gui_search_city (); void gui_search_switch (int pos); diff --git a/main/main.c b/main/main.c index 4355333..5c1de3b 100644 --- a/main/main.c +++ b/main/main.c @@ -62,12 +62,17 @@ int app_loop () { /****************************************************************************** * update stausbar */ -void app_status (char *text, int progress) { +void app_status (int status, char *text, float progress) { static char oldtext[255]; if (text) strncpy (app.statusline_text, text, 255); else strncpy (app.statusline_text, oldtext, 255); - app.statusline_progress = progress; + + if (status >= 0) app.status = status; + + if (progress < 0.0) app.statusline_progress = 0.0; + else if (progress > 1.0) app.statusline_progress = 1.0; + else app.statusline_progress = progress; #ifdef SPOSMROUTE if (currentwin) currentwin->screen_changed = 1; diff --git a/main/osmroute.h b/main/osmroute.h index 491b49e..f1db64a 100644 --- a/main/osmroute.h +++ b/main/osmroute.h @@ -139,7 +139,7 @@ struct cfgdata { struct appdata { char statusline_text[255]; - int statusline_progress; + float statusline_progress; // value in 0.0 to 1.0 int status; float debug_lon; float debug_lat; @@ -174,7 +174,7 @@ extern struct appdata app; */ extern int app_init (int argc, char **argv); extern int app_shutdown (); -extern void app_status (char *text, int progress); +extern void app_status (int status, char *text, float progress); extern int app_loop (); extern void config_init (); diff --git a/mapsys/map.c b/mapsys/map.c index fa99523..1d50dc2 100644 --- a/mapsys/map.c +++ b/mapsys/map.c @@ -251,6 +251,9 @@ void map_refresh (float lon, float lat) { map_ls_get_filename (rfn, LEN_FILENAME, map_geo2igeo (lon), map_geo2igeo (lat)); #if defined(SPOSMROUTE) map_webload (fn, rfn, NULL); + map_clear (); + map_init (); + draw_redrawmap (); #endif }; @@ -304,6 +307,12 @@ void map_refreshblock (struct map_pos start, struct map_pos end, float delta) { #endif } } + + map_clear (); + map_init (); +#if defined(SPOSMROUTE) + draw_redrawmap (); +#endif }; diff --git a/mapsys/map_hash.c b/mapsys/map_hash.c index fb7de83..5b87283 100644 --- a/mapsys/map_hash.c +++ b/mapsys/map_hash.c @@ -167,7 +167,7 @@ void map_hash_free (struct map_hash *mh, int noremove) { * allocate new memory, copy all the data and free the momory again. */ struct map_hash *map_hash_realloc (struct map_hash *mhorg, int memsize) { - struct map_hash *res; + struct map_hash *res = NULL; int i = memsize; if (i < mhorg->datasize) return res; diff --git a/mapsys/map_loadsave.c b/mapsys/map_loadsave.c index b6cf829..4598232 100644 --- a/mapsys/map_loadsave.c +++ b/mapsys/map_loadsave.c @@ -217,7 +217,7 @@ struct map_lsstat *map_ls_statopen (char *fname) { mlss.r_fd = mlss.w_fd = 0; mlss.changed = 0; - if (file_exist (mlss.fname) == NULL) { + if (file_exist (mlss.fname) == 0) { d_printf ("map_ls_statopen file '%s' not found.", mlss.fname); mlss.r_fd = 0; return &mlss; diff --git a/mapsys/map_osmload.c b/mapsys/map_osmload.c index bfd81f6..c4ff1d7 100644 --- a/mapsys/map_osmload.c +++ b/mapsys/map_osmload.c @@ -737,7 +737,7 @@ void osm_waynodes_check () { for (hid = 0; hid < osm_hidmax; hid++) { sprintf (text, _("checking for waynodes in hid %d"), hid); - app_status (text, 0); + app_status (-1, text, 0.0); ohash = osm_hashnodes_load (hid, 1); for (i = 0; i < ohash->hash_cnt; i++) { if ((i%1024) == 0) main_wnd_loop (i, ohash->hash_cnt); @@ -1605,7 +1605,7 @@ void osm_processdata (xmlTextReaderPtr reader) { osm.oway->type -= MWAY_MAX; osm_area_cnt++; - osm_area_save (osm.oway, &osm.area); + if (osm.oway->type != MAREA_ignore) osm_area_save (osm.oway, &osm.area); } else { osm_ways_cnt++; @@ -1724,7 +1724,7 @@ void osm_processdata (xmlTextReaderPtr reader) { else if (strcmp ((char*) v, (char*) "steps") == 0) osm.oway->type = MWAY_footway; else { osm.oway->type = MWAY_unknown_way; - // printf ("unknown highway:'%s'\n", v); + printf ("unknown highway:'%s'\n", v); } } @@ -1922,7 +1922,7 @@ void osm_loadfile (char *fn) { osm_init (); if (fn == NULL) return; - app_status (_("converting file"), 0); + app_status (-1, _("converting file"), 0.0); d_printf ("osm_loadfile (%s)", fn); /* check the extension of the osm file */ @@ -1984,7 +1984,7 @@ void osm_loadfile (char *fn) { /* reset the locale setting back to the environment setting */ setlocale (LC_ALL, NULL); osm_free (); - app_status (_(""), -1); + app_status (-1, _(""), 0.0); }; @@ -2023,7 +2023,7 @@ void map_load_web (struct map_pos hs, struct map_pos he) { #if defined (_LINUX_) osm_load_from_web_end = he; osm_load_from_web_start = hs; - app_status (_("refresh from OpenStreetMap.org"), 0); + app_status (-1, _("refresh from OpenStreetMap.org"), 0.0); for (ret = 0; ret < MLWEBMAX; ret++) wl[ret].p.used = 0; for (ret = 0; ret < 13; ret++) args[ret] = NULL; @@ -2039,7 +2039,7 @@ void map_load_web (struct map_pos hs, struct map_pos he) { ret = execwait (&wl[i].p); if (ret == 1) { osm_loadfile (wl[i].fcache); - app_status (_("refresh from OpenStreetMap.org"), 0); + app_status (-1, _("refresh from OpenStreetMap.org"), 0.0); main_wnd_update (); } } diff --git a/mapsys/map_searchhash.c b/mapsys/map_searchhash.c index af8b5bf..f6fb7b3 100644 --- a/mapsys/map_searchhash.c +++ b/mapsys/map_searchhash.c @@ -200,7 +200,7 @@ void map_search_sort_alg1 (struct maps_sort *data) { } if (j % 100 == 0) { sprintf (text, _("Sorting search.mapidx %d/%d"), j, data->cnt); - app_status (text, 0); + app_status (-1, text, 0.0); main_wnd_update (); } } @@ -350,7 +350,7 @@ void map_search_sort_alg2 (struct maps_sort *data) { /* display update on the screen */ if (to++ < 0 || to > 250) { sprintf (text, _("sorting search.mapidx %d"), maps_qs_pos); - app_status (text, 0); + app_status (-1, text, 0.0); main_wnd_update (); to = 0; } @@ -440,7 +440,7 @@ void map_search_sort () { lid = msd.id; if (i % 10000 == 0) { sprintf (text, _("save search.mapidx %d"), i); - app_status (text, 0); + app_status (-1, text, 0.0); main_wnd_update (); } } @@ -471,8 +471,8 @@ void map_search_sort () { * the size on file. */ static char maps_line[MAP_SEARCHLINE_LEN*4]; -#warning maps_readpos.. read current position without checing and return -#warning start of next line. +#warning maps_readpos.. read current position without checking +#warning and return start of next line. /* * read an random position, check if we are at the start of valid data. If not diff --git a/mapsys/map_webload.c b/mapsys/map_webload.c index 7a0b66f..67370a7 100644 --- a/mapsys/map_webload.c +++ b/mapsys/map_webload.c @@ -346,8 +346,8 @@ int map_webload (char *remotefn, char *localfn, char *statustext) { else strncpy (_statustext, statustext, 255); d_printf ("map_webload started"); - app.status = APPSTATUS_loadfromweb; - + app_status(APPSTATUS_loadfromweb, NULL, 0.0); + strncpy (host, HOST, NET_HOSTLEN); strncpy (port, PORT, NET_PORTLEN); sock = tcp_connect (host, port); @@ -399,6 +399,7 @@ int map_webload (char *remotefn, char *localfn, char *statustext) { to = time(NULL); if (filesize > 0) sprintf (text, _("%s%d/%dkb loaded"), _statustext, filelen/1024, filesize/1024); else sprintf (text, _("%s%dkb loaded"), _statustext, filelen/1024); + app_status(-1, text, (float)((float)filelen/(float)filesize)); main_wnd_update (); } } @@ -418,12 +419,7 @@ int map_webload (char *remotefn, char *localfn, char *statustext) { if (file_exist (tmpfn)) unlink (tmpfn); } - app.status = APPSTATUS_nothing; - app_status(NULL, -1); - map_clear (); - map_init (); - draw_redrawmap (); - draw (); + app_status(APPSTATUS_nothing, NULL, 0.0); return 0; }; diff --git a/wince/wince_main.c b/wince/wince_main.c index 6a18d79..748adae 100644 --- a/wince/wince_main.c +++ b/wince/wince_main.c @@ -488,7 +488,7 @@ void DoMenuActions(HWND hWnd, INT id) { map_webload (rfn, lfn, NULL); map_search_sort (); #endif - app_status ("", -1); + app_status (-1, "", 0.0); } break; case IDM_MENU_MAP_WEBLOAD: