1496 |
gboolean handled = FALSE; |
gboolean handled = FALSE; |
1497 |
int step = GTK_WIDGET(widget)->allocation.width/OSM_GPS_MAP_SCROLL_STEP; |
int step = GTK_WIDGET(widget)->allocation.width/OSM_GPS_MAP_SCROLL_STEP; |
1498 |
|
|
1499 |
printf("key event with keyval %x\n", event->keyval); |
// printf("key event with keyval %x\n", event->keyval); |
1500 |
|
|
1501 |
// the map handles some keys on its own ... |
// the map handles some keys on its own ... |
1502 |
switch(event->keyval) { |
switch(event->keyval) { |
1564 |
#endif |
#endif |
1565 |
|
|
1566 |
default: |
default: |
1567 |
printf("unhandled key event with keyval %x\n", event->keyval); |
// printf("unhandled key event with keyval %x\n", event->keyval); |
1568 |
break; |
break; |
1569 |
} |
} |
1570 |
|
|
2183 |
GdkDrawable *drawable = widget->window; |
GdkDrawable *drawable = widget->window; |
2184 |
#endif |
#endif |
2185 |
|
|
2186 |
gdk_draw_drawable (drawable, |
if (!priv->dragging) |
|
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) |
|
2187 |
{ |
{ |
2188 |
gdk_draw_rectangle (drawable, |
gdk_draw_drawable (drawable, |
2189 |
widget->style->white_gc, |
widget->style->fg_gc[GTK_WIDGET_STATE (widget)], |
2190 |
TRUE, |
priv->pixmap, |
2191 |
priv->drag_mouse_dx + widget->allocation.width + EXTRA_BORDER, 0, |
event->area.x + EXTRA_BORDER, event->area.y + EXTRA_BORDER, |
2192 |
-priv->drag_mouse_dx - EXTRA_BORDER, |
event->area.x, event->area.y, |
2193 |
widget->allocation.height); |
event->area.width, event->area.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); |
|
2194 |
} |
} |
2195 |
else if (-priv->drag_mouse_dy > EXTRA_BORDER) |
else |
2196 |
{ |
{ |
2197 |
gdk_draw_rectangle (drawable, |
gdk_draw_drawable (drawable, |
2198 |
widget->style->white_gc, |
widget->style->fg_gc[GTK_WIDGET_STATE (widget)], |
2199 |
TRUE, |
priv->pixmap, |
2200 |
0, priv->drag_mouse_dy + widget->allocation.height + EXTRA_BORDER, |
0,0, |
2201 |
widget->allocation.width, |
priv->drag_mouse_dx - EXTRA_BORDER, |
2202 |
-priv->drag_mouse_dy - EXTRA_BORDER); |
priv->drag_mouse_dy - EXTRA_BORDER, |
2203 |
|
-1,-1); |
2204 |
|
|
2205 |
|
//Paint white outside of the map if dragging. Its less |
2206 |
|
//ugly than painting the corrupted map |
2207 |
|
if(priv->drag_mouse_dx>EXTRA_BORDER) { |
2208 |
|
gdk_draw_rectangle (drawable, |
2209 |
|
widget->style->white_gc, |
2210 |
|
TRUE, |
2211 |
|
0, 0, |
2212 |
|
priv->drag_mouse_dx - EXTRA_BORDER, |
2213 |
|
widget->allocation.height); |
2214 |
|
} |
2215 |
|
else if (-priv->drag_mouse_dx > EXTRA_BORDER) |
2216 |
|
{ |
2217 |
|
gdk_draw_rectangle (drawable, |
2218 |
|
widget->style->white_gc, |
2219 |
|
TRUE, |
2220 |
|
priv->drag_mouse_dx + widget->allocation.width + EXTRA_BORDER, 0, |
2221 |
|
-priv->drag_mouse_dx - EXTRA_BORDER, |
2222 |
|
widget->allocation.height); |
2223 |
|
} |
2224 |
|
|
2225 |
|
if (priv->drag_mouse_dy>EXTRA_BORDER) { |
2226 |
|
gdk_draw_rectangle (drawable, |
2227 |
|
widget->style->white_gc, |
2228 |
|
TRUE, |
2229 |
|
0, 0, |
2230 |
|
widget->allocation.width, |
2231 |
|
priv->drag_mouse_dy - EXTRA_BORDER); |
2232 |
|
} |
2233 |
|
else if (-priv->drag_mouse_dy > EXTRA_BORDER) |
2234 |
|
{ |
2235 |
|
gdk_draw_rectangle (drawable, |
2236 |
|
widget->style->white_gc, |
2237 |
|
TRUE, |
2238 |
|
0, priv->drag_mouse_dy + widget->allocation.height + EXTRA_BORDER, |
2239 |
|
widget->allocation.width, |
2240 |
|
-priv->drag_mouse_dy - EXTRA_BORDER); |
2241 |
|
} |
2242 |
} |
} |
2243 |
|
|
2244 |
#ifdef ENABLE_OSD |
#ifdef ENABLE_OSD |
2475 |
return "OpenStreetMap"; |
return "OpenStreetMap"; |
2476 |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: |
2477 |
return "OpenStreetMap Renderer"; |
return "OpenStreetMap Renderer"; |
2478 |
case OSM_GPS_MAP_SOURCE_OPENAERIALMAP: |
case OSM_GPS_MAP_SOURCE_OPENCYCLEMAP: |
2479 |
return "OpenAerialMap"; |
return "OpenCycleMap"; |
2480 |
case OSM_GPS_MAP_SOURCE_MAPS_FOR_FREE: |
case OSM_GPS_MAP_SOURCE_MAPS_FOR_FREE: |
2481 |
return "Maps-For-Free"; |
return "Maps-For-Free"; |
2482 |
case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: |
case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: |
2518 |
return OSM_REPO_URI; |
return OSM_REPO_URI; |
2519 |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: |
2520 |
return "http://tah.openstreetmap.org/Tiles/tile/#Z/#X/#Y.png"; |
return "http://tah.openstreetmap.org/Tiles/tile/#Z/#X/#Y.png"; |
2521 |
case OSM_GPS_MAP_SOURCE_OPENAERIALMAP: |
case OSM_GPS_MAP_SOURCE_OPENCYCLEMAP: |
2522 |
return "http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/#Z/#X/#Y.jpg"; |
return "http://c.andy.sandbox.cloudmade.com/tiles/cycle/#Z/#X/#Y.png"; |
2523 |
case OSM_GPS_MAP_SOURCE_MAPS_FOR_FREE: |
case OSM_GPS_MAP_SOURCE_MAPS_FOR_FREE: |
2524 |
return "http://maps-for-free.com/layer/relief/z#Z/row#Y/#Z_#X-#Y.jpg"; |
return "http://maps-for-free.com/layer/relief/z#Z/row#Y/#Z_#X-#Y.jpg"; |
2525 |
case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: |
case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: |
2557 |
case OSM_GPS_MAP_SOURCE_NULL: |
case OSM_GPS_MAP_SOURCE_NULL: |
2558 |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP: |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP: |
2559 |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: |
2560 |
|
case OSM_GPS_MAP_SOURCE_OPENCYCLEMAP: |
2561 |
return "png"; |
return "png"; |
|
case OSM_GPS_MAP_SOURCE_OPENAERIALMAP: |
|
2562 |
case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: |
case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: |
2563 |
case OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID: |
case OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID: |
2564 |
case OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_STREET: |
case OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_STREET: |
2592 |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP: |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP: |
2593 |
return OSM_MAX_ZOOM; |
return OSM_MAX_ZOOM; |
2594 |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: |
case OSM_GPS_MAP_SOURCE_OPENSTREETMAP_RENDERER: |
2595 |
case OSM_GPS_MAP_SOURCE_OPENAERIALMAP: |
case OSM_GPS_MAP_SOURCE_OPENCYCLEMAP: |
2596 |
case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: |
case OSM_GPS_MAP_SOURCE_GOOGLE_STREET: |
2597 |
case OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID: |
case OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID: |
2598 |
case OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_STREET: |
case OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_STREET: |