Code

change API: separate functions creating a blur filter, one for a given item, another...
[inkscape.git] / src / sp-text.cpp
index 3bbb3b89263d55e0fcc91c14c4d3eccda0bb7c39..3059cf22d9aaf16b599360e16eff94ccf7d19ef1 100644 (file)
@@ -248,6 +248,7 @@ sp_text_update (SPObject *object, SPCtx *ctx, guint flags)
         sp_item_invoke_bbox(text, &paintbox, NR::identity(), TRUE);
         for (SPItemView* v = text->display; v != NULL; v = v->next) {
             text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
+            nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
             // pass the bbox of the text object as paintbox (used for paintserver fills)
             text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox);
         }
@@ -263,6 +264,21 @@ sp_text_modified (SPObject *object, guint flags)
     guint cflags = (flags & SP_OBJECT_MODIFIED_CASCADE);
     if (flags & SP_OBJECT_MODIFIED_FLAG) cflags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
 
+    // FIXME: all that we need to do here is nr_arena_glyphs_[group_]set_style, to set the changed
+    // style, but there's no easy way to access the arena glyphs or glyph groups corresponding to a
+    // text object. Therefore we do here the same as in _update, that is, destroy all arena items
+    // and create new ones. This is probably quite wasteful.
+    if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG )) {
+        SPText *text = SP_TEXT (object);
+        NRRect paintbox;
+        sp_item_invoke_bbox(text, &paintbox, NR::identity(), TRUE);
+        for (SPItemView* v = text->display; v != NULL; v = v->next) {
+            text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
+            nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
+            text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox);
+        }
+    }
+
     /* Create temporary list of children */
     GSList *l = NULL;
     SPObject *child;
@@ -361,6 +377,8 @@ sp_text_show(SPItem *item, NRArena *arena, unsigned /* key*/, unsigned /*flags*/
     NRArenaGroup *flowed = NRArenaGroup::create(arena);
     nr_arena_group_set_transparent (flowed, FALSE);
 
+    nr_arena_group_set_style(flowed, group->style);
+
     // pass the bbox of the text object as paintbox (used for paintserver fills)
     NRRect paintbox;
     sp_item_invoke_bbox(item, &paintbox, NR::identity(), TRUE);
@@ -395,7 +413,7 @@ sp_text_description(SPItem *item)
         n = g_strdup(_("<no name found>"));
     }
 
-    GString *xs = SP_PX_TO_METRIC_STRING(style->font_size.computed, SP_DT_NAMEDVIEW(SP_ACTIVE_DESKTOP)->getDefaultMetric());
+    GString *xs = SP_PX_TO_METRIC_STRING(style->font_size.computed, sp_desktop_namedview(SP_ACTIVE_DESKTOP)->getDefaultMetric());
 
     char *ret = ( SP_IS_TEXT_TEXTPATH(item)
                   ? g_strdup_printf(_("<b>Text on path</b> (%s, %s)"), n, xs->str)