1478 |
if (priv->osd->busy(priv->osd)) |
if (priv->osd->busy(priv->osd)) |
1479 |
return FALSE; |
return FALSE; |
1480 |
|
|
1481 |
|
#ifdef DRAG_DEBUG |
1482 |
|
printf("trying redraw\n"); |
1483 |
|
#endif |
1484 |
|
|
1485 |
/* the motion_notify handler uses priv->pixmap to redraw the area; if we |
/* the motion_notify handler uses priv->pixmap to redraw the area; if we |
1486 |
* change it while we are dragging, we will end up showing it in the wrong |
* change it while we are dragging, we will end up showing it in the wrong |
1487 |
* place. This could be fixed by carefully recompute the coordinates, but |
* place. This could be fixed by carefully recompute the coordinates, but |
1489 |
if (priv->dragging) |
if (priv->dragging) |
1490 |
return FALSE; |
return FALSE; |
1491 |
|
|
1492 |
|
/* undo all offsets that may have happened when dragging */ |
1493 |
|
priv->drag_mouse_dx = 0; |
1494 |
|
priv->drag_mouse_dy = 0; |
1495 |
|
|
1496 |
priv->redraw_cycle++; |
priv->redraw_cycle++; |
1497 |
|
|
1498 |
/* draw white background to initialise pixmap */ |
/* draw white background to initialise pixmap */ |
1513 |
osm_gps_map_draw_balloon_int(map); |
osm_gps_map_draw_balloon_int(map); |
1514 |
#endif |
#endif |
1515 |
|
|
1516 |
//osm_gps_map_osd_speed(map, 1.5); |
#ifdef ENABLE_OSD |
1517 |
|
/* OSD may contain a coordinate/scale, so we may have to re-render it */ |
1518 |
|
if(priv->osd && OSM_IS_GPS_MAP (priv->osd->widget)) |
1519 |
|
priv->osd->render (priv->osd); |
1520 |
|
#endif |
1521 |
|
|
1522 |
osm_gps_map_purge_cache(map); |
osm_gps_map_purge_cache(map); |
1523 |
gtk_widget_queue_draw (GTK_WIDGET (map)); |
gtk_widget_queue_draw (GTK_WIDGET (map)); |
1524 |
|
|
2140 |
osm_gps_map_map_redraw_idle(OSM_GPS_MAP(widget)); |
osm_gps_map_map_redraw_idle(OSM_GPS_MAP(widget)); |
2141 |
} |
} |
2142 |
|
|
2143 |
priv->drag_mouse_dx = 0; |
#ifdef DRAG_DEBUG |
2144 |
priv->drag_mouse_dy = 0; |
printf("dragging done\n"); |
2145 |
|
#endif |
2146 |
|
|
2147 |
priv->drag_counter = -1; |
priv->drag_counter = -1; |
2148 |
|
|
2149 |
return FALSE; |
return FALSE; |
2257 |
GdkDrawable *drawable = widget->window; |
GdkDrawable *drawable = widget->window; |
2258 |
#endif |
#endif |
2259 |
|
|
2260 |
if (!priv->dragging && event) |
#ifdef DRAG_DEBUG |
2261 |
|
printf("expose, map %d/%d\n", priv->map_x, priv->map_y); |
2262 |
|
#endif |
2263 |
|
|
2264 |
|
if (!priv->drag_mouse_dx && !priv->drag_mouse_dy && event) |
2265 |
{ |
{ |
2266 |
|
#ifdef DRAG_DEBUG |
2267 |
|
printf(" dragging = %d, event = %p\n", priv->dragging, event); |
2268 |
|
#endif |
2269 |
|
|
2270 |
gdk_draw_drawable (drawable, |
gdk_draw_drawable (drawable, |
2271 |
widget->style->fg_gc[GTK_WIDGET_STATE (widget)], |
widget->style->fg_gc[GTK_WIDGET_STATE (widget)], |
2272 |
priv->pixmap, |
priv->pixmap, |
2276 |
} |
} |
2277 |
else |
else |
2278 |
{ |
{ |
2279 |
|
#ifdef DRAG_DEBUG |
2280 |
|
printf(" drag_mouse %d/%d\n", |
2281 |
|
priv->drag_mouse_dx - EXTRA_BORDER, |
2282 |
|
priv->drag_mouse_dy - EXTRA_BORDER); |
2283 |
|
#endif |
2284 |
|
|
2285 |
gdk_draw_drawable (drawable, |
gdk_draw_drawable (drawable, |
2286 |
widget->style->fg_gc[GTK_WIDGET_STATE (widget)], |
widget->style->fg_gc[GTK_WIDGET_STATE (widget)], |
2287 |
priv->pixmap, |
priv->pixmap, |
3045 |
priv->map_x += dx; |
priv->map_x += dx; |
3046 |
priv->map_y += dy; |
priv->map_y += dy; |
3047 |
|
|
3048 |
|
#ifdef ENABLE_OSD |
3049 |
|
/* OSD may contain a coordinate, so we may have to re-render it */ |
3050 |
|
if(priv->osd && OSM_IS_GPS_MAP (priv->osd->widget)) |
3051 |
|
priv->osd->render (priv->osd); |
3052 |
|
#endif |
3053 |
|
|
3054 |
osm_gps_map_map_redraw_idle (map); |
osm_gps_map_map_redraw_idle (map); |
3055 |
} |
} |
3056 |
|
|