22#include <glibmm/i18n.h>
23#include <gdk/gdkkeysyms.h>
68 if (prefs->
getBool(
"/tools/shapes/selcue")) {
72 if (prefs->
getBool(
"/tools/shapes/gradientdrag")) {
109 if (event.num_press == 1 && event.button == 1) {
110 setup_for_drag_start(event);
125 tolerance = prefs->getIntLimited(
"/options/dragtolerance/value", 0, 0, 100);
131 if (event.num_press == 1 && event.button == 1) {
134 setup_for_drag_start(event);
135 center = _desktop->w2d(event.pos);
138 auto &m = _desktop->getNamedView()->snap_manager;
140 m.freeSnapReturnByRef(center, SNAPSOURCE_NODE_HANDLE);
171 if (
dragging && event.button == 1) {
200 case GDK_KEY_Control_L:
201 case GDK_KEY_Control_R:
202 case GDK_KEY_Shift_L:
203 case GDK_KEY_Shift_R:
208 _(
"<b>Ctrl</b>: make circle or integer-ratio ellipse, snap arc/segment angle"),
209 _(
"<b>Shift</b>: draw around the starting point"),
210 _(
"<b>Alt</b>: snap ellipse to mouse pointer"));
247 case GDK_KEY_KP_Delete:
248 case GDK_KEY_BackSpace:
257 switch (event.keyval) {
260 case GDK_KEY_Control_L:
261 case GDK_KEY_Control_R:
262 case GDK_KEY_Shift_L:
263 case GDK_KEY_Shift_R:
295 this->
arc = cast<SPGenericEllipse>(layer->appendChildRepr(repr));
350 if (state & GDK_CONTROL_MASK) {
351 int ratio_x, ratio_y;
352 bool is_golden_ratio =
false;
354 if (fabs (rdimx) > fabs (rdimy)) {
356 is_golden_ratio =
true;
359 ratio_x = (int) rint (rdimx / rdimy);
363 is_golden_ratio =
true;
367 ratio_y = (int) rint (rdimy / rdimx);
370 if (!is_golden_ratio) {
372 _(
"<b>Ellipse</b>: %s × %s (constrained to ratio %d:%d); with <b>Shift</b> to draw around the starting point"),
373 xs.c_str(), ys.c_str(), ratio_x, ratio_y);
377 _(
"<b>Ellipse</b>: %s × %s (constrained to golden ratio 1.618 : 1); with <b>Shift</b> to draw around the starting point"),
378 xs.c_str(), ys.c_str());
381 _(
"<b>Ellipse</b>: %s × %s (constrained to golden ratio 1 : 1.618); with <b>Shift</b> to draw around the starting point"),
382 xs.c_str(), ys.c_str());
386 this->
message_context->setF(
Inkscape::IMMEDIATE_MESSAGE, _(
"<b>Ellipse</b>: %s × %s; with <b>Ctrl</b> to make circle, integer-ratio, or golden-ratio ellipse; with <b>Shift</b> to draw around the starting point"), xs.c_str(), ys.c_str());
395 if (this->
arc->
rx.
computed == 0 || this->arc->ry.computed == 0) {
3x3 matrix representing an affine transformation.
Affine inverse() const
Compute the inverse matrix.
CPoint midpoint() const
Get the point in the geometric center of the rectangle.
CPoint dimensions() const
Get rectangle's width and height as a point.
Two-dimensional point that doubles as a vector.
Coord length() const
Compute the distance from origin.
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
bool active(int button_state) const
Test if this modifier is currently active.
static Modifier * get(Type index)
A function to turn an enum index into a modifier object.
void clear()
Unselects all selected objects.
SPItem * singleItem()
Returns a single selected item.
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.
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)
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.
void position_set(double x, double y, double rx, double ry)
Base class for visual SVG elements.
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 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)
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.
Singleton class to access the preferences file in a convenient way.
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