[cairo-commit] goocanvas/demo demo-fifteen.c, 1.3, 1.4 demo.c, 1.29, 1.30 mv-demo.c, 1.11, 1.12
Damon Chaplin
commit at pdx.freedesktop.org
Wed Jun 20 06:00:02 PDT 2007
Committed by: damon
Update of /cvs/cairo/goocanvas/demo
In directory kemper:/tmp/cvs-serv16861/demo
Modified Files:
demo-fifteen.c demo.c mv-demo.c
Log Message:
2007-06-20 Damon Chaplin <damon at gnome.org>
* src/goocanvas.c: added "automatic-bounds", "bounds-from-origin" and
"bounds-padding" properties, used to calculate the canvas bounds
automatically.
* demo/demo.c (change_bounds_clicked):
* demo/mv-demo.c (change_bounds_clicked): test the above.
Index: demo-fifteen.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo-fifteen.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- demo-fifteen.c 29 Nov 2006 18:47:02 -0000 1.3
+++ demo-fifteen.c 20 Jun 2007 12:59:48 -0000 1.4
@@ -259,12 +259,18 @@
/* Create the canvas and board */
canvas = goo_canvas_new ();
+ g_object_set (G_OBJECT (canvas),
+ "automatic-bounds", TRUE,
+ "bounds-from-origin", FALSE,
+ NULL);
root = goo_canvas_get_root_item (GOO_CANVAS (canvas));
gtk_widget_set_size_request (canvas,
PIECE_SIZE * 4 + 1, PIECE_SIZE * 4 + 1);
+#if 0
goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0,
PIECE_SIZE * 4 + 1, PIECE_SIZE * 4 + 1);
+#endif
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.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- demo.c 15 May 2007 14:01:51 -0000 1.29
+++ demo.c 20 Jun 2007 12:59:48 -0000 1.30
@@ -168,10 +168,30 @@
};
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]);
+ gboolean automatic_bounds = TRUE;
+ gboolean bounds_from_origin = FALSE;
+ gdouble bounds_padding = 50.0;
- bounds_num = (bounds_num + 1) % 4;
+ if (bounds_num < 4)
+ {
+ automatic_bounds = FALSE;
+ goo_canvas_set_bounds (canvas,
+ bounds[bounds_num][0], bounds[bounds_num][1],
+ bounds[bounds_num][2], bounds[bounds_num][3]);
+ }
+ else if (bounds_num == 4)
+ {
+ bounds_from_origin = TRUE;
+ bounds_padding = 50.0;
+ }
+
+ g_object_set (G_OBJECT (canvas),
+ "automatic-bounds", automatic_bounds,
+ "bounds-from-origin", bounds_from_origin,
+ "bounds-padding", bounds_padding,
+ NULL);
+
+ bounds_num = (bounds_num + 1) % 6;
}
@@ -442,6 +462,9 @@
canvas = goo_canvas_new ();
g_object_set (G_OBJECT (canvas),
+ "automatic-bounds", TRUE,
+ "bounds-from-origin", FALSE,
+ "bounds-padding", 4.0,
"background-color-rgb", 0xC3C3FF,
NULL);
goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 604, 454);
Index: mv-demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/mv-demo.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mv-demo.c 14 May 2007 09:51:25 -0000 1.11
+++ mv-demo.c 20 Jun 2007 12:59:48 -0000 1.12
@@ -137,10 +137,30 @@
};
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]);
+ gboolean automatic_bounds = TRUE;
+ gboolean bounds_from_origin = FALSE;
+ gdouble bounds_padding = 50.0;
- bounds_num = (bounds_num + 1) % 4;
+ if (bounds_num < 4)
+ {
+ automatic_bounds = FALSE;
+ goo_canvas_set_bounds (canvas,
+ bounds[bounds_num][0], bounds[bounds_num][1],
+ bounds[bounds_num][2], bounds[bounds_num][3]);
+ }
+ else if (bounds_num == 4)
+ {
+ bounds_from_origin = TRUE;
+ bounds_padding = 50.0;
+ }
+
+ g_object_set (G_OBJECT (canvas),
+ "automatic-bounds", automatic_bounds,
+ "bounds-from-origin", bounds_from_origin,
+ "bounds-padding", bounds_padding,
+ NULL);
+
+ bounds_num = (bounds_num + 1) % 6;
}
@@ -390,6 +410,9 @@
canvas = goo_canvas_new ();
g_object_set (G_OBJECT (canvas),
+ "automatic-bounds", TRUE,
+ "bounds-from-origin", FALSE,
+ "bounds-padding", 4.0,
"background-color-rgb", 0xC3C3FF,
NULL);
goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, 604, 454);
More information about the cairo-commit
mailing list