[gnome-system-tools/rendering-cleanup: 5/21] e-map: Update the xofs/yofs properties together with the adjustments



commit acadfba8827a13f0c1312c4b37e3e25295096f93
Author: Benjamin Otte <otte redhat com>
Date:   Mon Oct 4 18:01:06 2010 +0200

    e-map: Update the xofs/yofs properties together with the adjustments

 src/time/e-map/e-map.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/src/time/e-map/e-map.c b/src/time/e-map/e-map.c
index 02f0a95..92797a5 100644
--- a/src/time/e-map/e-map.c
+++ b/src/time/e-map/e-map.c
@@ -96,7 +96,7 @@ static void e_map_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadj
 
 static void update_render_pixbuf (EMap *map, GdkInterpType interp, gboolean render_overlays);
 static void set_scroll_area (EMap *view);
-static void center_at (EMap *map, gint x, gint y, gboolean scroll);
+static void center_at (EMap *map, gint x, gint y);
 static void smooth_center_at (EMap *map, gint x, gint y);
 static void scroll_to (EMap *view, gint x, gint y);
 static void zoom_do (EMap *map);
@@ -1096,7 +1096,7 @@ repaint_point (EMap *map, EMapPoint *point)
 }
 
 static void
-center_at (EMap *map, gint x, gint y, gboolean scroll)
+center_at (EMap *map, gint x, gint y)
 {
 	EMapPrivate *priv;
 	GtkAllocation allocation;
@@ -1112,12 +1112,10 @@ center_at (EMap *map, gint x, gint y, gboolean scroll)
 	x = CLAMP (x - (allocation.width / 2), 0, pb_width - allocation.width);
 	y = CLAMP (y - (allocation.height / 2), 0, pb_height - allocation.height);
 
-	if (scroll)
-		scroll_to (map, x, y);
-	else {
-		priv->xofs = x;
-		priv->yofs = y;
-	}
+        priv->xofs = x;
+        priv->yofs = y;
+        gtk_adjustment_set_value (priv->hadj, priv->xofs);
+        gtk_adjustment_set_value (priv->vadj, priv->yofs);
 }
 
 static void
@@ -1439,6 +1437,8 @@ zoom_in_smooth (EMap *map)
 	e_map_world_to_window (map, priv->zoom_target_long, priv->zoom_target_lat, &x, &y);
 	priv->xofs = CLAMP (priv->xofs + x - allocation.width / 2.0, 0, E_MAP_GET_WIDTH (map) - allocation.width);
 	priv->yofs = CLAMP (priv->yofs + y - allocation.height / 2.0, 0, E_MAP_GET_HEIGHT (map) - allocation.height);
+        gtk_adjustment_set_value (priv->hadj, priv->xofs);
+        gtk_adjustment_set_value (priv->vadj, priv->yofs);
 
 	gtk_widget_draw (GTK_WIDGET (map), NULL);
 }
@@ -1499,7 +1499,7 @@ zoom_out (EMap *map)
 	update_render_pixbuf (map, GDK_INTERP_BILINEAR, TRUE);
 
 	e_map_world_to_window (map, longitude, latitude, &x, &y);
-	center_at (map, x + priv->xofs, y + priv->yofs, FALSE);
+	center_at (map, x + priv->xofs, y + priv->yofs);
 
 	gtk_widget_queue_draw (GTK_WIDGET (map));
 }
@@ -1521,8 +1521,6 @@ zoom_do (EMap *map)
 /*    if (e_map_get_smooth_zoom(map)) zoom_out_smooth(map); */
 		zoom_out (map);
 	}
-
-	set_scroll_area(map);
 }
 
 /* Callback used when an adjustment is changed */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]