diff options
| author | Jabiertxof <jtx@jtx> | 2017-01-04 20:38:05 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2017-01-04 20:38:05 +0000 |
| commit | 72a83bc13438724d098533b7d54da814cc7ef4ff (patch) | |
| tree | f6fceff4ea45dab0ea27fbdf0f1b0b597bc1ba67 /src/live_effects/lpe-mirror_symmetry.cpp | |
| parent | Fixing broken things (diff) | |
| download | inkscape-72a83bc13438724d098533b7d54da814cc7ef4ff.tar.gz inkscape-72a83bc13438724d098533b7d54da814cc7ef4ff.zip | |
Fixing some bugs
(bzr r15295.1.50)
Diffstat (limited to 'src/live_effects/lpe-mirror_symmetry.cpp')
| -rw-r--r-- | src/live_effects/lpe-mirror_symmetry.cpp | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index 576c7df5e..07a0d8b0c 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -89,7 +89,7 @@ LPEMirrorSymmetry::~LPEMirrorSymmetry() void LPEMirrorSymmetry::doAfterEffect (SPLPEItem const* lpeitem) { - if (split_elements) { + if (split_elements && !discard_orig_path) { // if (discard_orig_path) { // discard_orig_path.param_setValue(false); // discard_orig_path.write_to_SVG(); @@ -191,7 +191,7 @@ LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem) } void -LPEMirrorSymmetry::cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, const char * attributes) +LPEMirrorSymmetry::cloneD(SPObject *origin, SPObject *dest, bool live, bool root) { SPDocument * document = SP_ACTIVE_DOCUMENT; Inkscape::XML::Document *xml_doc = document->getReprDoc(); @@ -201,37 +201,35 @@ LPEMirrorSymmetry::cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, c for (std::vector<SPObject * >::iterator obj_it = childs.begin(); obj_it != childs.end(); ++obj_it) { SPObject *dest_child = dest->nthChild(index); - cloneAttrbutes(*obj_it, dest_child, live, attributes); + cloneD(*obj_it, dest_child, live, false); index++; } } - gchar ** attarray = g_strsplit(attributes, ",", 0); - gchar ** iter = attarray; - while (*iter != NULL) { - const char* att = (*iter); - SPShape * shape = SP_SHAPE(origin); - SPPath * path = SP_PATH(dest); - if (!path && !SP_IS_GROUP(dest)) { - Inkscape::XML::Node *dest_node = sp_selected_item_to_curved_repr(SP_ITEM(dest), 0); - dest->updateRepr(xml_doc, dest_node, SP_OBJECT_WRITE_ALL); - } + SPShape * shape = SP_SHAPE(origin); + SPPath * path = SP_PATH(dest); + if (!path && !SP_IS_GROUP(dest)) { + Inkscape::XML::Node *dest_node = sp_selected_item_to_curved_repr(SP_ITEM(dest), 0); + dest->updateRepr(xml_doc, dest_node, SP_OBJECT_WRITE_ALL); path = SP_PATH(dest); - if (path && shape) { - if ( live && att == "d") { - SPCurve *c = NULL; + } + if (path && shape) { + if ( live) { + SPCurve *c = NULL; + if (root) { + c = new SPCurve(); + c->set_pathvector(pathvector_before_effect); + } else { c = shape->getCurve(); - if (c) { - path->setCurve(c, TRUE); - dest->getRepr()->setAttribute(att,sp_svg_write_path(c->get_pathvector())); - c->unref(); - } else { - dest->getRepr()->setAttribute(att,NULL); - } + } + if (c) { + path->setCurve(c, TRUE); + c->unref(); } else { - dest->getRepr()->setAttribute(att,origin->getRepr()->attribute(att)); + dest->getRepr()->setAttribute("d", NULL); } + } else { + dest->getRepr()->setAttribute("d", origin->getRepr()->attribute("d")); } - iter++; } } @@ -288,7 +286,7 @@ LPEMirrorSymmetry::toMirror(Geom::Affine transform) elemref = container->appendChildRepr(phantom); Inkscape::GC::release(phantom); } - cloneAttrbutes(SP_OBJECT(sp_lpe_item), elemref, true, "d"); + cloneD(SP_OBJECT(sp_lpe_item), elemref, true, true); elemref->getRepr()->setAttribute("transform" , sp_svg_transform_write(transform)); if (elemref->parent != container) { Inkscape::XML::Node *copy = phantom->duplicate(xml_doc); @@ -553,6 +551,10 @@ LPEMirrorSymmetry::doEffect_path (Geom::PathVector const & path_in) mirror.setInitial(portion.finalPoint()); portion.append(mirror); portion = portion.reversed(); + } else { + if (!tmp_path.empty()) { + tmp_path.appendNew<Geom::LineSegment>( portion.initialPoint() ); + } } if (!original.closed()) { if (!split_elements) { |
