diff options
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/tool/node.cpp | 12 | ||||
| -rw-r--r-- | src/ui/tool/node.h | 6 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 12 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.h | 3 |
4 files changed, 18 insertions, 15 deletions
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 7ba69b039..1434a5c5b 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -476,9 +476,7 @@ Glib::ustring Handle::_getTip(unsigned state) const // a trick to mark as bspline if the node has no strength, we are going to use it later // to show the appropiate messages. We cannot do it in any different way becasue the function is constant - bool isBSpline = false; - //if( _parent->bsplineWeight != 0.0000) - // isBSpline = true; + bool isBSpline = _pm().isBSpline(); bool can_shift_rotate = _parent->type() == NODE_CUSP && !other()->isDegenerate(); if (can_shift_rotate && !isBSpline) { more = C_("Path handle tip", "more: Shift, Ctrl, Alt"); @@ -1421,13 +1419,7 @@ Node *Node::nodeAwayFrom(Handle *h) Glib::ustring Node::_getTip(unsigned state) const { - - /* if the node doesnt have strength, it marks it as bspline, we'll use it later - to show the appropiate messages. We cannot do it in any other way, because the - function is constant */ - bool isBSpline = false; - //if( this->bsplineWeight != 0.0000) - // isBSpline = true; + bool isBSpline = _pm().isBSpline(); if (state_held_shift(state)) { bool can_drag_out = (_next() && _front.isDegenerate()) || (_prev() && _back.isDegenerate()); if (can_drag_out) { diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index 202dbb3cd..415563a7d 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -217,6 +217,7 @@ public: Node *nodeAwayFrom(Handle *h); NodeList &nodeList() { return *(static_cast<ListNode*>(this)->ln_list); } + NodeList &nodeList() const { return *(static_cast<ListNode const*>(this)->ln_list); } /** * Move the node to the bottom of its canvas group. @@ -263,6 +264,7 @@ private: Inkscape::SnapSourceType _snapSourceType() const; Inkscape::SnapTargetType _snapTargetType() const; inline PathManipulator &_pm(); + inline PathManipulator &_pm() const; /** Determine whether two nodes are joined by a linear segment. */ static bool _is_line_segment(Node *first, Node *second); @@ -494,6 +496,10 @@ inline PathManipulator &Node::_pm() { return nodeList().subpathList().pm(); } +inline PathManipulator &Node::_pm() const { + return nodeList().subpathList().pm(); +} + // definitions for node iterator template <typename N> NodeIterator<N>::operator bool() const { diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 487c31b10..3beeed049 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1181,14 +1181,14 @@ void PathManipulator::_createControlPointsFromGeometry() } //determines if the trace has a bspline effect and the number of steps that it takes -int PathManipulator::BSplineGetSteps(){ +int PathManipulator::BSplineGetSteps() const { - LivePathEffect::LPEBSpline *lpe_bsp = NULL; + LivePathEffect::LPEBSpline const *lpe_bsp = NULL; if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + Inkscape::LivePathEffect::Effect const *thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); if(thisEffect){ - lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline*>(thisEffect->getLPEObj()->get_lpe()); + lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline const*>(thisEffect->getLPEObj()->get_lpe()); } } int steps = 0; @@ -1206,6 +1206,10 @@ bool PathManipulator::isBSpline(bool recalculate){ return _is_bspline; } +bool PathManipulator::isBSpline() const { + return BSplineGetSteps() > 0; +} + // returns the corresponding strength to the position of the handlers double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ using Geom::X; diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index a85664ddf..151805c83 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -96,7 +96,7 @@ public: NodeList::iterator extremeNode(NodeList::iterator origin, bool search_selected, bool search_unselected, bool closest); - int BSplineGetSteps(); + int BSplineGetSteps() const; // this is necessary for Tab-selection in MultiPathManipulator SubpathList &subpathList() { return _subpaths; } @@ -108,6 +108,7 @@ private: void _createControlPointsFromGeometry(); bool isBSpline(bool recalculate = false); + bool isBSpline() const; double BSplineHandlePosition(Handle *h, Handle *h2 = NULL); Geom::Point BSplineHandleReposition(Handle *h, Handle *h2 = NULL); Geom::Point BSplineHandleReposition(Handle *h, double pos); |
