96 |
|
|
97 |
//where downloaded tiles are cached |
//where downloaded tiles are cached |
98 |
char *cache_dir; |
char *cache_dir; |
|
gboolean cache_dir_is_full_path; |
|
99 |
|
|
100 |
//contains flags indicating the various special characters |
//contains flags indicating the various special characters |
101 |
//the uri string contains, that will be replaced when calculating |
//the uri string contains, that will be replaced when calculating |
188 |
PROP_REPO_URI, |
PROP_REPO_URI, |
189 |
PROP_PROXY_URI, |
PROP_PROXY_URI, |
190 |
PROP_TILE_CACHE_DIR, |
PROP_TILE_CACHE_DIR, |
|
PROP_TILE_CACHE_DIR_IS_FULL_PATH, |
|
191 |
PROP_ZOOM, |
PROP_ZOOM, |
192 |
PROP_MAX_ZOOM, |
PROP_MAX_ZOOM, |
193 |
PROP_MIN_ZOOM, |
PROP_MIN_ZOOM, |
1689 |
} |
} |
1690 |
} |
} |
1691 |
|
|
1692 |
if (!priv->cache_dir_is_full_path) { |
const char *fname = osm_gps_map_source_get_friendly_name(priv->map_source); |
1693 |
const char *fname = osm_gps_map_source_get_friendly_name(priv->map_source); |
if(!fname) fname = "_unknown_"; |
1694 |
if(!fname) fname = "_unknown_"; |
|
1695 |
|
if (priv->cache_dir) { |
1696 |
if (priv->cache_dir) { |
char *old = priv->cache_dir; |
1697 |
char *old = priv->cache_dir; |
//the new cachedir is the given cache dir + the md5 of the repo_uri |
1698 |
//the new cachedir is the given cache dir + the md5 of the repo_uri |
priv->cache_dir = g_strdup_printf("%s%c%s", old, G_DIR_SEPARATOR, fname); |
1699 |
priv->cache_dir = g_strdup_printf("%s%c%s", old, G_DIR_SEPARATOR, fname); |
g_debug("Adjusting cache dir %s -> %s", old, priv->cache_dir); |
1700 |
g_debug("Adjusting cache dir %s -> %s", old, priv->cache_dir); |
g_free(old); |
|
g_free(old); |
|
|
} else { |
|
|
//the new cachedir is the current dir + the md5 of the repo_uri |
|
|
priv->cache_dir = g_strdup(fname); |
|
|
} |
|
1701 |
} |
} |
1702 |
|
|
1703 |
inspect_map_uri(map); |
inspect_map_uri(map); |
1821 |
if ( g_value_get_string(value) ) |
if ( g_value_get_string(value) ) |
1822 |
priv->cache_dir = g_value_dup_string (value); |
priv->cache_dir = g_value_dup_string (value); |
1823 |
break; |
break; |
|
case PROP_TILE_CACHE_DIR_IS_FULL_PATH: |
|
|
priv->cache_dir_is_full_path = g_value_get_boolean (value); |
|
|
break; |
|
1824 |
case PROP_ZOOM: |
case PROP_ZOOM: |
1825 |
priv->map_zoom = g_value_get_int (value); |
priv->map_zoom = g_value_get_int (value); |
1826 |
break; |
break; |
1890 |
case PROP_TILE_CACHE_DIR: |
case PROP_TILE_CACHE_DIR: |
1891 |
g_value_set_string(value, priv->cache_dir); |
g_value_set_string(value, priv->cache_dir); |
1892 |
break; |
break; |
|
case PROP_TILE_CACHE_DIR_IS_FULL_PATH: |
|
|
g_value_set_boolean(value, priv->cache_dir_is_full_path); |
|
|
break; |
|
1893 |
case PROP_ZOOM: |
case PROP_ZOOM: |
1894 |
g_value_set_int(value, priv->map_zoom); |
g_value_set_int(value, priv->map_zoom); |
1895 |
break; |
break; |
2183 |
GdkDrawable *drawable = widget->window; |
GdkDrawable *drawable = widget->window; |
2184 |
#endif |
#endif |
2185 |
|
|
2186 |
gdk_draw_drawable (drawable, |
if (!priv->dragging) |
2187 |
widget->style->fg_gc[GTK_WIDGET_STATE (widget)], |
{ |
2188 |
priv->pixmap, |
gdk_draw_drawable (drawable, |
2189 |
0,0, |
widget->style->fg_gc[GTK_WIDGET_STATE (widget)], |
2190 |
priv->drag_mouse_dx - EXTRA_BORDER, |
priv->pixmap, |
2191 |
priv->drag_mouse_dy - EXTRA_BORDER, |
event->area.x + EXTRA_BORDER, event->area.y + EXTRA_BORDER, |
2192 |
-1,-1); |
event->area.x, event->area.y, |
2193 |
|
event->area.width, event->area.height); |
2194 |
//Paint white outside of the map if dragging. Its less |
} |
2195 |
//ugly than painting the corrupted map |
else |
2196 |
if(priv->drag_mouse_dx>EXTRA_BORDER) { |
{ |
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, 0, |
0,0, |
2201 |
priv->drag_mouse_dx - EXTRA_BORDER, |
priv->drag_mouse_dx - EXTRA_BORDER, |
2202 |
widget->allocation.height); |
priv->drag_mouse_dy - EXTRA_BORDER, |
2203 |
} |
-1,-1); |
2204 |
else if (-priv->drag_mouse_dx > EXTRA_BORDER) |
|
2205 |
{ |
//Paint white outside of the map if dragging. Its less |
2206 |
gdk_draw_rectangle (drawable, |
//ugly than painting the corrupted map |
2207 |
widget->style->white_gc, |
if(priv->drag_mouse_dx>EXTRA_BORDER) { |
2208 |
TRUE, |
gdk_draw_rectangle (drawable, |
2209 |
priv->drag_mouse_dx + widget->allocation.width + EXTRA_BORDER, 0, |
widget->style->white_gc, |
2210 |
-priv->drag_mouse_dx - EXTRA_BORDER, |
TRUE, |
2211 |
widget->allocation.height); |
0, 0, |
2212 |
} |
priv->drag_mouse_dx - EXTRA_BORDER, |
2213 |
|
widget->allocation.height); |
2214 |
if (priv->drag_mouse_dy>EXTRA_BORDER) { |
} |
2215 |
gdk_draw_rectangle (drawable, |
else if (-priv->drag_mouse_dx > EXTRA_BORDER) |
2216 |
widget->style->white_gc, |
{ |
2217 |
TRUE, |
gdk_draw_rectangle (drawable, |
2218 |
0, 0, |
widget->style->white_gc, |
2219 |
widget->allocation.width, |
TRUE, |
2220 |
priv->drag_mouse_dy - EXTRA_BORDER); |
priv->drag_mouse_dx + widget->allocation.width + EXTRA_BORDER, 0, |
2221 |
} |
-priv->drag_mouse_dx - EXTRA_BORDER, |
2222 |
else if (-priv->drag_mouse_dy > EXTRA_BORDER) |
widget->allocation.height); |
2223 |
{ |
} |
2224 |
gdk_draw_rectangle (drawable, |
|
2225 |
widget->style->white_gc, |
if (priv->drag_mouse_dy>EXTRA_BORDER) { |
2226 |
TRUE, |
gdk_draw_rectangle (drawable, |
2227 |
0, priv->drag_mouse_dy + widget->allocation.height + EXTRA_BORDER, |
widget->style->white_gc, |
2228 |
widget->allocation.width, |
TRUE, |
2229 |
-priv->drag_mouse_dy - EXTRA_BORDER); |
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 |
2336 |
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); |
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); |
2337 |
|
|
2338 |
g_object_class_install_property (object_class, |
g_object_class_install_property (object_class, |
|
PROP_TILE_CACHE_DIR_IS_FULL_PATH, |
|
|
g_param_spec_boolean ("tile-cache-is-full-path", |
|
|
"tile cache is full path", |
|
|
"if true, the path passed to tile-cache is interpreted as the full cache path", |
|
|
FALSE, |
|
|
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); |
|
|
|
|
|
g_object_class_install_property (object_class, |
|
2339 |
PROP_ZOOM, |
PROP_ZOOM, |
2340 |
g_param_spec_int ("zoom", |
g_param_spec_int ("zoom", |
2341 |
"zoom", |
"zoom", |