[cairo-commit] goocanvas/demo demo-features.c, 1.3, 1.4 demo.c, 1.27, 1.28 mv-demo-features.c, 1.2, 1.3 mv-demo.c, 1.10, 1.11

Damon Chaplin commit at pdx.freedesktop.org
Mon May 14 02:51:36 PDT 2007


Committed by: damon

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

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

	* src/goocanvas.c (goo_canvas_set_property) 
	(goo_canvas_set_bounds): queue a redraw of the widget.
	(goo_canvas_expose_event): clip to the canvas bounds if necessary.

	* demo/mv-demo.c (change_bounds_clicked): 
	* demo/demo.c (change_bounds_clicked): test changing the bounds
	dynamically.



Index: demo-features.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo-features.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- demo-features.c	8 Mar 2007 13:58:45 -0000	1.3
+++ demo-features.c	14 May 2007 09:51:25 -0000	1.4
@@ -77,7 +77,7 @@
 	root = goo_canvas_get_root_item (GOO_CANVAS (canvas));
 
 	gtk_widget_set_size_request (canvas, 400, 200);
-	goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 300, 200);
+	goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 400, 200);
 	gtk_container_add (GTK_CONTAINER (frame), canvas);
 	gtk_widget_show (canvas);
 

Index: demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- demo.c	11 May 2007 16:30:48 -0000	1.27
+++ demo.c	14 May 2007 09:51:25 -0000	1.28
@@ -140,6 +140,24 @@
 
 
 static void
+change_bounds_clicked (GtkWidget *button, GooCanvas *canvas)
+{
+  static gdouble bounds[4][4] = {
+    { -100, -100, 200, 200 },
+    { 100, 100, 200, 200 },
+    { 0, 0, 300, 300 },
+    { 0, 0, 604, 454 }
+  };
+  static gint bounds_num = 0;
+
+  goo_canvas_set_bounds (canvas, bounds[bounds_num][0], bounds[bounds_num][1],
+			 bounds[bounds_num][2], bounds[bounds_num][3]);
+
+  bounds_num = (bounds_num + 1) % 4;
+}
+
+
+static void
 move_ellipse_clicked (GtkWidget *button, GooCanvas *canvas)
 {
   static int last_state = 0;
@@ -473,6 +491,13 @@
 			  canvas);
 #endif
 
+	w = gtk_button_new_with_label("Change Bounds");
+	gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
+	gtk_widget_show (w);
+	g_signal_connect (w, "clicked",
+			  (GtkSignalFunc) change_bounds_clicked,
+			  canvas);
+
 	hbox = gtk_hbox_new (FALSE, 4);
 	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
 	gtk_widget_show (hbox);

Index: mv-demo-features.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/mv-demo-features.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mv-demo-features.c	8 Mar 2007 13:58:45 -0000	1.2
+++ mv-demo-features.c	14 May 2007 09:51:25 -0000	1.3
@@ -88,7 +88,7 @@
 	root = goo_canvas_group_model_new (NULL, NULL);
 
 	gtk_widget_set_size_request (canvas, 400, 200);
-	goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 300, 200);
+	goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 400, 200);
 	gtk_container_add (GTK_CONTAINER (frame), canvas);
 	gtk_widget_show (canvas);
 

Index: mv-demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/mv-demo.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mv-demo.c	3 Apr 2007 09:58:05 -0000	1.10
+++ mv-demo.c	14 May 2007 09:51:25 -0000	1.11
@@ -127,6 +127,24 @@
 
 
 static void
+change_bounds_clicked (GtkWidget *button, GooCanvas *canvas)
+{
+  static gdouble bounds[4][4] = {
+    { -100, -100, 200, 200 },
+    { 100, 100, 200, 200 },
+    { 0, 0, 300, 300 },
+    { 0, 0, 604, 454 }
+  };
+  static gint bounds_num = 0;
+
+  goo_canvas_set_bounds (canvas, bounds[bounds_num][0], bounds[bounds_num][1],
+			 bounds[bounds_num][2], bounds[bounds_num][3]);
+
+  bounds_num = (bounds_num + 1) % 4;
+}
+
+
+static void
 move_ellipse_clicked (GtkWidget *button, GooCanvas *canvas)
 {
   static int last_state = 0;
@@ -442,6 +460,13 @@
 			  canvas);
 #endif
 
+	w = gtk_button_new_with_label("Change Bounds");
+	gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
+	gtk_widget_show (w);
+	g_signal_connect (w, "clicked",
+			  (GtkSignalFunc) change_bounds_clicked,
+			  canvas);
+
 	hbox = gtk_hbox_new (FALSE, 4);
 	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
 	gtk_widget_show (hbox);



More information about the cairo-commit mailing list