Code

more unreffing temporary styles properly
[inkscape.git] / src / sp-text.cpp
index c1c4acae405cf64362c6bc6d3b4444c6477fec87..5c2c5412c3bd8e606876b70d6c8e6d3cd2dab666 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);
         }
@@ -273,6 +274,7 @@ sp_text_modified (SPObject *object, 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));
             text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox);
         }
     }
@@ -301,13 +303,14 @@ sp_text_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
     SPText *text = SP_TEXT (object);
 
     if (flags & SP_OBJECT_WRITE_BUILD) {
+        Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
         if (!repr)
-            repr = sp_repr_new ("svg:text");
+            repr = xml_doc->createElement("svg:text");
         GSList *l = NULL;
         for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
             Inkscape::XML::Node *crepr = NULL;
             if (SP_IS_STRING(child)) {
-                crepr = sp_repr_new_text(SP_STRING(child)->string.c_str());
+                crepr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
             } else {
                 crepr = child->updateRepr(NULL, flags);
             }
@@ -375,6 +378,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);
@@ -409,7 +414,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)