From 4a0858ff965d54fc08f721fbbc2503f9ab3d9d3c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 18 Feb 2013 11:23:51 +0100 Subject: refactor (bzr r11950.1.35) --- src/ui/tool/node.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index dc6e0fbae..dff8d3dd9 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -13,7 +13,6 @@ #include #include <2geom/bezier-utils.h> #include <2geom/transforms.h> - #include "display/sp-ctrlline.h" #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" @@ -196,8 +195,13 @@ void Handle::move(Geom::Point const &new_pos) break; default: break; } - - setPosition(new_pos); + //BSpline + if(_pm().isBSpline()){ + Handle *h = this; + setPosition(_pm().BSplineHandleReposition(h)); + }else + setPosition(new_pos); + //BSpline End } void Handle::setPosition(Geom::Point const &p) @@ -550,10 +554,24 @@ void Node::move(Geom::Point const &new_pos) // move handles when the node moves. Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); + //BSpline + float pos = 0; + if(_pm().isBSpline()){ + Node *n = this; + pos = _pm().BSplineMaxPosition(n); + } + //BSpline End setPosition(new_pos); _front.setPosition(_front.position() + delta); _back.setPosition(_back.position() + delta); - + //BSpline + if(_pm().isBSpline()){ + Handle* front = &_front; + Handle* back = &_back; + _front.setPosition(_pm().BSplineHandleRepositionFixed(front,pos)); + _back.setPosition(_pm().BSplineHandleRepositionFixed(back,pos)); + } + //BSpline End // if the node has a smooth handle after a line segment, it should be kept colinear // with the segment _fixNeighbors(old_pos, new_pos); -- cgit v1.2.3 From dfe131791aef37e26fd0358c32222dacf813864c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 19 Feb 2013 12:08:14 +0100 Subject: Mayor refactor (bzr r11950.1.36) --- src/ui/tool/node.cpp | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index dff8d3dd9..1a196c857 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -135,6 +135,15 @@ void Handle::move(Geom::Point const &new_pos) Node *node_away = _parent->nodeAwayFrom(this); // node in the opposite direction Handle *towards = node_towards ? node_towards->handleAwayFrom(_parent) : NULL; Handle *towards_second = node_towards ? node_towards->handleToward(_parent) : NULL; + //BSpline + bool isBSpline = false; + double pos = 0; + Handle *h = NULL; + Handle *h2 = NULL; + if(_pm().isBSpline()){ + isBSpline = true; + //BSpline End + } if (Geom::are_near(new_pos, _parent->position())) { // The handle becomes degenerate. @@ -165,6 +174,15 @@ void Handle::move(Geom::Point const &new_pos) other->setDirection(*node_towards, *_parent); } } + //BSpline + if(isBSpline){ + h = this; + setPosition(_pm().BSplineHandleReposition(h)); + pos = _pm().BSplineHandlePosition(h); + h2 = this->other(); + this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos)); + } + //BSpline End setPosition(new_pos); return; } @@ -195,12 +213,15 @@ void Handle::move(Geom::Point const &new_pos) break; default: break; } + setPosition(new_pos); //BSpline - if(_pm().isBSpline()){ - Handle *h = this; + if(isBSpline){ + h = this; setPosition(_pm().BSplineHandleReposition(h)); - }else - setPosition(new_pos); + pos = _pm().BSplineHandlePosition(h); + h2 = this->other(); + this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos)); + } //BSpline End } @@ -555,10 +576,12 @@ void Node::move(Geom::Point const &new_pos) Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); //BSpline - float pos = 0; + double pos = 0; if(_pm().isBSpline()){ Node *n = this; - pos = _pm().BSplineMaxPosition(n); + pos = _pm().BSplineHandlePosition(n->front()); + if(pos == 0) + pos = _pm().BSplineHandlePosition(n->back()); } //BSpline End setPosition(new_pos); @@ -568,8 +591,8 @@ void Node::move(Geom::Point const &new_pos) if(_pm().isBSpline()){ Handle* front = &_front; Handle* back = &_back; - _front.setPosition(_pm().BSplineHandleRepositionFixed(front,pos)); - _back.setPosition(_pm().BSplineHandleRepositionFixed(back,pos)); + _front.setPosition(_pm().BSplineHandleReposition(front,pos)); + _back.setPosition(_pm().BSplineHandleReposition(back,pos)); } //BSpline End // if the node has a smooth handle after a line segment, it should be kept colinear -- cgit v1.2.3 From 9af17a6572db964acebd2b7eeea29c8b722c8221 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 23 Feb 2013 23:34:58 +0100 Subject: Saved for next refactor (bzr r11950.1.37) --- src/ui/tool/node.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 1a196c857..c6a2df749 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -142,6 +142,7 @@ void Handle::move(Geom::Point const &new_pos) Handle *h2 = NULL; if(_pm().isBSpline()){ isBSpline = true; + _parent->_selection.insert(_parent); //BSpline End } @@ -174,6 +175,7 @@ void Handle::move(Geom::Point const &new_pos) other->setDirection(*node_towards, *_parent); } } + setPosition(new_pos); //BSpline if(isBSpline){ h = this; @@ -183,7 +185,6 @@ void Handle::move(Geom::Point const &new_pos) this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos)); } //BSpline End - setPosition(new_pos); return; } @@ -580,8 +581,6 @@ void Node::move(Geom::Point const &new_pos) if(_pm().isBSpline()){ Node *n = this; pos = _pm().BSplineHandlePosition(n->front()); - if(pos == 0) - pos = _pm().BSplineHandlePosition(n->back()); } //BSpline End setPosition(new_pos); -- cgit v1.2.3 From ca40dfd444c2543a6debc0786fa8679a108b1056 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 25 Feb 2013 10:59:10 +0100 Subject: BSpline refactor (bzr r11950.1.38) --- src/ui/tool/node.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index c6a2df749..6dc6c7528 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -577,13 +577,29 @@ void Node::move(Geom::Point const &new_pos) Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); //BSpline + double prevPos = 0; double pos = 0; + double nextPos = 0; + Node *n = this; + Node * nextNode = n->nodeToward(n->front()); + Node * prevNode = n->nodeToward(n->back()); if(_pm().isBSpline()){ - Node *n = this; + if(prevNode) + prevPos = _pm().BSplineHandlePosition(prevNode->front()); pos = _pm().BSplineHandlePosition(n->front()); + if(nextNode) + nextPos = _pm().BSplineHandlePosition(nextNode->back()); } //BSpline End setPosition(new_pos); + //BSpline + if(prevNode){ + prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevPos)); + } + if(nextNode){ + nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextPos)); + } + //BSpline End _front.setPosition(_front.position() + delta); _back.setPosition(_back.position() + delta); //BSpline -- cgit v1.2.3 From ecc57932f1e7d157950ada2901f6ea6f3acc8aad Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 28 Feb 2013 04:43:21 +0100 Subject: Fixed closed pc->ea (bzr r11950.1.40) --- src/ui/tool/node.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index fef904006..4cac0e543 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -138,12 +138,14 @@ void Handle::move(Geom::Point const &new_pos) //BSpline bool isBSpline = false; double pos = 0; - Handle *h = this; + Handle *h = NULL; + Handle *h2 = NULL; if(_pm().isBSpline()){ isBSpline = true; - _parent->_selection.insert(_parent); - //BSpline End + if(!_parent->selected()) + _parent->_selection.insert(_parent); } + //BSpline End if (Geom::are_near(new_pos, _parent->position())) { // The handle becomes degenerate. @@ -177,12 +179,11 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); //BSpline if(isBSpline){ + h = this; setPosition(_pm().BSplineHandleReposition(h)); pos = _pm().BSplineHandlePosition(h); - other->setPosition(_pm().BSplineHandleReposition(other,pos)); - if(pos == 0){ - _parent->setPosition(h->position()); - } + h2 = this->other(); + this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos)); } //BSpline End return; @@ -217,12 +218,11 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); //BSpline if(isBSpline){ + h = this; setPosition(_pm().BSplineHandleReposition(h)); pos = _pm().BSplineHandlePosition(h); - other->setPosition(_pm().BSplineHandleReposition(other,pos)); - if(pos == 0){ - _parent->setPosition(h->position()); - } + h2 = this->other(); + this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos)); } //BSpline End } @@ -588,21 +588,25 @@ void Node::move(Geom::Point const &new_pos) if(prevNode) prevPos = _pm().BSplineHandlePosition(prevNode->front()); pos = _pm().BSplineHandlePosition(n->front()); + if(pos == 0) + pos = _pm().BSplineHandlePosition(n->back()); if(nextNode) nextPos = _pm().BSplineHandlePosition(nextNode->back()); } //BSpline End setPosition(new_pos); //BSpline - if(prevNode){ + if(prevNode) prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevPos)); - } - if(nextNode){ + if(nextNode) nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextPos)); - } //BSpline End _front.setPosition(_front.position() + delta); _back.setPosition(_back.position() + delta); + //BSpline End + // if the node has a smooth handle after a line segment, it should be kept colinear + // with the segment + _fixNeighbors(old_pos, new_pos); //BSpline if(_pm().isBSpline()){ Handle* front = &_front; @@ -610,10 +614,6 @@ void Node::move(Geom::Point const &new_pos) _front.setPosition(_pm().BSplineHandleReposition(front,pos)); _back.setPosition(_pm().BSplineHandleReposition(back,pos)); } - //BSpline End - // if the node has a smooth handle after a line segment, it should be kept colinear - // with the segment - _fixNeighbors(old_pos, new_pos); } void Node::transform(Geom::Affine const &m) -- cgit v1.2.3 From 93394bdda7e0c876eafe9847a01c6d91e0dc0f7a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 5 Mar 2013 22:51:31 +0100 Subject: BPower for testing. (bzr r11950.1.45) --- src/ui/tool/node.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 4cac0e543..e7d62d619 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -142,8 +142,14 @@ void Handle::move(Geom::Point const &new_pos) Handle *h2 = NULL; if(_pm().isBSpline()){ isBSpline = true; - if(!_parent->selected()) - _parent->_selection.insert(_parent); + typedef ControlPointSelection::Set Set; + Set &nodes = _parent->_selection.allPoints(); + for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { + Node *n = static_cast(*i); + _parent->_selection.erase(n); + } + //if(!_parent->selected()) + _parent->_selection.insert(_parent); } //BSpline End @@ -596,10 +602,12 @@ void Node::move(Geom::Point const &new_pos) //BSpline End setPosition(new_pos); //BSpline - if(prevNode) - prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevPos)); - if(nextNode) - nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextPos)); + if(_pm().isBSpline()){ + if(prevNode) + prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevPos)); + if(nextNode) + nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextPos)); + } //BSpline End _front.setPosition(_front.position() + delta); _back.setPosition(_back.position() + delta); -- cgit v1.2.3 From b2981a3b8f54bccfa45c76f57b38c9c93808d2fc Mon Sep 17 00:00:00 2001 From: root Date: Tue, 12 Mar 2013 00:48:05 +0100 Subject: ~sub fix, double click to reset default handles and control to 10% step (bzr r11950.1.51) --- src/ui/tool/node.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 5 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index e7d62d619..bee2cc477 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -29,6 +29,9 @@ #include "ui/tool/node.h" #include "ui/tool/path-manipulator.h" #include +//BSpline +#include +//BSpline End; namespace { @@ -146,10 +149,11 @@ void Handle::move(Geom::Point const &new_pos) Set &nodes = _parent->_selection.allPoints(); for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { Node *n = static_cast(*i); - _parent->_selection.erase(n); - } - //if(!_parent->selected()) - _parent->_selection.insert(_parent); + if(n != _parent) + _parent->_selection.erase(n); + } + if(!_parent->selected()) + _parent->_selection.insert(_parent); } //BSpline End @@ -307,12 +311,33 @@ bool Handle::_eventHandler(SPEventContext *event_context, GdkEvent *event) break; default: break; } + //BSpline + case GDK_2BUTTON_PRESS: + handle_2button_press(); + break; + //BSpline End default: break; } return ControlPoint::_eventHandler(event_context, event); } +//BSpline +void Handle::handle_2button_press(){ + if(_pm().isBSpline()){ + Handle *h = NULL; + Handle *h2 = NULL; + double pos = 0; + h = this; + setPosition(_pm().BSplineHandleReposition(h,0.3334)); + pos = _pm().BSplineHandlePosition(h); + h2 = this->other(); + this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos)); + _pm().update(); + } +} +//BSpline End + bool Handle::grabbed(GdkEventMotion *) { _saved_other_pos = other()->position(); @@ -360,6 +385,16 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) ctrl_constraint = Inkscape::Snapper::SnapConstraint(parent_pos, parent_pos - perp_pos); } new_pos = result; + //BSpline + if(_pm().isBSpline()){ + Handle *h = NULL; + double pos = 0; + h = this; + setPosition(new_pos); + pos = ceilf(_pm().BSplineHandlePosition(h)*10)/10; + new_pos=_pm().BSplineHandleReposition(h,pos); + } + //BSpline End } std::vector unselected; @@ -728,7 +763,7 @@ void Node::updateHandles() _front._handleControlStyling(); _back._handleControlStyling(); } - + void Node::setType(NodeType type, bool update_handles) { @@ -738,6 +773,27 @@ void Node::setType(NodeType type, bool update_handles) return; } + //BSpline + if(_pm().isBSpline()){ + if (isEndNode()) return; + Handle* front = &_front; + Handle* back = &_back; + double pos = 0.3334; + switch (type) { + case NODE_CUSP: + if(update_handles) + pos = 0; + else + pos = _pm().BSplineHandlePosition(front);; + break; + default: break; + } + type = NODE_CUSP; + _front.setPosition(_pm().BSplineHandleReposition(front,pos)); + _back.setPosition(_pm().BSplineHandleReposition(back,pos)); + } + //BSpline End + // if update_handles is true, adjust handle positions to match the node type // handle degenerate handles appropriately if (update_handles) { @@ -821,7 +877,9 @@ void Node::setType(NodeType type, bool update_handles) default: break; } } + _type = type; + _setControlType(nodeTypeToCtrlType(_type)); updateState(); } -- cgit v1.2.3 From a5fc5840c370d58f395b7b256a11fd11ef3a9a54 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 18 Mar 2013 02:53:59 +0100 Subject: working whith widgets (bzr r11950.1.57) --- src/ui/tool/node.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index bee2cc477..b628d3500 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -113,6 +113,9 @@ Handle::Handle(NodeSharedData const &data, Geom::Point const &initial_pos, Node _degenerate(true) { setVisible(false); + //BSpline + setControlBsplineSteps( _pm().getControlBsplineSteps()); + //BSpline End; } Handle::~Handle() @@ -391,7 +394,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) double pos = 0; h = this; setPosition(new_pos); - pos = ceilf(_pm().BSplineHandlePosition(h)*10)/10; + pos = ceilf(_pm().BSplineHandlePosition(h)*controlBsplineSteps)/controlBsplineSteps; new_pos=_pm().BSplineHandleReposition(h,pos); } //BSpline End -- cgit v1.2.3 From 4e41340374ba833e748ffbbc610a28c7c3559557 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 19 Mar 2013 04:35:35 +0100 Subject: Working width widgets (bzr r11950.1.58) --- src/ui/tool/node.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index b628d3500..819f5db54 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -110,12 +110,9 @@ Handle::Handle(NodeSharedData const &data, Geom::Point const &initial_pos, Node _handle_colors, data.handle_group), _parent(parent), _handle_line(ControlManager::getManager().createControlLine(data.handle_line_group)), - _degenerate(true) + _degenerate(true),controlBsplineSteps(2) { setVisible(false); - //BSpline - setControlBsplineSteps( _pm().getControlBsplineSteps()); - //BSpline End; } Handle::~Handle() @@ -394,7 +391,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) double pos = 0; h = this; setPosition(new_pos); - pos = ceilf(_pm().BSplineHandlePosition(h)*controlBsplineSteps)/controlBsplineSteps; + pos = ceilf(_pm().BSplineHandlePosition(h)*_pm().getControlBsplineSteps())/_pm().getControlBsplineSteps(); new_pos=_pm().BSplineHandleReposition(h,pos); } //BSpline End -- cgit v1.2.3 From 49c304e53558c96b2442c06c9beccf5082bb8fe2 Mon Sep 17 00:00:00 2001 From: jtx Date: Wed, 20 Mar 2013 18:12:37 +0100 Subject: Fixing node fault (bzr r11950.4.2) --- src/ui/tool/node.cpp | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index e0aec8bb5..738d98e82 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -113,6 +113,7 @@ Handle::Handle(NodeSharedData const &data, Geom::Point const &initial_pos, Node _degenerate(true),controlBsplineSteps(2) { setVisible(false); + isBSpline = _pm().isBSpline; } Handle::~Handle() @@ -143,8 +144,7 @@ void Handle::move(Geom::Point const &new_pos) double pos = 0; Handle *h = NULL; Handle *h2 = NULL; - if(_pm().isBSpline){ - isBSpline = true; + if(isBSpline){ typedef ControlPointSelection::Set Set; Set &nodes = _parent->_selection.allPoints(); for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { @@ -324,7 +324,7 @@ bool Handle::_eventHandler(SPEventContext *event_context, GdkEvent *event) //BSpline void Handle::handle_2button_press(){ - if(_pm().isBSpline){ + if(isBSpline){ Handle *h = NULL; Handle *h2 = NULL; double pos = 0; @@ -386,7 +386,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } new_pos = result; //BSpline - if(_pm().isBSpline){ + if(isBSpline){ Handle *h = NULL; double pos = 0; h = this; @@ -398,7 +398,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } std::vector unselected; - if (snap && ( (!held_control(*event) && _pm().isBSpline) || !_pm().isBSpline)) { + if (snap && ( (!held_control(*event) && isBSpline) || !isBSpline)) { ControlPointSelection::Set &nodes = _parent->_selection.allPoints(); for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { Node *n = static_cast(*i); @@ -580,6 +580,7 @@ Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) : _handles_shown(false) { // NOTE we do not set type here, because the handles are still degenerate + isBSpline = _pm().isBSpline; } Node const *Node::_next() const @@ -625,7 +626,7 @@ void Node::move(Geom::Point const &new_pos) Node *n = this; Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); - if(_pm().isBSpline){ + if(isBSpline){ if(prevNode) prevPos = _pm().BSplineHandlePosition(prevNode->front()); pos = _pm().BSplineHandlePosition(n->front()); @@ -637,7 +638,7 @@ void Node::move(Geom::Point const &new_pos) //BSpline End setPosition(new_pos); //BSpline - if(_pm().isBSpline){ + if(isBSpline){ if(prevNode) prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevPos)); if(nextNode) @@ -651,7 +652,7 @@ void Node::move(Geom::Point const &new_pos) // with the segment _fixNeighbors(old_pos, new_pos); //BSpline - if(_pm().isBSpline){ + if(isBSpline){ Handle* front = &_front; Handle* back = &_back; _front.setPosition(_pm().BSplineHandleReposition(front,pos)); @@ -773,27 +774,6 @@ void Node::setType(NodeType type, bool update_handles) return; } - //BSpline - if(_pm().isBSpline){ - if (isEndNode()) return; - Handle* front = &_front; - Handle* back = &_back; - double pos = 0.3334; - switch (type) { - case NODE_CUSP: - if(update_handles) - pos = 0; - else - pos = _pm().BSplineHandlePosition(front);; - break; - default: break; - } - type = NODE_CUSP; - _front.setPosition(_pm().BSplineHandleReposition(front,pos)); - _back.setPosition(_pm().BSplineHandleReposition(back,pos)); - } - //BSpline End - // if update_handles is true, adjust handle positions to match the node type // handle degenerate handles appropriately if (update_handles) { @@ -882,6 +862,15 @@ void Node::setType(NodeType type, bool update_handles) _setControlType(nodeTypeToCtrlType(_type)); updateState(); + //BSpline + if(isBSpline){ + Handle* front = &_front; + Handle* back = &_back; + double pos = _pm().BSplineHandlePosition(front); + _front.setPosition(_pm().BSplineHandleReposition(front,pos)); + _back.setPosition(_pm().BSplineHandleReposition(back,pos)); + } + //BSpline End } void Node::pickBestType() -- cgit v1.2.3 From d8278200b80518c4a7c2f4fda642102ff268851d Mon Sep 17 00:00:00 2001 From: jtx Date: Wed, 20 Mar 2013 18:50:31 +0100 Subject: Fixing node fault (bzr r11950.4.3) --- src/ui/tool/node.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 738d98e82..93b45bde7 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -113,7 +113,12 @@ Handle::Handle(NodeSharedData const &data, Geom::Point const &initial_pos, Node _degenerate(true),controlBsplineSteps(2) { setVisible(false); - isBSpline = _pm().isBSpline; + std::string strPathManipulatorName = "PathManipulator"; + if(std::string(typeid(_pm()).name()) == strPathManipulatorName) + isBSpline = _pm().isBSpline; + else + //Esto no es cierto realmente pero evita que casque al crear nodos + isBSpline = false; } Handle::~Handle() @@ -580,7 +585,12 @@ Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) : _handles_shown(false) { // NOTE we do not set type here, because the handles are still degenerate - isBSpline = _pm().isBSpline; + std::string strPathManipulatorName = "PathManipulator"; + if(std::string(typeid(_pm()).name()) == strPathManipulatorName) + isBSpline = _pm().isBSpline; + else + //Esto no es cierto realmente pero evita que casque al crear nodos + isBSpline = false; } Node const *Node::_next() const -- cgit v1.2.3 From a7ced41f3fa6933d0da0151ef42e82e0862581fb Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 1 Apr 2013 01:09:52 +0200 Subject: Fix scale and rotate some nodes (bzr r11950.1.78) --- src/ui/tool/node.cpp | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index b4976bde5..dfa9c5d84 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -139,7 +139,6 @@ void Handle::move(Geom::Point const &new_pos) Handle *towards = node_towards ? node_towards->handleAwayFrom(_parent) : NULL; Handle *towards_second = node_towards ? node_towards->handleToward(_parent) : NULL; //BSpline - double pos = 0; Handle *h = NULL; Handle *h2 = NULL; if(_pm().isBSpline){ @@ -189,9 +188,9 @@ void Handle::move(Geom::Point const &new_pos) if(_pm().isBSpline){ h = this; setPosition(_pm().BSplineHandleReposition(h)); - pos = _pm().BSplineHandlePosition(h); + _parent->bsplineWeight = _pm().BSplineHandlePosition(h); h2 = this->other(); - this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos)); + this->other()->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); } //BSpline End return; @@ -228,9 +227,9 @@ void Handle::move(Geom::Point const &new_pos) if(_pm().isBSpline){ h = this; setPosition(_pm().BSplineHandleReposition(h)); - pos = _pm().BSplineHandlePosition(h); + _parent->bsplineWeight = _pm().BSplineHandlePosition(h); h2 = this->other(); - this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos)); + this->other()->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); } //BSpline End } @@ -325,12 +324,12 @@ void Handle::handle_2button_press(){ if(_pm().isBSpline){ Handle *h = NULL; Handle *h2 = NULL; - double pos = 0; + _parent->bsplineWeight = 0; h = this; setPosition(_pm().BSplineHandleReposition(h,0.3334)); - pos = _pm().BSplineHandlePosition(h); + _parent->bsplineWeight = _pm().BSplineHandlePosition(h); h2 = this->other(); - this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos)); + this->other()->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); _pm().update(); } } @@ -386,12 +385,12 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) //BSpline if(_pm().isBSpline){ Handle *h = NULL; - double pos = 0; + _parent->bsplineWeight = 0; h = this; setPosition(new_pos); int steps = _pm().getSteps(); - pos = ceilf(_pm().BSplineHandlePosition(h)*steps)/steps; - new_pos=_pm().BSplineHandleReposition(h,pos); + _parent->bsplineWeight = ceilf(_pm().BSplineHandlePosition(h)*steps)/steps; + new_pos=_pm().BSplineHandleReposition(h,_parent->bsplineWeight); } //BSpline End } @@ -579,6 +578,7 @@ Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) : _handles_shown(false) { // NOTE we do not set type here, because the handles are still degenerate + this->bsplineWeight = 0.3334; } Node const *Node::_next() const @@ -619,7 +619,6 @@ void Node::move(Geom::Point const &new_pos) Geom::Point delta = new_pos - position(); //BSpline double prevPos = 0; - double pos = 0; double nextPos = 0; Node *n = this; Node * nextNode = n->nodeToward(n->front()); @@ -627,9 +626,9 @@ void Node::move(Geom::Point const &new_pos) if(_pm().isBSpline){ if(prevNode) prevPos = _pm().BSplineHandlePosition(prevNode->front()); - pos = _pm().BSplineHandlePosition(n->front()); - if(pos == 0) - pos = _pm().BSplineHandlePosition(n->back()); + n->bsplineWeight = _pm().BSplineHandlePosition(n->front()); + if(n->bsplineWeight == 0) + n->bsplineWeight = _pm().BSplineHandlePosition(n->back()); if(nextNode) nextPos = _pm().BSplineHandlePosition(nextNode->back()); } @@ -653,8 +652,8 @@ void Node::move(Geom::Point const &new_pos) if(_pm().isBSpline){ Handle* front = &_front; Handle* back = &_back; - _front.setPosition(_pm().BSplineHandleReposition(front,pos)); - _back.setPosition(_pm().BSplineHandleReposition(back,pos)); + _front.setPosition(_pm().BSplineHandleReposition(front,n->bsplineWeight)); + _back.setPosition(_pm().BSplineHandleReposition(back,n->bsplineWeight)); } } @@ -864,10 +863,10 @@ void Node::setType(NodeType type, bool update_handles) if(isBSpline){ Handle* front = &_front; Handle* back = &_back; - double pos = _pm().BSplineHandlePosition(front); - if(pos !=0) pos = 0.3334; - _front.setPosition(_pm().BSplineHandleReposition(front,pos)); - _back.setPosition(_pm().BSplineHandleReposition(back,pos)); + this->bsplineWeight = _pm().BSplineHandlePosition(front); + if(this->bsplineWeight !=0) this->bsplineWeight = 0.3334; + _front.setPosition(_pm().BSplineHandleReposition(front,this->bsplineWeight)); + _back.setPosition(_pm().BSplineHandleReposition(back,this->bsplineWeight)); } //BSpline End } -- cgit v1.2.3 From 6ffc63f4ecd0550225a6fc752aba128575733a22 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 1 Apr 2013 10:03:19 +0200 Subject: Fixed scale-rotate isue with paths multiples (bzr r11950.1.80) --- src/ui/tool/node.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index dfa9c5d84..1f609dfa0 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -1118,6 +1118,12 @@ void Node::_setState(State state) case STATE_CLICKED: mgr.setActive(_canvas_item, true); mgr.setPrelight(_canvas_item, false); + //BSpline + if(_pm().isBSpline){ + this->bsplineWeight = _pm().BSplineHandlePosition(this->back()); + _pm().BSplineNodeHandlesReposition(this); + } + //BSpline End break; } SelectableControlPoint::_setState(state); -- cgit v1.2.3 From 30858428c74d1fa0f119f40b99fa5e51836d8599 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 8 Apr 2013 00:50:31 +0200 Subject: Change width only for selected nodes by widget (bzr r11950.1.83) --- src/ui/tool/node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 1f609dfa0..8f1c37649 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -577,8 +577,8 @@ Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) : _type(NODE_CUSP), _handles_shown(false) { - // NOTE we do not set type here, because the handles are still degenerate this->bsplineWeight = 0.3334; + // NOTE we do not set type here, because the handles are still degenerate } Node const *Node::_next() const -- cgit v1.2.3 From 458ca2842297a5eae7e4f6fc394b227d61881c8d Mon Sep 17 00:00:00 2001 From: root Date: Wed, 17 Apr 2013 23:03:51 +0200 Subject: Update color lines overlay, with halo of 1 px matched by Gez. Fix some crash snapping. Added new button widget to make cusp node (bzr r11950.1.96) --- src/ui/tool/node.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 8f1c37649..011d0d296 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -146,10 +146,8 @@ void Handle::move(Geom::Point const &new_pos) Set &nodes = _parent->_selection.allPoints(); for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { Node *n = static_cast(*i); - if(n != _parent) - _parent->_selection.erase(n); + _parent->_selection.erase(n); } - if(!_parent->selected()) _parent->_selection.insert(_parent); } //BSpline End @@ -187,8 +185,8 @@ void Handle::move(Geom::Point const &new_pos) //BSpline if(_pm().isBSpline){ h = this; - setPosition(_pm().BSplineHandleReposition(h)); _parent->bsplineWeight = _pm().BSplineHandlePosition(h); + setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); h2 = this->other(); this->other()->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); } @@ -422,6 +420,16 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) sm.freeSnapReturnByRef(new_pos, SNAPSOURCE_NODE_HANDLE); } sm.unSetup(); + //BSpline + if(_pm().isBSpline){ + Handle *h = NULL; + _parent->bsplineWeight = 0; + h = this; + setPosition(new_pos); + _parent->bsplineWeight = _pm().BSplineHandlePosition(h); + new_pos=_pm().BSplineHandleReposition(h,_parent->bsplineWeight); + } + //BSpline End } @@ -452,6 +460,7 @@ void Handle::ungrabbed(GdkEventButton *event) Geom::Point dist = _desktop->d2w(_parent->position()) - _desktop->d2w(position()); if (dist.length() <= drag_tolerance) { move(_parent->position()); + _parent->bsplineWeight = 0; } } -- cgit v1.2.3 From be4b46000a9a9f29d79b2e939c0669f6ddf0c59f Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 27 Apr 2013 02:01:11 +0200 Subject: Fixed important selection bug when changing to cusp nodes (bzr r11950.1.109) --- src/ui/tool/node.cpp | 69 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 29 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 011d0d296..d342d6c3d 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -141,17 +141,7 @@ void Handle::move(Geom::Point const &new_pos) //BSpline Handle *h = NULL; Handle *h2 = NULL; - if(_pm().isBSpline){ - typedef ControlPointSelection::Set Set; - Set &nodes = _parent->_selection.allPoints(); - for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { - Node *n = static_cast(*i); - _parent->_selection.erase(n); - } - _parent->_selection.insert(_parent); - } //BSpline End - if (Geom::are_near(new_pos, _parent->position())) { // The handle becomes degenerate. // Adjust node type as necessary. @@ -322,7 +312,7 @@ void Handle::handle_2button_press(){ if(_pm().isBSpline){ Handle *h = NULL; Handle *h2 = NULL; - _parent->bsplineWeight = 0; + _parent->bsplineWeight = 0.0000; h = this; setPosition(_pm().BSplineHandleReposition(h,0.3334)); _parent->bsplineWeight = _pm().BSplineHandlePosition(h); @@ -343,6 +333,7 @@ bool Handle::grabbed(GdkEventMotion *) void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) { + Geom::Point parent_pos = _parent->position(); Geom::Point origin = _last_drag_origin(); SnapManager &sm = _desktop->namedview->snap_manager; @@ -383,7 +374,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) //BSpline if(_pm().isBSpline){ Handle *h = NULL; - _parent->bsplineWeight = 0; + _parent->bsplineWeight = 0.0000; h = this; setPosition(new_pos); int steps = _pm().getSteps(); @@ -423,7 +414,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) //BSpline if(_pm().isBSpline){ Handle *h = NULL; - _parent->bsplineWeight = 0; + _parent->bsplineWeight = 0.0000; h = this; setPosition(new_pos); _parent->bsplineWeight = _pm().BSplineHandlePosition(h); @@ -460,7 +451,7 @@ void Handle::ungrabbed(GdkEventButton *event) Geom::Point dist = _desktop->d2w(_parent->position()) - _desktop->d2w(position()); if (dist.length() <= drag_tolerance) { move(_parent->position()); - _parent->bsplineWeight = 0; + _parent->bsplineWeight = 0.0000; } } @@ -472,11 +463,33 @@ void Handle::ungrabbed(GdkEventButton *event) _drag_out = false; _pm()._handleUngrabbed(); + //BSpline + if(_pm().isBSpline){ + typedef ControlPointSelection::Set Set; + Set &nodes = _parent->_selection.allPoints(); + for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { + Node *n = static_cast(*i); + _parent->_selection.erase(n); + } + _parent->_selection.insert(_parent); + } + //BSpline End } bool Handle::clicked(GdkEventButton *event) { _pm()._handleClicked(this, event); + //BSpline + if(_pm().isBSpline){ + typedef ControlPointSelection::Set Set; + Set &nodes = _parent->_selection.allPoints(); + for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { + Node *n = static_cast(*i); + _parent->_selection.erase(n); + } + _parent->_selection.insert(_parent); + } + //BSpline End return true; } @@ -627,8 +640,8 @@ void Node::move(Geom::Point const &new_pos) Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); //BSpline - double prevPos = 0; - double nextPos = 0; + double prevPos = 0.0000; + double nextPos = 0.0000; Node *n = this; Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); @@ -636,7 +649,7 @@ void Node::move(Geom::Point const &new_pos) if(prevNode) prevPos = _pm().BSplineHandlePosition(prevNode->front()); n->bsplineWeight = _pm().BSplineHandlePosition(n->front()); - if(n->bsplineWeight == 0) + if(n->bsplineWeight == 0.0000) n->bsplineWeight = _pm().BSplineHandlePosition(n->back()); if(nextNode) nextPos = _pm().BSplineHandlePosition(nextNode->back()); @@ -770,7 +783,7 @@ void Node::updateHandles() _front._handleControlStyling(); _back._handleControlStyling(); } - + void Node::setType(NodeType type, bool update_handles) { @@ -779,7 +792,14 @@ void Node::setType(NodeType type, bool update_handles) updateState(); // The size of the control might have changed return; } - + //BSpline + bool isBSpline = false; + try { + isBSpline = nodeList().subpathList().pm().isBSpline; + } + catch( char * str ) { + } + //BSpline End // if update_handles is true, adjust handle positions to match the node type // handle degenerate handles appropriately if (update_handles) { @@ -863,28 +883,19 @@ void Node::setType(NodeType type, bool update_handles) default: break; } //BSpline - bool isBSpline = false; - try { - isBSpline = nodeList().subpathList().pm().isBSpline; - } - catch( char * str ) { - } if(isBSpline){ Handle* front = &_front; Handle* back = &_back; this->bsplineWeight = _pm().BSplineHandlePosition(front); - if(this->bsplineWeight !=0) this->bsplineWeight = 0.3334; + if(this->bsplineWeight !=0.0000) this->bsplineWeight = 0.3334; _front.setPosition(_pm().BSplineHandleReposition(front,this->bsplineWeight)); _back.setPosition(_pm().BSplineHandleReposition(back,this->bsplineWeight)); } //BSpline End } - _type = type; - _setControlType(nodeTypeToCtrlType(_type)); updateState(); - } void Node::pickBestType() -- cgit v1.2.3 From dd30de233b38518008030c2c0a2366332422b236 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 6 May 2013 02:54:50 +0200 Subject: Removed auto select nodes, not decide for the user. Added auto update all selected handles when drag (bzr r11950.1.111) --- src/ui/tool/node.cpp | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index d342d6c3d..1d7b5850f 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -216,8 +216,15 @@ void Handle::move(Geom::Point const &new_pos) h = this; setPosition(_pm().BSplineHandleReposition(h)); _parent->bsplineWeight = _pm().BSplineHandlePosition(h); - h2 = this->other(); - this->other()->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + typedef ControlPointSelection::Set Set; + Set &nodes = _parent->_selection.allPoints(); + for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { + Node *n = static_cast(*i); + h = n->front(); + h2 = n->back(); + h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + } } //BSpline End } @@ -463,33 +470,11 @@ void Handle::ungrabbed(GdkEventButton *event) _drag_out = false; _pm()._handleUngrabbed(); - //BSpline - if(_pm().isBSpline){ - typedef ControlPointSelection::Set Set; - Set &nodes = _parent->_selection.allPoints(); - for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { - Node *n = static_cast(*i); - _parent->_selection.erase(n); - } - _parent->_selection.insert(_parent); - } - //BSpline End } bool Handle::clicked(GdkEventButton *event) { _pm()._handleClicked(this, event); - //BSpline - if(_pm().isBSpline){ - typedef ControlPointSelection::Set Set; - Set &nodes = _parent->_selection.allPoints(); - for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { - Node *n = static_cast(*i); - _parent->_selection.erase(n); - } - _parent->_selection.insert(_parent); - } - //BSpline End return true; } -- cgit v1.2.3 From 417a1e079bbc94ac0d8c6631832e47a35098ba98 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 6 May 2013 03:36:46 +0200 Subject: Change only selected nodes (bzr r11950.1.113) --- src/ui/tool/node.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 1d7b5850f..5362a6c45 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -219,11 +219,13 @@ void Handle::move(Geom::Point const &new_pos) typedef ControlPointSelection::Set Set; Set &nodes = _parent->_selection.allPoints(); for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { - Node *n = static_cast(*i); - h = n->front(); - h2 = n->back(); - h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + if((*i)->selected()){ + Node *n = static_cast(*i); + h = n->front(); + h2 = n->back(); + h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + } } } //BSpline End -- cgit v1.2.3 From e17c04bd7386e2e346b7f4f760f6e6ba3c24b886 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 17 May 2013 00:53:42 +0200 Subject: Fix error with try-catch (bzr r11950.1.115) --- src/ui/tool/node.cpp | 61 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 12 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 5362a6c45..89a0f4163 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -175,10 +175,25 @@ void Handle::move(Geom::Point const &new_pos) //BSpline if(_pm().isBSpline){ h = this; + setPosition(_pm().BSplineHandleReposition(h)); _parent->bsplineWeight = _pm().BSplineHandlePosition(h); - setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2 = this->other(); - this->other()->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + typedef ControlPointSelection::Set Set; + Set &nodes = _parent->_selection.allPoints(); + for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { + if((*i)->selected()){ + Node *n = static_cast(*i); + h = n->front(); + h2 = n->back(); + h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + } + } + if(!_parent->selected()){ + h = _parent->front(); + h2 = _parent->back(); + h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + } } //BSpline End return; @@ -192,6 +207,30 @@ void Handle::move(Geom::Point const &new_pos) Geom::Point new_delta = (Geom::dot(delta, direction) / Geom::L2sq(direction)) * direction; setRelativePos(new_delta); + //BSpline + if(_pm().isBSpline){ + h = this; + setPosition(_pm().BSplineHandleReposition(h)); + _parent->bsplineWeight = _pm().BSplineHandlePosition(h); + typedef ControlPointSelection::Set Set; + Set &nodes = _parent->_selection.allPoints(); + for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { + if((*i)->selected()){ + Node *n = static_cast(*i); + h = n->front(); + h2 = n->back(); + h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + } + } + if(!_parent->selected()){ + h = _parent->front(); + h2 = _parent->back(); + h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + } + } + //BSpline End return; } @@ -227,6 +266,12 @@ void Handle::move(Geom::Point const &new_pos) h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); } } + if(!_parent->selected()){ + h = _parent->front(); + h2 = _parent->back(); + h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + } } //BSpline End } @@ -779,14 +824,6 @@ void Node::setType(NodeType type, bool update_handles) updateState(); // The size of the control might have changed return; } - //BSpline - bool isBSpline = false; - try { - isBSpline = nodeList().subpathList().pm().isBSpline; - } - catch( char * str ) { - } - //BSpline End // if update_handles is true, adjust handle positions to match the node type // handle degenerate handles appropriately if (update_handles) { @@ -870,7 +907,7 @@ void Node::setType(NodeType type, bool update_handles) default: break; } //BSpline - if(isBSpline){ + if(_pm().isBSpline){ Handle* front = &_front; Handle* back = &_back; this->bsplineWeight = _pm().BSplineHandlePosition(front); -- cgit v1.2.3 From e8e2929ccb133b015db1de73de0efbb982d455a4 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 00:36:15 +0200 Subject: Fix bspline and strip multi node bspline power editing whith node tool because UX (bzr r11950.1.168) --- src/ui/tool/node.cpp | 102 +++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 5f5757a14..1151dc41b 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -176,23 +176,23 @@ void Handle::move(Geom::Point const &new_pos) h = this; setPosition(_pm().BSplineHandleReposition(h)); _parent->bsplineWeight = _pm().BSplineHandlePosition(h); - typedef ControlPointSelection::Set Set; - Set &nodes = _parent->_selection.allPoints(); - for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { - if((*i)->selected()){ - Node *n = static_cast(*i); - h = n->front(); - h2 = n->back(); - h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - } - } - if(!_parent->selected()){ - h = _parent->front(); - h2 = _parent->back(); - h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - } + //typedef ControlPointSelection::Set Set; + //Set &nodes = _parent->_selection.allPoints(); + //for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { + // if((*i)->selected()){ + // Node *n = static_cast(*i); + // h = n->front(); + // h2 = n->back(); + // h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + // h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + //} + //} + //if(!_parent->selected()){ + h = _parent->front(); + h2 = _parent->back(); + h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + //} } //BSpline End return; @@ -211,23 +211,23 @@ void Handle::move(Geom::Point const &new_pos) h = this; setPosition(_pm().BSplineHandleReposition(h)); _parent->bsplineWeight = _pm().BSplineHandlePosition(h); - typedef ControlPointSelection::Set Set; - Set &nodes = _parent->_selection.allPoints(); - for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { - if((*i)->selected()){ - Node *n = static_cast(*i); - h = n->front(); - h2 = n->back(); - h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - } - } - if(!_parent->selected()){ - h = _parent->front(); - h2 = _parent->back(); - h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - } + //typedef ControlPointSelection::Set Set; + //Set &nodes = _parent->_selection.allPoints(); + //for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { + // if((*i)->selected()){ + // Node *n = static_cast(*i); + // h = n->front(); + // h2 = n->back(); + // h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + // h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + // } + //} + //if(!_parent->selected()){ + h = _parent->front(); + h2 = _parent->back(); + h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + //} } //BSpline End return; @@ -254,23 +254,23 @@ void Handle::move(Geom::Point const &new_pos) h = this; setPosition(_pm().BSplineHandleReposition(h)); _parent->bsplineWeight = _pm().BSplineHandlePosition(h); - typedef ControlPointSelection::Set Set; - Set &nodes = _parent->_selection.allPoints(); - for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { - if((*i)->selected()){ - Node *n = static_cast(*i); - h = n->front(); - h2 = n->back(); - h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - } - } - if(!_parent->selected()){ - h = _parent->front(); - h2 = _parent->back(); - h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - } + //typedef ControlPointSelection::Set Set; + //Set &nodes = _parent->_selection.allPoints(); + //for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { + // if((*i)->selected()){ + // Node *n = static_cast(*i); + // h = n->front(); + // h2 = n->back(); + // h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + // h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + // } + //} + //if(!_parent->selected()){ + h = _parent->front(); + h2 = _parent->back(); + h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); + h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + //} } //BSpline End } -- cgit v1.2.3 From 6255e3bc1ad8c5c3824483e55e6f3c9de6941e5f Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 15:42:58 +0200 Subject: fix in nodes (bzr r11950.1.172) --- src/ui/tool/node.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 1151dc41b..7506a54a8 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -635,6 +635,8 @@ Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) : _handles_shown(false) { this->bsplineWeight = 0.3334; + if(_front->position() == this->position() && _back->position() == this->position()) + this->bsplineWeight = 0.0000; // NOTE we do not set type here, because the handles are still degenerate } -- cgit v1.2.3 From 0eb0148cade3cc19d1cf85fadd5928c8c8ee1674 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 15:47:51 +0200 Subject: update to trunk (bzr r11950.1.173) --- src/ui/tool/node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 7506a54a8..c5ab2f316 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -635,7 +635,7 @@ Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) : _handles_shown(false) { this->bsplineWeight = 0.3334; - if(_front->position() == this->position() && _back->position() == this->position()) + if(this->front()->position() == this->position() && this->back()->position() == this->position()) this->bsplineWeight = 0.0000; // NOTE we do not set type here, because the handles are still degenerate } -- cgit v1.2.3 From f238a7004752e4e56b7e6d602f675c97c0ce4733 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 17:09:32 +0200 Subject: Fixing BSplines (bzr r11950.1.174) --- src/ui/tool/node.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index c5ab2f316..c6d4537dd 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -726,6 +726,7 @@ void Node::transform(Geom::Affine const &m) /* Affine transforms keep handle invariants for smooth and symmetric nodes, * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); + _pm().BSplineNodeHandlesReposition(this); } Geom::Rect Node::bounds() const -- cgit v1.2.3 From 46699ed807e748453d6aaa054f87c0582c38d72e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 17:24:27 +0200 Subject: fix bsplines (bzr r11950.1.175) --- src/ui/tool/node.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index c6d4537dd..cbfd3ec0d 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -635,8 +635,6 @@ Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) : _handles_shown(false) { this->bsplineWeight = 0.3334; - if(this->front()->position() == this->position() && this->back()->position() == this->position()) - this->bsplineWeight = 0.0000; // NOTE we do not set type here, because the handles are still degenerate } -- cgit v1.2.3 From a4dcddb133064faf3f24f8f1a3f664f4d3d700b9 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 17:46:13 +0200 Subject: fix bsplines (bzr r11950.1.176) --- src/ui/tool/node.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index cbfd3ec0d..f6d100b57 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -724,7 +724,10 @@ void Node::transform(Geom::Affine const &m) /* Affine transforms keep handle invariants for smooth and symmetric nodes, * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); - _pm().BSplineNodeHandlesReposition(this); + if(_pm().isBSpline){ + this->front().setPosition(BSplineHandleReposition(this->front(),this->bsplineWeight)); + this->back().setPosition(BSplineHandleReposition(this->back(),this->bsplineWeight)); + } } Geom::Rect Node::bounds() const -- cgit v1.2.3 From db5de41dd8f09821561a14db45192a76479e2536 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 17:50:52 +0200 Subject: fix bsplines (bzr r11950.1.177) --- src/ui/tool/node.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index f6d100b57..91f8e8a54 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -725,8 +725,8 @@ void Node::transform(Geom::Affine const &m) * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); if(_pm().isBSpline){ - this->front().setPosition(BSplineHandleReposition(this->front(),this->bsplineWeight)); - this->back().setPosition(BSplineHandleReposition(this->back(),this->bsplineWeight)); + _front.setPosition(BSplineHandleReposition(_front,this->bsplineWeight)); + _back.setPosition(BSplineHandleReposition(_back,this->bsplineWeight)); } } -- cgit v1.2.3 From c868eae8e1cc980621791d982c519fc14139f906 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 17:56:26 +0200 Subject: fix bsplines (bzr r11950.1.178) --- src/ui/tool/node.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 91f8e8a54..933bfe0ca 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -725,8 +725,8 @@ void Node::transform(Geom::Affine const &m) * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); if(_pm().isBSpline){ - _front.setPosition(BSplineHandleReposition(_front,this->bsplineWeight)); - _back.setPosition(BSplineHandleReposition(_back,this->bsplineWeight)); + _front.setPosition(_pm().BSplineHandleReposition(_front,this->bsplineWeight)); + _back.setPosition(_pm().BSplineHandleReposition(_back,this->bsplineWeight)); } } -- cgit v1.2.3 From bae8160a80e84129b87846e09dee0a0aa0c08e0e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 18:52:27 +0200 Subject: fix bsplines (bzr r11950.1.179) --- src/ui/tool/node.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 933bfe0ca..8564f1f1a 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -725,8 +725,9 @@ void Node::transform(Geom::Affine const &m) * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); if(_pm().isBSpline){ - _front.setPosition(_pm().BSplineHandleReposition(_front,this->bsplineWeight)); - _back.setPosition(_pm().BSplineHandleReposition(_back,this->bsplineWeight)); + _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); + _back.setPosition(_pm().BSplineHandleReposition(this->back(),this->bsplineWeight)); + _pm().BSplineNodeHandlesReposition(this); } } -- cgit v1.2.3 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/node.cpp | 63 +++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 30 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 230d39e2e..af823a787 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -28,9 +28,9 @@ #include "ui/tool/node.h" #include "ui/tool/path-manipulator.h" #include -//BSpline + #include -//BSpline End; +; namespace { @@ -137,10 +137,10 @@ void Handle::move(Geom::Point const &new_pos) Node *node_away = _parent->nodeAwayFrom(this); // node in the opposite direction Handle *towards = node_towards ? node_towards->handleAwayFrom(_parent) : NULL; Handle *towards_second = node_towards ? node_towards->handleToward(_parent) : NULL; - //BSpline + Handle *h = NULL; Handle *h2 = NULL; - //BSpline End + _pm().BSpline(); if (Geom::are_near(new_pos, _parent->position())) { // The handle becomes degenerate. // Adjust node type as necessary. @@ -171,7 +171,7 @@ void Handle::move(Geom::Point const &new_pos) } } setPosition(new_pos); - //BSpline + if(_pm().isBSpline){ h = this; setPosition(_pm().BSplineHandleReposition(h)); @@ -194,7 +194,7 @@ void Handle::move(Geom::Point const &new_pos) h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); //} } - //BSpline End + return; } @@ -206,7 +206,7 @@ void Handle::move(Geom::Point const &new_pos) Geom::Point new_delta = (Geom::dot(delta, direction) / Geom::L2sq(direction)) * direction; setRelativePos(new_delta); - //BSpline + if(_pm().isBSpline){ h = this; setPosition(_pm().BSplineHandleReposition(h)); @@ -229,7 +229,7 @@ void Handle::move(Geom::Point const &new_pos) h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); //} } - //BSpline End + return; } @@ -249,7 +249,7 @@ void Handle::move(Geom::Point const &new_pos) default: break; } setPosition(new_pos); - //BSpline + if(_pm().isBSpline){ h = this; setPosition(_pm().BSplineHandleReposition(h)); @@ -272,7 +272,7 @@ void Handle::move(Geom::Point const &new_pos) h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); //} } - //BSpline End + } void Handle::setPosition(Geom::Point const &p) @@ -349,19 +349,20 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven break; default: break; } - //BSpline + case GDK_2BUTTON_PRESS: handle_2button_press(); break; - //BSpline End + default: break; } return ControlPoint::_eventHandler(event_context, event); } -//BSpline + void Handle::handle_2button_press(){ + _pm().BSpline(); if(_pm().isBSpline){ Handle *h = NULL; Handle *h2 = NULL; @@ -374,7 +375,7 @@ void Handle::handle_2button_press(){ _pm().update(); } } -//BSpline End + bool Handle::grabbed(GdkEventMotion *) { @@ -392,7 +393,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) SnapManager &sm = _desktop->namedview->snap_manager; bool snap = held_shift(*event) ? false : sm.someSnapperMightSnap(); boost::optional ctrl_constraint; - + _pm().BSpline(); // with Alt, preserve length if (held_alt(*event)) { new_pos = parent_pos + Geom::unit_vector(new_pos - parent_pos) * _saved_length; @@ -424,17 +425,17 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) ctrl_constraint = Inkscape::Snapper::SnapConstraint(parent_pos, parent_pos - perp_pos); } new_pos = result; - //BSpline + if(_pm().isBSpline){ Handle *h = NULL; _parent->bsplineWeight = 0.0000; h = this; setPosition(new_pos); - int steps = _pm().getSteps(); + int steps = _pm().BSplineGetSteps(); _parent->bsplineWeight = ceilf(_pm().BSplineHandlePosition(h)*steps)/steps; new_pos=_pm().BSplineHandleReposition(h,_parent->bsplineWeight); } - //BSpline End + } std::vector unselected; @@ -464,7 +465,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) sm.freeSnapReturnByRef(new_pos, SNAPSOURCE_NODE_HANDLE); } sm.unSetup(); - //BSpline + if(_pm().isBSpline){ Handle *h = NULL; _parent->bsplineWeight = 0.0000; @@ -473,7 +474,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) _parent->bsplineWeight = _pm().BSplineHandlePosition(h); new_pos=_pm().BSplineHandleReposition(h,_parent->bsplineWeight); } - //BSpline End + } @@ -674,9 +675,10 @@ void Node::move(Geom::Point const &new_pos) // move handles when the node moves. Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); - //BSpline + double prevPos = 0.0000; double nextPos = 0.0000; + _pm().BSpline(); Node *n = this; Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); @@ -689,23 +691,23 @@ void Node::move(Geom::Point const &new_pos) if(nextNode) nextPos = _pm().BSplineHandlePosition(nextNode->back()); } - //BSpline End + setPosition(new_pos); - //BSpline + if(_pm().isBSpline){ if(prevNode) prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevPos)); if(nextNode) nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextPos)); } - //BSpline End + _front.setPosition(_front.position() + delta); _back.setPosition(_back.position() + delta); - //BSpline End + // if the node has a smooth handle after a line segment, it should be kept colinear // with the segment _fixNeighbors(old_pos, new_pos); - //BSpline + if(_pm().isBSpline){ Handle* front = &_front; Handle* back = &_back; @@ -724,6 +726,7 @@ void Node::transform(Geom::Affine const &m) /* Affine transforms keep handle invariants for smooth and symmetric nodes, * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); + _pm().BSpline(); if(_pm().isBSpline){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),this->bsplineWeight)); @@ -914,7 +917,7 @@ void Node::setType(NodeType type, bool update_handles) break; default: break; } - //BSpline + _pm().BSpline(); if(_pm().isBSpline){ Handle* front = &_front; Handle* back = &_back; @@ -923,7 +926,7 @@ void Node::setType(NodeType type, bool update_handles) _front.setPosition(_pm().BSplineHandleReposition(front,this->bsplineWeight)); _back.setPosition(_pm().BSplineHandleReposition(back,this->bsplineWeight)); } - //BSpline End + } _type = type; _setControlType(nodeTypeToCtrlType(_type)); @@ -1170,12 +1173,12 @@ void Node::_setState(State state) case STATE_CLICKED: mgr.setActive(_canvas_item, true); mgr.setPrelight(_canvas_item, false); - //BSpline + _pm().BSpline(); if(_pm().isBSpline){ this->bsplineWeight = _pm().BSplineHandlePosition(this->back()); _pm().BSplineNodeHandlesReposition(this); } - //BSpline End + break; } SelectableControlPoint::_setState(state); -- cgit v1.2.3 From 57865cd8a96b1b5c72f44c9b97d1a828caf09f95 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 30 Dec 2013 19:45:52 +0100 Subject: Refactorizing (bzr r11950.1.211) --- src/ui/tool/node.cpp | 210 +++++++++++++++++++-------------------------------- 1 file changed, 78 insertions(+), 132 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index af823a787..70e374424 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -138,9 +138,6 @@ void Handle::move(Geom::Point const &new_pos) Handle *towards = node_towards ? node_towards->handleAwayFrom(_parent) : NULL; Handle *towards_second = node_towards ? node_towards->handleToward(_parent) : NULL; - Handle *h = NULL; - Handle *h2 = NULL; - _pm().BSpline(); if (Geom::are_near(new_pos, _parent->position())) { // The handle becomes degenerate. // Adjust node type as necessary. @@ -171,30 +168,13 @@ void Handle::move(Geom::Point const &new_pos) } } setPosition(new_pos); - + + //If is bspline move other handle if(_pm().isBSpline){ - h = this; - setPosition(_pm().BSplineHandleReposition(h)); - _parent->bsplineWeight = _pm().BSplineHandlePosition(h); - //typedef ControlPointSelection::Set Set; - //Set &nodes = _parent->_selection.allPoints(); - //for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { - // if((*i)->selected()){ - // Node *n = static_cast(*i); - // h = n->front(); - // h2 = n->back(); - // h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - // h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - //} - //} - //if(!_parent->selected()){ - h = _parent->front(); - h2 = _parent->back(); - h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - //} + setPosition(_pm().BSplineHandleReposition(this)); + _parent->bsplineWeight = _pm().BSplineHandlePosition(this); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); } - return; } @@ -206,28 +186,12 @@ void Handle::move(Geom::Point const &new_pos) Geom::Point new_delta = (Geom::dot(delta, direction) / Geom::L2sq(direction)) * direction; setRelativePos(new_delta); - + + //If is bspline move both handles if(_pm().isBSpline){ - h = this; - setPosition(_pm().BSplineHandleReposition(h)); - _parent->bsplineWeight = _pm().BSplineHandlePosition(h); - //typedef ControlPointSelection::Set Set; - //Set &nodes = _parent->_selection.allPoints(); - //for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { - // if((*i)->selected()){ - // Node *n = static_cast(*i); - // h = n->front(); - // h2 = n->back(); - // h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - // h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - // } - //} - //if(!_parent->selected()){ - h = _parent->front(); - h2 = _parent->back(); - h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - //} + setPosition(_pm().BSplineHandleReposition(this)); + _parent->bsplineWeight = _pm().BSplineHandlePosition(this); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); } return; @@ -249,28 +213,12 @@ void Handle::move(Geom::Point const &new_pos) default: break; } setPosition(new_pos); - + + //If is bspline move other handle if(_pm().isBSpline){ - h = this; - setPosition(_pm().BSplineHandleReposition(h)); - _parent->bsplineWeight = _pm().BSplineHandlePosition(h); - //typedef ControlPointSelection::Set Set; - //Set &nodes = _parent->_selection.allPoints(); - //for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { - // if((*i)->selected()){ - // Node *n = static_cast(*i); - // h = n->front(); - // h2 = n->back(); - // h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - // h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - // } - //} - //if(!_parent->selected()){ - h = _parent->front(); - h2 = _parent->back(); - h->setPosition(_pm().BSplineHandleReposition(h,_parent->bsplineWeight)); - h2->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); - //} + setPosition(_pm().BSplineHandleReposition(this)); + _parent->bsplineWeight = _pm().BSplineHandlePosition(this); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); } } @@ -362,16 +310,10 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven void Handle::handle_2button_press(){ - _pm().BSpline(); if(_pm().isBSpline){ - Handle *h = NULL; - Handle *h2 = NULL; - _parent->bsplineWeight = 0.0000; - h = this; - setPosition(_pm().BSplineHandleReposition(h,0.3334)); - _parent->bsplineWeight = _pm().BSplineHandlePosition(h); - h2 = this->other(); - this->other()->setPosition(_pm().BSplineHandleReposition(h2,_parent->bsplineWeight)); + setPosition(_pm().BSplineHandleReposition(this,0.3334)); + _parent->bsplineWeight = 0.3334; + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); _pm().update(); } } @@ -393,7 +335,6 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) SnapManager &sm = _desktop->namedview->snap_manager; bool snap = held_shift(*event) ? false : sm.someSnapperMightSnap(); boost::optional ctrl_constraint; - _pm().BSpline(); // with Alt, preserve length if (held_alt(*event)) { new_pos = parent_pos + Geom::unit_vector(new_pos - parent_pos) * _saved_length; @@ -427,19 +368,18 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) new_pos = result; if(_pm().isBSpline){ - Handle *h = NULL; - _parent->bsplineWeight = 0.0000; - h = this; setPosition(new_pos); int steps = _pm().BSplineGetSteps(); - _parent->bsplineWeight = ceilf(_pm().BSplineHandlePosition(h)*steps)/steps; - new_pos=_pm().BSplineHandleReposition(h,_parent->bsplineWeight); + _parent->bsplineWeight = ceilf(_pm().BSplineHandlePosition(this)*steps)/steps; + new_pos=_pm().BSplineHandleReposition(this,_parent->bsplineWeight); } } std::vector unselected; - if (snap && ( (!held_control(*event) && _pm().isBSpline) || !_pm().isBSpline)) { + + //IF Snap and Not CTRL && BSpline or BSPLINE is false + if (snap && (((!held_control(*event) && _pm().isBSpline) && (!held_shift(*event) && _pm().isBSpline)) || !_pm().isBSpline)) { ControlPointSelection::Set &nodes = _parent->_selection.allPoints(); for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { Node *n = static_cast(*i); @@ -465,16 +405,11 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) sm.freeSnapReturnByRef(new_pos, SNAPSOURCE_NODE_HANDLE); } sm.unSetup(); - if(_pm().isBSpline){ - Handle *h = NULL; - _parent->bsplineWeight = 0.0000; - h = this; setPosition(new_pos); - _parent->bsplineWeight = _pm().BSplineHandlePosition(h); - new_pos=_pm().BSplineHandleReposition(h,_parent->bsplineWeight); + _parent->bsplineWeight = _pm().BSplineHandlePosition(this); + new_pos=_pm().BSplineHandleReposition(this,_parent->bsplineWeight); } - } @@ -489,6 +424,10 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) other()->setPosition(_saved_other_pos); } } + + 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 _pm().update(); } @@ -505,7 +444,9 @@ void Handle::ungrabbed(GdkEventButton *event) Geom::Point dist = _desktop->d2w(_parent->position()) - _desktop->d2w(position()); if (dist.length() <= drag_tolerance) { move(_parent->position()); - _parent->bsplineWeight = 0.0000; + if(_pm().isBSpline){ + _parent->bsplineWeight = 0.0000; + } } } @@ -548,13 +489,18 @@ static double snap_increment_degrees() { Glib::ustring Handle::_getTip(unsigned state) const { char const *more; + bool isBSpline = false; + if( _parent->bsplineWeight != 0.0000) + isBSpline = true; bool can_shift_rotate = _parent->type() == NODE_CUSP && !other()->isDegenerate(); - if (can_shift_rotate) { + if (can_shift_rotate && !isBSpline) { more = C_("Path handle tip", "more: Shift, Ctrl, Alt"); - } else { + } else if(isBSpline){ + more = C_("Path handle tip", "move:Shift, reset:double click, more: Ctrl"); + }else { more = C_("Path handle tip", "more: Ctrl, Alt"); } - if (state_held_alt(state)) { + if (state_held_alt(state) && !isBSpline) { if (state_held_control(state)) { if (state_held_shift(state) && can_shift_rotate) { return format_tip(C_("Path handle tip", @@ -577,18 +523,24 @@ Glib::ustring Handle::_getTip(unsigned state) const } } else { if (state_held_control(state)) { - if (state_held_shift(state) && can_shift_rotate) { + if (state_held_shift(state) && can_shift_rotate && !isBSpline) { return format_tip(C_("Path handle tip", "Shift+Ctrl: snap rotation angle to %g° increments and rotate both handles"), snap_increment_degrees()); - } else { + } else if(isBSpline){ + return format_tip(C_("Path handle tip", + "Ctrl: Move handle by his actual steps in BSpline Live Effect")); + }else{ return format_tip(C_("Path handle tip", "Ctrl: snap rotation angle to %g° increments, click to retract"), snap_increment_degrees()); } - } else if (state_held_shift(state) && can_shift_rotate) { + } else if (state_held_shift(state) && can_shift_rotate && !isBSpline) { return C_("Path hande tip", "Shift: rotate both handles by the same angle"); + } else if(state_held_shift(state) && isBSpline){ + return C_("Path hande tip", + "Shift: move handle"); } } @@ -676,31 +628,14 @@ void Node::move(Geom::Point const &new_pos) Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); - double prevPos = 0.0000; - double nextPos = 0.0000; - _pm().BSpline(); + double oldPos = 0.0000; Node *n = this; - Node * nextNode = n->nodeToward(n->front()); - Node * prevNode = n->nodeToward(n->back()); if(_pm().isBSpline){ - if(prevNode) - prevPos = _pm().BSplineHandlePosition(prevNode->front()); - n->bsplineWeight = _pm().BSplineHandlePosition(n->front()); - if(n->bsplineWeight == 0.0000) - n->bsplineWeight = _pm().BSplineHandlePosition(n->back()); - if(nextNode) - nextPos = _pm().BSplineHandlePosition(nextNode->back()); + oldPos = n->bsplineWeight; } setPosition(new_pos); - - if(_pm().isBSpline){ - if(prevNode) - prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevPos)); - if(nextNode) - nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextPos)); - } - + _front.setPosition(_front.position() + delta); _back.setPosition(_back.position() + delta); @@ -709,15 +644,18 @@ void Node::move(Geom::Point const &new_pos) _fixNeighbors(old_pos, new_pos); if(_pm().isBSpline){ - Handle* front = &_front; - Handle* back = &_back; - _front.setPosition(_pm().BSplineHandleReposition(front,n->bsplineWeight)); - _back.setPosition(_pm().BSplineHandleReposition(back,n->bsplineWeight)); + _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); + _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); + _pm().BSplineNodeHandlesReposition(this); } } void Node::transform(Geom::Affine const &m) { + double oldPos = 0.0000; + if(_pm().isBSpline){ + oldPos = this->bsplineWeight; + } Geom::Point old_pos = position(); setPosition(position() * m); _front.setPosition(_front.position() * m); @@ -726,10 +664,9 @@ void Node::transform(Geom::Affine const &m) /* Affine transforms keep handle invariants for smooth and symmetric nodes, * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); - _pm().BSpline(); if(_pm().isBSpline){ - _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); - _back.setPosition(_pm().BSplineHandleReposition(this->back(),this->bsplineWeight)); + _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); + _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); _pm().BSplineNodeHandlesReposition(this); } } @@ -817,6 +754,8 @@ void Node::showHandles(bool v) if (!_back.isDegenerate()) { _back.setVisible(v); } + if(!_pm().isBSpline) + this->bsplineWeight = 0.0000; } void Node::updateHandles() @@ -917,14 +856,10 @@ void Node::setType(NodeType type, bool update_handles) break; default: break; } - _pm().BSpline(); if(_pm().isBSpline){ - Handle* front = &_front; - Handle* back = &_back; - this->bsplineWeight = _pm().BSplineHandlePosition(front); if(this->bsplineWeight !=0.0000) this->bsplineWeight = 0.3334; - _front.setPosition(_pm().BSplineHandleReposition(front,this->bsplineWeight)); - _back.setPosition(_pm().BSplineHandleReposition(back,this->bsplineWeight)); + _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); + _back.setPosition(_pm().BSplineHandleReposition(this->back(),this->bsplineWeight)); } } @@ -1175,8 +1110,19 @@ void Node::_setState(State state) mgr.setPrelight(_canvas_item, false); _pm().BSpline(); if(_pm().isBSpline){ - this->bsplineWeight = _pm().BSplineHandlePosition(this->back()); - _pm().BSplineNodeHandlesReposition(this); + if(!this->back()->isDegenerate()){ + this->bsplineWeight = _pm().BSplineHandlePosition(this->back()); + }else if (!this->front()->isDegenerate()){ + this->bsplineWeight = _pm().BSplineHandlePosition(this->front()); + }else{ + this->bsplineWeight = 0.0000; + } + if(!this->front()->isDegenerate()){ + this->front()->setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); + } + if(!this->back()->isDegenerate()){ + this->back()->setPosition(_pm().BSplineHandleReposition(this->back(),this->bsplineWeight)); + } } break; -- cgit v1.2.3 From 4c6918c72721a35e0347e9e087396238e72eb62e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 30 Dec 2013 20:41:32 +0100 Subject: Refactorizing (bzr r11950.1.212) --- src/ui/tool/node.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 70e374424..7266c85bb 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -28,9 +28,7 @@ #include "ui/tool/node.h" #include "ui/tool/path-manipulator.h" #include - #include -; namespace { @@ -137,7 +135,7 @@ void Handle::move(Geom::Point const &new_pos) Node *node_away = _parent->nodeAwayFrom(this); // node in the opposite direction Handle *towards = node_towards ? node_towards->handleAwayFrom(_parent) : NULL; Handle *towards_second = node_towards ? node_towards->handleToward(_parent) : NULL; - + if (Geom::are_near(new_pos, _parent->position())) { // The handle becomes degenerate. // Adjust node type as necessary. @@ -308,7 +306,6 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven return ControlPoint::_eventHandler(event_context, event); } - void Handle::handle_2button_press(){ if(_pm().isBSpline){ setPosition(_pm().BSplineHandleReposition(this,0.3334)); @@ -318,7 +315,6 @@ void Handle::handle_2button_press(){ } } - bool Handle::grabbed(GdkEventMotion *) { _saved_other_pos = other()->position(); @@ -335,6 +331,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) SnapManager &sm = _desktop->namedview->snap_manager; bool snap = held_shift(*event) ? false : sm.someSnapperMightSnap(); boost::optional ctrl_constraint; + // with Alt, preserve length if (held_alt(*event)) { new_pos = parent_pos + Geom::unit_vector(new_pos - parent_pos) * _saved_length; @@ -366,14 +363,13 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) ctrl_constraint = Inkscape::Snapper::SnapConstraint(parent_pos, parent_pos - perp_pos); } new_pos = result; - + if(_pm().isBSpline){ setPosition(new_pos); int steps = _pm().BSplineGetSteps(); _parent->bsplineWeight = ceilf(_pm().BSplineHandlePosition(this)*steps)/steps; new_pos=_pm().BSplineHandleReposition(this,_parent->bsplineWeight); } - } std::vector unselected; @@ -627,22 +623,22 @@ void Node::move(Geom::Point const &new_pos) // move handles when the node moves. Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); - + double oldPos = 0.0000; Node *n = this; if(_pm().isBSpline){ oldPos = n->bsplineWeight; } - + setPosition(new_pos); _front.setPosition(_front.position() + delta); _back.setPosition(_back.position() + delta); - + // if the node has a smooth handle after a line segment, it should be kept colinear // with the segment _fixNeighbors(old_pos, new_pos); - + if(_pm().isBSpline){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); @@ -774,6 +770,7 @@ void Node::setType(NodeType type, bool update_handles) updateState(); // The size of the control might have changed return; } + // if update_handles is true, adjust handle positions to match the node type // handle degenerate handles appropriately if (update_handles) { @@ -861,7 +858,6 @@ void Node::setType(NodeType type, bool update_handles) _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),this->bsplineWeight)); } - } _type = type; _setControlType(nodeTypeToCtrlType(_type)); @@ -1124,7 +1120,6 @@ void Node::_setState(State state) this->back()->setPosition(_pm().BSplineHandleReposition(this->back(),this->bsplineWeight)); } } - break; } SelectableControlPoint::_setState(state); -- cgit v1.2.3 From 8d781fb629a07fdbd828b2eeb18694bb32e88768 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 30 Dec 2013 21:45:48 +0100 Subject: Updated tip strings (bzr r11950.1.215) --- src/ui/tool/node.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 7266c85bb..305dd6798 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -492,7 +492,7 @@ Glib::ustring Handle::_getTip(unsigned state) const if (can_shift_rotate && !isBSpline) { more = C_("Path handle tip", "more: Shift, Ctrl, Alt"); } else if(isBSpline){ - more = C_("Path handle tip", "move:Shift, reset:double click, more: Ctrl"); + more = C_("Path handle tip", "more: Ctrl"); }else { more = C_("Path handle tip", "more: Ctrl, Alt"); } @@ -545,9 +545,13 @@ Glib::ustring Handle::_getTip(unsigned state) const return format_tip(C_("Path handle tip", "Auto node handle: drag to convert to smooth node (%s)"), more); default: - return format_tip(C_("Path handle tip", - "%s: drag to shape the segment (%s)"), - handle_type_to_localized_string(_parent->type()), more); + if(!isBSpline){ + return format_tip(C_("Path handle tip", + "Auto node handle: drag to convert to smooth node (%s)"), more); + }else{ + return format_tip(C_("Path handle tip", + "BSpline node handle: Shift to drag, double click to reset (%s)"), more); + } } } -- cgit v1.2.3 From 140267c64cd9d19e372328d6f30c072102c2dd33 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 30 Dec 2013 22:04:13 +0100 Subject: Refact (bzr r11950.1.216) --- src/ui/tool/node.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 305dd6798..85a407384 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -974,6 +974,7 @@ bool Node::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEvent _selection.spatialGrow(this, dir); } return true; + default: break; } -- cgit v1.2.3 From 1abfd51451a3df8a46ec9e23332aff72208ac942 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 30 Dec 2013 23:19:31 +0100 Subject: Spanish comment of node.cpp (bzr r11950.1.217) --- src/ui/tool/node.cpp | 53 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 85a407384..9eab1d7dc 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -167,7 +167,7 @@ void Handle::move(Geom::Point const &new_pos) } setPosition(new_pos); - //If is bspline move other handle + //spanish: mueve el tirador y su opuesto la misma proporción if(_pm().isBSpline){ setPosition(_pm().BSplineHandleReposition(this)); _parent->bsplineWeight = _pm().BSplineHandlePosition(this); @@ -185,7 +185,7 @@ void Handle::move(Geom::Point const &new_pos) / Geom::L2sq(direction)) * direction; setRelativePos(new_delta); - //If is bspline move both handles + //spanish: mueve el tirador y su opuesto la misma proporción if(_pm().isBSpline){ setPosition(_pm().BSplineHandleReposition(this)); _parent->bsplineWeight = _pm().BSplineHandlePosition(this); @@ -212,7 +212,7 @@ void Handle::move(Geom::Point const &new_pos) } setPosition(new_pos); - //If is bspline move other handle + //spanish: mueve el tirador y su opuesto la misma proporción if(_pm().isBSpline){ setPosition(_pm().BSplineHandleReposition(this)); _parent->bsplineWeight = _pm().BSplineHandlePosition(this); @@ -295,7 +295,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven break; default: break; } - + //spanish: nuevo evento de doble click para resetear a la proporción por defecto, 0.3334%, los tiradores de un nodo case GDK_2BUTTON_PRESS: handle_2button_press(); break; @@ -306,6 +306,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven return ControlPoint::_eventHandler(event_context, event); } +//spanish: función que mueve el tirador y su opuesto a la proporción por defecto de 0.3334 void Handle::handle_2button_press(){ if(_pm().isBSpline){ setPosition(_pm().BSplineHandleReposition(this,0.3334)); @@ -363,7 +364,8 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) ctrl_constraint = Inkscape::Snapper::SnapConstraint(parent_pos, parent_pos - perp_pos); } new_pos = result; - + //spanish: mueve el tirador y su opuesto en X posiciones fijas depenfiendo de la configuración de el + //parametro "steps whith control" del efecto en vivo BSpline if(_pm().isBSpline){ setPosition(new_pos); int steps = _pm().BSplineGetSteps(); @@ -373,9 +375,8 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } std::vector unselected; - - //IF Snap and Not CTRL && BSpline or BSPLINE is false - if (snap && (((!held_control(*event) && _pm().isBSpline) && (!held_shift(*event) && _pm().isBSpline)) || !_pm().isBSpline)) { + //spanish: si está activado el ajuste (snap) y no es bspline + 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(*i); @@ -401,11 +402,6 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) sm.freeSnapReturnByRef(new_pos, SNAPSOURCE_NODE_HANDLE); } sm.unSetup(); - if(_pm().isBSpline){ - setPosition(new_pos); - _parent->bsplineWeight = _pm().BSplineHandlePosition(this); - new_pos=_pm().BSplineHandleReposition(this,_parent->bsplineWeight); - } } @@ -420,7 +416,8 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) other()->setPosition(_saved_other_pos); } } - + //spanish: si es bspline pero no está presionado SHIFT o CONTROL + //lo fija en la posición original if(_pm().isBSpline && !held_shift(*event) && !held_control(*event)){ new_pos=_last_drag_origin(); } @@ -440,6 +437,7 @@ void Handle::ungrabbed(GdkEventButton *event) Geom::Point dist = _desktop->d2w(_parent->position()) - _desktop->d2w(position()); if (dist.length() <= drag_tolerance) { move(_parent->position()); + //spanish: marca la fuerza del bspline como 0.0000 if(_pm().isBSpline){ _parent->bsplineWeight = 0.0000; } @@ -485,6 +483,9 @@ static double snap_increment_degrees() { Glib::ustring Handle::_getTip(unsigned state) const { char const *more; + //spanish: un truco par, si el nodo tiene fuerza, nos marca que es + //del tipo bspline, lo utilizaremos despues para mostras los mensajes apropiados + //no lo podemos hacer de otra forma al ser constante la funcion bool isBSpline = false; if( _parent->bsplineWeight != 0.0000) isBSpline = true; @@ -587,7 +588,6 @@ Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) : _type(NODE_CUSP), _handles_shown(false) { - this->bsplineWeight = 0.3334; // NOTE we do not set type here, because the handles are still degenerate } @@ -627,7 +627,8 @@ void Node::move(Geom::Point const &new_pos) // move handles when the node moves. Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); - + //spanish: guardamos la fuerza anterior del nodo para reaplicarsela + //de nuevo una vez sea movido el nodo double oldPos = 0.0000; Node *n = this; if(_pm().isBSpline){ @@ -642,7 +643,8 @@ void Node::move(Geom::Point const &new_pos) // if the node has a smooth handle after a line segment, it should be kept colinear // with the segment _fixNeighbors(old_pos, new_pos); - + //spanish: movemos los tiradores involucrados, primero los del nodo en cuestión + //y despues los de los nodos colindantes if(_pm().isBSpline){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); @@ -652,6 +654,8 @@ void Node::move(Geom::Point const &new_pos) void Node::transform(Geom::Affine const &m) { + //spanish: guardamos la fuerza anterior del nodo para reaplicarsela + //de nuevo una vez sea movido el nodo double oldPos = 0.0000; if(_pm().isBSpline){ oldPos = this->bsplineWeight; @@ -664,6 +668,8 @@ void Node::transform(Geom::Affine const &m) /* Affine transforms keep handle invariants for smooth and symmetric nodes, * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); + //spanish: movemos los tiradores involucrados, primero los del nodo en cuestión + //y despues los de los nodos colindantes if(_pm().isBSpline){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); @@ -754,8 +760,12 @@ void Node::showHandles(bool v) if (!_back.isDegenerate()) { _back.setVisible(v); } - if(!_pm().isBSpline) - this->bsplineWeight = 0.0000; + //spanish: definimos la fuerza de los nodos,según sea o no trazado bspline. + //Cada vez que actuemos sobre dichos tiradores en un trazado + //bspline esta fuerza se tiene que actualizar + this->bsplineWeight = 0.0000; + if(_pm().isBSpline) + this->bsplineWeight = 0.3334; } void Node::updateHandles() @@ -857,6 +867,9 @@ void Node::setType(NodeType type, bool update_handles) break; default: break; } + //spanish: en los cambios de tipo de nodo, sobre trazados bspline, + //o bien los mantenemos con potencia 0.0000 en modo esquina + //o les damos la potencia por defecto en modo de curva if(_pm().isBSpline){ if(this->bsplineWeight !=0.0000) this->bsplineWeight = 0.3334; _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); @@ -1109,7 +1122,7 @@ void Node::_setState(State state) case STATE_CLICKED: mgr.setActive(_canvas_item, true); mgr.setPrelight(_canvas_item, false); - _pm().BSpline(); + //spanish: esto muestra los tiradores al seleccionar los nodos if(_pm().isBSpline){ if(!this->back()->isDegenerate()){ this->bsplineWeight = _pm().BSplineHandlePosition(this->back()); -- cgit v1.2.3 From 3e2698fd64dbf8c63b1efc758be5b3a1c30fe1fc Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 31 Dec 2013 01:42:32 +0100 Subject: fix a bug whith degenerate handles (bzr r11950.1.229) --- src/ui/tool/node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 9eab1d7dc..a932e5b7b 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -764,7 +764,7 @@ void Node::showHandles(bool v) //Cada vez que actuemos sobre dichos tiradores en un trazado //bspline esta fuerza se tiene que actualizar this->bsplineWeight = 0.0000; - if(_pm().isBSpline) + if(_pm().isBSpline && (!_front.isDegenerate() || !_back.isDegenerate())) this->bsplineWeight = 0.3334; } -- cgit v1.2.3 From c08c28e9a22f0fe5f06e9dc34430c3acb16f3c13 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 2 Jan 2014 16:15:27 +0100 Subject: Fixed a boring bug sometimes curves be converted to lines, increasing a bit the distance from the handle to the line (bzr r11950.1.230) --- src/ui/tool/node.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index a932e5b7b..39b21ae6d 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -1388,6 +1388,12 @@ Node *Node::nodeAwayFrom(Handle *h) Glib::ustring Node::_getTip(unsigned state) const { + //spanish: un truco par, si el nodo tiene fuerza, nos marca que es + //del tipo bspline, lo utilizaremos despues para mostras los mensajes apropiados + //no lo podemos hacer de otra forma al ser constante la funcion + bool isBSpline = false; + if( this->bsplineWeight != 0.0000) + isBSpline = true; if (state_held_shift(state)) { bool can_drag_out = (_next() && _front.isDegenerate()) || (_prev() && _back.isDegenerate()); if (can_drag_out) { @@ -1417,15 +1423,24 @@ Glib::ustring Node::_getTip(unsigned state) const // No modifiers: assemble tip from node type char const *nodetype = node_type_to_localized_string(_type); if (_selection.transformHandlesEnabled() && selected()) { - if (_selection.size() == 1) { + if (_selection.size() == 1 && !isBSpline) { return format_tip(C_("Path node tip", "%s: drag to shape the path (more: Shift, Ctrl, Alt)"), nodetype); + }else if(_selection.size() == 1){ + return format_tip(C_("Path node tip", + "BSpline node: %g weight, drag to shape the path (more: Shift, Ctrl, Alt)"),this->bsplineWeight); } return format_tip(C_("Path node tip", "%s: drag to shape the path, click to toggle scale/rotation handles (more: Shift, Ctrl, Alt)"), nodetype); } - return format_tip(C_("Path node tip", - "%s: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)"), nodetype); + if (!isBSpline) { + return format_tip(C_("Path node tip", + "%s: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)"), nodetype); + }else{ + return format_tip(C_("Path node tip", + "BSpline node: drag to shape the path, click to select only this node (more: Shift, Ctrl, Alt)")); + + } } Glib::ustring Node::_getDragTip(GdkEventMotion */*event*/) const -- cgit v1.2.3 From 0b15b05d641661e6b1d5cb73520c7cdead1cfc89 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 9 Jan 2014 17:46:40 +0100 Subject: Fix a bug whith oposite handles on node move,and a little cleanup (bzr r11950.1.232) --- src/ui/tool/node.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 39b21ae6d..63556e499 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -170,7 +170,6 @@ void Handle::move(Geom::Point const &new_pos) //spanish: mueve el tirador y su opuesto la misma proporción if(_pm().isBSpline){ setPosition(_pm().BSplineHandleReposition(this)); - _parent->bsplineWeight = _pm().BSplineHandlePosition(this); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); } return; @@ -188,7 +187,6 @@ void Handle::move(Geom::Point const &new_pos) //spanish: mueve el tirador y su opuesto la misma proporción if(_pm().isBSpline){ setPosition(_pm().BSplineHandleReposition(this)); - _parent->bsplineWeight = _pm().BSplineHandlePosition(this); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); } @@ -215,7 +213,6 @@ void Handle::move(Geom::Point const &new_pos) //spanish: mueve el tirador y su opuesto la misma proporción if(_pm().isBSpline){ setPosition(_pm().BSplineHandleReposition(this)); - _parent->bsplineWeight = _pm().BSplineHandlePosition(this); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); } @@ -310,7 +307,6 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven void Handle::handle_2button_press(){ if(_pm().isBSpline){ setPosition(_pm().BSplineHandleReposition(this,0.3334)); - _parent->bsplineWeight = 0.3334; this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); _pm().update(); } @@ -764,8 +760,14 @@ void Node::showHandles(bool v) //Cada vez que actuemos sobre dichos tiradores en un trazado //bspline esta fuerza se tiene que actualizar this->bsplineWeight = 0.0000; - if(_pm().isBSpline && (!_front.isDegenerate() || !_back.isDegenerate())) - this->bsplineWeight = 0.3334; + if(_pm().isBSpline && (!_front.isDegenerate() || !_back.isDegenerate())){ + if (!_front.isDegenerate()) { + _pm().BSplineHandlePosition(&_front); + } + if (!_back.isDegenerate()) { + _pm().BSplineHandlePosition(&_back); + } + } } void Node::updateHandles() @@ -1125,9 +1127,9 @@ void Node::_setState(State state) //spanish: esto muestra los tiradores al seleccionar los nodos if(_pm().isBSpline){ if(!this->back()->isDegenerate()){ - this->bsplineWeight = _pm().BSplineHandlePosition(this->back()); + _pm().BSplineHandlePosition(this->back()); }else if (!this->front()->isDegenerate()){ - this->bsplineWeight = _pm().BSplineHandlePosition(this->front()); + _pm().BSplineHandlePosition(this->front()); }else{ this->bsplineWeight = 0.0000; } -- cgit v1.2.3 From 1f76e96f90e3badb3b9693d477e6e75fbaaa1bd1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 28 Feb 2014 20:12:44 +0100 Subject: adding some comments (bzr r11950.1.260) --- src/ui/tool/node.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 63556e499..69f4a8e82 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -322,7 +322,6 @@ bool Handle::grabbed(GdkEventMotion *) void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) { - Geom::Point parent_pos = _parent->position(); Geom::Point origin = _last_drag_origin(); SnapManager &sm = _desktop->namedview->snap_manager; @@ -479,7 +478,7 @@ static double snap_increment_degrees() { Glib::ustring Handle::_getTip(unsigned state) const { char const *more; - //spanish: un truco par, si el nodo tiene fuerza, nos marca que es + //spanish: un truco para, si el nodo tiene fuerza, nos marca que es //del tipo bspline, lo utilizaremos despues para mostras los mensajes apropiados //no lo podemos hacer de otra forma al ser constante la funcion bool isBSpline = false; -- cgit v1.2.3 From 616ae6e54d98f03dc1ff3ce7d3c528521fd7e233 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 1 Mar 2014 16:28:13 +0100 Subject: Substitute isBSpline property by a cached function isBSpline(bool) (bzr r11950.1.261) --- src/ui/tool/node.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 69f4a8e82..78d8fe833 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -168,7 +168,7 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); //spanish: mueve el tirador y su opuesto la misma proporción - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); } @@ -185,7 +185,7 @@ void Handle::move(Geom::Point const &new_pos) setRelativePos(new_delta); //spanish: mueve el tirador y su opuesto la misma proporción - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); } @@ -211,7 +211,7 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); //spanish: mueve el tirador y su opuesto la misma proporción - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); } @@ -305,7 +305,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven //spanish: función que mueve el tirador y su opuesto a la proporción por defecto de 0.3334 void Handle::handle_2button_press(){ - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,0.3334)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); _pm().update(); @@ -361,7 +361,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) new_pos = result; //spanish: mueve el tirador y su opuesto en X posiciones fijas depenfiendo de la configuración de el //parametro "steps whith control" del efecto en vivo BSpline - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ setPosition(new_pos); int steps = _pm().BSplineGetSteps(); _parent->bsplineWeight = ceilf(_pm().BSplineHandlePosition(this)*steps)/steps; @@ -371,7 +371,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) std::vector unselected; //spanish: si está activado el ajuste (snap) y no es bspline - if (snap && !_pm().isBSpline) { + if (snap && !_pm().isBSpline(false)) { ControlPointSelection::Set &nodes = _parent->_selection.allPoints(); for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { Node *n = static_cast(*i); @@ -413,7 +413,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } //spanish: si es bspline pero no está presionado SHIFT o CONTROL //lo fija en la posición original - if(_pm().isBSpline && !held_shift(*event) && !held_control(*event)){ + if(_pm().isBSpline(false) && !held_shift(*event) && !held_control(*event)){ new_pos=_last_drag_origin(); } move(new_pos); // needed for correct update, even though it's redundant @@ -433,7 +433,7 @@ void Handle::ungrabbed(GdkEventButton *event) if (dist.length() <= drag_tolerance) { move(_parent->position()); //spanish: marca la fuerza del bspline como 0.0000 - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ _parent->bsplineWeight = 0.0000; } } @@ -626,7 +626,7 @@ void Node::move(Geom::Point const &new_pos) //de nuevo una vez sea movido el nodo double oldPos = 0.0000; Node *n = this; - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ oldPos = n->bsplineWeight; } @@ -640,7 +640,7 @@ void Node::move(Geom::Point const &new_pos) _fixNeighbors(old_pos, new_pos); //spanish: movemos los tiradores involucrados, primero los del nodo en cuestión //y despues los de los nodos colindantes - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); _pm().BSplineNodeHandlesReposition(this); @@ -652,7 +652,7 @@ void Node::transform(Geom::Affine const &m) //spanish: guardamos la fuerza anterior del nodo para reaplicarsela //de nuevo una vez sea movido el nodo double oldPos = 0.0000; - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ oldPos = this->bsplineWeight; } Geom::Point old_pos = position(); @@ -665,7 +665,7 @@ void Node::transform(Geom::Affine const &m) _fixNeighbors(old_pos, position()); //spanish: movemos los tiradores involucrados, primero los del nodo en cuestión //y despues los de los nodos colindantes - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); _pm().BSplineNodeHandlesReposition(this); @@ -759,7 +759,7 @@ void Node::showHandles(bool v) //Cada vez que actuemos sobre dichos tiradores en un trazado //bspline esta fuerza se tiene que actualizar this->bsplineWeight = 0.0000; - if(_pm().isBSpline && (!_front.isDegenerate() || !_back.isDegenerate())){ + if(_pm().isBSpline(false) && (!_front.isDegenerate() || !_back.isDegenerate())){ if (!_front.isDegenerate()) { _pm().BSplineHandlePosition(&_front); } @@ -871,7 +871,7 @@ void Node::setType(NodeType type, bool update_handles) //spanish: en los cambios de tipo de nodo, sobre trazados bspline, //o bien los mantenemos con potencia 0.0000 en modo esquina //o les damos la potencia por defecto en modo de curva - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ if(this->bsplineWeight !=0.0000) this->bsplineWeight = 0.3334; _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),this->bsplineWeight)); @@ -1124,7 +1124,7 @@ void Node::_setState(State state) mgr.setActive(_canvas_item, true); mgr.setPrelight(_canvas_item, false); //spanish: esto muestra los tiradores al seleccionar los nodos - if(_pm().isBSpline){ + if(_pm().isBSpline(false)){ if(!this->back()->isDegenerate()){ _pm().BSplineHandlePosition(this->back()); }else if (!this->front()->isDegenerate()){ -- cgit v1.2.3 From 9ae7e81723f4ea4e2640ed01d55d94e73874804f Mon Sep 17 00:00:00 2001 From: Guiu Rocafort Date: Wed, 5 Mar 2014 12:37:27 +0100 Subject: translations from spanish to english done, it might need a little review, but everything seems ok (bzr r11950.5.1) --- src/ui/tool/node.cpp | 64 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 78d8fe833..73460a313 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -167,7 +167,7 @@ void Handle::move(Geom::Point const &new_pos) } setPosition(new_pos); - //spanish: mueve el tirador y su opuesto la misma proporción + //move the handler and its oposite the same proportion if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); @@ -184,7 +184,7 @@ void Handle::move(Geom::Point const &new_pos) / Geom::L2sq(direction)) * direction; setRelativePos(new_delta); - //spanish: mueve el tirador y su opuesto la misma proporción + //move the handler and its oposite the same proportion if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); @@ -210,7 +210,7 @@ void Handle::move(Geom::Point const &new_pos) } setPosition(new_pos); - //spanish: mueve el tirador y su opuesto la misma proporción + // moves the handler and its oposite the same proportion if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); @@ -292,7 +292,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven break; default: break; } - //spanish: nuevo evento de doble click para resetear a la proporción por defecto, 0.3334%, los tiradores de un nodo + // new double click event to set the handlers of a node to the default proportion, 0.3334% case GDK_2BUTTON_PRESS: handle_2button_press(); break; @@ -303,7 +303,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven return ControlPoint::_eventHandler(event_context, event); } -//spanish: función que mueve el tirador y su opuesto a la proporción por defecto de 0.3334 +//this function moves the handler and its oposite to the default proportion of 0.3334 void Handle::handle_2button_press(){ if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,0.3334)); @@ -359,8 +359,8 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) ctrl_constraint = Inkscape::Snapper::SnapConstraint(parent_pos, parent_pos - perp_pos); } new_pos = result; - //spanish: mueve el tirador y su opuesto en X posiciones fijas depenfiendo de la configuración de el - //parametro "steps whith control" del efecto en vivo BSpline + // moves the handler and its oposite in X fixed positions depending on parameter "steps with control" + // by default in live BSpline if(_pm().isBSpline(false)){ setPosition(new_pos); int steps = _pm().BSplineGetSteps(); @@ -370,7 +370,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } std::vector unselected; - //spanish: si está activado el ajuste (snap) y no es bspline + //if the snap adjustment is activated and it is not bspline if (snap && !_pm().isBSpline(false)) { ControlPointSelection::Set &nodes = _parent->_selection.allPoints(); for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { @@ -411,8 +411,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) other()->setPosition(_saved_other_pos); } } - //spanish: si es bspline pero no está presionado SHIFT o CONTROL - //lo fija en la posición original + //if it is bspline but SHIFT or CONTROL are not pressed it fixes it in the original position if(_pm().isBSpline(false) && !held_shift(*event) && !held_control(*event)){ new_pos=_last_drag_origin(); } @@ -432,7 +431,7 @@ void Handle::ungrabbed(GdkEventButton *event) Geom::Point dist = _desktop->d2w(_parent->position()) - _desktop->d2w(position()); if (dist.length() <= drag_tolerance) { move(_parent->position()); - //spanish: marca la fuerza del bspline como 0.0000 + //sets the bspline strength to 0.0000 if(_pm().isBSpline(false)){ _parent->bsplineWeight = 0.0000; } @@ -478,9 +477,9 @@ static double snap_increment_degrees() { Glib::ustring Handle::_getTip(unsigned state) const { char const *more; - //spanish: un truco para, si el nodo tiene fuerza, nos marca que es - //del tipo bspline, lo utilizaremos despues para mostras los mensajes apropiados - //no lo podemos hacer de otra forma al ser constante la funcion + // 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; @@ -622,8 +621,8 @@ void Node::move(Geom::Point const &new_pos) // move handles when the node moves. Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); - //spanish: guardamos la fuerza anterior del nodo para reaplicarsela - //de nuevo una vez sea movido el nodo + + // save the previous node strength to apply it again once the node is moved double oldPos = 0.0000; Node *n = this; if(_pm().isBSpline(false)){ @@ -638,8 +637,8 @@ void Node::move(Geom::Point const &new_pos) // if the node has a smooth handle after a line segment, it should be kept colinear // with the segment _fixNeighbors(old_pos, new_pos); - //spanish: movemos los tiradores involucrados, primero los del nodo en cuestión - //y despues los de los nodos colindantes + + // move the affected handlers. First the node ones, later the adjoining ones. if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); @@ -649,8 +648,7 @@ void Node::move(Geom::Point const &new_pos) void Node::transform(Geom::Affine const &m) { - //spanish: guardamos la fuerza anterior del nodo para reaplicarsela - //de nuevo una vez sea movido el nodo + // save the previous node strength to apply it again later when the node is moved double oldPos = 0.0000; if(_pm().isBSpline(false)){ oldPos = this->bsplineWeight; @@ -663,8 +661,8 @@ void Node::transform(Geom::Affine const &m) /* Affine transforms keep handle invariants for smooth and symmetric nodes, * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); - //spanish: movemos los tiradores involucrados, primero los del nodo en cuestión - //y despues los de los nodos colindantes + + // move the involved handlers, first the node ones, later the adjoining ones if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); @@ -755,9 +753,11 @@ void Node::showHandles(bool v) if (!_back.isDegenerate()) { _back.setVisible(v); } - //spanish: definimos la fuerza de los nodos,según sea o no trazado bspline. - //Cada vez que actuemos sobre dichos tiradores en un trazado - //bspline esta fuerza se tiene que actualizar + + // define the node strength, depending on being or not bspline traced. + // every time we operate over these handlers in a trace bspline + // that strength needs to be updated. + this->bsplineWeight = 0.0000; if(_pm().isBSpline(false) && (!_front.isDegenerate() || !_back.isDegenerate())){ if (!_front.isDegenerate()) { @@ -868,9 +868,8 @@ void Node::setType(NodeType type, bool update_handles) break; default: break; } - //spanish: en los cambios de tipo de nodo, sobre trazados bspline, - //o bien los mantenemos con potencia 0.0000 en modo esquina - //o les damos la potencia por defecto en modo de curva + /* in node type changes, about bspline traces, we can mantain them with 0.0000 power in border mode, + or we give them the default power in curve mode */ if(_pm().isBSpline(false)){ if(this->bsplineWeight !=0.0000) this->bsplineWeight = 0.3334; _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); @@ -1123,7 +1122,7 @@ void Node::_setState(State state) case STATE_CLICKED: mgr.setActive(_canvas_item, true); mgr.setPrelight(_canvas_item, false); - //spanish: esto muestra los tiradores al seleccionar los nodos + //this shows the handlers when selecting the nodes if(_pm().isBSpline(false)){ if(!this->back()->isDegenerate()){ _pm().BSplineHandlePosition(this->back()); @@ -1389,9 +1388,10 @@ Node *Node::nodeAwayFrom(Handle *h) Glib::ustring Node::_getTip(unsigned state) const { - //spanish: un truco par, si el nodo tiene fuerza, nos marca que es - //del tipo bspline, lo utilizaremos despues para mostras los mensajes apropiados - //no lo podemos hacer de otra forma al ser constante la funcion + + /* 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; -- cgit v1.2.3 From a9eea1cea2a13f129bcb30f175cea82ffcbcee29 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 5 Mar 2014 20:03:46 +0100 Subject: Translations (bzr r11950.1.279) --- src/ui/tool/node.cpp | 64 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 73460a313..78d8fe833 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -167,7 +167,7 @@ void Handle::move(Geom::Point const &new_pos) } setPosition(new_pos); - //move the handler and its oposite the same proportion + //spanish: mueve el tirador y su opuesto la misma proporción if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); @@ -184,7 +184,7 @@ void Handle::move(Geom::Point const &new_pos) / Geom::L2sq(direction)) * direction; setRelativePos(new_delta); - //move the handler and its oposite the same proportion + //spanish: mueve el tirador y su opuesto la misma proporción if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); @@ -210,7 +210,7 @@ void Handle::move(Geom::Point const &new_pos) } setPosition(new_pos); - // moves the handler and its oposite the same proportion + //spanish: mueve el tirador y su opuesto la misma proporción if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); @@ -292,7 +292,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven break; default: break; } - // new double click event to set the handlers of a node to the default proportion, 0.3334% + //spanish: nuevo evento de doble click para resetear a la proporción por defecto, 0.3334%, los tiradores de un nodo case GDK_2BUTTON_PRESS: handle_2button_press(); break; @@ -303,7 +303,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven return ControlPoint::_eventHandler(event_context, event); } -//this function moves the handler and its oposite to the default proportion of 0.3334 +//spanish: función que mueve el tirador y su opuesto a la proporción por defecto de 0.3334 void Handle::handle_2button_press(){ if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,0.3334)); @@ -359,8 +359,8 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) ctrl_constraint = Inkscape::Snapper::SnapConstraint(parent_pos, parent_pos - perp_pos); } new_pos = result; - // moves the handler and its oposite in X fixed positions depending on parameter "steps with control" - // by default in live BSpline + //spanish: mueve el tirador y su opuesto en X posiciones fijas depenfiendo de la configuración de el + //parametro "steps whith control" del efecto en vivo BSpline if(_pm().isBSpline(false)){ setPosition(new_pos); int steps = _pm().BSplineGetSteps(); @@ -370,7 +370,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } std::vector unselected; - //if the snap adjustment is activated and it is not bspline + //spanish: si está activado el ajuste (snap) y no es bspline if (snap && !_pm().isBSpline(false)) { ControlPointSelection::Set &nodes = _parent->_selection.allPoints(); for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { @@ -411,7 +411,8 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) other()->setPosition(_saved_other_pos); } } - //if it is bspline but SHIFT or CONTROL are not pressed it fixes it in the original position + //spanish: si es bspline pero no está presionado SHIFT o CONTROL + //lo fija en la posición original if(_pm().isBSpline(false) && !held_shift(*event) && !held_control(*event)){ new_pos=_last_drag_origin(); } @@ -431,7 +432,7 @@ void Handle::ungrabbed(GdkEventButton *event) Geom::Point dist = _desktop->d2w(_parent->position()) - _desktop->d2w(position()); if (dist.length() <= drag_tolerance) { move(_parent->position()); - //sets the bspline strength to 0.0000 + //spanish: marca la fuerza del bspline como 0.0000 if(_pm().isBSpline(false)){ _parent->bsplineWeight = 0.0000; } @@ -477,9 +478,9 @@ static double snap_increment_degrees() { Glib::ustring Handle::_getTip(unsigned state) const { char const *more; - // 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 - + //spanish: un truco para, si el nodo tiene fuerza, nos marca que es + //del tipo bspline, lo utilizaremos despues para mostras los mensajes apropiados + //no lo podemos hacer de otra forma al ser constante la funcion bool isBSpline = false; if( _parent->bsplineWeight != 0.0000) isBSpline = true; @@ -621,8 +622,8 @@ void Node::move(Geom::Point const &new_pos) // move handles when the node moves. Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); - - // save the previous node strength to apply it again once the node is moved + //spanish: guardamos la fuerza anterior del nodo para reaplicarsela + //de nuevo una vez sea movido el nodo double oldPos = 0.0000; Node *n = this; if(_pm().isBSpline(false)){ @@ -637,8 +638,8 @@ void Node::move(Geom::Point const &new_pos) // if the node has a smooth handle after a line segment, it should be kept colinear // with the segment _fixNeighbors(old_pos, new_pos); - - // move the affected handlers. First the node ones, later the adjoining ones. + //spanish: movemos los tiradores involucrados, primero los del nodo en cuestión + //y despues los de los nodos colindantes if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); @@ -648,7 +649,8 @@ void Node::move(Geom::Point const &new_pos) void Node::transform(Geom::Affine const &m) { - // save the previous node strength to apply it again later when the node is moved + //spanish: guardamos la fuerza anterior del nodo para reaplicarsela + //de nuevo una vez sea movido el nodo double oldPos = 0.0000; if(_pm().isBSpline(false)){ oldPos = this->bsplineWeight; @@ -661,8 +663,8 @@ void Node::transform(Geom::Affine const &m) /* Affine transforms keep handle invariants for smooth and symmetric nodes, * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); - - // move the involved handlers, first the node ones, later the adjoining ones + //spanish: movemos los tiradores involucrados, primero los del nodo en cuestión + //y despues los de los nodos colindantes if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); @@ -753,11 +755,9 @@ void Node::showHandles(bool v) if (!_back.isDegenerate()) { _back.setVisible(v); } - - // define the node strength, depending on being or not bspline traced. - // every time we operate over these handlers in a trace bspline - // that strength needs to be updated. - + //spanish: definimos la fuerza de los nodos,según sea o no trazado bspline. + //Cada vez que actuemos sobre dichos tiradores en un trazado + //bspline esta fuerza se tiene que actualizar this->bsplineWeight = 0.0000; if(_pm().isBSpline(false) && (!_front.isDegenerate() || !_back.isDegenerate())){ if (!_front.isDegenerate()) { @@ -868,8 +868,9 @@ void Node::setType(NodeType type, bool update_handles) break; default: break; } - /* in node type changes, about bspline traces, we can mantain them with 0.0000 power in border mode, - or we give them the default power in curve mode */ + //spanish: en los cambios de tipo de nodo, sobre trazados bspline, + //o bien los mantenemos con potencia 0.0000 en modo esquina + //o les damos la potencia por defecto en modo de curva if(_pm().isBSpline(false)){ if(this->bsplineWeight !=0.0000) this->bsplineWeight = 0.3334; _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); @@ -1122,7 +1123,7 @@ void Node::_setState(State state) case STATE_CLICKED: mgr.setActive(_canvas_item, true); mgr.setPrelight(_canvas_item, false); - //this shows the handlers when selecting the nodes + //spanish: esto muestra los tiradores al seleccionar los nodos if(_pm().isBSpline(false)){ if(!this->back()->isDegenerate()){ _pm().BSplineHandlePosition(this->back()); @@ -1388,10 +1389,9 @@ 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 */ + //spanish: un truco par, si el nodo tiene fuerza, nos marca que es + //del tipo bspline, lo utilizaremos despues para mostras los mensajes apropiados + //no lo podemos hacer de otra forma al ser constante la funcion bool isBSpline = false; if( this->bsplineWeight != 0.0000) isBSpline = true; -- cgit v1.2.3 From c15e77cc2670408ab725ba60c064743a9b61a375 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 5 Mar 2014 20:18:54 +0100 Subject: Fixing branch problems (bzr r11950.1.281) --- src/ui/tool/node.cpp | 64 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 78d8fe833..73460a313 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -167,7 +167,7 @@ void Handle::move(Geom::Point const &new_pos) } setPosition(new_pos); - //spanish: mueve el tirador y su opuesto la misma proporción + //move the handler and its oposite the same proportion if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); @@ -184,7 +184,7 @@ void Handle::move(Geom::Point const &new_pos) / Geom::L2sq(direction)) * direction; setRelativePos(new_delta); - //spanish: mueve el tirador y su opuesto la misma proporción + //move the handler and its oposite the same proportion if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); @@ -210,7 +210,7 @@ void Handle::move(Geom::Point const &new_pos) } setPosition(new_pos); - //spanish: mueve el tirador y su opuesto la misma proporción + // moves the handler and its oposite the same proportion if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); @@ -292,7 +292,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven break; default: break; } - //spanish: nuevo evento de doble click para resetear a la proporción por defecto, 0.3334%, los tiradores de un nodo + // new double click event to set the handlers of a node to the default proportion, 0.3334% case GDK_2BUTTON_PRESS: handle_2button_press(); break; @@ -303,7 +303,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven return ControlPoint::_eventHandler(event_context, event); } -//spanish: función que mueve el tirador y su opuesto a la proporción por defecto de 0.3334 +//this function moves the handler and its oposite to the default proportion of 0.3334 void Handle::handle_2button_press(){ if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,0.3334)); @@ -359,8 +359,8 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) ctrl_constraint = Inkscape::Snapper::SnapConstraint(parent_pos, parent_pos - perp_pos); } new_pos = result; - //spanish: mueve el tirador y su opuesto en X posiciones fijas depenfiendo de la configuración de el - //parametro "steps whith control" del efecto en vivo BSpline + // moves the handler and its oposite in X fixed positions depending on parameter "steps with control" + // by default in live BSpline if(_pm().isBSpline(false)){ setPosition(new_pos); int steps = _pm().BSplineGetSteps(); @@ -370,7 +370,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } std::vector unselected; - //spanish: si está activado el ajuste (snap) y no es bspline + //if the snap adjustment is activated and it is not bspline if (snap && !_pm().isBSpline(false)) { ControlPointSelection::Set &nodes = _parent->_selection.allPoints(); for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { @@ -411,8 +411,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) other()->setPosition(_saved_other_pos); } } - //spanish: si es bspline pero no está presionado SHIFT o CONTROL - //lo fija en la posición original + //if it is bspline but SHIFT or CONTROL are not pressed it fixes it in the original position if(_pm().isBSpline(false) && !held_shift(*event) && !held_control(*event)){ new_pos=_last_drag_origin(); } @@ -432,7 +431,7 @@ void Handle::ungrabbed(GdkEventButton *event) Geom::Point dist = _desktop->d2w(_parent->position()) - _desktop->d2w(position()); if (dist.length() <= drag_tolerance) { move(_parent->position()); - //spanish: marca la fuerza del bspline como 0.0000 + //sets the bspline strength to 0.0000 if(_pm().isBSpline(false)){ _parent->bsplineWeight = 0.0000; } @@ -478,9 +477,9 @@ static double snap_increment_degrees() { Glib::ustring Handle::_getTip(unsigned state) const { char const *more; - //spanish: un truco para, si el nodo tiene fuerza, nos marca que es - //del tipo bspline, lo utilizaremos despues para mostras los mensajes apropiados - //no lo podemos hacer de otra forma al ser constante la funcion + // 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; @@ -622,8 +621,8 @@ void Node::move(Geom::Point const &new_pos) // move handles when the node moves. Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); - //spanish: guardamos la fuerza anterior del nodo para reaplicarsela - //de nuevo una vez sea movido el nodo + + // save the previous node strength to apply it again once the node is moved double oldPos = 0.0000; Node *n = this; if(_pm().isBSpline(false)){ @@ -638,8 +637,8 @@ void Node::move(Geom::Point const &new_pos) // if the node has a smooth handle after a line segment, it should be kept colinear // with the segment _fixNeighbors(old_pos, new_pos); - //spanish: movemos los tiradores involucrados, primero los del nodo en cuestión - //y despues los de los nodos colindantes + + // move the affected handlers. First the node ones, later the adjoining ones. if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); @@ -649,8 +648,7 @@ void Node::move(Geom::Point const &new_pos) void Node::transform(Geom::Affine const &m) { - //spanish: guardamos la fuerza anterior del nodo para reaplicarsela - //de nuevo una vez sea movido el nodo + // save the previous node strength to apply it again later when the node is moved double oldPos = 0.0000; if(_pm().isBSpline(false)){ oldPos = this->bsplineWeight; @@ -663,8 +661,8 @@ void Node::transform(Geom::Affine const &m) /* Affine transforms keep handle invariants for smooth and symmetric nodes, * but smooth nodes at ends of linear segments and auto nodes need special treatment */ _fixNeighbors(old_pos, position()); - //spanish: movemos los tiradores involucrados, primero los del nodo en cuestión - //y despues los de los nodos colindantes + + // move the involved handlers, first the node ones, later the adjoining ones if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); @@ -755,9 +753,11 @@ void Node::showHandles(bool v) if (!_back.isDegenerate()) { _back.setVisible(v); } - //spanish: definimos la fuerza de los nodos,según sea o no trazado bspline. - //Cada vez que actuemos sobre dichos tiradores en un trazado - //bspline esta fuerza se tiene que actualizar + + // define the node strength, depending on being or not bspline traced. + // every time we operate over these handlers in a trace bspline + // that strength needs to be updated. + this->bsplineWeight = 0.0000; if(_pm().isBSpline(false) && (!_front.isDegenerate() || !_back.isDegenerate())){ if (!_front.isDegenerate()) { @@ -868,9 +868,8 @@ void Node::setType(NodeType type, bool update_handles) break; default: break; } - //spanish: en los cambios de tipo de nodo, sobre trazados bspline, - //o bien los mantenemos con potencia 0.0000 en modo esquina - //o les damos la potencia por defecto en modo de curva + /* in node type changes, about bspline traces, we can mantain them with 0.0000 power in border mode, + or we give them the default power in curve mode */ if(_pm().isBSpline(false)){ if(this->bsplineWeight !=0.0000) this->bsplineWeight = 0.3334; _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); @@ -1123,7 +1122,7 @@ void Node::_setState(State state) case STATE_CLICKED: mgr.setActive(_canvas_item, true); mgr.setPrelight(_canvas_item, false); - //spanish: esto muestra los tiradores al seleccionar los nodos + //this shows the handlers when selecting the nodes if(_pm().isBSpline(false)){ if(!this->back()->isDegenerate()){ _pm().BSplineHandlePosition(this->back()); @@ -1389,9 +1388,10 @@ Node *Node::nodeAwayFrom(Handle *h) Glib::ustring Node::_getTip(unsigned state) const { - //spanish: un truco par, si el nodo tiene fuerza, nos marca que es - //del tipo bspline, lo utilizaremos despues para mostras los mensajes apropiados - //no lo podemos hacer de otra forma al ser constante la funcion + + /* 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; -- cgit v1.2.3 From ac61d9ff74ea5ee53ad39e95c22348da35ef5cf0 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 31 Mar 2014 16:41:27 +0200 Subject: =?UTF-8?q?use=20=20instead=20=20by=20point=20of=20?= =?UTF-8?q?Vin=C3=ADcius?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (bzr r11950.1.321) --- src/ui/tool/node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 4824e13fb..3be3a89a7 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -28,7 +28,7 @@ #include "ui/tool/node.h" #include "ui/tool/path-manipulator.h" #include -#include +#include namespace { -- cgit v1.2.3 From 2b19c5f6508b7a59766d89f315f9f4fbc364f288 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 1 Apr 2014 00:48:28 +0200 Subject: Some node.cpp/h work moved to path_manipulator. Header variable bsplineWeight removed from all. Simplification of code with less functions in path_manipulator. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To fix: tips stop working because is handled by two static functions and couldent call to path_manipulator from here. Vinícius, any work arround? lines 480,481,1426,1427,1462 of node.cpp. gez: ¿Puedes probar si notas algun bug o problema? principalmente con la herramienta nodo, gracias. (bzr r11950.1.322) --- src/ui/tool/node.cpp | 166 +++++++++++++++++++++++++++++---------------------- 1 file changed, 96 insertions(+), 70 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 3be3a89a7..1eaf0afa7 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -30,6 +30,7 @@ #include #include + namespace { Inkscape::ControlType nodeTypeToCtrlType(Inkscape::UI::NodeType type) @@ -168,9 +169,9 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); //move the handler and its oposite the same proportion - if(_pm().isBSpline(false)){ + if(_pm().isBSpline()){ setPosition(_pm().BSplineHandleReposition(this)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),true)); } return; } @@ -185,9 +186,9 @@ void Handle::move(Geom::Point const &new_pos) setRelativePos(new_delta); //move the handler and its oposite the same proportion - if(_pm().isBSpline(false)){ + if(_pm().isBSpline()){ setPosition(_pm().BSplineHandleReposition(this)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),true)); } return; @@ -211,9 +212,9 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); // moves the handler and its oposite the same proportion - if(_pm().isBSpline(false)){ + if(_pm().isBSpline()){ setPosition(_pm().BSplineHandleReposition(this)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),true)); } } @@ -305,9 +306,9 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven //this function moves the handler and its oposite to the default proportion of 0.3334 void Handle::handle_2button_press(){ - if(_pm().isBSpline(false)){ + if(_pm().isBSpline()){ setPosition(_pm().BSplineHandleReposition(this,0.3334)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),_parent->bsplineWeight)); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),0.3334)); _pm().update(); } } @@ -361,17 +362,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(false)){ + if(_pm().isBSpline()){ setPosition(new_pos); int steps = _pm().BSplineGetSteps(); - _parent->bsplineWeight = ceilf(_pm().BSplineHandlePosition(this)*steps)/steps; - new_pos=_pm().BSplineHandleReposition(this,_parent->bsplineWeight); + new_pos=_pm().BSplineHandleReposition(this,ceilf(_pm().BSplineHandlePosition(this)*steps)/steps); } } std::vector unselected; //if the snap adjustment is activated and it is not bspline - if (snap && !_pm().isBSpline(false)) { + 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(*i); @@ -412,7 +412,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(false) && !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 @@ -431,10 +431,6 @@ void Handle::ungrabbed(GdkEventButton *event) Geom::Point dist = _desktop->d2w(_parent->position()) - _desktop->d2w(position()); if (dist.length() <= drag_tolerance) { move(_parent->position()); - //sets the bspline strength to 0.0000 - if(_pm().isBSpline(false)){ - _parent->bsplineWeight = 0.0000; - } } } @@ -481,8 +477,8 @@ Glib::ustring Handle::_getTip(unsigned state) const // 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; + //if( _parent->bsplineWeight != 0.0000) + // isBSpline = true; bool can_shift_rotate = _parent->type() == NODE_CUSP && !other()->isDegenerate(); if (can_shift_rotate && !isBSpline) { more = C_("Path handle tip", "more: Shift, Ctrl, Alt"); @@ -622,11 +618,21 @@ void Node::move(Geom::Point const &new_pos) Geom::Point old_pos = position(); Geom::Point delta = new_pos - position(); - // save the previous node strength to apply it again once the node is moved - double oldPos = 0.0000; + // save the previous nodes strength to apply it again once the node is moved + double nodeWeight = 0.0000; + double nextNodeWeight = 0.0000; + double prevNodeWeight = 0.0000; Node *n = this; - if(_pm().isBSpline(false)){ - oldPos = n->bsplineWeight; + Node * nextNode = n->nodeToward(n->front()); + Node * prevNode = n->nodeToward(n->back()); + if(_pm().isBSpline()){ + nodeWeight = _pm().BSplineHandlePosition(n->front()); + if(nextNode){ + nextNodeWeight = _pm().BSplineHandlePosition(nextNode->front()); + } + if(prevNode){ + prevNodeWeight = _pm().BSplineHandlePosition(prevNode->front()); + } } setPosition(new_pos); @@ -639,21 +645,49 @@ 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(false)){ - _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); - _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); - _pm().BSplineNodeHandlesReposition(this); + if(_pm().isBSpline()){ + _front.setPosition(_pm().BSplineHandleReposition(this->front(),nodeWeight)); + _back.setPosition(_pm().BSplineHandleReposition(this->back(),nodeWeight)); + if(prevNode){ + if(prevNode->front()->isDegenerate()){ + prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevNodeWeight)); + }else{ + prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),true)); + } + } + if(nextNode){ + if(nextNode->back()->isDegenerate()){ + nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNodeWeight)); + }else{ + nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),true)); + } + } } } void Node::transform(Geom::Affine const &m) { - // save the previous node strength to apply it again later when the node is moved - double oldPos = 0.0000; - if(_pm().isBSpline(false)){ - oldPos = this->bsplineWeight; - } + Geom::Point old_pos = position(); + + // save the previous nodes strength to apply it again once the node is moved + double nodeWeight = 0.0000; + double nextNodeWeight = 0.0000; + double prevNodeWeight = 0.0000; + + Node *n = this; + Node * nextNode = n->nodeToward(n->front()); + Node * prevNode = n->nodeToward(n->back()); + if(_pm().isBSpline()){ + nodeWeight = _pm().BSplineHandlePosition(n->front()); + if(nextNode){ + nextNodeWeight = _pm().BSplineHandlePosition(nextNode->front()); + } + if(prevNode){ + prevNodeWeight = _pm().BSplineHandlePosition(prevNode->front()); + } + } + setPosition(position() * m); _front.setPosition(_front.position() * m); _back.setPosition(_back.position() * m); @@ -663,10 +697,23 @@ 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(false)){ - _front.setPosition(_pm().BSplineHandleReposition(this->front(),oldPos)); - _back.setPosition(_pm().BSplineHandleReposition(this->back(),oldPos)); - _pm().BSplineNodeHandlesReposition(this); + if(_pm().isBSpline()){ + _front.setPosition(_pm().BSplineHandleReposition(this->front(),nodeWeight)); + _back.setPosition(_pm().BSplineHandleReposition(this->back(),nodeWeight)); + if(prevNode){ + if(prevNode->front()->isDegenerate()){ + prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevNodeWeight)); + }else{ + prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),true)); + } + } + if(nextNode){ + if(nextNode->back()->isDegenerate()){ + nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNodeWeight)); + }else{ + nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),true)); + } + } } } @@ -754,19 +801,6 @@ void Node::showHandles(bool v) _back.setVisible(v); } - // define the node strength, depending on being or not bspline traced. - // every time we operate over these handlers in a trace bspline - // that strength needs to be updated. - - this->bsplineWeight = 0.0000; - if(_pm().isBSpline(false) && (!_front.isDegenerate() || !_back.isDegenerate())){ - if (!_front.isDegenerate()) { - _pm().BSplineHandlePosition(&_front); - } - if (!_back.isDegenerate()) { - _pm().BSplineHandlePosition(&_back); - } - } } void Node::updateHandles() @@ -870,10 +904,13 @@ void Node::setType(NodeType type, bool update_handles) } /* in node type changes, about bspline traces, we can mantain them with 0.0000 power in border mode, or we give them the default power in curve mode */ - if(_pm().isBSpline(false)){ - if(this->bsplineWeight !=0.0000) this->bsplineWeight = 0.3334; - _front.setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); - _back.setPosition(_pm().BSplineHandleReposition(this->back(),this->bsplineWeight)); + if(_pm().isBSpline()){ + double weight = 0.0000; + if(_pm().BSplineHandlePosition(this->front()) != 0.0000){ + weight = 0.3334; + } + _front.setPosition(_pm().BSplineHandleReposition(this->front(),weight)); + _back.setPosition(_pm().BSplineHandleReposition(this->back(),weight)); } } _type = type; @@ -1123,20 +1160,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(false)){ - if(!this->back()->isDegenerate()){ - _pm().BSplineHandlePosition(this->back()); - }else if (!this->front()->isDegenerate()){ - _pm().BSplineHandlePosition(this->front()); - }else{ - this->bsplineWeight = 0.0000; - } - if(!this->front()->isDegenerate()){ - this->front()->setPosition(_pm().BSplineHandleReposition(this->front(),this->bsplineWeight)); - } - if(!this->back()->isDegenerate()){ - this->back()->setPosition(_pm().BSplineHandleReposition(this->back(),this->bsplineWeight)); - } + if(_pm().isBSpline()){ + this->front()->setPosition(_pm().BSplineHandleReposition(this->front())); + this->back()->setPosition(_pm().BSplineHandleReposition(this->back())); } break; } @@ -1397,8 +1423,8 @@ Glib::ustring Node::_getTip(unsigned state) const 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; + //if( this->bsplineWeight != 0.0000) + // isBSpline = true; if (state_held_shift(state)) { bool can_drag_out = (_next() && _front.isDegenerate()) || (_prev() && _back.isDegenerate()); if (can_drag_out) { @@ -1433,7 +1459,7 @@ Glib::ustring Node::_getTip(unsigned state) const "%s: drag to shape the path (more: Shift, Ctrl, Alt)"), nodetype); }else if(_selection.size() == 1){ return format_tip(C_("Path node tip", - "BSpline node: %g weight, drag to shape the path (more: Shift, Ctrl, Alt)"),this->bsplineWeight); + "BSpline node: %g weight, drag to shape the path (more: Shift, Ctrl, Alt)"),0.0000/*this->bsplineWeight*/); } return format_tip(C_("Path node tip", "%s: drag to shape the path, click to toggle scale/rotation handles (more: Shift, Ctrl, Alt)"), nodetype); -- cgit v1.2.3 From 0f78c1425e814758c0a0d7f0c2578eae88fe3ab6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 1 Apr 2014 14:02:22 +0200 Subject: =?UTF-8?q?A=20refactor=20for=20fixing=20some=20issues.=20Pending?= =?UTF-8?q?=20how=20to=20handle=20static=20functions=20Vin=C3=ADcius=20for?= =?UTF-8?q?=20handle=20tips=20in=20his=20static=20functions=20i=20know=20t?= =?UTF-8?q?wo=20ways:=20A:=20A=20bool=20property=20in=20node=20class=20of?= =?UTF-8?q?=20node.h=20to=20handle=20if=20curve=20is=20bspline=20B:=20Call?= =?UTF-8?q?=20another=20non=20static=20function=20from=20the=20static=20ti?= =?UTF-8?q?ps=20one=20-not=20tested-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (bzr r11950.1.323) --- src/ui/tool/node.cpp | 61 +++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 29 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 1eaf0afa7..7ba69b039 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -170,8 +170,8 @@ void Handle::move(Geom::Point const &new_pos) //move the handler and its oposite the same proportion if(_pm().isBSpline()){ - setPosition(_pm().BSplineHandleReposition(this)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),true)); + setPosition(_pm().BSplineHandleReposition(this,this)); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); } return; } @@ -187,8 +187,8 @@ void Handle::move(Geom::Point const &new_pos) //move the handler and its oposite the same proportion if(_pm().isBSpline()){ - setPosition(_pm().BSplineHandleReposition(this)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),true)); + setPosition(_pm().BSplineHandleReposition(this,this)); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); } return; @@ -213,8 +213,8 @@ void Handle::move(Geom::Point const &new_pos) // moves the handler and its oposite the same proportion if(_pm().isBSpline()){ - setPosition(_pm().BSplineHandleReposition(this)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),true)); + setPosition(_pm().BSplineHandleReposition(this,this)); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); } } @@ -365,7 +365,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) if(_pm().isBSpline()){ setPosition(new_pos); int steps = _pm().BSplineGetSteps(); - new_pos=_pm().BSplineHandleReposition(this,ceilf(_pm().BSplineHandlePosition(this)*steps)/steps); + new_pos=_pm().BSplineHandleReposition(this,ceilf(_pm().BSplineHandlePosition(this,this)*steps)/steps); } } @@ -625,13 +625,15 @@ void Node::move(Geom::Point const &new_pos) Node *n = this; Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); - if(_pm().isBSpline()){ - nodeWeight = _pm().BSplineHandlePosition(n->front()); - if(nextNode){ - nextNodeWeight = _pm().BSplineHandlePosition(nextNode->front()); + nodeWeight = _pm().BSplineHandlePosition(n->front()); + if(prevNode){ + if(prevNode->isEndNode()){ + prevNodeWeight = _pm().BSplineHandlePosition(prevNode->front(),prevNode->front()); } - if(prevNode){ - prevNodeWeight = _pm().BSplineHandlePosition(prevNode->front()); + } + if(nextNode){ + if(nextNode->isEndNode()){ + nextNodeWeight = _pm().BSplineHandlePosition(nextNode->back(),nextNode->back()); } } @@ -649,17 +651,17 @@ void Node::move(Geom::Point const &new_pos) _front.setPosition(_pm().BSplineHandleReposition(this->front(),nodeWeight)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),nodeWeight)); if(prevNode){ - if(prevNode->front()->isDegenerate()){ + if(prevNode->isEndNode()){ prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevNodeWeight)); }else{ - prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),true)); + prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevNode->back())); } } if(nextNode){ - if(nextNode->back()->isDegenerate()){ + if(nextNode->isEndNode()){ nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNodeWeight)); }else{ - nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),true)); + nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNode->back())); } } } @@ -674,17 +676,18 @@ void Node::transform(Geom::Affine const &m) double nodeWeight = 0.0000; double nextNodeWeight = 0.0000; double prevNodeWeight = 0.0000; - Node *n = this; Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); - if(_pm().isBSpline()){ - nodeWeight = _pm().BSplineHandlePosition(n->front()); - if(nextNode){ - nextNodeWeight = _pm().BSplineHandlePosition(nextNode->front()); + nodeWeight = _pm().BSplineHandlePosition(n->front()); + if(prevNode){ + if(prevNode->isEndNode()){ + prevNodeWeight = _pm().BSplineHandlePosition(prevNode->front(),prevNode->front()); } - if(prevNode){ - prevNodeWeight = _pm().BSplineHandlePosition(prevNode->front()); + } + if(nextNode){ + if(nextNode->isEndNode()){ + nextNodeWeight = _pm().BSplineHandlePosition(nextNode->back(),nextNode->back()); } } @@ -701,17 +704,17 @@ void Node::transform(Geom::Affine const &m) _front.setPosition(_pm().BSplineHandleReposition(this->front(),nodeWeight)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),nodeWeight)); if(prevNode){ - if(prevNode->front()->isDegenerate()){ + if(prevNode->isEndNode()){ prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevNodeWeight)); }else{ - prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),true)); + prevNode->front()->setPosition(_pm().BSplineHandleReposition(prevNode->front(),prevNode->back())); } } if(nextNode){ - if(nextNode->back()->isDegenerate()){ + if(nextNode->isEndNode()){ nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNodeWeight)); }else{ - nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),true)); + nextNode->back()->setPosition(_pm().BSplineHandleReposition(nextNode->back(),nextNode->front())); } } } @@ -906,7 +909,7 @@ void Node::setType(NodeType type, bool update_handles) or we give them the default power in curve mode */ if(_pm().isBSpline()){ double weight = 0.0000; - if(_pm().BSplineHandlePosition(this->front()) != 0.0000){ + if(_pm().BSplineHandlePosition(this->front()) != 0.0000 ){ weight = 0.3334; } _front.setPosition(_pm().BSplineHandleReposition(this->front(),weight)); -- cgit v1.2.3 From 5a8b00f027b9eb3d4abb290d2ddf26d36d71cf80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20dos=20Santos=20Oliveira?= Date: Mon, 5 May 2014 04:13:35 -0300 Subject: Enabling path manipulator to comunicate if paths are bspline when accessing const objects. This change was required to correctly show on the GUI whether or not a node was a bspline. (bzr r11950.8.1) --- src/ui/tool/node.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 7ba69b039..6cb254b7f 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -1421,13 +1421,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) { -- cgit v1.2.3