Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::UI::Handle Class Reference

#include <node.h>

Inheritance diagram for Inkscape::UI::Handle:
Inkscape::UI::ControlPoint

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)
 
Nodeparent ()
 
Handleother ()
 
Handle const * other () const
 
- Public Member Functions inherited from Inkscape::UI::ControlPoint
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 Public Member Functions inherited from Inkscape::UI::ControlPoint
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
 
- Protected Member Functions inherited from Inkscape::UI::ControlPoint
 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

- Public Types inherited from Inkscape::UI::ControlPoint
enum  State { STATE_NORMAL , STATE_MOUSEOVER , STATE_CLICKED }
 Enumeration representing the possible states of the control point, used to determine its appearance. More...
 
- Public Attributes inherited from Inkscape::UI::ControlPoint
SPDesktop *const _desktop
 The desktop this control point resides on.
 
- Static Public Attributes inherited from Inkscape::UI::ControlPoint
static ControlPointmouseovered_point = nullptr
 Holds the currently mouseovered control point.
 
static sigc::signal< void(ControlPoint *)> signal_mouseover_change
 Emitted when the mouseovered point changes.
 
- Static Protected Member Functions inherited from Inkscape::UI::ControlPoint
static Geom::Point const & _last_click_event_point ()
 
static Geom::Point const & _last_drag_origin ()
 
static bool _is_drag_cancelled (MotionEvent const &event)
 
- Protected Attributes inherited from Inkscape::UI::ControlPoint
CanvasItemPtr< Inkscape::CanvasItemCtrl_canvas_item_ctrl
 Visual representation of the control point.
 
State _state = STATE_NORMAL
 
- Static Protected Attributes inherited from Inkscape::UI::ControlPoint
static bool _drag_initiated = false
 

Detailed Description

Definition at line 61 of file node.h.

Constructor & Destructor Documentation

◆ ~Handle()

Handle::~Handle ( )
overridedefault

◆ Handle()

Handle::Handle ( NodeSharedData const &  data,
Geom::Point const &  initial_pos,
Node parent 
)
protected

Definition at line 176 of file node.cpp.

References setVisible().

Member Function Documentation

◆ _eventHandler()

◆ _getDragTip()

Glib::ustring Handle::_getDragTip ( MotionEvent const &  event) const
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.

◆ _getTip()

Glib::ustring Handle::_getTip ( unsigned  state) const
overrideprotectedvirtual

◆ _hasDragTips()

bool Inkscape::UI::Handle::_hasDragTips ( ) const
inlineoverrideprotectedvirtual

Reimplemented from Inkscape::UI::ControlPoint.

Definition at line 97 of file node.h.

◆ _pm() [1/2]

PathManipulator & Handle::_pm ( )
inlineprivate

Definition at line 469 of file node.h.

References _parent, and Inkscape::UI::Node::_pm().

Referenced by _update_bspline_handles().

◆ _pm() [2/2]

PathManipulator & Handle::_pm ( ) const
inlineprivate

Definition at line 472 of file node.h.

References _parent, and Inkscape::UI::Node::_pm().

◆ _update_bspline_handles()

void Handle::_update_bspline_handles ( )
private

◆ clicked()

bool Handle::clicked ( ButtonReleaseEvent const &  event)
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.

Parameters
eventButton release event
Returns
true if the click had some effect, false if it did nothing.

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.

◆ dragged()

void Handle::dragged ( Geom::Point new_pos,
MotionEvent const &  event 
)
overrideprotectedvirtual

◆ grabbed()

bool Handle::grabbed ( MotionEvent const &  event)
overrideprotectedvirtual

Called when the user moves the point beyond the drag tolerance with the first button held down.

Parameters
eventMotion event when drag tolerance was exceeded.
Returns
true if you called transferGrab() during this method.

Reimplemented from Inkscape::UI::ControlPoint.

Definition at line 437 of file node.cpp.

References Geom::unit_vector().

◆ handle_2button_press()

void Handle::handle_2button_press ( )
protectedvirtual

Definition at line 428 of file node.cpp.

References Inkscape::UI::DEFAULT_START_POWER.

◆ handle_type_to_localized_string()

char const * Handle::handle_type_to_localized_string ( NodeType  type)
static

◆ isDegenerate()

◆ length()

double Handle::length ( ) const
inline

◆ move()

void Handle::move ( Geom::Point const &  pos)
overridevirtual

◆ other() [1/2]

◆ other() [2/2]

Handle const * Handle::other ( ) const

Definition at line 598 of file node.cpp.

◆ parent()

◆ relativePos()

◆ retract()

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().

◆ setDirection() [1/2]

void Handle::setDirection ( Geom::Point const &  dir)

Definition at line 328 of file node.cpp.

References length(), setRelativePos(), and Geom::unit_vector().

◆ setDirection() [2/2]

void Handle::setDirection ( Geom::Point const &  from,
Geom::Point const &  to 
)

◆ setLength()

void Handle::setLength ( double  len)

Definition at line 310 of file node.cpp.

References isDegenerate(), len, relativePos(), setRelativePos(), and Geom::unit_vector().

◆ setPosition()

void Handle::setPosition ( Geom::Point const &  pos)
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.

Todo:
Investigate whether this method should be protected

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().

◆ setRelativePos()

◆ setVisible()

void Handle::setVisible ( bool  v)
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().

◆ ungrabbed()

void Handle::ungrabbed ( ButtonReleaseEvent const *  event)
overrideprotectedvirtual

Called when the control point finishes a drag.

Parameters
eventButton release event

Reimplemented from Inkscape::UI::ControlPoint.

Definition at line 557 of file node.cpp.

References Inkscape::Preferences::get().

Friends And Related Symbol Documentation

◆ Node

friend class Node
friend

Definition at line 118 of file node.h.

Member Data Documentation

◆ _degenerate

bool Inkscape::UI::Handle::_degenerate
private

Definition at line 106 of file node.h.

Referenced by isDegenerate(), and setPosition().

◆ _drag_out

bool Handle::_drag_out = false
staticprivate

Definition at line 117 of file node.h.

Referenced by Inkscape::UI::Node::grabbed().

◆ _handle_line

CanvasItemPtr<CanvasItemCurve> Inkscape::UI::Handle::_handle_line
private

Definition at line 105 of file node.h.

Referenced by setPosition(), and setVisible().

◆ _parent

Node* Inkscape::UI::Handle::_parent
private

◆ _saved_dir

Geom::Point Handle::_saved_dir
staticprivate

Definition at line 115 of file node.h.

◆ _saved_length

double Handle::_saved_length = 0.0
staticprivate

Definition at line 116 of file node.h.

◆ _saved_other_pos

Geom::Point Handle::_saved_other_pos
staticprivate

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.

Definition at line 114 of file node.h.


The documentation for this class was generated from the following files: