19#include <gdk/gdkkeysyms.h>
20#include <glibmm/i18n.h>
61 if (prefs->getBool(
"/tools/shapes/selcue")) {
65 if (prefs->getBool(
"/tools/shapes/gradientdrag")) {
101 auto defs = document->
getDefs();
103 for (
auto const &
child : defs->children) {
104 if (is<Persp3D>(&
child)) {
116 if (button_event.num_press == 1 && button_event.button == 1) {
131 int const snaps = prefs->getInt(
"/options/rotationsnapsperpi/value", 12);
132 tolerance = prefs->getIntLimited(
"/options/dragtolerance/value", 0, 0, 100);
134 auto cur_persp = document->getCurrentPersp3D();
140 if (event.num_press != 1 || event.button != 1) {
144 auto const button_w = event.pos;
167 cur_persp = document->getCurrentPersp3D();
193 auto const motion_w =
event.pos;
220 drag_ptC = pline.closest_to(motion_dt);
243 auto const motion_w =
event.pos;
253 if (event.button != 1) {
290 case GDK_KEY_KP_Down:
297 case GDK_KEY_bracketright:
298 document->getCurrentPersp3D()->rotate_VP (
Proj::X, 180 / snaps * y_dir,
mod_alt(event));
299 DocumentUndo::done(document, _(
"Change perspective (angle of PLs)"), INKSCAPE_ICON(
"draw-cuboid"));
303 case GDK_KEY_bracketleft:
304 document->getCurrentPersp3D()->rotate_VP (
Proj::X, -180 / snaps * y_dir,
mod_alt(event));
305 DocumentUndo::done(document, _(
"Change perspective (angle of PLs)"), INKSCAPE_ICON(
"draw-cuboid"));
309 case GDK_KEY_parenright:
310 document->getCurrentPersp3D()->rotate_VP (
Proj::Y, 180 / snaps * y_dir,
mod_alt(event));
311 DocumentUndo::done(document, _(
"Change perspective (angle of PLs)"), INKSCAPE_ICON(
"draw-cuboid"));
315 case GDK_KEY_parenleft:
316 document->getCurrentPersp3D()->rotate_VP (
Proj::Y, -180 / snaps * y_dir,
mod_alt(event));
317 DocumentUndo::done(document, _(
"Change perspective (angle of PLs)"), INKSCAPE_ICON(
"draw-cuboid"));
321 case GDK_KEY_braceright:
322 document->getCurrentPersp3D()->rotate_VP (
Proj::Z, 180 / snaps * y_dir,
mod_alt(event));
323 DocumentUndo::done(document, _(
"Change perspective (angle of PLs)"), INKSCAPE_ICON(
"draw-cuboid"));
327 case GDK_KEY_braceleft:
328 document->getCurrentPersp3D()->rotate_VP (
Proj::Z, -180 / snaps * y_dir,
mod_alt(event));
329 DocumentUndo::done(document, _(
"Change perspective (angle of PLs)"), INKSCAPE_ICON(
"draw-cuboid"));
344 if (document->getCurrentPersp3D()) {
345 document->getCurrentPersp3D()->print_debugging_info();
409 case GDK_KEY_KP_Delete:
410 case GDK_KEY_BackSpace:
441 for (
int i = 0; i < 6; ++i) {
449 side->front_or_rear = front_or_rear;
454 Glib::ustring descr =
"/desktop/";
455 descr += side->axes_string();
458 Glib::ustring cur_style = prefs->getString(descr);
460 bool use_current = prefs->getBool(
"/tools/shapes/3dbox/usecurrent",
false);
462 if (use_current && !cur_style.empty()) {
464 side->setAttribute(
"style", cur_style);
467 auto tool_path = Glib::ustring::compose(
"/tools/shapes/3dbox/%1", side->axes_string());
513 if (!doc || !doc->getCurrentPersp3D()) {
static Box3DSide * createBox3DSide(SPBox3D *box)
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()
Unselects all selected objects.
SPItem * singleItem()
Returns a single selected item.
std::list< Persp3D * > const perspList()
Returns a list of all perspectives which have a 3D box in the current selection.
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)
static void toggle_VPs(std::list< Persp3D * >, Proj::Axis axis)
static Persp3D * create_xml_element(SPDocument *document)
static SPBox3D * createBox3D(SPItem *parent)
Create a SPBox3D and append it to the parent.
void check_for_swapped_coords()
To do: update description of desktop.
SPDocument * getDocument() const
void setToolboxFocusTo(char const *label)
SPNamedView * getNamedView() const
Inkscape::Selection * getSelection() const
void applyCurrentOrToolStyle(SPObject *obj, Glib::ustring const &tool_path, bool with_text)
Apply the desktop's current style or the tool style to the object.
Geom::Affine const & w2d() const
Transformation from window to desktop coordinates (zoom/rotate).
Typed SVG document implementation.
void setCurrentPersp3D(Persp3D *const persp)
SPDefs * getDefs()
Return the main defs object for the document.
Base class for visual SVG elements.
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.
Editable view implementation.
TODO: insert short description here.
Macro for icon names used in Inkscape.
Interface for locally managing a current status message.
std::pair< Box3D::Axis, Box3D::FrontOrRear > int_to_face(unsigned id)
Box3D::Axis orth_plane_or_axis(Box3D::Axis axis)
Box3D::Axis extract_first_axis_direction(Box3D::Axis dirs)
Box3D::Axis extract_second_axis_direction(Box3D::Axis dirs)
bool is_plane(Box3D::Axis plane)
bool mod_alt(unsigned modifiers)
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)
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.
virtual EventType type() const =0
Return the dynamic type of the CanvasEvent.
Movement of the mouse pointer.