Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
GrDragger Struct Reference

This class holds together a visible on-canvas knot and a list of draggables that need to be moved when the knot moves. More...

#include <gradient-drag.h>

Public Member Functions

 GrDragger (GrDrag *parent, Geom::Point p, GrDraggable *draggable)
 
virtual ~GrDragger ()
 
void addDraggable (GrDraggable *draggable)
 Adds a draggable to the dragger.
 
void updateKnotShape ()
 Adds a draggable to the dragger.
 
void updateTip ()
 Updates the statusbar tip of the dragger knot, based on its draggables.
 
void select ()
 Draw this dragger as selected.
 
void deselect ()
 Draw this dragger as normal (deselected).
 
bool isSelected ()
 
void moveThisToDraggable (SPItem *item, GrPointType point_type, gint point_i, Inkscape::PaintTarget fill_or_stroke, bool write_repr)
 Moves this dragger to the point of the given draggable, acting upon all other draggables.
 
void moveOtherToDraggable (SPItem *item, GrPointType point_type, gint point_i, Inkscape::PaintTarget fill_or_stroke, bool write_repr)
 
void updateMidstopDependencies (GrDraggable *draggable, bool write_repr)
 Moves all midstop draggables that depend on this one.
 
void updateDependencies (bool write_repr)
 Moves all draggables that depend on this one.
 
void moveMeshHandles (Geom::Point pc_old, MeshNodeOperation op)
 Update mesh handles when mesh corner is moved.
 
GrDraggergetMgCorner ()
 Find mesh corner corresponding to given dragger.
 
void highlightNode (SPMeshNode *node, bool highlight, Geom::Point corner_pos, int index)
 Highlight mesh node.
 
void highlightCorner (bool highlight)
 Highlight handles for mesh corner corresponding to this dragger.
 
bool mayMerge (GrDragger *other)
 
bool mayMerge (GrDraggable *da2)
 
bool isA (GrPointType point_type)
 Checks if the dragger has a draggable with this point_type.
 
bool isA (SPItem *item, GrPointType point_type, Inkscape::PaintTarget fill_or_stroke)
 Checks if the dragger has a draggable with this item, point_type, fill_or_stroke.
 
bool isA (SPItem *item, GrPointType point_type, gint point_i, Inkscape::PaintTarget fill_or_stroke)
 Checks if the dragger has a draggable with this item, point_type + point_i (number), fill_or_stroke.
 
void fireDraggables (bool write_repr, bool scale_radial=false, bool merging_focus=false)
 Act upon all draggables of the dragger, setting them to the dragger's point.
 

Public Attributes

GrDragparent
 
SPKnotknot
 
Geom::Point point
 
Geom::Point point_original
 
std::vector< GrDraggable * > draggables
 

Protected Member Functions

void updateControlSizes ()
 

Private Attributes

sigc::connection _moved_connection
 
sigc::connection _clicked_connection
 
sigc::connection _doubleclicked_connection
 
sigc::connection _mousedown_connection
 
sigc::connection _ungrabbed_connection
 

Detailed Description

This class holds together a visible on-canvas knot and a list of draggables that need to be moved when the knot moves.

Normally there's one draggable in the list, but there may be more when draggers are snapped together.

Definition at line 85 of file gradient-drag.h.

Constructor & Destructor Documentation

◆ GrDragger()

◆ ~GrDragger()

Member Function Documentation

◆ addDraggable()

void GrDragger::addDraggable ( GrDraggable draggable)

Adds a draggable to the dragger.

Definition at line 1544 of file gradient-drag.cpp.

References draggables, and updateTip().

Referenced by gr_knot_moved_handler(), and GrDragger().

◆ deselect()

void GrDragger::deselect ( )

Draw this dragger as normal (deselected).

Definition at line 1934 of file gradient-drag.cpp.

References highlightCorner(), knot, and SPKnot::selectKnot().

Referenced by GrDrag::setDeselected(), and GrDrag::setSelected().

◆ fireDraggables()

void GrDragger::fireDraggables ( bool  write_repr,
bool  scale_radial = false,
bool  merging_focus = false 
)

Act upon all draggables of the dragger, setting them to the dragger's point.

Definition at line 1267 of file gradient-drag.cpp.

References draggables, GrDrag::local_change, parent, POINT_RG_CENTER, POINT_RG_FOCUS, and sp_item_gradient_set_coords().

Referenced by gr_knot_moved_handler(), and gr_knot_ungrabbed_handler().

◆ getMgCorner()

◆ highlightCorner()

void GrDragger::highlightCorner ( bool  highlight)

◆ highlightNode()

◆ isA() [1/3]

bool GrDragger::isA ( GrPointType  point_type)

Checks if the dragger has a draggable with this point_type.

Definition at line 1292 of file gradient-drag.cpp.

References draggables.

Referenced by gr_knot_moved_handler(), moveMeshHandles(), GrDrag::setSelected(), and updateTip().

◆ isA() [2/3]

bool GrDragger::isA ( SPItem item,
GrPointType  point_type,
gint  point_i,
Inkscape::PaintTarget  fill_or_stroke 
)

Checks if the dragger has a draggable with this item, point_type + point_i (number), fill_or_stroke.

Definition at line 1305 of file gradient-drag.cpp.

References draggables, and item.

◆ isA() [3/3]

bool GrDragger::isA ( SPItem item,
GrPointType  point_type,
Inkscape::PaintTarget  fill_or_stroke 
)

Checks if the dragger has a draggable with this item, point_type, fill_or_stroke.

Definition at line 1318 of file gradient-drag.cpp.

References draggables, and item.

◆ isSelected()

bool GrDragger::isSelected ( )

◆ mayMerge() [1/2]

bool GrDragger::mayMerge ( GrDraggable da2)

Definition at line 1361 of file gradient-drag.cpp.

References draggables.

◆ mayMerge() [2/2]

bool GrDragger::mayMerge ( GrDragger other)

Definition at line 1347 of file gradient-drag.cpp.

References draggables.

Referenced by gr_knot_moved_handler().

◆ moveMeshHandles()

void GrDragger::moveMeshHandles ( Geom::Point  pc_old,
MeshNodeOperation  op 
)

Update mesh handles when mesh corner is moved.

pc_old: old position of corner (could be changed to dp if we figure out transforms). op: how other nodes (handles, tensors) should be moved. Scaling takes place only between a selected and an unselected corner, other wise a handle is displaced the same distance as the adjacent corner. If a side is a line, then the handles are always placed 1/3 of side length from each corner.

Ooops, needs to be reimplemented.

Definition at line 1382 of file gradient-drag.cpp.

References draggables, GrDraggable::fill_or_stroke, Inkscape::FOR_FILL, GrDrag::getDraggerFor(), getGradient(), getGradientCoords(), SPGradient::gradientTransform, SPItem::i2dt_affine(), isA(), item, GrDraggable::item, knot, SPKnot::moveto(), parent, GrDraggable::point_i, POINT_MG_CORNER, POINT_MG_HANDLE, POINT_MG_TENSOR, GrDraggable::point_type, scale, GrDrag::selected, and sp_gradient_convert_to_userspace().

Referenced by gr_knot_moved_handler(), and gr_knot_ungrabbed_handler().

◆ moveOtherToDraggable()

void GrDragger::moveOtherToDraggable ( SPItem item,
GrPointType  point_type,
gint  point_i,
Inkscape::PaintTarget  fill_or_stroke,
bool  write_repr 
)

◆ moveThisToDraggable()

void GrDragger::moveThisToDraggable ( SPItem item,
GrPointType  point_type,
gint  point_i,
Inkscape::PaintTarget  fill_or_stroke,
bool  write_repr 
)

Moves this dragger to the point of the given draggable, acting upon all other draggables.

Definition at line 1555 of file gradient-drag.cpp.

References draggables, GrDraggable::fill_or_stroke, getGradientCoords(), item, GrDraggable::item, knot, SPKnot::moveto(), point, GrDraggable::point_i, point_original, GrDraggable::point_type, and sp_item_gradient_set_coords().

Referenced by moveOtherToDraggable().

◆ select()

void GrDragger::select ( )

Draw this dragger as selected.

Definition at line 1925 of file gradient-drag.cpp.

References highlightCorner(), knot, and SPKnot::selectKnot().

Referenced by GrDrag::setSelected().

◆ updateControlSizes()

void GrDragger::updateControlSizes ( )
protected

Definition at line 1283 of file gradient-drag.cpp.

References knot, SPKnot::updateCtrl(), and updateKnotShape().

◆ updateDependencies()

void GrDragger::updateDependencies ( bool  write_repr)

◆ updateKnotShape()

void GrDragger::updateKnotShape ( )

Adds a draggable to the dragger.

Definition at line 1532 of file gradient-drag.cpp.

References SPKnot::ctrl, draggables, gr_knot_types, knot, and GrDraggable::point_type.

Referenced by gr_knot_moved_handler(), GrDragger(), highlightNode(), and updateControlSizes().

◆ updateMidstopDependencies()

void GrDragger::updateMidstopDependencies ( GrDraggable draggable,
bool  write_repr 
)

Moves all midstop draggables that depend on this one.

Definition at line 1584 of file gradient-drag.cpp.

References GrDraggable::fill_or_stroke, GrDraggable::getServer(), GrDraggable::item, moveOtherToDraggable(), num, POINT_LG_MID, POINT_RG_MID1, and POINT_RG_MID2.

Referenced by updateDependencies().

◆ updateTip()

Member Data Documentation

◆ _clicked_connection

sigc::connection GrDragger::_clicked_connection
private

Definition at line 137 of file gradient-drag.h.

Referenced by GrDragger(), and ~GrDragger().

◆ _doubleclicked_connection

sigc::connection GrDragger::_doubleclicked_connection
private

Definition at line 138 of file gradient-drag.h.

Referenced by GrDragger(), and ~GrDragger().

◆ _mousedown_connection

sigc::connection GrDragger::_mousedown_connection
private

Definition at line 139 of file gradient-drag.h.

Referenced by GrDragger(), and ~GrDragger().

◆ _moved_connection

sigc::connection GrDragger::_moved_connection
private

Definition at line 136 of file gradient-drag.h.

Referenced by GrDragger(), and ~GrDragger().

◆ _ungrabbed_connection

sigc::connection GrDragger::_ungrabbed_connection
private

Definition at line 140 of file gradient-drag.h.

Referenced by GrDragger(), and ~GrDragger().

◆ draggables

◆ knot

◆ parent

◆ point

◆ point_original


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