=== modified file 'src/live_effects/lpe-bendpath.cpp' --- src/live_effects/lpe-bendpath.cpp 2014-03-27 01:33:44 +0000 +++ src/live_effects/lpe-bendpath.cpp 2014-09-27 21:03:43 +0000 @@ -76,6 +76,9 @@ { // get the item bounding box original_bbox(lpeitem); + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); } Geom::Piecewise > === modified file 'src/live_effects/lpe-envelope-perspective.cpp' --- src/live_effects/lpe-envelope-perspective.cpp 2014-08-26 00:27:45 +0000 +++ src/live_effects/lpe-envelope-perspective.cpp 2014-09-27 21:12:20 +0000 @@ -350,6 +350,9 @@ { original_bbox(lpeitem); setDefaults(); + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); } void === modified file 'src/live_effects/lpe-envelope.cpp' --- src/live_effects/lpe-envelope.cpp 2014-03-27 01:33:44 +0000 +++ src/live_effects/lpe-envelope.cpp 2014-09-27 21:03:43 +0000 @@ -32,7 +32,7 @@ bend_path2(_("Right bend path:"), _("Right path along which to bend the original path"), "bendpath2", &wr, this, "M0,0 L1,0"), bend_path3(_("Bottom bend path:"), _("Bottom path along which to bend the original path"), "bendpath3", &wr, this, "M0,0 L1,0"), bend_path4(_("Left bend path:"), _("Left path along which to bend the original path"), "bendpath4", &wr, this, "M0,0 L1,0"), - xx(_("E_nable left & right paths"), _("Enable the left and right deformation paths"), "xx", &wr, this, true), + xx(_("_Enable left & right paths"), _("Enable the left and right deformation paths"), "xx", &wr, this, true), yy(_("_Enable top & bottom paths"), _("Enable the top and bottom deformation paths"), "yy", &wr, this, true) { registerParameter( dynamic_cast(&yy) ); @@ -54,6 +54,9 @@ { // get the item bounding box original_bbox(lpeitem); + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); } Geom::Piecewise > === modified file 'src/live_effects/lpe-lattice.cpp' --- src/live_effects/lpe-lattice.cpp 2014-03-27 01:33:44 +0000 +++ src/live_effects/lpe-lattice.cpp 2014-09-27 21:03:43 +0000 @@ -176,6 +176,9 @@ LPELattice::doBeforeEffect (SPLPEItem const* lpeitem) { original_bbox(lpeitem); + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); } void === modified file 'src/live_effects/lpe-lattice2.cpp' --- src/live_effects/lpe-lattice2.cpp 2014-05-13 07:44:27 +0000 +++ src/live_effects/lpe-lattice2.cpp 2014-09-27 21:11:33 +0000 @@ -254,6 +254,9 @@ { original_bbox(lpeitem); setDefaults(); + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); } void === modified file 'src/live_effects/lpe-mirror_symmetry.cpp' --- src/live_effects/lpe-mirror_symmetry.cpp 2014-03-27 01:33:44 +0000 +++ src/live_effects/lpe-mirror_symmetry.cpp 2014-09-27 21:03:43 +0000 @@ -43,6 +43,14 @@ } void +LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem) +{ + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); +} + +void LPEMirrorSymmetry::doOnApply (SPLPEItem const* lpeitem) { using namespace Geom; === modified file 'src/live_effects/lpe-mirror_symmetry.h' --- src/live_effects/lpe-mirror_symmetry.h 2014-03-27 01:33:44 +0000 +++ src/live_effects/lpe-mirror_symmetry.h 2014-09-27 21:03:43 +0000 @@ -30,6 +30,8 @@ virtual void doOnApply (SPLPEItem const* lpeitem); + virtual void doBeforeEffect (SPLPEItem const* lpeitem); + virtual std::vector doEffect_path (std::vector const & path_in); private: === modified file 'src/live_effects/lpe-offset.cpp' --- src/live_effects/lpe-offset.cpp 2014-03-27 01:33:44 +0000 +++ src/live_effects/lpe-offset.cpp 2014-09-27 21:03:43 +0000 @@ -55,6 +55,14 @@ pwd2.continuousConcat(cap_pwd2); } +void +LPEOffset::doBeforeEffect (SPLPEItem const* lpeitem) +{ + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); +} + Geom::Piecewise > LPEOffset::doEffect_pwd2 (Geom::Piecewise > const & pwd2_in) { === modified file 'src/live_effects/lpe-offset.h' --- src/live_effects/lpe-offset.h 2014-03-27 01:33:44 +0000 +++ src/live_effects/lpe-offset.h 2014-09-27 21:03:43 +0000 @@ -28,6 +28,8 @@ virtual void doOnApply (SPLPEItem const* lpeitem); + virtual void doBeforeEffect (SPLPEItem const* lpeitem); + virtual Geom::Piecewise > doEffect_pwd2 (Geom::Piecewise > const & pwd2_in); private: === modified file 'src/live_effects/lpe-perspective_path.cpp' --- src/live_effects/lpe-perspective_path.cpp 2014-08-30 15:31:41 +0000 +++ src/live_effects/lpe-perspective_path.cpp 2014-09-27 21:03:43 +0000 @@ -90,6 +90,9 @@ SP_LPE_ITEM(lpeitem)->removeCurrentPathEffect(false); return; } + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); } void LPEPerspectivePath::refresh(Gtk::Entry* perspective) { === modified file 'src/live_effects/lpe-roughen.cpp' --- src/live_effects/lpe-roughen.cpp 2014-09-15 16:50:10 +0000 +++ src/live_effects/lpe-roughen.cpp 2014-09-27 22:02:11 +0000 @@ -71,11 +71,14 @@ LPERoughen::~LPERoughen() {} -void LPERoughen::doBeforeEffect(SPLPEItem const */*lpeitem*/) +void LPERoughen::doBeforeEffect(SPLPEItem const *lpeitem) { displaceX.resetRandomizer(); displaceY.resetRandomizer(); srand(1); + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); } Gtk::Widget *LPERoughen::newWidget() === modified file 'src/live_effects/lpe-roughen.h' --- src/live_effects/lpe-roughen.h 2014-09-15 16:50:10 +0000 +++ src/live_effects/lpe-roughen.h 2014-09-27 22:02:09 +0000 @@ -38,7 +38,7 @@ virtual void doEffect(SPCurve *curve); virtual double sign(double randNumber); virtual Geom::Point randomize(); - virtual void doBeforeEffect(SPLPEItem const */*lpeitem*/); + virtual void doBeforeEffect(SPLPEItem const * lpeitem); virtual SPCurve *addNodesAndJitter(const Geom::Curve *A, double t); virtual SPCurve *jitter(const Geom::Curve *A); virtual Geom::Point tpoint(Geom::Point A, Geom::Point B, double t = 0.5); === modified file 'src/live_effects/lpe-simplify.cpp' --- src/live_effects/lpe-simplify.cpp 2014-08-11 03:11:03 +0000 +++ src/live_effects/lpe-simplify.cpp 2014-09-27 21:11:02 +0000 @@ -65,6 +65,9 @@ hp.clear(); } bbox = SP_ITEM(lpeitem)->visualBounds(); + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); } === modified file 'src/live_effects/lpe-vonkoch.cpp' --- src/live_effects/lpe-vonkoch.cpp 2014-06-19 00:29:52 +0000 +++ src/live_effects/lpe-vonkoch.cpp 2014-09-27 21:55:17 +0000 @@ -264,6 +264,9 @@ tmp_pathv.push_back(tmp_path); ref_path.set_new_value(tmp_pathv,true); } + SPLPEItem * item = const_cast(lpeitem); + item->apply_to_clippath(item); + item->apply_to_mask(item); } === modified file 'src/selection-chemistry.cpp' --- src/selection-chemistry.cpp 2014-08-17 14:58:39 +0000 +++ src/selection-chemistry.cpp 2014-09-27 21:03:43 +0000 @@ -4063,6 +4063,10 @@ for ( SPObject *child = obj->firstChild() ; child; child = child->getNext() ) { // Collect all clipped paths and masks within a single group Inkscape::XML::Node *copy = SP_OBJECT(child)->getRepr()->duplicate(xml_doc); + if(copy->attribute("inkscape:original-d")) + { + copy->setAttribute("d", copy->attribute("inkscape:original-d")); + } items_to_move = g_slist_prepend(items_to_move, copy); } === modified file 'src/sp-lpe-item.cpp' --- src/sp-lpe-item.cpp 2014-07-30 15:53:05 +0000 +++ src/sp-lpe-item.cpp 2014-09-27 22:55:01 +0000 @@ -56,7 +56,6 @@ static void sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem); static void sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem); -static void sp_lpe_item_apply_to_clip_or_mask_group(SPGroup * group, SPItem * item); typedef std::list HRefList; static std::string patheffectlist_write_svg(PathEffectList const & list); @@ -344,6 +343,16 @@ { g_return_if_fail(lpeitem != NULL); + SPMask * mask = lpeitem->mask_ref->getObject(); + if(mask) + { + sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(mask->firstChild())); + } + SPClipPath * clipPath = lpeitem->clip_ref->getObject(); + if(clipPath) + { + sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild())); + } if (SP_IS_GROUP(lpeitem)) { GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( GSList const *iter = item_list; iter; iter = iter->next ) { @@ -367,6 +376,18 @@ g_return_if_fail(lpeitem != NULL); if (SP_IS_GROUP(lpeitem)) { + if (!lpeitem->hasPathEffectRecursive()) { + SPMask * mask = lpeitem->mask_ref->getObject(); + if(mask) + { + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild())); + } + SPClipPath * clipPath = lpeitem->clip_ref->getObject(); + if(clipPath) + { + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild())); + } + } GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( GSList const *iter = item_list; iter; iter = iter->next ) { SPObject *subitem = static_cast(iter->data); @@ -378,6 +399,16 @@ else if (SP_IS_PATH(lpeitem)) { Inkscape::XML::Node *repr = lpeitem->getRepr(); if (!lpeitem->hasPathEffectRecursive() && repr->attribute("inkscape:original-d")) { + SPMask * mask = lpeitem->mask_ref->getObject(); + if(mask) + { + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild())); + } + SPClipPath * clipPath = lpeitem->clip_ref->getObject(); + if(clipPath) + { + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild())); + } repr->setAttribute("d", repr->attribute("inkscape:original-d")); repr->setAttribute("inkscape:original-d", NULL); } @@ -613,12 +644,8 @@ return hasPathEffect(); } } - -//The next 3 functions are because the revert of the bug 1241902 -//for the moment not used - void -sp_lpe_item_apply_to_clippath(SPItem * item) +SPLPEItem::apply_to_clippath(SPItem *item) { SPClipPath *clipPath = item->clip_ref->getObject(); if(clipPath) { @@ -630,11 +657,18 @@ } else if(SP_IS_SHAPE(clip_data)) { clip_curve = SP_SHAPE(clip_data)->getCurve(); } else if(SP_IS_GROUP(clip_data)) { - sp_lpe_item_apply_to_clip_or_mask_group(SP_GROUP(clip_data), item); + apply_to_clip_or_mask_group(SP_ITEM(clip_data), item); return; } if(clip_curve) { - bool success = SP_LPE_ITEM(item)->performPathEffect(clip_curve); + bool success = false; + if(SP_IS_GROUP(this)){ + clip_curve->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this))); + success = this->performPathEffect(clip_curve); + clip_curve->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this)).inverse()); + } else { + success = this->performPathEffect(clip_curve); + } Inkscape::XML::Node *reprClip = clip_data->getRepr(); if (success) { gchar *str = sp_svg_write_path(clip_curve->get_pathvector()); @@ -654,10 +688,17 @@ clip_curve->unref(); } } + if(SP_IS_GROUP(item)){ + GSList const *item_list = sp_item_group_item_list(SP_GROUP(item)); + for ( GSList const *iter = item_list; iter; iter = iter->next ) { + SPObject *subitem = static_cast(iter->data); + apply_to_clippath(SP_ITEM(subitem)); + } + } } void -sp_lpe_item_apply_to_mask(SPItem * item) +SPLPEItem::apply_to_mask(SPItem *item) { SPMask *mask = item->mask_ref->getObject(); if(mask) { @@ -669,11 +710,18 @@ } else if(SP_IS_SHAPE(mask_data)) { mask_curve = SP_SHAPE(mask_data)->getCurve(); } else if(SP_IS_GROUP(mask_data)) { - sp_lpe_item_apply_to_clip_or_mask_group(SP_GROUP(mask_data), item); + apply_to_clip_or_mask_group(SP_ITEM(mask_data), item); return; } if(mask_curve) { - bool success = SP_LPE_ITEM(item)->performPathEffect(mask_curve); + bool success = false; + if(SP_IS_GROUP(this)){ + mask_curve->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this))); + success = this->performPathEffect(mask_curve); + mask_curve->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this)).inverse()); + } else { + success = this->performPathEffect(mask_curve); + } Inkscape::XML::Node *reprmask = mask_data->getRepr(); if (success) { gchar *str = sp_svg_write_path(mask_curve->get_pathvector()); @@ -693,16 +741,26 @@ mask_curve->unref(); } } + if(SP_IS_GROUP(item)){ + GSList const *item_list = sp_item_group_item_list(SP_GROUP(item)); + for ( GSList const *iter = item_list; iter; iter = iter->next ) { + SPObject *subitem = static_cast(iter->data); + apply_to_mask(SP_ITEM(subitem)); + } + } } -static void -sp_lpe_item_apply_to_clip_or_mask_group(SPGroup *group, SPItem *item) +void +SPLPEItem::apply_to_clip_or_mask_group(SPItem *group, SPItem *item) { - GSList *item_list = sp_item_group_item_list(group); + if (!SP_IS_GROUP(group)) { + return; + } + GSList *item_list = sp_item_group_item_list(SP_GROUP(group)); for ( GSList *iter = item_list; iter; iter = iter->next ) { SPObject *subitem = static_cast(iter->data); if (SP_IS_GROUP(subitem)) { - sp_lpe_item_apply_to_clip_or_mask_group(SP_GROUP(subitem), item); + apply_to_clip_or_mask_group(SP_ITEM(subitem), item); } else if (SP_IS_SHAPE(subitem)) { SPCurve * c = NULL; @@ -712,7 +770,14 @@ c = SP_SHAPE(subitem)->getCurve(); } if (c) { - bool success = SP_LPE_ITEM(item)->performPathEffect(c); + bool success = false; + if(SP_IS_GROUP(group)){ + c->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this))); + success = this->performPathEffect(c); + c->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this)).inverse()); + } else { + success = this->performPathEffect(c); + } Inkscape::XML::Node *repr = subitem->getRepr(); if (success) { gchar *str = sp_svg_write_path(c->get_pathvector()); === modified file 'src/sp-lpe-item.h' --- src/sp-lpe-item.h 2014-08-31 18:17:26 +0000 +++ src/sp-lpe-item.h 2014-09-27 21:03:43 +0000 @@ -90,14 +90,14 @@ void removeAllPathEffects(bool keep_paths); void addPathEffect(char *value, bool reset); void addPathEffect(LivePathEffectObject * new_lpeobj); - + void apply_to_mask(SPItem * item); + void apply_to_clippath(SPItem * item); + void apply_to_clip_or_mask_group(SPItem * group, SPItem * item); bool forkPathEffectsIfNecessary(unsigned int nr_of_allowed_users = 1); void editNextParamOncanvas(SPDesktop *dt); }; -void sp_lpe_item_apply_to_mask(SPItem * item); -void sp_lpe_item_apply_to_clippath(SPItem * item); void sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write); // careful, class already has method with *very* similar name! #endif /* !SP_LPE_ITEM_H_SEEN */