--- trunk/src/map-tool.c 2009/11/23 20:12:22 205 +++ trunk/src/map-tool.c 2009/11/28 14:20:28 220 @@ -180,6 +180,20 @@ } } +static void map_draw_wpt(GtkWidget *map, cache_t *cache, wpt_t *wpt) { + /* only draw wpts that don't equal the main point */ + if(pos_differ(&cache->pos, &wpt->pos)) { + if(!isnan(wpt->pos.lat) && !isnan(wpt->pos.lon)) { + GdkPixbuf *icon = + icon_get(ICON_WPT, (wpt->sym!=WPT_SYM_UNKNOWN)? + wpt->sym:WPT_SYM_REFPOINT); + + osm_gps_map_add_image(OSM_GPS_MAP(map), + wpt->pos.lat, wpt->pos.lon, icon); + } + } +} + static void map_draw_gpx(appdata_t *appdata, cache_display_t *caches, GtkWidget *map, gpx_t *gpx, cache_t *nav, gboolean semi) { @@ -200,6 +214,15 @@ /* if nav is not given do what semi sais */ map_draw_cache(map, cache, nav?(cache != nav):semi); caches[i].id = cache->id; + + /* also draw waypoints of nav cache */ + if(nav && cache == nav) { + wpt_t *wpt = cache->wpt; + while(wpt) { + map_draw_wpt(map, cache, wpt); + wpt = wpt->next; + } + } } cache = cache->next; @@ -333,6 +356,21 @@ #endif } + /* also mark geomath position */ + + /* remove all existing appearances of this icon first */ + osm_gps_map_remove_image(OSM_GPS_MAP(context->widget), + icon_get(ICON_MISC, 6)); + + if(!isnan(context->appdata->geomath.lat) && + !isnan(context->appdata->geomath.lon)) { + + osm_gps_map_add_image(OSM_GPS_MAP(context->widget), + context->appdata->geomath.lat, + context->appdata->geomath.lon, + icon_get(ICON_MISC, 6)); + } + if(name) { char *title = g_strdup_printf(_("Map - %s"), name); g_free(name); @@ -825,18 +863,26 @@ return FALSE; } -#ifdef USE_MAEMO static gboolean on_focus_out(GtkWidget *widget, GdkEventFocus *event, gpointer data) { map_context_t *context = (map_context_t*)data; printf("map lost focus\n"); + + /* save new map position */ + gfloat lat, lon; + g_object_get(widget, "latitude", &lat, "longitude", &lon, NULL); + + context->appdata->map.pos.lat = lat; + context->appdata->map.pos.lon = lon; + +#ifdef USE_MAEMO gtk_timeout_remove(context->handler_id); context->handler_id = 0; +#endif return FALSE; } -#endif void map_update(appdata_t *appdata) { printf("map_update\n"); @@ -931,10 +977,8 @@ g_signal_connect(G_OBJECT(context->widget), "focus-in-event", G_CALLBACK(on_focus_in), context); -#ifdef USE_MAEMO g_signal_connect(G_OBJECT(context->widget), "focus-out-event", G_CALLBACK(on_focus_out), context); -#endif g_signal_connect(G_OBJECT(context->widget), "configure-event", G_CALLBACK(on_map_configure), context);