From: Kaj-Michael Lang Date: Tue, 8 Apr 2008 07:58:16 +0000 (+0300) Subject: Start to add support for zoom ranges X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6d9afeee8e69cf0b4be3dffe694c592b8b9bf8b;p=mapper Start to add support for zoom ranges --- diff --git a/src/map.c b/src/map.c index a3e279d..c40c778 100644 --- a/src/map.c +++ b/src/map.c @@ -93,6 +93,7 @@ static GdkPixmap *map_pixmap; guint _base_tilex = -5; guint _base_tiley = -5; +static guint map_max_zoom=MAX_ZOOM; guint _zoom = 3; /* zoom level, from 0 to MAX_ZOOM. */ Point _min_center = { -1, -1 }; @@ -446,7 +447,7 @@ if (tilex > _world_size_tiles || tiley > _world_size_tiles) g_debug("MAP RT: %u %u (%u) %u %u (%u, %u)", tilex, tiley, _world_size_tiles, destx, desty, buf_width_tiles, buf_height_tiles); /* The tile is possible. */ -for (zoff = (_curr_repo->double_size ? 1 : 0); !pixbuf && (_zoom + zoff) <= MAX_ZOOM && zoff <= TILE_SIZE_P2; zoff += 1) { +for (zoff = (_curr_repo->double_size ? 1 : 0); !pixbuf && (_zoom + zoff) <= map_max_zoom && zoff <= TILE_SIZE_P2; zoff += 1) { pixbuf=map_tile_load(tilex, tiley, zoff, !fast_fail); if (!pixbuf) { if (!fast_fail) @@ -534,7 +535,7 @@ map_set_zoom(guint new_zoom) { /* Note that, since new_zoom is a guint and MIN_ZOOM is 0, this if * condition also checks for new_zoom >= MIN_ZOOM. */ -if (new_zoom > (MAX_ZOOM - 1)) +if (new_zoom > (map_max_zoom - 1)) return FALSE; if (new_zoom == _zoom) return FALSE; @@ -974,14 +975,14 @@ map_key_zoom_timeout(void) if (_key_zoom_new < _zoom) { /* We're currently zooming in (_zoom is decreasing). */ guint test = _key_zoom_new - _curr_repo->view_zoom_steps; - if (test < MAX_ZOOM) + if (test < map_max_zoom) _key_zoom_new = test; else return FALSE; } else { /* We're currently zooming out (_zoom is increasing). */ guint test = _key_zoom_new + _curr_repo->view_zoom_steps; - if (test < MAX_ZOOM) + if (test < map_max_zoom) _key_zoom_new = test; else return FALSE; @@ -1120,7 +1121,7 @@ map_zoom(gint zdir) gint nzoom; nzoom=_zoom+zdir; -if ((nzoom > 0) && (nzoom < MAX_ZOOM - 1)) { +if ((nzoom >= 0) && (nzoom < map_max_zoom - 1)) { map_set_zoom(nzoom); } return nzoom;