From 19117c36082531a00df461260f917d1207edde1f Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Wed, 11 Aug 2010 08:43:24 +0200 Subject: Clear pointers in the snapmanager if they're no longer needed. (bzr r9697) --- 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 a8582ccc5..4c8cc74d8 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -274,8 +274,10 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } else { sm.freeSnapReturnByRef(new_pos, SNAPSOURCE_NODE_HANDLE); } + sm.unSetup(); } + // with Shift, if the node is cusp, rotate the other handle as well if (_parent->type() == NODE_CUSP && !_drag_out) { if (held_shift(*event)) { -- cgit v1.2.3 From f2bd49a175f20c29d6dd23b7380609dcfd7135c2 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 14 Aug 2010 16:40:06 +0200 Subject: Fix a crash and add more safety checks to catch NULL pointers (bzr r9713) --- src/ui/tool/node.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 4c8cc74d8..f6fb6cc54 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -966,6 +966,11 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) } } sm.setupIgnoreSelection(_desktop, true, &unselected); + } else { + // even if we won't really snap, we might still call the one of the + // constrainedSnap() methods to enforce the constraints, so we need + // to setup the snapmanager anyway + sm.setup(_desktop); } if (held_control(*event)) { @@ -1029,6 +1034,8 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) new_pos = sp.getPoint(); } + sm.unSetup(); + SelectableControlPoint::dragged(new_pos, event); } -- cgit v1.2.3 From f624e4f24f6cc1a26552da5106f63ee4ae1fc57b Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 15 Aug 2010 21:54:12 +0200 Subject: 2nd attempt at fixing the crash introduced in rev. #9692. This should nail it! (bzr r9714) --- 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 f6fb6cc54..1070e4bc3 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -946,6 +946,7 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) SnapManager &sm = _desktop->namedview->snap_manager; bool snap = sm.someSnapperMightSnap(); Inkscape::SnappedPoint sp; + std::vector unselected; if (snap) { /* setup * TODO We are doing this every time a snap happens. It should once be done only once @@ -955,7 +956,6 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) * TODO Snapping to unselected segments of selected paths doesn't work yet. */ // Build the list of unselected nodes. - std::vector unselected; typedef ControlPointSelection::Set Set; Set &nodes = _selection.allPoints(); for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { -- cgit v1.2.3 From e97b9eafcdbf2ac0034bca19e5e9c3297d438da3 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 25 Sep 2010 11:04:23 +0200 Subject: fix snapmanager initialization Fixed bugs: - https://launchpad.net/bugs/630642 (bzr r9783) --- src/ui/tool/node.cpp | 10 +++++----- 1 file changed, 5 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 1070e4bc3..575a2f59e 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -944,7 +944,12 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) { // 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 + // constrainedSnap() methods to enforce the constraints, so we need + // to setup the snapmanager anyway; this is also required for someSnapperMightSnap() + sm.setup(_desktop); bool snap = sm.someSnapperMightSnap(); + Inkscape::SnappedPoint sp; std::vector unselected; if (snap) { @@ -966,11 +971,6 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) } } sm.setupIgnoreSelection(_desktop, true, &unselected); - } else { - // even if we won't really snap, we might still call the one of the - // constrainedSnap() methods to enforce the constraints, so we need - // to setup the snapmanager anyway - sm.setup(_desktop); } if (held_control(*event)) { -- cgit v1.2.3 From 2b29b7a55f8e939d8588cfdc3fe26839da5e1357 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 25 Sep 2010 11:29:21 +0200 Subject: Addition to my previous commit: fix for trunk is a bit different from the fix for v0.48 (bzr r9784) --- 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 575a2f59e..a5952c9fb 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -970,6 +970,7 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) unselected.push_back(p); } } + sm.unSetup(); sm.setupIgnoreSelection(_desktop, true, &unselected); } -- cgit v1.2.3 From f827618fbfb446bcd954281fd46b5e88090590cf Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Tue, 12 Oct 2010 18:22:08 +0200 Subject: Fix oddities related to smooth endnodes. Should fix a crasher. (bzr r9826) --- src/ui/tool/node.cpp | 6 ++++-- 1 file changed, 4 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 a5952c9fb..7efb6a5dc 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -580,13 +580,15 @@ void Node::setType(NodeType type, bool update_handles) _updateAutoHandles(); break; case NODE_SMOOTH: { + // ignore attempts to make smooth endnodes. + if (isEndNode()) return; // rotate handles to be colinear // for degenerate nodes set positions like auto handles bool prev_line = _is_line_segment(_prev(), this); bool next_line = _is_line_segment(this, _next()); if (_type == NODE_SMOOTH) { - // for a node that is already smooth and has a degenerate handle, - // drag out the second handle to 1/3 the length of the linear segment + // For a node that is already smooth and has a degenerate handle, + // drag out the second handle without changing the direction of the first one. if (_front.isDegenerate()) { double dist = Geom::distance(_next()->position(), position()); _front.setRelativePos(Geom::unit_vector(-_back.relativePos()) * dist / 3); -- cgit v1.2.3 From 9506eb893b0a00f957624653388e2faad41cbcb8 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Tue, 12 Oct 2010 18:23:52 +0200 Subject: Remove the misfeature of retracting handles when the cusp node button is clicked and there are cusp nodes selected. It's really annoying when you have both smooth and cusp nodes in a selection. Use segment commands and Ctrl+click to retract handles instead. (bzr r9827) --- src/ui/tool/node.cpp | 11 +++++++---- 1 file changed, 7 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 7efb6a5dc..399fa5292 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -569,10 +569,13 @@ void Node::setType(NodeType type, bool update_handles) switch (type) { case NODE_CUSP: // if the existing type is also NODE_CUSP, retract handles - if (_type == NODE_CUSP) { - _front.retract(); - _back.retract(); - } + // NOTE: This misfeature is very annoying when you have both cusp and smooth + // nodes in a selection, so I have removed it. Use segment commands + // or Ctrl+click to retract handles. + //if (_type == NODE_CUSP) { + // _front.retract(); + // _back.retract(); + //} break; case NODE_AUTO: // auto handles make no sense for endnodes -- cgit v1.2.3 From c8c9ae21902c8603dd80be90d0b3b7851eef816d Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 7 Nov 2010 00:09:40 +0100 Subject: Reintroduce Shift+L shortcut and handle retraction when setting the type of already cusp nodes to cusp in the node tool (bzr r9875) --- src/ui/tool/node.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/ui/tool/node.cpp') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 399fa5292..60b5812c6 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -568,14 +568,7 @@ void Node::setType(NodeType type, bool update_handles) if (update_handles) { switch (type) { case NODE_CUSP: - // if the existing type is also NODE_CUSP, retract handles - // NOTE: This misfeature is very annoying when you have both cusp and smooth - // nodes in a selection, so I have removed it. Use segment commands - // or Ctrl+click to retract handles. - //if (_type == NODE_CUSP) { - // _front.retract(); - // _back.retract(); - //} + // nothing to do break; case NODE_AUTO: // auto handles make no sense for endnodes -- cgit v1.2.3 From 144819c918dc761641c3cb5a490205fb73194ee3 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Wed, 17 Nov 2010 13:12:56 +1100 Subject: Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in all 1074 Vim modelines. The reason for this is that (a) setting the encoding isn't nice, and (b) Vim 7.3 (with modeline enabled) disallows it and pops up an error whenever you open any file with it ("invalid modeline"). Also corrected five deviant modestrings: * src/ui/widget/dock.cpp and src/ui/widget/dock.h: missing colon at the end * src/ui/dialog/tile.cpp: removed gratuitous second colon at the end * src/helper/units-test.h: removed gratuitous space before a colon * share/extensions/export_gimp_palette.py: missing textwidth=99 That's my geekiest commit yet. (bzr r9900) --- 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 60b5812c6..9ab495488 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -1382,4 +1382,4 @@ NodeList &NodeList::get(iterator const &i) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3 From a6ba6ad5e29d23ba866e4d8bda61b4f18e053ba1 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Wed, 17 Nov 2010 22:17:44 +0100 Subject: Shift should disable snapping when dragging the rotation center of an object (bzr r9903) --- 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 9ab495488..6460d9062 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -1020,12 +1020,12 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) constraints.push_back(Inkscape::Snapper::SnapConstraint(origin, *bperp_point)); } - sp = sm.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(new_pos, _snapSourceType()), constraints); + sp = sm.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(new_pos, _snapSourceType()), constraints, held_shift(*event)); } else { // with Ctrl, constrain to axes constraints.push_back(Inkscape::Snapper::SnapConstraint(origin, Geom::Point(1, 0))); constraints.push_back(Inkscape::Snapper::SnapConstraint(origin, Geom::Point(0, 1))); - sp = sm.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(new_pos, _snapSourceType()), constraints); + sp = sm.multipleConstrainedSnaps(Inkscape::SnapCandidatePoint(new_pos, _snapSourceType()), constraints, held_shift(*event)); } new_pos = sp.getPoint(); } else if (snap) { -- cgit v1.2.3 From a6d9d1d88e4a31033d0a96bf2d9f7e93cbdf4534 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 18 Nov 2010 19:10:22 +0100 Subject: Fix four minor node tool regressions: * Inverted modifier for spatial/linear grow * PgDn/PgUp keyboard shortcuts for grow * Shift during drag disables snapping * Clicking on the background deselects first the nodes and then the path Fixed bugs: - https://launchpad.net/bugs/647498 - https://launchpad.net/bugs/588628 (bzr r9904) --- src/ui/tool/node.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 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 6460d9062..12d04dd2b 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -728,8 +728,7 @@ NodeType Node::parse_nodetype(char x) /** Customized event handler to catch scroll events needed for selection grow/shrink. */ bool Node::_eventHandler(GdkEvent *event) { - static NodeList::iterator origin; - static int dir; + int dir = 0; switch (event->type) { @@ -740,14 +739,34 @@ bool Node::_eventHandler(GdkEvent *event) dir = -1; } else break; if (held_control(event->scroll)) { - _selection.spatialGrow(this, dir); + _linearGrow(dir); } else { + _selection.spatialGrow(this, dir); + } + return true; + case GDK_KEY_PRESS: + switch (shortcut_key(event->key)) + { + case GDK_Page_Up: + dir = 1; + break; + case GDK_Page_Down: + dir = -1; + break; + default: goto bail_out; + } + + if (held_control(event->key)) { _linearGrow(dir); + } else { + _selection.spatialGrow(this, dir); } return true; default: break; } + + bail_out: return ControlPoint::_eventHandler(event); } @@ -946,7 +965,9 @@ void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) // constrainedSnap() methods to enforce the constraints, so we need // to setup the snapmanager anyway; this is also required for someSnapperMightSnap() sm.setup(_desktop); - bool snap = sm.someSnapperMightSnap(); + + // do not snap when Shift is pressed + bool snap = !held_shift(*event) && sm.someSnapperMightSnap(); Inkscape::SnappedPoint sp; std::vector unselected; -- cgit v1.2.3