[goffice] more canvas fixes.
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] more canvas fixes.
- Date: Sat, 6 Mar 2010 12:22:49 +0000 (UTC)
commit 9c553ccc876f04a63478c17454bb944d69a517e0
Author: Jean Brefort <jean brefort normalesup org>
Date: Sat Mar 6 13:17:06 2010 +0100
more canvas fixes.
ChangeLog | 7 +++++++
goffice/canvas/goc-arc.c | 1 +
goffice/canvas/goc-styled-item.c | 4 +++-
tests/shapes-demo.c | 18 ++++--------------
4 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7f0a20b..91a4362 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2010-03-06 Jean Brefort <jean brefort normalesup org>
+ * goffice/canvas/goc-arc.c (goc_arc_update_bounds): set the line style.
+ * goffice/canvas/goc-styled-item.c (goc_styled_item_style_changed):
+ enforce invalidation of the item when done.
+ * tests/shapes-demo.c (parse_line): more fixes.
+
+2010-03-06 Jean Brefort <jean brefort normalesup org>
+
* goffice/canvas/goc-polyline.c (goc_polyline_draw): missing white spaces.
* tests/shapes-demo.c (my_test), (parse_line), (enter_callback): add
missing calls to goc_item_bounds_changed and fix white spaces and other
diff --git a/goffice/canvas/goc-arc.c b/goffice/canvas/goc-arc.c
index 60ac9ff..dc3800c 100644
--- a/goffice/canvas/goc-arc.c
+++ b/goffice/canvas/goc-arc.c
@@ -311,6 +311,7 @@ goc_arc_update_bounds (GocItem *item)
prepare_draw_arrow (item, cr, 0, 0);
if (arc->end_arrow.typ != GO_ARROW_NONE)
prepare_draw_arrow (item, cr, 1, 0);
+ goc_styled_item_set_cairo_line (GOC_STYLED_ITEM (item), cr);
cairo_stroke_extents (cr, &item->x0, &item->y0, &item->x1, &item->y1);
}
diff --git a/goffice/canvas/goc-styled-item.c b/goffice/canvas/goc-styled-item.c
index c596f92..ef72613 100644
--- a/goffice/canvas/goc-styled-item.c
+++ b/goffice/canvas/goc-styled-item.c
@@ -223,9 +223,11 @@ goc_styled_item_apply_theme (GOStyledObject *gsi, GOStyle *style)
static void
goc_styled_item_style_changed (GOStyledObject *gsi)
{
- goc_item_bounds_changed (GOC_ITEM (gsi));
+ GocItem *item = GOC_ITEM (gsi);
+ goc_item_bounds_changed (item);
g_signal_emit (G_OBJECT (gsi),
goc_styled_item_signals [STYLE_CHANGED], 0, GOC_STYLED_ITEM (gsi)->style);
+ goc_item_invalidate (item);
}
static GODoc*
diff --git a/tests/shapes-demo.c b/tests/shapes-demo.c
index 76f7596..f1085fa 100644
--- a/tests/shapes-demo.c
+++ b/tests/shapes-demo.c
@@ -174,14 +174,12 @@ parse_line (GocCanvas *canvas, gchar *entry)
if (g_strv_length (v) > 7) {
goc_item_set (item, "rotation", (double) atoi (v[7]) * M_PI/ 180., NULL);
}
- goc_item_invalidate (item);
}
break;
case 3: /* LINE */
if (g_strv_length (v) > 4) {
item = goc_item_new (goc_canvas_get_root (canvas), GOC_TYPE_LINE,
"x0", (double) atoi (v[1]), "y0", (double) atoi (v[2]), "x1", (double) atoi (v[3]), "y1", (double) atoi (v[4]), NULL);
- goc_item_invalidate (item);
}
break;
case 4: /* RECTANGLE */
@@ -191,22 +189,20 @@ parse_line (GocCanvas *canvas, gchar *entry)
if( g_strv_length (v) > 5) {
goc_item_set (item, "rotation", (double) atoi (v[5]) * M_PI / 180., NULL);
}
- goc_item_invalidate (item);
}
break;
case 5: /* ELLIPSE */
- if(g_strv_length(v) > 4) {
+ if (g_strv_length(v) > 4) {
item = goc_item_new (goc_canvas_get_root (canvas), GOC_TYPE_ELLIPSE,
"x", (double) atoi (v[1]), "y", (double) atoi (v[2]), "width", (double) atoi (v[3]), "height", (double) atoi (v[4]), NULL);
if(g_strv_length (v) > 5) {
goc_item_set (item,"rotation",(double) atoi (v[5]) * M_PI / 180., NULL);
}
- goc_item_invalidate (item);
}
break;
case 6: /* POLY */
case 7:
- if(g_strv_length(v) > 2) {
+ if (g_strv_length(v) > 2) {
GocPoints *points = goc_points_new ((g_strv_length(v) - 1) / 2);
for (i=0; i < g_strv_length (v) / 2; i++) {
points->points[i].x = atoi (v[i * 2 + 1]);
@@ -216,7 +212,6 @@ parse_line (GocCanvas *canvas, gchar *entry)
item = goc_item_new (goc_canvas_get_root (canvas), GOC_TYPE_POLYLINE, "points", points, NULL);
else
item = goc_item_new (goc_canvas_get_root (canvas), GOC_TYPE_POLYGON, "points", points, NULL);
- goc_item_invalidate (item);
}
break;
case 20: /* STROKE */
@@ -270,15 +265,10 @@ parse_line (GocCanvas *canvas, gchar *entry)
}
}
}
- goc_item_bounds_changed (item);
break;
case 100: /* RTL */
- if (g_strv_length (v) > 1) {
- canvas->direction = atoi (v[1]);
- goc_canvas_get_scroll_position (canvas, &x, &y);
- goc_canvas_scroll_to (canvas, x+1, y+1);
- goc_canvas_scroll_to (canvas, x, y);
- }
+ if (g_strv_length (v) > 1)
+ goc_canvas_set_direction (canvas, atoi (v[1]));
break;
case 101: /* SCROLL */
if (g_strv_length (v) > 2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]