2#ifndef SEEN_GRADIENT_DRAG_H
3#define SEEN_GRADIENT_DRAG_H
22#include <sigc++/sigc++.h>
27#include <glibmm/ustring.h>
130 void fireDraggables(
bool write_repr,
bool scale_radial =
false,
bool merging_focus =
false);
164 return (
selected.empty() ? 0 : ((*(
selected.begin()))->draggables[0]->point_type));
223 void selected_move(
double x,
double y,
bool write_repr =
true,
bool scale_radial =
false);
Cartesian point / 2D vector and related operations.
std::unique_ptr< T, CanvasItemUnlinkDeleter > CanvasItemPtr
Smart pointer used to hold CanvasItems, like std::unique_ptr.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
This is the root class of the gradient dragging machinery.
GrDragger * addDragger(GrDraggable *draggable)
If there already exists a dragger within MERGE_DIST of p, add the draggable to it; otherwise create n...
void updateDraggers()
Regenerates the draggers list from the current selection; is called when selection is changed or modi...
void deselect_all()
Deselect all stops/draggers (private).
void refreshDraggers()
Refresh draggers, moving and toggling visibility as necessary.
guint singleSelectedDraggerSingleDraggableType()
GrDragger * select_prev()
Select the knot previous from the last selected one and deselect all other selected.
void updateLines()
Regenerates the lines list from the current selection; is called on each move of a dragger,...
Inkscape::Colors::Color getColor()
void deselectAll()
Deselect all stops/draggers (public; emits signal).
void addColorToDragger(GrDragger &dragger, const char *color)
void selectByStop(SPStop *stop, bool add_to_selection=true, bool override=true)
Select draggers by stop.
std::vector< double > vert_levels
void addLine(SPItem *item, Geom::Point p1, Geom::Point p2, Inkscape::PaintTarget fill_or_stroke)
Create a line from p1 to p2 and add it to the curves list.
void setDeselected(GrDragger *dragger)
Deselect a dragger.
guint singleSelectedDraggerNumDraggables()
bool dropColor(SPItem *item, gchar const *c, Geom::Point p)
void addDraggersRadial(SPRadialGradient *rg, SPItem *item, Inkscape::PaintTarget fill_or_stroke)
Add draggers for the radial gradient rg on item.
void addCurve(SPItem *item, Geom::Point p0, Geom::Point p1, Geom::Point p2, Geom::Point p3, int corner0, int corner1, int handle0, int handle1, Inkscape::PaintTarget fill_or_stroke)
Create a curve from p0 to p3 and add it to the curves list.
GrDragger * select_next()
Select the knot next to the last selected one and deselect all other selected.
bool styleSet(const SPCSSAttr *css, bool switch_style)
SPStop * addStopNearPoint(SPItem *item, Geom::Point mouse_p, double tolerance)
void selected_move_nowrite(double x, double y, bool scale_radial)
void grabKnot(GrDragger *dragger, gint x, gint y, guint32 etime)
Artificially grab the knot of this dragger; used by the gradient context.
bool key_press_handler(Inkscape::KeyPressEvent const &event)
Handle arrow key events.
bool mouseOver()
Returns true if at least one of the draggers' knots has the mouse hovering above it.
void addDraggersMesh(SPMeshGradient *mg, SPItem *item, Inkscape::PaintTarget fill_or_stroke)
Add draggers for the mesh gradient mg on item.
Inkscape::Selection * selection
void selectByCoords(std::vector< Geom::Point > coords)
Select all stops/draggers that match the coords.
Glib::ustring makeStopSafeColor(gchar const *str, bool &isNull)
sigc::connection style_query_connection
void selected_move_screen(double x, double y)
std::set< GrDragger * > selected
void dropColorOnCorrespondingRegion(const char *color, Geom::Point p)
std::vector< double > hor_levels
std::vector< ItemCurve > item_curves
void refreshDraggersMesh(SPMeshGradient *mg, SPItem *item, Inkscape::PaintTarget fill_or_stroke)
Refresh draggers, moving and toggling visibility as necessary.
sigc::connection sel_changed_connection
void deleteSelected(bool just_one=false)
void selected_reverse_vector()
sigc::connection style_set_connection
void updateLevels()
Regenerates the levels list from the current selection.
void selectAll()
Select all stops/draggers.
void selected_move(double x, double y, bool write_repr=true, bool scale_radial=false)
void setSelected(GrDragger *dragger, bool add_to_selection=false, bool override=true)
Select a dragger.
void selectRect(Geom::Rect const &r)
Select all stops/draggers that fall within the rect.
sigc::connection sel_modified_connection
std::vector< GrDragger * > draggers
GrDragger * getDraggerFor(GrDraggable *d)
Select the dragger which has the given draggable.
void addDraggersLinear(SPLinearGradient *lg, SPItem *item, Inkscape::PaintTarget fill_or_stroke)
Add draggers for the linear gradient lg on item.
The set of selected SPObjects for a given document and layer model.
To do: update description of desktop.
Base class for visual SVG elements.
Desktop-bound visual control object.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
std::shared_ptr< Css const > css
Inkscape::XML::Node * node
Helper class to stream background task notifications as a series of messages.
CanvasItemPtr< Inkscape::CanvasItemCurve > curve
This class represents a single draggable point of a gradient.
int equals(GrDraggable *other)
bool mayMerge(GrDraggable *da2)
Inkscape::PaintTarget fill_or_stroke
This class holds together a visible on-canvas knot and a list of draggables that need to be moved whe...
void updateTip()
Updates the statusbar tip of the dragger knot, based on its draggables.
std::vector< GrDraggable * > draggables
void updateDependencies(bool write_repr)
Moves all draggables that depend on this one.
void moveOtherToDraggable(SPItem *item, GrPointType point_type, gint point_i, Inkscape::PaintTarget fill_or_stroke, bool write_repr)
GrDragger * getMgCorner()
Find mesh corner corresponding to given dragger.
void highlightCorner(bool highlight)
Highlight handles for mesh corner corresponding to this dragger.
void updateControlSizes()
sigc::connection _doubleclicked_connection
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.
void addDraggable(GrDraggable *draggable)
Adds a draggable to the dragger.
sigc::connection _mousedown_connection
void highlightNode(SPMeshNode *node, bool highlight, Geom::Point corner_pos, int index)
Highlight mesh node.
void updateMidstopDependencies(GrDraggable *draggable, bool write_repr)
Moves all midstop draggables that depend on this one.
void deselect()
Draw this dragger as normal (deselected).
sigc::connection _clicked_connection
void moveMeshHandles(Geom::Point pc_old, MeshNodeOperation op)
Update mesh handles when mesh corner is moved.
bool mayMerge(GrDragger *other)
void updateKnotShape()
Adds a draggable to the dragger.
sigc::connection _moved_connection
Geom::Point point_original
bool isA(GrPointType point_type)
Checks if the dragger has a draggable with this point_type.
void select()
Draw this dragger as selected.
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.
sigc::connection _ungrabbed_connection