--- trunk/src/osm-gps-map.c 2009/08/27 08:29:48 82 +++ trunk/src/osm-gps-map.c 2009/08/30 19:05:44 86 @@ -1496,7 +1496,7 @@ gboolean handled = FALSE; int step = GTK_WIDGET(widget)->allocation.width/OSM_GPS_MAP_SCROLL_STEP; - printf("key event with keyval %x\n", event->keyval); + // printf("key event with keyval %x\n", event->keyval); // the map handles some keys on its own ... switch(event->keyval) { @@ -1564,7 +1564,7 @@ #endif default: - printf("unhandled key event with keyval %x\n", event->keyval); + // printf("unhandled key event with keyval %x\n", event->keyval); break; } @@ -2183,50 +2183,62 @@ GdkDrawable *drawable = widget->window; #endif - gdk_draw_drawable (drawable, - widget->style->fg_gc[GTK_WIDGET_STATE (widget)], - priv->pixmap, - 0,0, - priv->drag_mouse_dx - EXTRA_BORDER, - priv->drag_mouse_dy - EXTRA_BORDER, - -1,-1); - - //Paint white outside of the map if dragging. Its less - //ugly than painting the corrupted map - if(priv->drag_mouse_dx>EXTRA_BORDER) { - gdk_draw_rectangle (drawable, - widget->style->white_gc, - TRUE, - 0, 0, - priv->drag_mouse_dx - EXTRA_BORDER, - widget->allocation.height); - } - else if (-priv->drag_mouse_dx > EXTRA_BORDER) + if (!priv->dragging && event) { - gdk_draw_rectangle (drawable, - widget->style->white_gc, - TRUE, - priv->drag_mouse_dx + widget->allocation.width + EXTRA_BORDER, 0, - -priv->drag_mouse_dx - EXTRA_BORDER, - widget->allocation.height); - } - - if (priv->drag_mouse_dy>EXTRA_BORDER) { - gdk_draw_rectangle (drawable, - widget->style->white_gc, - TRUE, - 0, 0, - widget->allocation.width, - priv->drag_mouse_dy - EXTRA_BORDER); + gdk_draw_drawable (drawable, + widget->style->fg_gc[GTK_WIDGET_STATE (widget)], + priv->pixmap, + event->area.x + EXTRA_BORDER, event->area.y + EXTRA_BORDER, + event->area.x, event->area.y, + event->area.width, event->area.height); } - else if (-priv->drag_mouse_dy > EXTRA_BORDER) + else { - gdk_draw_rectangle (drawable, - widget->style->white_gc, - TRUE, - 0, priv->drag_mouse_dy + widget->allocation.height + EXTRA_BORDER, - widget->allocation.width, - -priv->drag_mouse_dy - EXTRA_BORDER); + gdk_draw_drawable (drawable, + widget->style->fg_gc[GTK_WIDGET_STATE (widget)], + priv->pixmap, + 0,0, + priv->drag_mouse_dx - EXTRA_BORDER, + priv->drag_mouse_dy - EXTRA_BORDER, + -1,-1); + + //Paint white outside of the map if dragging. Its less + //ugly than painting the corrupted map + if(priv->drag_mouse_dx>EXTRA_BORDER) { + gdk_draw_rectangle (drawable, + widget->style->white_gc, + TRUE, + 0, 0, + priv->drag_mouse_dx - EXTRA_BORDER, + widget->allocation.height); + } + else if (-priv->drag_mouse_dx > EXTRA_BORDER) + { + gdk_draw_rectangle (drawable, + widget->style->white_gc, + TRUE, + priv->drag_mouse_dx + widget->allocation.width + EXTRA_BORDER, 0, + -priv->drag_mouse_dx - EXTRA_BORDER, + widget->allocation.height); + } + + if (priv->drag_mouse_dy>EXTRA_BORDER) { + gdk_draw_rectangle (drawable, + widget->style->white_gc, + TRUE, + 0, 0, + widget->allocation.width, + priv->drag_mouse_dy - EXTRA_BORDER); + } + else if (-priv->drag_mouse_dy > EXTRA_BORDER) + { + gdk_draw_rectangle (drawable, + widget->style->white_gc, + TRUE, + 0, priv->drag_mouse_dy + widget->allocation.height + EXTRA_BORDER, + widget->allocation.width, + -priv->drag_mouse_dy - EXTRA_BORDER); + } } #ifdef ENABLE_OSD @@ -2463,8 +2475,8 @@ return "OpenStreetMap"; case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: return "OpenStreetMap Renderer"; - case OSM_GPS_MAP_SOURCE_OPENAERIALMAP: - return "OpenAerialMap"; + case OSM_GPS_MAP_SOURCE_OPENCYCLEMAP: + return "OpenCycleMap"; case OSM_GPS_MAP_SOURCE_MAPS_FOR_FREE: return "Maps-For-Free"; case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: @@ -2506,8 +2518,8 @@ return OSM_REPO_URI; case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: return "http://tah.openstreetmap.org/Tiles/tile/#Z/#X/#Y.png"; - case OSM_GPS_MAP_SOURCE_OPENAERIALMAP: - return "http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/#Z/#X/#Y.jpg"; + case OSM_GPS_MAP_SOURCE_OPENCYCLEMAP: + return "http://c.andy.sandbox.cloudmade.com/tiles/cycle/#Z/#X/#Y.png"; case OSM_GPS_MAP_SOURCE_MAPS_FOR_FREE: return "http://maps-for-free.com/layer/relief/z#Z/row#Y/#Z_#X-#Y.jpg"; case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: @@ -2545,8 +2557,8 @@ case OSM_GPS_MAP_SOURCE_NULL: case OSM_GPS_MAP_SOURCE_OPENSTREETMAP: case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: + case OSM_GPS_MAP_SOURCE_OPENCYCLEMAP: return "png"; - case OSM_GPS_MAP_SOURCE_OPENAERIALMAP: case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: case OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID: case OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_STREET: @@ -2580,7 +2592,7 @@ case OSM_GPS_MAP_SOURCE_OPENSTREETMAP: return OSM_MAX_ZOOM; case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: - case OSM_GPS_MAP_SOURCE_OPENAERIALMAP: + case OSM_GPS_MAP_SOURCE_OPENCYCLEMAP: case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: case OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID: case OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_STREET: @@ -3007,4 +3019,9 @@ priv->osd = osd; } +void +osm_gps_map_repaint (OsmGpsMap *map) { + osm_gps_map_expose (GTK_WIDGET(map), NULL); +} + #endif