diff options
| author | Andrew Higginson <at.higginson@gmail.com> | 2011-12-27 21:04:47 +0000 |
|---|---|---|
| committer | Andrew <at.higginson@gmail.com> | 2011-12-27 21:04:47 +0000 |
| commit | 80960b623a99aae1402ab651b2974ef544ed3b03 (patch) | |
| tree | ba49d42c2789e9e11f805e2d5263e10f9fedeef8 /src/ui/tool/node.cpp | |
| parent | try to fix bug (diff) | |
| parent | GDL: Cherry-pick upstream patch 73852 (2011-03-23) - Add missing return value. (diff) | |
| download | inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.tar.gz inkscape-80960b623a99aae1402ab651b2974ef544ed3b03.zip | |
merged with trunk so I can build again...
(bzr r10092.1.36)
Diffstat (limited to 'src/ui/tool/node.cpp')
| -rw-r--r-- | src/ui/tool/node.cpp | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 8e3da266b..d268a9f14 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -1,5 +1,6 @@ -/** @file - * Editable node - implementation +/** + * @file + * Editable node - implementation. */ /* Authors: * Krzysztof KosiĆski <tweenk.pl@gmail.com> @@ -70,13 +71,11 @@ static Geom::Point direction(Geom::Point const &first, Geom::Point const &second } /** - * @class Handle - * @brief Control point of a cubic Bezier curve in a path. + * Control point of a cubic Bezier curve in a path. * * Handle keeps the node type invariant only for the opposite handle of the same node. * Keeping the invariant on node moves is left to the %Node class. */ - Geom::Point Handle::_saved_other_pos(0, 0); double Handle::_saved_length = 0.0; bool Handle::_drag_out = false; @@ -307,12 +306,10 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) std::vector<Inkscape::SnapCandidatePoint> unselected; if (snap) { - typedef ControlPointSelection::Set Set; - Set &nodes = _parent->_selection.allPoints(); - for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { + ControlPointSelection::Set &nodes = _parent->_selection.allPoints(); + for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) { Node *n = static_cast<Node*>(*i); - Inkscape::SnapCandidatePoint p(n->position(), n->_snapSourceType(), n->_snapTargetType()); - unselected.push_back(p); + unselected.push_back(n->snapCandidatePoint()); } sm.setupIgnoreSelection(_desktop, true, &unselected); @@ -326,7 +323,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } else if (ctrl_constraint) { // NOTE: this is subtly wrong. // We should get all possible constraints and snap along them using - // multipleConstrainedSnaps, instead of first snapping to angle and the to objects + // multipleConstrainedSnaps, instead of first snapping to angle and then to objects Inkscape::SnappedPoint p; p = sm.constrainedSnap(Inkscape::SnapCandidatePoint(new_pos, SNAPSOURCE_NODE_HANDLE), *ctrl_constraint); new_pos = p.getPoint(); @@ -469,12 +466,10 @@ Glib::ustring Handle::_getDragTip(GdkEventMotion */*event*/) } /** - * @class Node - * @brief Curve endpoint in an editable path. + * Curve endpoint in an editable path. * * The method move() keeps node type invariants during translations. */ - Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) : SelectableControlPoint(data.desktop, initial_pos, Gtk::ANCHOR_CENTER, SP_CTRL_SHAPE_DIAMOND, 9.0, *data.selection, &node_colors, data.node_group) @@ -1118,8 +1113,15 @@ Inkscape::SnapTargetType Node::_snapTargetType() return SNAPTARGET_NODE_CUSP; } -/** @brief Gets the handle that faces the given adjacent node. - * Will abort with error if the given node is not adjacent. */ +Inkscape::SnapCandidatePoint Node::snapCandidatePoint() +{ + return SnapCandidatePoint(position(), _snapSourceType(), _snapTargetType()); +} + +/** + * Gets the handle that faces the given adjacent node. + * Will abort with error if the given node is not adjacent. + */ Handle *Node::handleToward(Node *to) { if (_next() == to) { @@ -1131,8 +1133,10 @@ Handle *Node::handleToward(Node *to) g_error("Node::handleToward(): second node is not adjacent!"); } -/** @brief Gets the node in the direction of the given handle. - * Will abort with error if the handle doesn't belong to this node. */ +/** + * Gets the node in the direction of the given handle. + * Will abort with error if the handle doesn't belong to this node. + */ Node *Node::nodeToward(Handle *dir) { if (front() == dir) { @@ -1144,8 +1148,10 @@ Node *Node::nodeToward(Handle *dir) g_error("Node::nodeToward(): handle is not a child of this node!"); } -/** @brief Gets the handle that goes in the direction opposite to the given adjacent node. - * Will abort with error if the given node is not adjacent. */ +/** + * Gets the handle that goes in the direction opposite to the given adjacent node. + * Will abort with error if the given node is not adjacent. + */ Handle *Node::handleAwayFrom(Node *to) { if (_next() == to) { @@ -1157,8 +1163,10 @@ Handle *Node::handleAwayFrom(Node *to) g_error("Node::handleAwayFrom(): second node is not adjacent!"); } -/** @brief Gets the node in the direction opposite to the given handle. - * Will abort with error if the handle doesn't belong to this node. */ +/** + * Gets the node in the direction opposite to the given handle. + * Will abort with error if the handle doesn't belong to this node. + */ Node *Node::nodeAwayFrom(Handle *h) { if (front() == h) { @@ -1259,14 +1267,12 @@ SPCtrlShapeType Node::_node_type_to_shape(NodeType type) /** - * @class NodeList - * @brief An editable list of nodes representing a subpath. + * An editable list of nodes representing a subpath. * * It can optionally be cyclic to represent a closed path. * The list has iterators that act like plain node iterators, but can also be used * to obtain shared pointers to nodes. */ - NodeList::NodeList(SubpathList &splist) : _list(splist) , _closed(false) @@ -1427,7 +1433,7 @@ NodeList &NodeList::get(iterator const &i) { /** * @class SubpathList - * @brief Editable path composed of one or more subpaths + * Editable path composed of one or more subpaths. */ } // namespace UI |
