21#include <gdk/gdkkeysyms.h>
22#include <glibmm/i18n.h>
68 if (prefs->
getBool(
"/tools/shapes/selcue")) {
72 if (prefs->
getBool(
"/tools/shapes/gradientdrag")) {
108 if (
name ==
"rx" ) {
110 }
else if (
name ==
"ry" ) {
119 if (event.num_press == 1 && event.button == 1) {
120 setup_for_drag_start(event);
134 tolerance = prefs->getIntLimited(
"/options/dragtolerance/value", 0, 0, 100);
140 if (event.num_press == 1 && event.button == 1) {
142 auto const button_w = event.pos;
145 saveDragOrigin(button_w);
149 item_to_select = sp_event_context_find_item (_desktop, button_w, event.modifiers & GDK_ALT_MASK, true);
151 auto button_dt = _desktop->w2d(button_w);
155 auto &m = _desktop->getNamedView()->snap_manager;
157 m.freeSnapReturnByRef(button_dt, SNAPSOURCE_NODE_HANDLE);
188 if (
dragging && event.button == 1) {
216 case GDK_KEY_Control_L:
217 case GDK_KEY_Control_R:
218 case GDK_KEY_Shift_L:
219 case GDK_KEY_Shift_R:
224 _(
"<b>Ctrl</b>: make square or integer-ratio rect, lock a rounded corner circular"),
225 _(
"<b>Shift</b>: draw around the starting point"),
226 _(
"<b>Alt</b>: use with Ctrl to make square"));
270 case GDK_KEY_KP_Delete:
271 case GDK_KEY_BackSpace:
283 case GDK_KEY_Control_L:
284 case GDK_KEY_Control_R:
285 case GDK_KEY_Shift_L:
286 case GDK_KEY_Shift_R:
325 if (this->
rx != 0.0) {
329 if (this->
ry != 0.0) {
330 if (this->
rx == 0.0) {
346 if (state & GDK_CONTROL_MASK) {
347 int ratio_x, ratio_y;
348 bool is_golden_ratio =
false;
350 if (fabs (rdimx) > fabs (rdimy)) {
352 is_golden_ratio =
true;
355 ratio_x = (int) rint (rdimx / rdimy);
359 is_golden_ratio =
true;
363 ratio_y = (int) rint (rdimy / rdimx);
366 if (!is_golden_ratio) {
368 _(
"<b>Rectangle</b>: %s × %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"),
369 xs.c_str(), ys.c_str(), ratio_x, ratio_y);
373 _(
"<b>Rectangle</b>: %s × %s (constrained to golden ratio 1.618 : 1); with <b>Shift</b> to draw around the starting point"),
374 xs.c_str(), ys.c_str());
377 _(
"<b>Rectangle</b>: %s × %s (constrained to golden ratio 1 : 1.618); with <b>Shift</b> to draw around the starting point"),
378 xs.c_str(), ys.c_str());
383 _(
"<b>Rectangle</b>: %s × %s; with <b>Ctrl</b> to make square, integer-ratio, or golden-ratio rectangle; with <b>Shift</b> to draw around the starting point"),
384 xs.c_str(), ys.c_str());
405 this->
rect =
nullptr;
Affine inverse() const
Compute the inverse matrix.
CPoint min() const
Get the corner of the rectangle with smallest coordinate values.
CPoint dimensions() const
Get rectangle's width and height as a point.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
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.
Glib::ustring getEntryName() const
Get the last component of the preference's path.
double getDoubleLimited(double def=0.0, double min=DBL_MIN, double max=DBL_MAX, Glib::ustring const &unit="") const
Interpret the preference as a limited floating point value.
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.
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.
To do: update description of desktop.
SPDocument * getDocument() const
void setToolboxFocusTo(char const *label)
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.
Geom::Affine i2doc_affine() const
Returns the accumulated transformation of the item and all its ancestors, including root's viewport.
void doWriteTransform(Geom::Affine const &transform, Geom::Affine const *adv=nullptr, bool compensate=true)
Set a new transform on an object.
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 setRx(bool set, double value)
void setRy(bool set, double value)
void setPosition(double x, double y, double width, double height)
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.
constexpr double goldenratio
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.
Macro for icon names used in Inkscape.
Interface for locally managing a current status message.
static R & release(R &r)
Decrements the reference count of a anchored object.
void inspect_event(E &&event, Fs... funcs)
Perform pattern-matching on a CanvasEvent.
bool mod_ctrl_only(unsigned modifiers)
bool mod_shift_only(unsigned modifiers)
Geom::Rect snap_rectangular_box(SPDesktop const *desktop, SPItem *item, Geom::Point const &pt, Geom::Point const ¢er, int state)
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.
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