From d2417aa8fb6f6945faccd0ba4a19337c509329b6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 17 Nov 2014 22:27:06 +0100 Subject: fix a bug in bspline on apply on non shapes (bzr r13726) --- src/live_effects/lpe-bspline.cpp | 21 ++++----------------- src/live_effects/lpe-bspline.h | 2 +- 2 files changed, 5 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp index 97a4c6205..c5390a0c9 100644 --- a/src/live_effects/lpe-bspline.cpp +++ b/src/live_effects/lpe-bspline.cpp @@ -88,25 +88,12 @@ void LPEBSpline::doBeforeEffect (SPLPEItem const* /*lpeitem*/) } -void LPEBSpline::createAndApply(const char *name, SPDocument *doc, - SPItem *item) +void LPEBSpline::doOnApply(SPLPEItem const* lpeitem) { - if (!SP_IS_SHAPE(item)) { + if (!SP_IS_SHAPE(lpeitem)) { g_warning("LPE BSpline can only be applied to shapes (not groups)."); - } else { - // Path effect definition - Inkscape::XML::Document *xml_doc = doc->getReprDoc(); - Inkscape::XML::Node *repr = xml_doc->createElement("inkscape:path-effect"); - repr->setAttribute("effect", name); - - doc->getDefs()->getRepr() - ->addChild(repr, NULL); // adds to and assigns the 'id' attribute - const gchar *repr_id = repr->attribute("id"); - Inkscape::GC::release(repr); - - gchar *href = g_strdup_printf("#%s", repr_id); - SP_LPE_ITEM(item)->addPathEffect(href, true); - g_free(href); + SPLPEItem * item = const_cast(lpeitem); + item->removeCurrentPathEffect(false); } } diff --git a/src/live_effects/lpe-bspline.h b/src/live_effects/lpe-bspline.h index 8751a5720..a17c0c4ac 100644 --- a/src/live_effects/lpe-bspline.h +++ b/src/live_effects/lpe-bspline.h @@ -19,10 +19,10 @@ public: LPEBSpline(LivePathEffectObject *lpeobject); virtual ~LPEBSpline(); - virtual void createAndApply(const char *name, SPDocument *doc, SPItem *item); virtual LPEPathFlashType pathFlashType() const { return SUPPRESS_FLASH; } + virtual void doOnApply(SPLPEItem const* lpeitem); virtual void doEffect(SPCurve *curve); virtual void doBeforeEffect (SPLPEItem const* lpeitem); void drawHandle(Geom::Point p, double radiusHelperNodes); -- cgit v1.2.3