diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-04-10 20:13:49 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-04-10 20:13:49 +0000 |
| commit | fa68fdb0ddb24cf72b56d2fc895e784b8cfcbc9a (patch) | |
| tree | f5416fe697de60e3dd284e44e40ec285834ee34b /src/ui/tool | |
| parent | Rename a variable to current coding style (diff) | |
| parent | added info about multiple pen feature in gui (diff) | |
| download | inkscape-fa68fdb0ddb24cf72b56d2fc895e784b8cfcbc9a.tar.gz inkscape-fa68fdb0ddb24cf72b56d2fc895e784b8cfcbc9a.zip | |
update to trunk
(bzr r12588.1.42)
Diffstat (limited to 'src/ui/tool')
| -rw-r--r-- | src/ui/tool/curve-drag-point.cpp | 4 | ||||
| -rw-r--r-- | src/ui/tool/node.cpp | 98 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 122 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.h | 12 |
4 files changed, 118 insertions, 118 deletions
diff --git a/src/ui/tool/curve-drag-point.cpp b/src/ui/tool/curve-drag-point.cpp index a90dfb155..23640456e 100644 --- a/src/ui/tool/curve-drag-point.cpp +++ b/src/ui/tool/curve-drag-point.cpp @@ -54,7 +54,7 @@ bool CurveDragPoint::grabbed(GdkEventMotion */*event*/) // delta is a vector equal 1/3 of distance from first to second Geom::Point delta = (second->position() - first->position()) / 3.0; // only update the nodes if the mode is bspline - if(!_pm.isBSpline()){ + if(!_pm._isBSpline()){ first->front()->move(first->front()->position() + delta); second->back()->move(second->back()->position() - delta); } @@ -91,7 +91,7 @@ void CurveDragPoint::dragged(Geom::Point &new_pos, GdkEventMotion *event) Geom::Point offset1 = (weight/(3*t*t*(1-t))) * delta; //modified so that, if the trace is bspline, it only acts if the SHIFT key is pressed - if(!_pm.isBSpline()){ + if(!_pm._isBSpline()){ first->front()->move(first->front()->position() + offset0); second->back()->move(second->back()->position() + offset1); }else if(weight>=0.8){ diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 08cc6708d..aa5365265 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -175,9 +175,9 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); //move the handler and its oposite the same proportion - if(_pm().isBSpline()){ - setPosition(_pm().BSplineHandleReposition(this,this)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); + if(_pm()._isBSpline()){ + setPosition(_pm()._bsplineHandleReposition(this,this)); + this->other()->setPosition(_pm()._bsplineHandleReposition(this->other(),this)); } return; } @@ -192,9 +192,9 @@ void Handle::move(Geom::Point const &new_pos) setRelativePos(new_delta); //move the handler and its oposite the same proportion - if(_pm().isBSpline()){ - setPosition(_pm().BSplineHandleReposition(this,this)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); + if(_pm()._isBSpline()){ + setPosition(_pm()._bsplineHandleReposition(this,this)); + this->other()->setPosition(_pm()._bsplineHandleReposition(this->other(),this)); } return; @@ -218,9 +218,9 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); // moves the handler and its oposite the same proportion - if(_pm().isBSpline()){ - setPosition(_pm().BSplineHandleReposition(this,this)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); + if(_pm()._isBSpline()){ + setPosition(_pm()._bsplineHandleReposition(this,this)); + this->other()->setPosition(_pm()._bsplineHandleReposition(this->other(),this)); } } @@ -312,9 +312,9 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven //this function moves the handler and its oposite to the default proportion of defaultStartPower void Handle::handle_2button_press(){ - if(_pm().isBSpline()){ - setPosition(_pm().BSplineHandleReposition(this,defaultStartPower)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),defaultStartPower)); + if(_pm()._isBSpline()){ + setPosition(_pm()._bsplineHandleReposition(this,defaultStartPower)); + this->other()->setPosition(_pm()._bsplineHandleReposition(this->other(),defaultStartPower)); _pm().update(); } } @@ -372,16 +372,16 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) new_pos = result; // moves the handler and its oposite in X fixed positions depending on parameter "steps with control" // by default in live BSpline - if(_pm().isBSpline()){ + if(_pm()._isBSpline()){ setPosition(new_pos); - int steps = _pm().BSplineGetSteps(); - new_pos=_pm().BSplineHandleReposition(this,ceilf(_pm().BSplineHandlePosition(this,this)*steps)/steps); + int steps = _pm()._bsplineGetSteps(); + new_pos=_pm()._bsplineHandleReposition(this,ceilf(_pm()._bsplineHandlePosition(this,this)*steps)/steps); } } std::vector<Inkscape::SnapCandidatePoint> unselected; //if the snap adjustment is activated and it is not bspline - if (snap && !_pm().isBSpline()) { + if (snap && !_pm()._isBSpline()) { ControlPointSelection::Set &nodes = _parent->_selection.allPoints(); for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { Node *n = static_cast<Node*>(*i); @@ -422,7 +422,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } } //if it is bspline but SHIFT or CONTROL are not pressed it fixes it in the original position - if(_pm().isBSpline() && !held_shift(*event) && !held_control(*event)){ + if(_pm()._isBSpline() && !held_shift(*event) && !held_control(*event)){ new_pos=_last_drag_origin(); } move(new_pos); // needed for correct update, even though it's redundant @@ -486,7 +486,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 Handle *h = const_cast<Handle *>(this); - bool isBSpline = _pm().isBSpline(); + 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"); @@ -549,7 +549,7 @@ Glib::ustring Handle::_getTip(unsigned state) const "<b>Auto node handle</b>: drag to convert to smooth node (%s)"), more); }else{ return format_tip(C_("Path handle tip", - "<b>BSpline node handle</b>: Shift to drag, double click to reset (%s). %g power"),more,_pm().BSplineHandlePosition(h,NULL)); + "<b>BSpline node handle</b>: Shift to drag, double click to reset (%s). %g power"),more,_pm()._bsplineHandlePosition(h,NULL)); } } } @@ -633,15 +633,15 @@ void Node::move(Geom::Point const &new_pos) Node *n = this; Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); - nodeWeight = fmax(_pm().BSplineHandlePosition(n->front()),_pm().BSplineHandlePosition(n->back())); + nodeWeight = fmax(_pm()._bsplineHandlePosition(n->front()),_pm()._bsplineHandlePosition(n->back())); if(prevNode){ if(prevNode->isEndNode()){ - prevNodeWeight = _pm().BSplineHandlePosition(prevNode->front(),prevNode->front()); + prevNodeWeight = _pm()._bsplineHandlePosition(prevNode->front(),prevNode->front()); } } if(nextNode){ if(nextNode->isEndNode()){ - nextNodeWeight = _pm().BSplineHandlePosition(nextNode->back(),nextNode->back()); + nextNodeWeight = _pm()._bsplineHandlePosition(nextNode->back(),nextNode->back()); } } @@ -655,21 +655,21 @@ void Node::move(Geom::Point const &new_pos) _fixNeighbors(old_pos, new_pos); // move the affected handlers. First the node ones, later the adjoining ones. - if(_pm().isBSpline()){ - _front.setPosition(_pm().BSplineHandleReposition(this->front(),nodeWeight)); - _back.setPosition(_pm().BSplineHandleReposition(this->back(),nodeWeight)); + if(_pm()._isBSpline()){ + _front.setPosition(_pm()._bsplineHandleReposition(this->front(),nodeWeight)); + _back.setPosition(_pm()._bsplineHandleReposition(this->back(),nodeWeight)); if(prevNode){ if(prevNode->isEndNode()){ - prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevNodeWeight)); + prevNode->front()->setPosition(_pm()._bsplineHandleReposition(prevNode->front(),prevNodeWeight)); }else{ - prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevNode->back())); + prevNode->front()->setPosition(_pm()._bsplineHandleReposition(prevNode->front(),prevNode->back())); } } if(nextNode){ if(nextNode->isEndNode()){ - nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNodeWeight)); + nextNode->back()->setPosition(_pm()._bsplineHandleReposition(nextNode->back(),nextNodeWeight)); }else{ - nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNode->front())); + nextNode->back()->setPosition(_pm()._bsplineHandleReposition(nextNode->back(),nextNode->front())); } } } @@ -687,15 +687,15 @@ void Node::transform(Geom::Affine const &m) Node *n = this; Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); - nodeWeight = _pm().BSplineHandlePosition(n->front()); + nodeWeight = _pm()._bsplineHandlePosition(n->front()); if(prevNode){ if(prevNode->isEndNode()){ - prevNodeWeight = _pm().BSplineHandlePosition(prevNode->front(),prevNode->front()); + prevNodeWeight = _pm()._bsplineHandlePosition(prevNode->front(),prevNode->front()); } } if(nextNode){ if(nextNode->isEndNode()){ - nextNodeWeight = _pm().BSplineHandlePosition(nextNode->back(),nextNode->back()); + nextNodeWeight = _pm()._bsplineHandlePosition(nextNode->back(),nextNode->back()); } } @@ -708,21 +708,21 @@ void Node::transform(Geom::Affine const &m) _fixNeighbors(old_pos, position()); // move the involved handlers, first the node ones, later the adjoining ones - if(_pm().isBSpline()){ - _front.setPosition(_pm().BSplineHandleReposition(this->front(),nodeWeight)); - _back.setPosition(_pm().BSplineHandleReposition(this->back(),nodeWeight)); + if(_pm()._isBSpline()){ + _front.setPosition(_pm()._bsplineHandleReposition(this->front(),nodeWeight)); + _back.setPosition(_pm()._bsplineHandleReposition(this->back(),nodeWeight)); if(prevNode){ if(prevNode->isEndNode()){ - prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevNodeWeight)); + prevNode->front()->setPosition(_pm()._bsplineHandleReposition(prevNode->front(),prevNodeWeight)); }else{ - prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevNode->back())); + prevNode->front()->setPosition(_pm()._bsplineHandleReposition(prevNode->front(),prevNode->back())); } } if(nextNode){ if(nextNode->isEndNode()){ - nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNodeWeight)); + nextNode->back()->setPosition(_pm()._bsplineHandleReposition(nextNode->back(),nextNodeWeight)); }else{ - nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNode->front())); + nextNode->back()->setPosition(_pm()._bsplineHandleReposition(nextNode->back(),nextNode->front())); } } } @@ -915,13 +915,13 @@ void Node::setType(NodeType type, bool update_handles) } /* in node type changes, about bspline traces, we can mantain them with noPower power in border mode, or we give them the default power in curve mode */ - if(_pm().isBSpline()){ + if(_pm()._isBSpline()){ double weight = noPower; - if(_pm().BSplineHandlePosition(this->front()) != noPower ){ + if(_pm()._bsplineHandlePosition(this->front()) != noPower ){ weight = defaultStartPower; } - _front.setPosition(_pm().BSplineHandleReposition(this->front(),weight)); - _back.setPosition(_pm().BSplineHandleReposition(this->back(),weight)); + _front.setPosition(_pm()._bsplineHandleReposition(this->front(),weight)); + _back.setPosition(_pm()._bsplineHandleReposition(this->back(),weight)); } } _type = type; @@ -1171,9 +1171,9 @@ void Node::_setState(State state) mgr.setActive(_canvas_item, true); mgr.setPrelight(_canvas_item, false); //this shows the handlers when selecting the nodes - if(_pm().isBSpline()){ - this->front()->setPosition(_pm().BSplineHandleReposition(this->front())); - this->back()->setPosition(_pm().BSplineHandleReposition(this->back())); + if(_pm()._isBSpline()){ + this->front()->setPosition(_pm()._bsplineHandleReposition(this->front())); + this->back()->setPosition(_pm()._bsplineHandleReposition(this->back())); } break; } @@ -1433,7 +1433,7 @@ Node *Node::nodeAwayFrom(Handle *h) Glib::ustring Node::_getTip(unsigned state) const { - bool isBSpline = _pm().isBSpline(); + bool isBSpline = _pm()._isBSpline(); Handle *h = const_cast<Handle *>(&_front); Handle *h2 = const_cast<Handle *>(&_back); if (state_held_shift(state)) { @@ -1470,7 +1470,7 @@ Glib::ustring Node::_getTip(unsigned state) const "<b>%s</b>: drag to shape the path (more: Shift, Ctrl, Alt)"), nodetype); }else if(_selection.size() == 1){ return format_tip(C_("Path node tip", - "<b>BSpline node</b>: drag to shape the path (more: Shift, Ctrl, Alt). %g power"),_pm().BSplineHandlePosition(h,h2)); + "<b>BSpline node</b>: drag to shape the path (more: Shift, Ctrl, Alt). %g power"),_pm()._bsplineHandlePosition(h,h2)); } return format_tip(C_("Path node tip", "<b>%s</b>: drag to shape the path, click to toggle scale/rotation handles (more: Shift, Ctrl, Alt)"), nodetype); @@ -1480,7 +1480,7 @@ Glib::ustring Node::_getTip(unsigned state) const "<b>%s</b>: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)"), nodetype); }else{ return format_tip(C_("Path node tip", - "<b>BSpline node</b>: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt). %g power"),_pm().BSplineHandlePosition(h,h2)); + "<b>BSpline node</b>: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt). %g power"),_pm()._bsplineHandlePosition(h,h2)); } } diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index dbae69f2c..6b0c95f68 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -56,8 +56,8 @@ enum PathChange { }; } // anonymous namespace -const double handleCubicGap = 0.01; -const double noPower = 0.0; +const double HANDLE_CUBIC_GAP = 0.01; +const double NO_POWER = 0.0; const double defaultStartPower = 0.3334; @@ -152,7 +152,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _createControlPointsFromGeometry(); //Define if the path is BSpline on construction - recalculateIsBSpline(); + _recalculateIsBSpline(); } PathManipulator::~PathManipulator() @@ -671,12 +671,12 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite start = next; } // if we are removing, we readjust the handlers - if(isBSpline()){ + if(_isBSpline()){ if(start.prev()){ - start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),start.prev()->back())); + start.prev()->front()->setPosition(_bsplineHandleReposition(start.prev()->front(),start.prev()->back())); } if(end){ - end->back()->setPosition(BSplineHandleReposition(end->back(),end->front())); + end->back()->setPosition(_bsplineHandleReposition(end->back(),end->front())); } } @@ -1000,30 +1000,30 @@ NodeList::iterator PathManipulator::subdivideSegment(NodeList::iterator first, d // set new handle positions Node *n = new Node(_multi_path_manipulator._path_data.node_data, seg2[0]); - if(!isBSpline()){ + if(!_isBSpline()){ n->back()->setPosition(seg1[2]); n->front()->setPosition(seg2[1]); n->setType(NODE_SMOOTH, false); } else { - Geom::D2< Geom::SBasis > SBasisInsideNodes; - SPCurve *lineInsideNodes = new SPCurve(); + Geom::D2< Geom::SBasis > sbasis_inside_nodes; + SPCurve *line_inside_nodes = new SPCurve(); if(second->back()->isDegenerate()){ - lineInsideNodes->moveto(n->position()); - lineInsideNodes->lineto(second->position()); - SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); - Geom::Point next = SBasisInsideNodes.valueAt(defaultStartPower); - next = Geom::Point(next[Geom::X] + handleCubicGap,next[Geom::Y] + handleCubicGap); - lineInsideNodes->reset(); + line_inside_nodes->moveto(n->position()); + line_inside_nodes->lineto(second->position()); + sbasis_inside_nodes = line_inside_nodes->first_segment()->toSBasis(); + Geom::Point next = sbasis_inside_nodes.valueAt(defaultStartPower); + next = Geom::Point(next[Geom::X] + HANDLE_CUBIC_GAP,next[Geom::Y] + HANDLE_CUBIC_GAP); + line_inside_nodes->reset(); n->front()->setPosition(next); }else{ n->front()->setPosition(seg2[1]); } if(first->front()->isDegenerate()){ - lineInsideNodes->moveto(n->position()); - lineInsideNodes->lineto(first->position()); - SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); - Geom::Point previous = SBasisInsideNodes.valueAt(defaultStartPower); - previous = Geom::Point(previous[Geom::X] + handleCubicGap,previous[Geom::Y] + handleCubicGap); + line_inside_nodes->moveto(n->position()); + line_inside_nodes->lineto(first->position()); + sbasis_inside_nodes = line_inside_nodes->first_segment()->toSBasis(); + Geom::Point previous = sbasis_inside_nodes.valueAt(defaultStartPower); + previous = Geom::Point(previous[Geom::X] + HANDLE_CUBIC_GAP,previous[Geom::Y] + HANDLE_CUBIC_GAP); n->back()->setPosition(previous); }else{ n->back()->setPosition(seg1[2]); @@ -1218,16 +1218,16 @@ void PathManipulator::_createControlPointsFromGeometry() } //determines if the trace has a bspline effect and the number of steps that it takes -int PathManipulator::BSplineGetSteps() const { +int PathManipulator::_bsplineGetSteps() const { LivePathEffect::LPEBSpline const *lpe_bsp = NULL; SPLPEItem * path = dynamic_cast<SPLPEItem *>(_path); if (path){ if(path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect const *thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); - if(thisEffect){ - lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline const*>(thisEffect->getLPEObj()->get_lpe()); + Inkscape::LivePathEffect::Effect const *this_effect = path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(this_effect){ + lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline const*>(this_effect->getLPEObj()->get_lpe()); } } } @@ -1239,10 +1239,10 @@ int PathManipulator::BSplineGetSteps() const { } // determines if the trace has bspline effect -void PathManipulator::recalculateIsBSpline(){ +void PathManipulator::_recalculateIsBSpline(){ if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) { - Inkscape::LivePathEffect::Effect const *thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); - if(thisEffect){ + Inkscape::LivePathEffect::Effect const *this_effect = _path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(this_effect){ _is_bspline = true; return; } @@ -1250,61 +1250,61 @@ void PathManipulator::recalculateIsBSpline(){ _is_bspline = false; } -bool PathManipulator::isBSpline() const { +bool PathManipulator::_isBSpline() const { return _is_bspline; } // returns the corresponding strength to the position of the handlers -double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2) +double PathManipulator::_bsplineHandlePosition(Handle *h, Handle *h2) { using Geom::X; using Geom::Y; if(h2){ h = h2; } - double pos = noPower; + double pos = NO_POWER; Node *n = h->parent(); - Node * nextNode = NULL; - nextNode = n->nodeToward(h); - if(nextNode){ - SPCurve *lineInsideNodes = new SPCurve(); - lineInsideNodes->moveto(n->position()); - lineInsideNodes->lineto(nextNode->position()); + Node * next_node = NULL; + next_node = n->nodeToward(h); + if(next_node){ + SPCurve *line_inside_nodes = new SPCurve(); + line_inside_nodes->moveto(n->position()); + line_inside_nodes->lineto(next_node->position()); if(!are_near(h->position(), n->position())){ - pos = Geom::nearest_point(Geom::Point(h->position()[X] - handleCubicGap, h->position()[Y] - handleCubicGap), *lineInsideNodes->first_segment()); + pos = Geom::nearest_point(Geom::Point(h->position()[X] - HANDLE_CUBIC_GAP, h->position()[Y] - HANDLE_CUBIC_GAP), *line_inside_nodes->first_segment()); } } - if (pos == noPower && !h2){ - return BSplineHandlePosition(h, h->other()); + if (pos == NO_POWER && !h2){ + return _bsplineHandlePosition(h, h->other()); } return pos; } // give the location for the handler in the corresponding position -Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2) +Geom::Point PathManipulator::_bsplineHandleReposition(Handle *h, Handle *h2) { - double pos = this->BSplineHandlePosition(h, h2); - return BSplineHandleReposition(h,pos); + double pos = this->_bsplineHandlePosition(h, h2); + return _bsplineHandleReposition(h,pos); } // give the location for the handler to the specified position -Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ +Geom::Point PathManipulator::_bsplineHandleReposition(Handle *h,double pos){ using Geom::X; using Geom::Y; Geom::Point ret = h->position(); Node *n = h->parent(); - Geom::D2< Geom::SBasis > SBasisInsideNodes; - SPCurve *lineInsideNodes = new SPCurve(); - Node * nextNode = NULL; - nextNode = n->nodeToward(h); - if(nextNode && pos != noPower){ - lineInsideNodes->moveto(n->position()); - lineInsideNodes->lineto(nextNode->position()); - SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); - ret = SBasisInsideNodes.valueAt(pos); - ret = Geom::Point(ret[X] + handleCubicGap,ret[Y] + handleCubicGap); + Geom::D2< Geom::SBasis > sbasis_inside_nodes; + SPCurve *line_inside_nodes = new SPCurve(); + Node * next_node = NULL; + next_node = n->nodeToward(h); + if(next_node && pos != NO_POWER){ + line_inside_nodes->moveto(n->position()); + line_inside_nodes->lineto(next_node->position()); + sbasis_inside_nodes = line_inside_nodes->first_segment()->toSBasis(); + ret = sbasis_inside_nodes.valueAt(pos); + ret = Geom::Point(ret[X] + HANDLE_CUBIC_GAP, ret[Y] + HANDLE_CUBIC_GAP); }else{ - if(pos == noPower){ + if(pos == NO_POWER){ ret = n->position(); } } @@ -1319,7 +1319,7 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) { Geom::PathBuilder builder; //Refresh if is bspline some times -think on path change selection, this value get lost - recalculateIsBSpline(); + _recalculateIsBSpline(); for (std::list<SubpathPtr>::iterator spi = _subpaths.begin(); spi != _subpaths.end(); ) { SubpathPtr subpath = *spi; if (subpath->empty()) { @@ -1349,16 +1349,16 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) if (alert_LPE) { /// \todo note that _path can be an Inkscape::LivePathEffect::Effect* too, kind of confusing, rework member naming? if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) { - Inkscape::LivePathEffect::Effect* thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE); - if(thisEffect){ - LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast<LivePathEffect::LPEPowerStroke*>(thisEffect->getLPEObj()->get_lpe()); + Inkscape::LivePathEffect::Effect* this_effect = _path->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE); + if(this_effect){ + LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast<LivePathEffect::LPEPowerStroke*>(this_effect->getLPEObj()->get_lpe()); if (lpe_pwr) { lpe_pwr->adjustForNewPath(pathv); } } - thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); - if(thisEffect){ - LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast<LivePathEffect::LPEFilletChamfer*>(thisEffect->getLPEObj()->get_lpe()); + this_effect = _path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); + if(this_effect){ + LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast<LivePathEffect::LPEFilletChamfer*>(this_effect->getLPEObj()->get_lpe()); if (lpe_fll) { lpe_fll->adjustForNewPath(pathv); } diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index 6dc1c9d09..2219af849 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() const; + int _bsplineGetSteps() const; // this is necessary for Tab-selection in MultiPathManipulator SubpathList &subpathList() { return _subpaths; } @@ -107,11 +107,11 @@ private: void _createControlPointsFromGeometry(); - void recalculateIsBSpline(); - 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); + void _recalculateIsBSpline(); + 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); void _createGeometryFromControlPoints(bool alert_LPE = false); unsigned _deleteStretch(NodeList::iterator first, NodeList::iterator last, bool keep_shape); std::string _createTypeString(); |
