Inkscape
Vector Graphics Editor
|
#include <node.h>
Public Member Functions | |
~Handle () override | |
Geom::Point | relativePos () const |
double | length () const |
bool | isDegenerate () const |
void | setVisible (bool) override |
Set the visibility of the control point. | |
void | move (Geom::Point const &p) override |
Move the control point to new position with side effects. | |
void | setPosition (Geom::Point const &p) override |
Relocate the control point without side effects. | |
void | setRelativePos (Geom::Point const &p) |
void | setLength (double len) |
void | retract () |
void | setDirection (Geom::Point const &from, Geom::Point const &to) |
void | setDirection (Geom::Point const &dir) |
Node * | parent () |
Handle * | other () |
Handle const * | other () const |
![]() | |
virtual | ~ControlPoint () |
ControlPoint (ControlPoint const &other)=delete | |
void | operator= (ControlPoint const &other)=delete |
bool | doubleClicked () const |
void | set_selected_appearance (bool selected) |
Geom::Point const & | position () const |
Current position of the control point. | |
virtual void | transform (Geom::Affine const &m) |
Apply an arbitrary affine transformation to a control point. | |
virtual void | fixNeighbors () |
Apply any node repairs, by default no fixing is applied but Nodes will update smooth nodes to make sure nodes are kept consistent. | |
bool | visible () const |
void | transferGrab (ControlPoint *from, MotionEvent const &event) |
Transfer the grab to another point. | |
State | state () const |
bool | mouseovered () const |
Static Public Member Functions | |
static char const * | handle_type_to_localized_string (NodeType type) |
See also: Node::node_type_to_localized_string(NodeType type) | |
![]() | |
static Glib::ustring | format_tip (char const *format,...) G_GNUC_PRINTF(1 |
Protected Member Functions | |
Handle (NodeSharedData const &data, Geom::Point const &initial_pos, Node *parent) | |
virtual void | handle_2button_press () |
bool | _eventHandler (Inkscape::UI::Tools::ToolBase *event_context, CanvasEvent const &event) override |
void | dragged (Geom::Point &new_pos, MotionEvent const &event) override |
Called while dragging, but before moving the knot to new position. | |
bool | grabbed (MotionEvent const &event) override |
Called when the user moves the point beyond the drag tolerance with the first button held down. | |
void | ungrabbed (ButtonReleaseEvent const *event) override |
Called when the control point finishes a drag. | |
bool | clicked (ButtonReleaseEvent const &event) override |
Called when the control point is clicked, at mouse button release. | |
Glib::ustring | _getTip (unsigned state) const override |
Glib::ustring | _getDragTip (MotionEvent const &event) const override |
bool | _hasDragTips () const override |
![]() | |
ControlPoint (SPDesktop *d, Geom::Point const &initial_pos, SPAnchorType anchor, Inkscape::CanvasItemCtrlType type, Inkscape::CanvasItemGroup *group=nullptr) | |
Create a regular control point. | |
virtual bool | doubleclicked (ButtonReleaseEvent const &event) |
Called when the control point is doubleclicked, at mouse button release. | |
virtual void | _setState (State state) |
Change the state of the knot. | |
void | _handleControlStyling () |
void | _setSize (unsigned int size) |
void | _setControlType (Inkscape::CanvasItemCtrlType type) |
void | _setAnchor (SPAnchorType anchor) |
Private Member Functions | |
PathManipulator & | _pm () |
PathManipulator & | _pm () const |
void | _update_bspline_handles () |
Private Attributes | |
Node * | _parent |
CanvasItemPtr< CanvasItemCurve > | _handle_line |
bool | _degenerate |
Static Private Attributes | |
static Geom::Point | _saved_other_pos |
Control point of a cubic Bezier curve in a path. | |
static Geom::Point | _saved_dir |
static double | _saved_length = 0.0 |
static bool | _drag_out = false |
Friends | |
class | Node |
Additional Inherited Members | |
![]() | |
enum | State { STATE_NORMAL , STATE_MOUSEOVER , STATE_CLICKED } |
Enumeration representing the possible states of the control point, used to determine its appearance. More... | |
![]() | |
SPDesktop *const | _desktop |
The desktop this control point resides on. | |
![]() | |
static ControlPoint * | mouseovered_point = nullptr |
Holds the currently mouseovered control point. | |
static sigc::signal< void(ControlPoint *)> | signal_mouseover_change |
Emitted when the mouseovered point changes. | |
![]() | |
static Geom::Point const & | _last_click_event_point () |
static Geom::Point const & | _last_drag_origin () |
static bool | _is_drag_cancelled (MotionEvent const &event) |
![]() | |
CanvasItemPtr< Inkscape::CanvasItemCtrl > | _canvas_item_ctrl |
Visual representation of the control point. | |
State | _state = STATE_NORMAL |
![]() | |
static bool | _drag_initiated = false |
|
overridedefault |
|
protected |
Definition at line 176 of file node.cpp.
References setVisible().
|
overrideprotectedvirtual |
Reimplemented from Inkscape::UI::ControlPoint.
Definition at line 353 of file node.cpp.
References Inkscape::UI::PathManipulator::_commit(), _parent, Inkscape::UI::Node::_pm(), Inkscape::UI::Node::_type, Inkscape::inspect_event(), Inkscape::mod_shift_only(), Inkscape::UI::NODE_AUTO, Inkscape::UI::NODE_CUSP, Inkscape::UI::NODE_SMOOTH, Inkscape::UI::NODE_SYMMETRIC, other(), relativePos(), setRelativePos(), Inkscape::UI::Node::setType(), and Inkscape::UI::PathManipulator::update().
|
overrideprotectedvirtual |
Reimplemented from Inkscape::UI::ControlPoint.
Definition at line 732 of file node.cpp.
References Geom::angle_between(), len, Inkscape::Util::Quantity::string(), Geom::X, and Geom::Y.
|
overrideprotectedvirtual |
Reimplemented from Inkscape::UI::ControlPoint.
Definition at line 619 of file node.cpp.
References Inkscape::mod_alt(), Inkscape::mod_ctrl(), Inkscape::mod_shift(), Inkscape::UI::NODE_AUTO, Inkscape::UI::NODE_SYMMETRIC, and Inkscape::UI::snap_increment_degrees().
|
inlineoverrideprotectedvirtual |
Reimplemented from Inkscape::UI::ControlPoint.
|
inlineprivate |
Definition at line 469 of file node.h.
References _parent, and Inkscape::UI::Node::_pm().
Referenced by _update_bspline_handles().
|
inlineprivate |
Definition at line 472 of file node.h.
References _parent, and Inkscape::UI::Node::_pm().
|
private |
Definition at line 195 of file node.cpp.
References Inkscape::UI::PathManipulator::_bsplineHandlePosition(), _pm(), other(), setPosition(), and Inkscape::UI::PathManipulator::update().
Referenced by move().
|
overrideprotectedvirtual |
Called when the control point is clicked, at mouse button release.
Improperly implementing this method can cause the default context menu not to appear when a control point is right-clicked.
event | Button release event |
Reimplemented from Inkscape::UI::ControlPoint.
Definition at line 582 of file node.cpp.
References Inkscape::mod_alt(), Inkscape::mod_ctrl(), Inkscape::UI::NODE_AUTO, and parent.
|
overrideprotectedvirtual |
Called while dragging, but before moving the knot to new position.
pos | Old position, always equal to position() |
new_pos | New position (after drag). This is passed as a non-const reference, so you can change it from the handler - that's how constrained dragging is implemented. |
event | Motion event. |
Reimplemented from Inkscape::UI::ControlPoint.
Definition at line 446 of file node.cpp.
References Geom::angle_between(), Geom::constrain_angle(), SnapManager::constrainedSnap(), Geom::distance(), SnapManager::freeSnapReturnByRef(), Inkscape::Preferences::get(), Inkscape::Preferences::getIntLimited(), SnapManager::getNamedView(), Inkscape::SnappedPoint::getPoint(), Inkscape::mod_alt(), Inkscape::mod_ctrl(), Inkscape::mod_shift(), Geom::Line::nearestTime(), node, Inkscape::UI::Node::nodeAwayFrom(), origin, Geom::Line::pointAt(), Inkscape::UI::ControlPoint::position(), result, Geom::rot90(), SnapManager::setupIgnoreSelection(), SPNamedView::snap_manager, Inkscape::SNAPSOURCE_NODE_HANDLE, SnapManager::someSnapperMightSnap(), Geom::unit_vector(), and SnapManager::unSetup().
|
overrideprotectedvirtual |
Called when the user moves the point beyond the drag tolerance with the first button held down.
event | Motion event when drag tolerance was exceeded. |
Reimplemented from Inkscape::UI::ControlPoint.
Definition at line 437 of file node.cpp.
References Geom::unit_vector().
|
protectedvirtual |
Definition at line 428 of file node.cpp.
References Inkscape::UI::DEFAULT_START_POWER.
|
static |
See also: Node::node_type_to_localized_string(NodeType type)
Definition at line 337 of file node.cpp.
References Inkscape::UI::NODE_AUTO, Inkscape::UI::NODE_CUSP, Inkscape::UI::NODE_SMOOTH, and Inkscape::UI::NODE_SYMMETRIC.
|
inline |
Definition at line 68 of file node.h.
References _degenerate.
Referenced by Inkscape::UI::Node::_getTip(), Inkscape::UI::Node::_is_line_segment(), Inkscape::UI::PathManipulator::build_segment(), Inkscape::UI::PathManipulator::copySelectedPath(), Inkscape::UI::Node::dragged(), Inkscape::UI::Node::fixNeighbors(), Inkscape::UI::Node::grabbed(), Inkscape::UI::Node::isDegenerate(), move(), Inkscape::UI::Node::pickBestType(), Inkscape::UI::PathManipulator::rotateHandle(), Inkscape::UI::PathManipulator::scaleHandle(), setLength(), Inkscape::UI::Node::setType(), and Inkscape::UI::Node::showHandles().
|
inline |
Definition at line 466 of file node.h.
References Geom::Point::length(), and relativePos().
Referenced by Inkscape::UI::PathManipulator::rotateHandle(), setDirection(), and Inkscape::UI::Node::setType().
|
overridevirtual |
Move the control point to new position with side effects.
This is called after each drag. Override this method if only some positions make sense for a control point (like a point that must always be on a path and can't modify it), or when moving a control point changes the positions of other points.
Reimplemented from Inkscape::UI::ControlPoint.
Definition at line 206 of file node.cpp.
References Inkscape::UI::ControlPoint::_desktop, Inkscape::UI::Node::_is_line_segment(), _parent, _update_bspline_handles(), Geom::are_near(), delta, Inkscape::UI::direction(), Geom::dot(), Inkscape::UI::Node::handleAwayFrom(), Inkscape::UI::Node::handleToward(), isDegenerate(), Inkscape::UI::NODE_AUTO, Inkscape::UI::NODE_CUSP, Inkscape::UI::NODE_SMOOTH, Inkscape::UI::NODE_SYMMETRIC, Inkscape::UI::Node::nodeAwayFrom(), Inkscape::UI::Node::nodeToward(), other(), Inkscape::UI::ControlPoint::position(), setDirection(), setPosition(), setRelativePos(), Inkscape::UI::Node::setType(), Inkscape::UI::Tools::sp_update_helperpath(), and Inkscape::UI::Node::type().
Referenced by Inkscape::UI::PathManipulator::_handleClicked(), and retract().
Handle * Handle::other | ( | ) |
Definition at line 603 of file node.cpp.
Referenced by Inkscape::UI::PathManipulator::_bsplineHandlePosition(), _eventHandler(), _update_bspline_handles(), and move().
|
inline |
Definition at line 79 of file node.h.
References _parent.
Referenced by Inkscape::UI::PathManipulator::_bsplineHandlePosition(), Inkscape::UI::PathManipulator::_bsplineHandleReposition(), and Inkscape::UI::PathManipulator::_handleClicked().
|
inline |
Definition at line 460 of file node.h.
References _parent, and Inkscape::UI::ControlPoint::position().
Referenced by _eventHandler(), Inkscape::UI::Node::dragged(), length(), Inkscape::UI::PathManipulator::rotateHandle(), Inkscape::UI::PathManipulator::scaleHandle(), setLength(), and Inkscape::UI::Node::setType().
void Handle::retract | ( | ) |
Definition at line 318 of file node.cpp.
References _parent, move(), and Inkscape::UI::ControlPoint::position().
Referenced by Inkscape::UI::Node::_updateAutoHandles().
void Handle::setDirection | ( | Geom::Point const & | dir | ) |
Definition at line 328 of file node.cpp.
References length(), setRelativePos(), and Geom::unit_vector().
void Handle::setDirection | ( | Geom::Point const & | from, |
Geom::Point const & | to | ||
) |
Definition at line 323 of file node.cpp.
References setDirection().
Referenced by Inkscape::UI::Node::fixNeighbors(), move(), setDirection(), and Inkscape::UI::Node::setType().
void Handle::setLength | ( | double | len | ) |
Definition at line 310 of file node.cpp.
References isDegenerate(), len, relativePos(), setRelativePos(), and Geom::unit_vector().
|
overridevirtual |
Relocate the control point without side effects.
Overload this method only if there is an additional graphical representation that must be updated (like the lines that connect handles to nodes). If you override it, you must also call the superclass implementation of the method.
Reimplemented from Inkscape::UI::ControlPoint.
Definition at line 292 of file node.cpp.
References _degenerate, _handle_line, Inkscape::UI::Node::_handles_shown, _parent, Geom::are_near(), Inkscape::UI::ControlPoint::position(), Inkscape::UI::ControlPoint::setPosition(), setVisible(), and Inkscape::UI::ControlPoint::visible().
Referenced by Inkscape::UI::PathManipulator::_createControlPointsFromGeometry(), Inkscape::UI::Node::_setState(), _update_bspline_handles(), Inkscape::UI::Node::grabbed(), Inkscape::UI::MultiPathManipulator::joinNodes(), move(), Inkscape::UI::Node::move(), setRelativePos(), Inkscape::UI::Node::setType(), and Inkscape::UI::Node::transform().
|
inline |
Definition at line 463 of file node.h.
References _parent, Inkscape::UI::ControlPoint::position(), and setPosition().
Referenced by _eventHandler(), Inkscape::UI::Node::_updateAutoHandles(), move(), Inkscape::UI::PathManipulator::rotateHandle(), Inkscape::UI::PathManipulator::scaleHandle(), setDirection(), setLength(), and Inkscape::UI::Node::setType().
|
overridevirtual |
Set the visibility of the control point.
An invisible point is not drawn on the canvas and cannot receive any events.
Reimplemented from Inkscape::UI::ControlPoint.
Definition at line 188 of file node.cpp.
References _handle_line, _parent, Inkscape::UI::SelectableControlPoint::selected(), Inkscape::UI::ControlPoint::set_selected_appearance(), and Inkscape::UI::ControlPoint::setVisible().
Referenced by Inkscape::UI::Node::grabbed(), Handle(), setPosition(), and Inkscape::UI::Node::showHandles().
|
overrideprotectedvirtual |
Called when the control point finishes a drag.
event | Button release event |
Reimplemented from Inkscape::UI::ControlPoint.
Definition at line 557 of file node.cpp.
References Inkscape::Preferences::get().
|
private |
Definition at line 106 of file node.h.
Referenced by isDegenerate(), and setPosition().
|
staticprivate |
Definition at line 117 of file node.h.
Referenced by Inkscape::UI::Node::grabbed().
|
private |
Definition at line 105 of file node.h.
Referenced by setPosition(), and setVisible().
|
private |
Definition at line 103 of file node.h.
Referenced by _eventHandler(), _pm(), _pm(), move(), parent(), relativePos(), retract(), setPosition(), setRelativePos(), and setVisible().
|
staticprivate |
|
staticprivate |