From e7eeaf23639692c87f9cd772b8cdbfb7e54ceea6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 14:49:05 +0100 Subject: Fix a bug on duplicate item with multiples LPE on it. previously the LPE become "clones" if more than 1 LPE on the item. Also wee need to discuss what happends on LPE copied what are inside a group, fork them or clone, currently are cloned This can be a feature or a bug in the same user with diferent works. My proposal is fork it and add a item in paste LPEs to allow cloned LPE on paste (bzr r15213) --- src/ui/clipboard.cpp | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 0a671cc8a..ef00e11b3 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -688,7 +688,23 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) else obj_copy = _copyNode(obj, _doc, _clipnode); - + // For lpe items, copy lpe stack if applicable + SPLPEItem *lpeitem = dynamic_cast(item); + if (lpeitem) { + Inkscape::SVGOStringStream os; + if (lpeitem->hasPathEffect()) { + for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it) + { + LivePathEffectObject *lpeobj = (*it)->lpeobject; + if (lpeobj) { + Inkscape::XML::Node * lpeobjcopy = _copyNode(lpeobj->getRepr(), _doc, _defs); + lpeobjcopy->setAttribute("id",lpeobj->getRepr()->attribute("id")); + os << "#" << lpeobj->getRepr()->attribute("id") << ";"; + } + } + } + obj_copy->setAttribute("inkscape:path-effect", os.str().c_str()); + } // copy complete inherited style SPCSSAttr *css = sp_repr_css_attr_inherited(obj, "style"); sp_repr_css_set(obj_copy, css, "style"); @@ -720,14 +736,6 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) sp_repr_css_set(_clipnode, style, "style"); sp_repr_css_attr_unref(style); } - - // copy path effect from the first path - if (object) { - gchar const *effect =object->getRepr()->attribute("inkscape:path-effect"); - if (effect) { - _clipnode->setAttribute("inkscape:path-effect", effect); - } - } } Geom::OptRect size = selection->visualBounds(); @@ -784,20 +792,6 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) } } - // For lpe items, copy lpe stack if applicable - SPLPEItem *lpeitem = dynamic_cast(item); - if (lpeitem) { - if (lpeitem->hasPathEffect()) { - for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it) - { - LivePathEffectObject *lpeobj = (*it)->lpeobject; - if (lpeobj) { - _copyNode(lpeobj->getRepr(), _doc, _defs); - } - } - } - } - // For 3D boxes, copy perspectives { SPBox3D *box = dynamic_cast(item); -- cgit v1.2.3