Code

Fix LP bug #179328
authorjohanengelen <johanengelen@users.sourceforge.net>
Wed, 2 Jan 2008 14:42:39 +0000 (14:42 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Wed, 2 Jan 2008 14:42:39 +0000 (14:42 +0000)
src/path-chemistry.cpp
src/sp-path.cpp
src/sp-path.h

index b09d63ec067661fbf3957dc8ecba64c9ebad7253..744d5ede80b46b9f2ed086cce01c1fbb4cb2005f 100644 (file)
@@ -388,6 +388,8 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/)
     return repr;
 }
 
+
+// FIXME: THIS DOES NOT REVERSE THE NODETYPES ORDER!
 void
 sp_selected_path_reverse()
 {
@@ -410,16 +412,20 @@ sp_selected_path_reverse()
 
     for (GSList *i = items; i != NULL; i = i->next) {
 
-        if (!SP_IS_SHAPE(i->data))
+        if (!SP_IS_PATH(i->data))
             continue;
 
         did = true;
-        SPShape *shape = SP_SHAPE(i->data);
+        SPPath *path = SP_PATH(i->data);
 
-        SPCurve *rcurve = sp_curve_reverse(shape->curve);
+        SPCurve *rcurve = sp_curve_reverse(sp_path_get_curve_reference(path));
 
         gchar *str = sp_svg_write_path(SP_CURVE_BPATH(rcurve));
-        SP_OBJECT_REPR(shape)->setAttribute("d", str);
+        if ( sp_shape_has_path_effect(SP_SHAPE(path)) ) {
+            SP_OBJECT_REPR(path)->setAttribute("inkscape:original-d", str);
+        } else {
+            SP_OBJECT_REPR(path)->setAttribute("d", str);
+        }
         g_free(str);
 
         sp_curve_unref(rcurve);
index 8aed675900901ec04325d3d708a2e81b6a40058b..b9e94d72e3a6ffcfbc81cb9ce043eeaf29a9292a 100644 (file)
@@ -452,6 +452,20 @@ sp_path_get_curve_for_edit (SPPath *path)
     }
 }
 
+/**
+ * Return a reference to original_curve if it exists or
+ * shape->curve if not.
+ */
+const SPCurve*
+sp_path_get_curve_reference (SPPath *path)
+{
+    if (path->original_curve) {
+        return path->original_curve;
+    } else {
+        return path->curve;
+    }
+}
+
 /*
   Local Variables:
   mode:c++
index cd413db5447481140eee38553b1a7e1540206eaf..bf294c37ceebedf980d5af97eae31be309292e27 100644 (file)
@@ -37,6 +37,7 @@ gint sp_nodes_in_path(SPPath *path);
 void     sp_path_set_original_curve (SPPath *path, SPCurve *curve, unsigned int owner, bool write);
 SPCurve* sp_path_get_original_curve (SPPath *path);
 SPCurve* sp_path_get_curve_for_edit (SPPath *path);
+const SPCurve* sp_path_get_curve_reference (SPPath *path);
 
 #endif