[cairo-commit] goocanvas/demo demo.c,1.28,1.29

Damon Chaplin commit at pdx.freedesktop.org
Tue May 15 07:02:02 PDT 2007


Committed by: damon

Update of /cvs/cairo/goocanvas/demo
In directory kemper:/tmp/cvs-serv28719/demo

Modified Files:
	demo.c 
Log Message:
2007-05-15  Damon Chaplin  <damon at gnome.org>

	* src/goocanvas.c: added "scale-x" and "scale-y" properties to set
	the horizontal and vertical scale independently. Note that if items
	use the visibility threshold setting it will compare it to the minimum
	of scale_x and scale_y.

	* demo/demo.c: added "Scale X" and "Scale Y" spinbuttons.



Index: demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- demo.c	14 May 2007 09:51:25 -0000	1.28
+++ demo.c	15 May 2007 14:01:51 -0000	1.29
@@ -78,6 +78,24 @@
 
 
 static void
+zoom_x_changed (GtkAdjustment *adj, GooCanvas *canvas)
+{
+  g_object_set (G_OBJECT (canvas),
+		"scale-x", adj->value,
+		NULL);
+}
+
+
+static void
+zoom_y_changed (GtkAdjustment *adj, GooCanvas *canvas)
+{
+  g_object_set (G_OBJECT (canvas),
+		"scale-y", adj->value,
+		NULL);
+}
+
+
+static void
 center_toggled (GtkToggleButton *button, gpointer data)
 {
   /*foo_canvas_set_center_scroll_region (data,
@@ -428,9 +446,9 @@
 		      NULL);
 	goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 604, 454);
 
-	/* Zoom */
+	/* Scale */
 
-	w = gtk_label_new ("Zoom:");
+	w = gtk_label_new ("Scale:");
 	gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
 	gtk_widget_show (w);
 
@@ -443,6 +461,39 @@
 	gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
 	gtk_widget_show (w);
 
+
+	w = gtk_label_new ("Scale X:");
+	gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
+	gtk_widget_show (w);
+
+	adj = GTK_ADJUSTMENT (gtk_adjustment_new (1.00, 0.05, 50.00, 0.05, 0.50, 0.50));
+	w = gtk_spin_button_new (adj, 0.0, 2);
+	g_signal_connect (adj, "value_changed",
+			  (GtkSignalFunc) zoom_x_changed,
+			  canvas);
+	gtk_widget_set_size_request (w, 50, -1);
+	gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
+	gtk_widget_show (w);
+
+
+	w = gtk_label_new ("Scale Y:");
+	gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
+	gtk_widget_show (w);
+
+	adj = GTK_ADJUSTMENT (gtk_adjustment_new (1.00, 0.05, 50.00, 0.05, 0.50, 0.50));
+	w = gtk_spin_button_new (adj, 0.0, 2);
+	g_signal_connect (adj, "value_changed",
+			  (GtkSignalFunc) zoom_y_changed,
+			  canvas);
+	gtk_widget_set_size_request (w, 50, -1);
+	gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
+	gtk_widget_show (w);
+
+
+	hbox = gtk_hbox_new (FALSE, 4);
+	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+	gtk_widget_show (hbox);
+
 	/* Center: */
 	
 	w = gtk_check_button_new_with_label("Center scroll region");



More information about the cairo-commit mailing list