From 2a36d641976fafb68113aa9eb2f7439a868f7a20 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Wed, 2 Jan 2008 14:42:39 +0000 Subject: [PATCH] Fix LP bug #179328 --- src/path-chemistry.cpp | 14 ++++++++++---- src/sp-path.cpp | 14 ++++++++++++++ src/sp-path.h | 1 + 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index b09d63ec0..744d5ede8 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -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); diff --git a/src/sp-path.cpp b/src/sp-path.cpp index 8aed67590..b9e94d72e 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -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++ diff --git a/src/sp-path.h b/src/sp-path.h index cd413db54..bf294c37c 100644 --- a/src/sp-path.h +++ b/src/sp-path.h @@ -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 -- 2.30.2