Code

fix pasting style after copying a text span
[inkscape.git] / src / text-chemistry.cpp
index e1eaa47fb98e6735167471dd87573714444c1d8a..f1348ad670c1393efd6c8cf1d47a6c4d2141aa1b 100644 (file)
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
+
+#include <cstring>
+#include <string>
+#include <glibmm/i18n.h>
+
 #include "libnr/nr-matrix-fns.h"
 #include "xml/repr.h"
-#include <glibmm/i18n.h>
 #include "sp-rect.h"
 #include "sp-textpath.h"
 #include "inkscape.h"
@@ -221,9 +225,9 @@ text_remove_from_path()
     if (!did) {
         sp_desktop_message_stack(desktop)->flash(Inkscape::ERROR_MESSAGE, _("<b>No texts-on-paths</b> in the selection."));
     } else {
-        selection->setList(g_slist_copy((GSList *) selection->itemList())); // reselect to update statusbar description
         sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, 
                          _("Remove text from path"));
+        selection->setList(g_slist_copy((GSList *) selection->itemList())); // reselect to update statusbar description
     }
 }
 
@@ -426,10 +430,10 @@ text_unflow ()
 
         NRRect bbox;
         sp_item_invoke_bbox(SP_ITEM(flowtext), &bbox, sp_item_i2doc_affine(SP_ITEM(flowtext)), TRUE);
-        NR::Point xy(bbox.x0, bbox.y0);
-        if (xy[NR::X] != 1e18 && xy[NR::Y] != 1e18) {
-            sp_repr_set_svg_double(rtext, "x", xy[NR::X]);
-            sp_repr_set_svg_double(rtext, "y", xy[NR::Y]);
+        Geom::Point xy(bbox.x0, bbox.y0);
+        if (xy[Geom::X] != 1e18 && xy[Geom::Y] != 1e18) {
+            sp_repr_set_svg_double(rtext, "x", xy[Geom::X]);
+            sp_repr_set_svg_double(rtext, "y", xy[Geom::Y]);
         }
 
         /* Create <tspan> */
@@ -504,7 +508,7 @@ flowtext_to_text()
         did = true;
 
         Inkscape::XML::Node *parent = SP_OBJECT_REPR(item)->parent();
-        parent->appendChild(repr);
+        parent->addChild(repr, SP_OBJECT_REPR(item));
 
         SPItem *new_item = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
         sp_item_write_transform(new_item, repr, item->transform);