From 127e68f823638bee0728d275dc2610ed1e062b6b Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 22 Sep 2014 23:59:18 +0200 Subject: Fix a bug in BSpline, happend pressing any key hover a modified weight handle -it buggy reset to default weight-. (bzr r13341.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 e38f82673..8ef5a61dc 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -293,6 +293,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven break; default: break; } + break; // new double click event to set the handlers of a node to the default proportion, 0.3334% case GDK_2BUTTON_PRESS: handle_2button_press(); -- cgit v1.2.3 From 86cf2d0a97e0412629102ae51df0a4797f9179db Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 23 Sep 2014 23:43:31 +0200 Subject: remove magic numbers from bspline (bzr r13341.1.219) --- src/ui/tool/node.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 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 8ef5a61dc..c52bd4c07 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -59,6 +59,11 @@ Inkscape::ControlType nodeTypeToCtrlType(Inkscape::UI::NodeType type) namespace Inkscape { namespace UI { +const double handleCubicGap = 0.01; +const double noPower = 0.0; +const double defaultStartPower = 0.3334; +const double defaultEndPower = 0.6667; + ControlPoint::ColorSet Node::node_colors = { {0xbfbfbf00, 0x000000ff}, // normal fill, stroke {0xff000000, 0x000000ff}, // mouseover fill, stroke @@ -294,7 +299,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven default: break; } break; - // new double click event to set the handlers of a node to the default proportion, 0.3334% + // new double click event to set the handlers of a node to the default proportion, defaultStartPower% case GDK_2BUTTON_PRESS: handle_2button_press(); break; @@ -305,11 +310,11 @@ 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 +//this function moves the handler and its oposite to the default proportion of defaultStartPower void Handle::handle_2button_press(){ if(_pm().isBSpline()){ - setPosition(_pm().BSplineHandleReposition(this,0.3334)); - this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),0.3334)); + setPosition(_pm().BSplineHandleReposition(this,defaultStartPower)); + this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),defaultStartPower)); _pm().update(); } } @@ -618,9 +623,9 @@ void Node::move(Geom::Point const &new_pos) Geom::Point delta = new_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; + double nodeWeight = noPower; + double nextNodeWeight = noPower; + double prevNodeWeight = noPower; Node *n = this; Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); @@ -672,9 +677,9 @@ void Node::transform(Geom::Affine const &m) 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; + double nodeWeight = noPower; + double nextNodeWeight = noPower; + double prevNodeWeight = noPower; Node *n = this; Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); @@ -904,12 +909,12 @@ 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, + /* in node type changes, about bspline traces, we can mantain them with noPower power in border mode, or we give them the default power in curve mode */ if(_pm().isBSpline()){ - double weight = 0.0000; - if(_pm().BSplineHandlePosition(this->front()) != 0.0000 ){ - weight = 0.3334; + double weight = noPower; + if(_pm().BSplineHandlePosition(this->front()) != noPower ){ + weight = defaultStartPower; } _front.setPosition(_pm().BSplineHandleReposition(this->front(),weight)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),weight)); @@ -1455,7 +1460,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)"),0.0000/*this->bsplineWeight*/); + "BSpline node: %g weight, drag to shape the path (more: Shift, Ctrl, Alt)"),noPower/*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 389581f8c8a49e7cd922a09e0088e1414a7db05b Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Sep 2014 03:50:36 +0200 Subject: This push add suport to helper paths redraw to nodes, handles and knots. This redraw at mouse movement. Whith knots also redraw at button release event (bzr r13341.1.227) --- src/ui/tool/node.cpp | 11 ++++++++++- 1 file changed, 10 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 c52bd4c07..5d6e96588 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -27,10 +27,11 @@ #include "ui/tool/event-utils.h" #include "ui/tool/node.h" #include "ui/tool/path-manipulator.h" +#include "ui/tools/node-tool.h" +#include "tools-switch.h" #include #include - namespace { Inkscape::ControlType nodeTypeToCtrlType(Inkscape::UI::NodeType type) @@ -329,6 +330,10 @@ bool Handle::grabbed(GdkEventMotion *) void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) { + if (tools_isactive(_desktop, TOOLS_NODES)) { + Inkscape::UI::Tools::NodeTool *nt = static_cast(_desktop->event_context); + nt->update_helperpath(); + } Geom::Point parent_pos = _parent->position(); Geom::Point origin = _last_drag_origin(); SnapManager &sm = _desktop->namedview->snap_manager; @@ -1222,6 +1227,10 @@ bool Node::grabbed(GdkEventMotion *event) void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) { + if (tools_isactive(_desktop, TOOLS_NODES)) { + Inkscape::UI::Tools::NodeTool *nt = static_cast(_desktop->event_context); + nt->update_helperpath(); + } // For a note on how snapping is implemented in Inkscape, see snap.h. SnapManager &sm = _desktop->namedview->snap_manager; // even if we won't really snap, we might still call the one of the -- cgit v1.2.3 From 156cf3323a936c7dfccd9e09458cd8b5d174b7fe Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Sun, 5 Oct 2014 19:24:27 -0400 Subject: Move more UI code into ui/ (bzr r13341.1.253) --- 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 5d6e96588..4abc901d2 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 "ui/tools/node-tool.h" -#include "tools-switch.h" +#include "ui/tools-switch.h" #include #include -- cgit v1.2.3