Code

Refactoring SPColor to C++ and removing legacy CMYK implementation
[inkscape.git] / src / splivarot.cpp
index 3ee5b5d61532b010717f520ef9391c54ec06f66d..d16137c1d06a81e1854d7814e6809eb0a6b4d721 100644 (file)
@@ -27,6 +27,8 @@
 #include "marker.h"
 #include "enums.h"
 #include "sp-text.h"
+#include "sp-flowtext.h"
+#include "text-editing.h"
 #include "sp-item-group.h"
 #include "style.h"
 #include "inkscape.h"
@@ -481,7 +483,7 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin
     // premultiply by the inverse of parent's repr
     SPItem *parent_item = SP_ITEM(sp_desktop_document(desktop)->getObjectByRepr(parent));
     NR::Matrix local = sp_item_i2doc_affine(parent_item);
-    gchar *transform = sp_svg_transform_write(local);
+    gchar *transform = sp_svg_transform_write(local.inverse());
 
     // now that we have the result, add it on the canvas
     if ( bop == bool_op_cut || bop == bool_op_slice ) {
@@ -1482,6 +1484,8 @@ sp_selected_path_simplify_item(SPDesktop *desktop,
     Inkscape::XML::Node *parent = SP_OBJECT_REPR(item)->parent();
     // remember id
     char const *id = SP_OBJECT_REPR(item)->attribute("id");
+    // remember path effect
+    char const *patheffect = SP_OBJECT_REPR(item)->attribute("inkscape:path-effect");
 
     //If a group was selected, to not change the selection list
     if (modifySelection)
@@ -1515,7 +1519,10 @@ sp_selected_path_simplify_item(SPDesktop *desktop,
 
     // path
     gchar *str = orig->svg_dump_path();
-    repr->setAttribute("d", str);
+    if (patheffect)
+        repr->setAttribute("inkscape:original-d", str);
+    else 
+        repr->setAttribute("d", str);
     g_free(str);
 
     // restore id
@@ -1532,6 +1539,9 @@ sp_selected_path_simplify_item(SPDesktop *desktop,
     // reapply the transform
     sp_item_write_transform(newitem, repr, transform);
 
+    // restore path effect
+    repr->setAttribute("inkscape:path-effect", patheffect);
+
     //If we are not in a selected group
     if (modifySelection)
         selection->add(repr);
@@ -1701,30 +1711,31 @@ Ancetre(Inkscape::XML::Node *a, Inkscape::XML::Node *who)
 Path *
 Path_for_item(SPItem *item, bool doTransformation, bool transformFull)
 {
-    SPCurve *curve;
+    SPCurve *curve = NULL;
 
     if (!item)
         return NULL;
 
     if (SP_IS_SHAPE(item))
     {
-        curve = sp_shape_get_curve(SP_SHAPE(item));
+        if (SP_IS_PATH(item)) {
+            curve = sp_path_get_curve_for_edit(SP_PATH(item));
+        } else {
+            curve = sp_shape_get_curve(SP_SHAPE(item));
+        }
     }
-    else if (SP_IS_TEXT(item))
+    else if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item))
     {
-        curve = SP_TEXT(item)->getNormalizedBpath();
+        curve = te_get_layout(item)->convertToCurves();
     }
     else if (SP_IS_IMAGE(item))
     {
         curve = sp_image_get_curve(SP_IMAGE(item));
     }
-    else
-    {
-        curve = NULL;
-    }
 
     if (!curve)
         return NULL;
+
     NArtBpath *bpath = SP_CURVE_BPATH(curve);
     if (bpath == NULL)
         return NULL;