Inkscape
Vector Graphics Editor
|
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. | |
GrDragger * | getMgCorner () |
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 | |
GrDrag * | parent |
SPKnot * | knot |
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 |
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.
GrDragger::GrDragger | ( | GrDrag * | parent, |
Geom::Point | p, | ||
GrDraggable * | draggable | ||
) |
Definition at line 1664 of file gradient-drag.cpp.
References _clicked_connection, _doubleclicked_connection, _mousedown_connection, _moved_connection, _ungrabbed_connection, addDraggable(), Inkscape::CANVAS_ITEM_CTRL_TYPE_SIZER, SPKnot::click_signal, GrDrag::desktop, SPKnot::doubleclicked_signal, draggables, gr_knot_clicked_handler(), gr_knot_doubleclicked_handler(), gr_knot_mousedown_handler(), gr_knot_moved_handler(), gr_knot_moved_midpoint_handler(), gr_knot_ungrabbed_handler(), knot, SPKnot::mousedown_signal, SPKnot::moved_signal, parent, POINT_LG_MID, POINT_RG_MID1, POINT_RG_MID2, GrDraggable::point_type, SPKnot::setPosition(), SPKnot::show(), SP_KNOT_STATE_NORMAL, SPKnot::ungrabbed_signal, SPKnot::updateCtrl(), and updateKnotShape().
|
virtual |
Definition at line 1713 of file gradient-drag.cpp.
References _clicked_connection, _doubleclicked_connection, _mousedown_connection, _moved_connection, _ungrabbed_connection, draggables, knot, and SPKnot::unref().
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().
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().
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().
GrDragger * GrDragger::getMgCorner | ( | ) |
Find mesh corner corresponding to given dragger.
Definition at line 1783 of file gradient-drag.cpp.
References draggables, GrDraggable::fill_or_stroke, GrDrag::getDraggerFor(), getGradient(), GrDraggable::item, MG_NODE_TYPE_CORNER, MG_NODE_TYPE_HANDLE, parent, GrDraggable::point_i, POINT_MG_CORNER, GrDraggable::point_type, and set.
Referenced by gr_knot_mousedown_handler(), and gr_knot_moved_handler().
void GrDragger::highlightCorner | ( | bool | highlight | ) |
Highlight handles for mesh corner corresponding to this dragger.
Definition at line 1869 of file gradient-drag.cpp.
References draggables, GrDraggable::fill_or_stroke, getGradient(), highlightNode(), GrDraggable::item, SPMeshNodeArray::nodes, SPMeshNodeArray::patch_columns(), SPMeshNodeArray::patch_rows(), point, GrDraggable::point_i, POINT_MG_CORNER, and GrDraggable::point_type.
Referenced by deselect(), gr_knot_mousedown_handler(), gr_knot_moved_handler(), and select().
void GrDragger::highlightNode | ( | SPMeshNode * | node, |
bool | highlight, | ||
Geom::Point | corner_pos, | ||
int | index | ||
) |
Highlight mesh node.
Definition at line 1829 of file gradient-drag.cpp.
References Geom::Ray::angle(), SPKnot::desktop, draggables, end, GrDraggable::fill_or_stroke, GrDrag::getDraggerFor(), SPDesktop::is_yaxisdown(), GrDraggable::item, knot, MG_NODE_TYPE_HANDLE, node, parent, POINT_MG_HANDLE, POINT_MG_TENSOR, SPKnot::pos, SPKnot::selectKnot(), SPKnot::setAngle(), Geom::Ray::setPoints(), SPKnot::updateCtrl(), and updateKnotShape().
Referenced by highlightCorner().
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().
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.
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.
bool GrDragger::isSelected | ( | ) |
Definition at line 1941 of file gradient-drag.cpp.
References parent, and GrDrag::selected.
Referenced by Inkscape::UI::Tools::get_stop_intervals(), gr_knot_moved_midpoint_handler(), and gr_midpoint_limits().
bool GrDragger::mayMerge | ( | GrDraggable * | da2 | ) |
Definition at line 1361 of file gradient-drag.cpp.
References draggables.
bool GrDragger::mayMerge | ( | GrDragger * | other | ) |
Definition at line 1347 of file gradient-drag.cpp.
References draggables.
Referenced by gr_knot_moved_handler().
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().
void GrDragger::moveOtherToDraggable | ( | SPItem * | item, |
GrPointType | point_type, | ||
gint | point_i, | ||
Inkscape::PaintTarget | fill_or_stroke, | ||
bool | write_repr | ||
) |
Definition at line 1772 of file gradient-drag.cpp.
References GrDrag::getDraggerFor(), item, moveThisToDraggable(), and parent.
Referenced by updateDependencies(), and updateMidstopDependencies().
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().
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().
|
protected |
Definition at line 1283 of file gradient-drag.cpp.
References knot, SPKnot::updateCtrl(), and updateKnotShape().
void GrDragger::updateDependencies | ( | bool | write_repr | ) |
Moves all draggables that depend on this one.
Definition at line 1608 of file gradient-drag.cpp.
References draggables, moveOtherToDraggable(), POINT_LG_BEGIN, POINT_LG_END, POINT_LG_MID, POINT_RG_CENTER, POINT_RG_FOCUS, POINT_RG_MID1, POINT_RG_MID2, POINT_RG_R1, POINT_RG_R2, and updateMidstopDependencies().
Referenced by gr_knot_moved_handler(), and gr_knot_ungrabbed_handler().
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().
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().
void GrDragger::updateTip | ( | ) |
Updates the statusbar tip of the dragger knot, based on its draggables.
Definition at line 1478 of file gradient-drag.cpp.
References SPItem::detailedDescription(), draggables, GrDraggable::fill_or_stroke, Inkscape::FOR_STROKE, gr_knot_descr, isA(), GrDraggable::item, knot, GrDraggable::point_i, POINT_LG_MID, POINT_MG_CORNER, POINT_MG_HANDLE, POINT_MG_TENSOR, POINT_RG_CENTER, POINT_RG_FOCUS, POINT_RG_MID1, POINT_RG_MID2, GrDraggable::point_type, and SPKnot::setTip().
Referenced by addDraggable(), and gr_knot_moved_handler().
|
private |
Definition at line 137 of file gradient-drag.h.
Referenced by GrDragger(), and ~GrDragger().
|
private |
Definition at line 138 of file gradient-drag.h.
Referenced by GrDragger(), and ~GrDragger().
|
private |
Definition at line 139 of file gradient-drag.h.
Referenced by GrDragger(), and ~GrDragger().
|
private |
Definition at line 136 of file gradient-drag.h.
Referenced by GrDragger(), and ~GrDragger().
|
private |
Definition at line 140 of file gradient-drag.h.
Referenced by GrDragger(), and ~GrDragger().
std::vector<GrDraggable *> GrDragger::draggables |
Definition at line 98 of file gradient-drag.h.
Referenced by GrDrag::addColorToDragger(), addDraggable(), GrDrag::deleteSelected(), GrDrag::dropColor(), fireDraggables(), getMgCorner(), gr_knot_clicked_handler(), gr_knot_doubleclicked_handler(), gr_knot_moved_handler(), gr_knot_moved_midpoint_handler(), gr_midpoint_limits(), GrDragger(), highlightCorner(), highlightNode(), isA(), isA(), isA(), mayMerge(), mayMerge(), moveMeshHandles(), moveThisToDraggable(), Inkscape::UI::Toolbar::GradientToolbar::select_stop_by_draggers(), GrDrag::selected_move(), updateDependencies(), updateKnotShape(), updateTip(), and ~GrDragger().
SPKnot* GrDragger::knot |
Definition at line 91 of file gradient-drag.h.
Referenced by GrDrag::addCurve(), GrDrag::addDraggersMesh(), deselect(), GrDrag::grabKnot(), GrDrag::grabKnot(), GrDragger(), highlightNode(), moveMeshHandles(), moveThisToDraggable(), GrDrag::refreshDraggersMesh(), select(), updateControlSizes(), updateKnotShape(), updateTip(), and ~GrDragger().
GrDrag* GrDragger::parent |
Definition at line 89 of file gradient-drag.h.
Referenced by fireDraggables(), getMgCorner(), gr_knot_clicked_handler(), gr_knot_doubleclicked_handler(), gr_knot_mousedown_handler(), gr_knot_moved_handler(), gr_knot_moved_midpoint_handler(), gr_knot_ungrabbed_handler(), gr_midpoint_limits(), GrDragger(), highlightNode(), isSelected(), moveMeshHandles(), and moveOtherToDraggable().
Geom::Point GrDragger::point |
Definition at line 94 of file gradient-drag.h.
Referenced by Inkscape::UI::Tools::get_stop_intervals(), gr_knot_clicked_handler(), gr_knot_doubleclicked_handler(), gr_knot_moved_handler(), gr_knot_moved_midpoint_handler(), gr_knot_ungrabbed_handler(), gr_midpoint_limits(), GrDrag::grabKnot(), GrDrag::grabKnot(), highlightCorner(), moveThisToDraggable(), Inkscape::UI::Tools::MeshTool::select_next(), Inkscape::UI::Tools::MeshTool::select_prev(), and GrDrag::selected_move().
Geom::Point GrDragger::point_original |
Definition at line 96 of file gradient-drag.h.
Referenced by gr_knot_clicked_handler(), gr_knot_doubleclicked_handler(), gr_knot_moved_handler(), gr_knot_ungrabbed_handler(), and moveThisToDraggable().