From: Kaj-Michael Lang Date: Thu, 8 May 2008 13:53:50 +0000 (+0300) Subject: Map widget: X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03190db824e1ec142ccf428863011da476d8b210;p=mapper Map widget: - Add mouse tracking testing --- diff --git a/src/gtkmap.c b/src/gtkmap.c index 8316aa3..b745b5c 100644 --- a/src/gtkmap.c +++ b/src/gtkmap.c @@ -173,6 +173,12 @@ struct _GtkMapPriv guint draw_width; + gboolean button_down; + gint mouse_x; + gint mouse_y; + gdouble mouse_lat; + gdouble mouse_lon; + gboolean fast_render; guint key_zoom_new; @@ -399,6 +405,7 @@ priv->show_velvec=TRUE; priv->show_markers=TRUE; priv->show_location=TRUE; +priv->button_down=FALSE; priv->click_to_center=FALSE; priv->zoom_in_on_2button=FALSE; @@ -1576,6 +1583,18 @@ return FALSE; static gboolean gtk_map_motion_notify_cb(GtkWidget *widget, GdkEventMotion *event, gpointer data) { +GtkMap *map; +GtkMapPriv *priv; + +g_return_val_if_fail(GTK_IS_MAP(widget), FALSE); +map=GTK_MAP(widget); +priv=GTK_MAP_GET_PRIVATE(map); + +priv->mouse_x=(gint)event->x; +priv->mouse_y=(gint)event->y; +unit2latlon(x2unit((gint) (event->x+0.5)), y2unit((gint) (event->y+0.5)), priv->mouse_lat, priv->mouse_lon); + +g_debug("MOUSE: %d,%d (%f,%f)", priv->mouse_x, priv->mouse_y, priv->mouse_lat, priv->mouse_lon); return FALSE; } @@ -1592,6 +1611,7 @@ priv=GTK_MAP_GET_PRIVATE(map); switch (event->button) { case 1: + priv->button_down=TRUE; if (priv->click_to_center) { gtk_map_set_center(widget, x2unit((gint) (event->x+0.5)), y2unit((gint) (event->y+0.5))); return FALSE; @@ -1625,7 +1645,7 @@ priv=GTK_MAP_GET_PRIVATE(map); switch (event->button) { case 1: - + priv->button_down=FALSE; break; case 2: