21#include <gdk/gdkkeysyms.h>
22#include <glibmm/i18n.h>
72 if (prefs->
getBool(
"/tools/shapes/selcue")) {
76 if (prefs->
getBool(
"/tools/shapes/gradientdrag")) {
105 g_assert (selection !=
nullptr);
115 if (path ==
"magnitude") {
116 this->
magnitude = CLAMP(val.
getInt(5), this->isflatsided ? 3 : 2, 1024);
117 }
else if (path ==
"proportion") {
119 }
else if (path ==
"isflatsided") {
121 }
else if (path ==
"rounded") {
123 }
else if (path ==
"randomized") {
133 tolerance = prefs->getIntLimited(
"/options/dragtolerance/value", 0, 0, 100);
139 if (event.num_press == 1 && event.button == 1) {
142 setup_for_drag_start(event);
143 center = _desktop->w2d(event.pos);
146 auto &m = _desktop->getNamedView()->snap_manager;
148 m.freeSnapReturnByRef(center, SNAPSOURCE_NODE_HANDLE);
179 if (
dragging && event.button == 1) {
207 case GDK_KEY_Control_L:
208 case GDK_KEY_Control_R:
209 case GDK_KEY_Shift_L:
210 case GDK_KEY_Shift_R:
214 _(
"<b>Ctrl</b>: snap angle; keep rays radial"),
254 case GDK_KEY_KP_Delete:
255 case GDK_KEY_BackSpace:
264 switch (event.keyval) {
267 case GDK_KEY_Control_L:
268 case GDK_KEY_Control_R:
269 case GDK_KEY_Shift_L:
270 case GDK_KEY_Shift_R:
289 int const snaps = prefs->
getInt(
"/options/rotationsnapsperpi/value", 12);
325 double const sides = (gdouble) this->
magnitude;
328 double arg1 = atan2(d);
330 if (state & GDK_CONTROL_MASK) {
332 double snaps_radian = M_PI/snaps;
333 arg1 = std::round(arg1/snaps_radian) * snaps_radian;
337 arg1, arg1 + M_PI / sides, this->isflatsided, this->rounded, this->randomized);
344 _(
"<b>Polygon</b>: radius %s, angle %.2f°; with <b>Ctrl</b> to snap angle") :
345 _(
"<b>Star</b>: radius %s, angle %.2f°; with <b>Ctrl</b> to snap angle") ),
346 rads.c_str(), arg1 * 180 / M_PI);
353 if (this->
star->
r[1] == 0) {
371 this->
star =
nullptr;
Coord descrim() const
Calculate the descriminant.
Affine inverse() const
Compute the inverse matrix.
Two-dimensional point that doubles as a vector.
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
static void cancel(SPDocument *document)
void clear()
removes our current message from the stack
void clear()
Unselects all selected objects.
SPItem * singleItem()
Returns a single selected item.
Data type representing a typeless value of a preference.
double getDouble(double def=0.0, Glib::ustring const &unit="") const
Interpret the preference as a floating point value.
Glib::ustring getEntryName() const
Get the last component of the preference's path.
bool getBool(bool def=false) const
Interpret the preference as a Boolean value.
int getInt(int def=0) const
Interpret the preference as an integer.
Preference storage class.
bool getBool(Glib::ustring const &pref_path, bool def=false)
Retrieve a Boolean value.
static Preferences * get()
Access the singleton Preferences object.
int getInt(Glib::ustring const &pref_path, int def=0)
Retrieve an integer.
The set of selected SPObjects for a given document and layer model.
void set(XML::Node *repr)
Set the selection to an XML node's SPObject.
sigc::connection connectChanged(sigc::slot< void(Selection *)> slot)
Connects a slot to be notified of selection changes.
Class to store data for points which are snap candidates, either as a source or as a target.
void set_item(SPItem *item)
void unset_item(bool keep_knotholder=false)
Glib::ustring string(Unit const *u) const
Return a printable string of the value in the specified unit.
Interface for refcounted XML nodes.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
To do: update description of desktop.
SPDocument * getDocument() const
void setToolboxFocusTo(char const *label)
Geom::Affine const & dt2doc() const
SPNamedView * getNamedView() const
Inkscape::Selection * getSelection() const
Geom::Affine const & w2d() const
Transformation from window to desktop coordinates (zoom/rotate).
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
Base class for visual SVG elements.
void adjust_stroke_width_recursive(double ex)
Recursively scale stroke width in item and its children by expansion.
Geom::Affine i2doc_affine() const
Returns the accumulated transformation of the item and all its ancestors, including root's viewport.
void setCenter(Geom::Point const &object_centre)
Sets the transform_center_x and transform_center_y properties to retain the rotation center.
Inkscape::Util::Unit const * display_units
Inkscape::XML::Node * updateRepr(unsigned int flags=SP_OBJECT_WRITE_EXT)
Updates the object's repr based on the object's state.
void deleteObject(bool propagate, bool propagate_descendants)
Deletes an object, unparenting it from its parent.
void set_shape() override
Class to coordinate snapping operations.
void setup(SPDesktop const *desktop, bool snapindicator=true, SPObject const *item_to_ignore=nullptr, std::vector< Inkscape::SnapCandidatePoint > *unselected_nodes=nullptr)
Convenience shortcut when there is only one item to ignore.
void freeSnapReturnByRef(Geom::Point &p, Inkscape::SnapSourceType const source_type, Geom::OptRect const &bbox_to_snap=Geom::OptRect()) const
Try to snap a point to grids, guides or objects.
void sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, Glib::ustring const &tool_path, bool with_text)
Apply the desktop's current style or the tool style to repr.
Editable view implementation.
TODO: insert short description here.
double Coord
Floating point type used to store coordinates.
Macro for icon names used in Inkscape.
Interface for locally managing a current status message.
SBasis L2(D2< SBasis > const &a, unsigned k)
static R & release(R &r)
Decrements the reference count of a anchored object.
Helper class to stream background task notifications as a series of messages.
void inspect_event(E &&event, Fs... funcs)
Perform pattern-matching on a CanvasEvent.
bool mod_ctrl_only(unsigned modifiers)
bool mod_alt_only(unsigned modifiers)
bool have_viable_layer(SPDesktop *desktop, MessageContext *message)
Check to see if the current layer is both unhidden and unlocked.
Inkscape::ShapeEditor This is a container class which contains a knotholder for shapes.
void sp_lpe_item_update_patheffect(SPLPEItem *lpeitem, bool wholetree, bool write, bool with_satellites)
Calls any registered handlers for the update_patheffect action.
void sp_star_position_set(SPStar *star, gint sides, Geom::Point center, gdouble r1, gdouble r2, gdouble arg1, gdouble arg2, bool isflat, double rounded, double randomized)
Abstract base class for events.
unsigned modifiers
The modifiers mask immediately before the event.
Movement of the mouse pointer.
Interface for XML documents.
virtual Node * createElement(char const *name)=0