From: Kaj-Michael Lang Date: Sat, 15 Mar 2008 12:42:58 +0000 (+0200) Subject: Keep zoom level if already close when going to Home location. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a11eac59d1a8353b39472873d1f88928add029fa;p=mapper Keep zoom level if already close when going to Home location. --- diff --git a/src/cb.c b/src/cb.c index c5989b6..7e561e4 100644 --- a/src/cb.c +++ b/src/cb.c @@ -302,7 +302,8 @@ menu_cb_goto_home(GtkAction *action) if (map_goto_position(&_home)==FALSE) { MACRO_BANNER_SHOW_INFO(_window, _("Home not set.")); } else { - map_set_zoom(3); + if (map_get_zoom()>3) + map_set_zoom(3); MACRO_BANNER_SHOW_INFO(_window, _("At home location")); } return TRUE; diff --git a/src/map.c b/src/map.c index b390fe3..a4bfd83 100644 --- a/src/map.c +++ b/src/map.c @@ -521,6 +521,12 @@ map_render_data(); MACRO_QUEUE_DRAW_AREA(); } +guint +map_get_zoom(void) +{ +return _zoom; +} + /** * Set the current zoom level. If the given zoom level is the same as the * current zoom level, or if the new zoom is invalid diff --git a/src/map.h b/src/map.h index c2cc8ad..aa0e7ba 100644 --- a/src/map.h +++ b/src/map.h @@ -190,6 +190,9 @@ GtkWidget *map_new(void); gboolean map_key_zoom_timeout(); int map_zoom(gint zdir); +guint map_get_zoom(void); +void map_set_zoom(guint zoom); + gboolean map_zoom_in(void); gboolean map_zoom_out(void); void map_set_autozoom(gboolean az, gfloat speed);