From ebc5ac2b758155192114ea1bec8b3d32820a18d3 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 3 Dec 2013 16:55:14 +0100 Subject: Fix a bug delete BSpline LPE from a path retain some BSpline properties (bzr r11950.1.206) --- src/ui/tool/path-manipulator.cpp | 52 ++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 21 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index e66c6a899..fd421e587 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -43,9 +43,9 @@ #include "ui/tool/multi-path-manipulator.h" #include "xml/node.h" #include "xml/node-observer.h" -//BSpline + #include "live_effects/lpe-bspline.h" -//BSpline end + namespace Inkscape { namespace UI { @@ -150,20 +150,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, sigc::hide( sigc::mem_fun(*this, &PathManipulator::_updateOutlineOnZoomChange))); _createControlPointsFromGeometry(); - //BSpline - lpe_bsp = NULL; - - if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); - if(thisEffect){ - lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); - } - } - - if(lpe_bsp){ - isBSpline = true; - } - //BSpline End + BSpline(); } PathManipulator::~PathManipulator() @@ -681,7 +668,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite nl.erase(start); start = next; } - //BSpline + if(isBSpline){ double pos = 0.0000; if(start.prev()){ @@ -693,7 +680,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite end->back()->setPosition(BSplineHandleReposition(end->back(),pos)); } } - //BSpline End + return del_len; } @@ -928,9 +915,9 @@ void PathManipulator::showHandles(bool show) /** Set the visibility of outline. */ void PathManipulator::showOutline(bool show) { - //BSpline + if(isBSpline) show = true; - //BSpline + if (show == _show_outline) return; _show_outline = show; _updateOutline(); @@ -1204,10 +1191,33 @@ void PathManipulator::_createControlPointsFromGeometry() } } -int PathManipulator::getSteps(){ +int PathManipulator::BSplineGetSteps(){ + LivePathEffect::LPEBSpline *lpe_bsp = NULL; + + if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + } + } return lpe_bsp->steps+1; } +void PathManipulator::BSpline(){ + LivePathEffect::LPEBSpline *lpe_bsp = NULL; + + if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + } + } + isBSpline = false; + if(lpe_bsp){ + isBSpline = true; + } +} + double PathManipulator::BSplineHandlePosition(Handle *h){ using Geom::X; using Geom::Y; -- cgit v1.2.3