Code

Remove second option for resizing 3D boxes (now we have 8 handles; the four front...
[inkscape.git] / src / box3d-context.cpp
1 #define __SP_3DBOX_CONTEXT_C__
3 /*
4  * 3D box drawing context
5  *
6  * Author:
7  *   Lauris Kaplinski <lauris@kaplinski.com>
8  *   bulia byak <buliabyak@users.sf.net>
9  *
10  * Copyright (C) 2007      Maximilian Albert <Anhalter42@gmx.de>
11  * Copyright (C) 2006      Johan Engelen <johan@shouraizou.nl>
12  * Copyright (C) 2000-2005 authors
13  * Copyright (C) 2000-2001 Ximian, Inc.
14  *
15  * Released under GNU GPL, read the file 'COPYING' for more information
16  */
18 #include "config.h"
20 #include <gdk/gdkkeysyms.h>
22 #include "macros.h"
23 #include "display/sp-canvas.h"
24 #include "document.h"
25 #include "sp-namedview.h"
26 #include "selection.h"
27 #include "desktop-handles.h"
28 #include "snap.h"
29 #include "display/curve.h"
30 #include "desktop.h"
31 #include "message-context.h"
32 #include "pixmaps/cursor-rect.xpm"
33 #include "box3d.h"
34 #include "box3d-context.h"
35 #include "sp-metrics.h"
36 #include <glibmm/i18n.h>
37 #include "object-edit.h"
38 #include "xml/repr.h"
39 #include "xml/node-event-vector.h"
40 #include "prefs-utils.h"
41 #include "context-fns.h"
43 static void sp_3dbox_context_class_init(SP3DBoxContextClass *klass);
44 static void sp_3dbox_context_init(SP3DBoxContext *box3d_context);
45 static void sp_3dbox_context_dispose(GObject *object);
47 static void sp_3dbox_context_setup(SPEventContext *ec);
48 static void sp_3dbox_context_set(SPEventContext *ec, gchar const *key, gchar const *val);
50 static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEvent *event);
51 static gint sp_3dbox_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event);
53 static void sp_3dbox_drag(SP3DBoxContext &bc, guint state);
54 static void sp_3dbox_finish(SP3DBoxContext *bc);
56 static SPEventContextClass *parent_class;
59 GtkType sp_3dbox_context_get_type()
60 {
61     static GType type = 0;
62     if (!type) {
63         GTypeInfo info = {
64             sizeof(SP3DBoxContextClass),
65             NULL, NULL,
66             (GClassInitFunc) sp_3dbox_context_class_init,
67             NULL, NULL,
68             sizeof(SP3DBoxContext),
69             4,
70             (GInstanceInitFunc) sp_3dbox_context_init,
71             NULL,    /* value_table */
72         };
73         type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SP3DBoxContext", &info, (GTypeFlags) 0);
74     }
75     return type;
76 }
78 static void sp_3dbox_context_class_init(SP3DBoxContextClass *klass)
79 {
80     GObjectClass *object_class = (GObjectClass *) klass;
81     SPEventContextClass *event_context_class = (SPEventContextClass *) klass;
83     parent_class = (SPEventContextClass *) g_type_class_peek_parent(klass);
85     object_class->dispose = sp_3dbox_context_dispose;
87     event_context_class->setup = sp_3dbox_context_setup;
88     event_context_class->set = sp_3dbox_context_set;
89     event_context_class->root_handler  = sp_3dbox_context_root_handler;
90     event_context_class->item_handler  = sp_3dbox_context_item_handler;
91 }
93 static void sp_3dbox_context_init(SP3DBoxContext *box3d_context)
94 {
95     SPEventContext *event_context = SP_EVENT_CONTEXT(box3d_context);
97     event_context->cursor_shape = cursor_rect_xpm;
98     event_context->hot_x = 4;
99     event_context->hot_y = 4;
100     event_context->xp = 0;
101     event_context->yp = 0;
102     event_context->tolerance = 0;
103     event_context->within_tolerance = false;
104     event_context->item_to_select = NULL;
106     event_context->shape_repr = NULL;
107     event_context->shape_knot_holder = NULL;
109     box3d_context->item = NULL;
111     box3d_context->ctrl_dragged = false;
112     box3d_context->extruded = false;
113     
114     box3d_context->_vpdrag = NULL;
116     new (&box3d_context->sel_changed_connection) sigc::connection();
119 static void sp_3dbox_context_dispose(GObject *object)
121     SP3DBoxContext *bc = SP_3DBOX_CONTEXT(object);
122     SPEventContext *ec = SP_EVENT_CONTEXT(object);
124     ec->enableGrDrag(false);
126     delete (bc->_vpdrag);
127     bc->_vpdrag = NULL;
129     bc->sel_changed_connection.disconnect();
130     bc->sel_changed_connection.~connection();
132     /* fixme: This is necessary because we do not grab */
133     if (bc->item) {
134         sp_3dbox_finish(bc);
135     }
137     if (ec->shape_knot_holder) {
138         sp_knot_holder_destroy(ec->shape_knot_holder);
139         ec->shape_knot_holder = NULL;
140     }
142     if (ec->shape_repr) { // remove old listener
143         sp_repr_remove_listener_by_data(ec->shape_repr, ec);
144         Inkscape::GC::release(ec->shape_repr);
145         ec->shape_repr = 0;
146     }
148     if (bc->_message_context) {
149         delete bc->_message_context;
150     }
152     G_OBJECT_CLASS(parent_class)->dispose(object);
155 static Inkscape::XML::NodeEventVector ec_shape_repr_events = {
156     NULL, /* child_added */
157     NULL, /* child_removed */
158     ec_shape_event_attr_changed,
159     NULL, /* content_changed */
160     NULL  /* order_changed */
161 };
163 /**
164 \brief  Callback that processes the "changed" signal on the selection;
165 destroys old and creates new knotholder
166 */
167 void sp_3dbox_context_selection_changed(Inkscape::Selection *selection, gpointer data)
169     SP3DBoxContext *bc = SP_3DBOX_CONTEXT(data);
170     SPEventContext *ec = SP_EVENT_CONTEXT(bc);
172     if (ec->shape_knot_holder) { // destroy knotholder
173         sp_knot_holder_destroy(ec->shape_knot_holder);
174         ec->shape_knot_holder = NULL;
175     }
177     if (ec->shape_repr) { // remove old listener
178         sp_repr_remove_listener_by_data(ec->shape_repr, ec);
179         Inkscape::GC::release(ec->shape_repr);
180         ec->shape_repr = 0;
181     }
183     SPItem *item = selection->singleItem();
184     if (item) {
185         ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
186         Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
187         if (shape_repr) {
188             ec->shape_repr = shape_repr;
189             Inkscape::GC::anchor(shape_repr);
190             sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
191         }
192         if (SP_IS_3DBOX (item)) {
193             bc->_vpdrag->document->current_perspective = bc->_vpdrag->document->get_persp_of_box (SP_3DBOX (item));
194         }
195     } else {
196         /* If several boxes sharing the same perspective are selected,
197            we can still set the current selection accordingly */
198         std::set<Box3D::Perspective3D *> perspectives;
199         for (GSList *i = (GSList *) selection->itemList(); i != NULL; i = i->next) {
200             if (SP_IS_3DBOX (i->data)) {
201                 perspectives.insert (bc->_vpdrag->document->get_persp_of_box (SP_3DBOX (i->data)));
202             }
203         }
204         if (perspectives.size() == 1) {
205             bc->_vpdrag->document->current_perspective = *(perspectives.begin());
206         }
207         // TODO: What to do if several boxes with different perspectives are selected?
208     }
211 static void sp_3dbox_context_setup(SPEventContext *ec)
213     SP3DBoxContext *bc = SP_3DBOX_CONTEXT(ec);
215     if (((SPEventContextClass *) parent_class)->setup) {
216         ((SPEventContextClass *) parent_class)->setup(ec);
217     }
219     SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
220     if (item) {
221         ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop);
222         Inkscape::XML::Node *shape_repr = SP_OBJECT_REPR(item);
223         if (shape_repr) {
224             ec->shape_repr = shape_repr;
225             Inkscape::GC::anchor(shape_repr);
226             sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
227         }
228     }
230     bc->sel_changed_connection.disconnect();
231     bc->sel_changed_connection = sp_desktop_selection(ec->desktop)->connectChanged(
232         sigc::bind(sigc::ptr_fun(&sp_3dbox_context_selection_changed), (gpointer)bc)
233     );
235     bc->_vpdrag = new Box3D::VPDrag(sp_desktop_document (ec->desktop));
237     if (prefs_get_int_attribute("tools.shapes", "selcue", 0) != 0) {
238         ec->enableSelectionCue();
239     }
241     if (prefs_get_int_attribute("tools.shapes", "gradientdrag", 0) != 0) {
242         ec->enableGrDrag();
243     }
245     bc->_message_context = new Inkscape::MessageContext((ec->desktop)->messageStack());
248 static void sp_3dbox_context_set(SPEventContext *ec, gchar const *key, gchar const *val)
250     //SP3DBoxContext *bc = SP_3DBOX_CONTEXT(ec);
252     /* fixme: Proper error handling for non-numeric data.  Use a locale-independent function like
253      * g_ascii_strtod (or a thin wrapper that does the right thing for invalid values inf/nan). */
254     /**
255     if ( strcmp(key, "rx") == 0 ) {
256         bc->rx = ( val
257                          ? g_ascii_strtod (val, NULL)
258                          : 0.0 );
259     } else if ( strcmp(key, "ry") == 0 ) {
260         bc->ry = ( val
261                          ? g_ascii_strtod (val, NULL)
262                          : 0.0 );
263     }
264     **/
267 static gint sp_3dbox_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event)
269     SPDesktop *desktop = event_context->desktop;
271     gint ret = FALSE;
273     switch (event->type) {
274     case GDK_BUTTON_PRESS:
275         if ( event->button.button == 1 && !event_context->space_panning) {
276             Inkscape::setup_for_drag_start(desktop, event_context, event);
277             ret = TRUE;
278         }
279         break;
280         // motion and release are always on root (why?)
281     default:
282         break;
283     }
285     if (((SPEventContextClass *) parent_class)->item_handler) {
286         ret = ((SPEventContextClass *) parent_class)->item_handler(event_context, item, event);
287     }
289     return ret;
292 static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEvent *event)
294     static bool dragging;
296     SPDesktop *desktop = event_context->desktop;
297     Inkscape::Selection *selection = sp_desktop_selection (desktop);
299     SP3DBoxContext *bc = SP_3DBOX_CONTEXT(event_context);
301     event_context->tolerance = prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100);
303     gint ret = FALSE;
304     switch (event->type) {
305     case GDK_BUTTON_PRESS:
306         if ( event->button.button == 1  && !event_context->space_panning) {
307             NR::Point const button_w(event->button.x,
308                                      event->button.y);
310             // save drag origin
311             event_context->xp = (gint) button_w[NR::X];
312             event_context->yp = (gint) button_w[NR::Y];
313             event_context->within_tolerance = true;
314             
315             // remember clicked item, disregarding groups, honoring Alt
316             event_context->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, event->button.state & GDK_CONTROL_MASK);
318             dragging = true;
319             
320             /* Position center */
321             NR::Point const button_dt(desktop->w2d(button_w));
322             bc->drag_origin = button_dt;
323             bc->drag_ptB = button_dt;
324             bc->drag_ptC = button_dt;
326             /* Snap center */
327             SnapManager const &m = desktop->namedview->snap_manager;
328             bc->center = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE,
329                                     button_dt, bc->item).getPoint();
331             sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
332                                 ( GDK_KEY_PRESS_MASK |
333                                   GDK_BUTTON_RELEASE_MASK       |
334                                   GDK_POINTER_MOTION_MASK       |
335                                   GDK_BUTTON_PRESS_MASK ),
336                                 NULL, event->button.time);
337             ret = TRUE;
338         }
339         break;
340     case GDK_MOTION_NOTIFY:
341         if ( dragging
342              && ( event->motion.state & GDK_BUTTON1_MASK )  && !event_context->space_panning)
343         {
344             if ( event_context->within_tolerance
345                  && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
346                  && ( abs( (gint) event->motion.y - event_context->yp ) < event_context->tolerance ) ) {
347                 break; // do not drag if we're within tolerance from origin
348             }
349             // Once the user has moved farther than tolerance from the original location
350             // (indicating they intend to draw, not click), then always process the
351             // motion notify coordinates as given (no snapping back to origin)
352             event_context->within_tolerance = false;
354             NR::Point const motion_w(event->motion.x,
355                                      event->motion.y);
356             NR::Point motion_dt(desktop->w2d(motion_w));
358             SnapManager const &m = desktop->namedview->snap_manager;
359             motion_dt = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt, bc->item).getPoint();
361             bc->ctrl_dragged  = event->motion.state & GDK_CONTROL_MASK;
363             if (event->motion.state & GDK_SHIFT_MASK && !bc->extruded) {
364                 /* once shift is pressed, set bc->extruded (no need to create further faces;
365                    all of them are already created in sp_3dbox_init) */
366                 bc->extruded = true;
367             }
369             if (!bc->extruded) {
370                 bc->drag_ptB = motion_dt;
371                 bc->drag_ptC = motion_dt;
372             } else {
373                 // Without Ctrl, motion of the extruded corner is constrained to the
374                 // perspective line from drag_ptB to vanishing point Y.
375                 if (!bc->ctrl_dragged) {
376                         bc->drag_ptC = Box3D::perspective_line_snap (bc->drag_ptB, Box3D::Z, motion_dt, bc->_vpdrag->document->current_perspective);
377                 } else {
378                     bc->drag_ptC = motion_dt;
379                 }
380                 bc->drag_ptC = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, bc->drag_ptC, bc->item).getPoint();
381                 if (bc->ctrl_dragged) {
382                         Box3D::PerspectiveLine pl1 (NR::Point (event_context->xp, event_context->yp), Box3D::Y, bc->_vpdrag->document->current_perspective);
383                         Box3D::PerspectiveLine pl2 (bc->drag_ptB, Box3D::X, bc->_vpdrag->document->current_perspective);
384                         NR::Point corner1 = pl1.meet(pl2);
385                         
386                         Box3D::PerspectiveLine pl3 (corner1, Box3D::X, bc->_vpdrag->document->current_perspective);
387                         Box3D::PerspectiveLine pl4 (bc->drag_ptC, Box3D::Z, bc->_vpdrag->document->current_perspective);
388                         bc->drag_ptB = pl3.meet(pl4);
389                 }
390             }
391             
392             
393             sp_3dbox_drag(*bc, event->motion.state);
394             
395             ret = TRUE;
396         }
397         break;
398     case GDK_BUTTON_RELEASE:
399         event_context->xp = event_context->yp = 0;
400         if ( event->button.button == 1  && !event_context->space_panning) {
401             dragging = false;
403             if (!event_context->within_tolerance) {
404                 // we've been dragging, finish the box
405                 sp_3dbox_finish(bc);
406             } else if (event_context->item_to_select) {
407                 // no dragging, select clicked item if any
408                 if (event->button.state & GDK_SHIFT_MASK) {
409                     selection->toggle(event_context->item_to_select);
410                 } else {
411                     selection->set(event_context->item_to_select);
412                 }
413             } else {
414                 // click in an empty space
415                 selection->clear();
416             }
418             event_context->item_to_select = NULL;
419             ret = TRUE;
420             sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
421                                   event->button.time);
422         }
423         break;
424     case GDK_KEY_PRESS:
425         switch (get_group0_keyval (&event->key)) {
426         case GDK_Alt_L:
427         case GDK_Alt_R:
428         case GDK_Control_L:
429         case GDK_Control_R:
430         case GDK_Shift_L:
431         case GDK_Shift_R:
432         case GDK_Meta_L:  // Meta is when you press Shift+Alt (at least on my machine)
433         case GDK_Meta_R:
434             /***
435             if (!dragging){
436                 sp_event_show_modifier_tip (event_context->defaultMessageContext(), event,
437                                             _("<b>Ctrl</b>: make square or integer-ratio rect, lock a rounded corner circular"),
438                                             _("<b>Shift</b>: draw around the starting point"),
439                                             NULL);
440             }
441             ***/
442             break;
443         case GDK_Up:
444         case GDK_Down:
445         case GDK_KP_Up:
446         case GDK_KP_Down:
447             // prevent the zoom field from activation
448             if (!MOD__CTRL_ONLY)
449                 ret = TRUE;
450             break;
452         case GDK_I:
453             Box3D::Perspective3D::print_debugging_info();
454             ret = true;
455             break;
457         case GDK_L:
458         case GDK_l:
459             bc->_vpdrag->show_lines = !bc->_vpdrag->show_lines;
460             bc->_vpdrag->updateLines();
461             ret = true;
462             break;
464         case GDK_A:
465         case GDK_a:
466             if (MOD__CTRL) break; // Don't catch Ctrl+A ("select all")
467             if (bc->_vpdrag->show_lines) {
468                 bc->_vpdrag->front_or_rear_lines = bc->_vpdrag->front_or_rear_lines ^ 0x2; // toggle rear PLs
469             }
470             bc->_vpdrag->updateLines();
471             ret = true;
472             break;
474         case GDK_x:
475         case GDK_X:
476         {
477             if (MOD__CTRL) break; // Don't catch Ctrl+X ('cut') and Ctrl+Shift+X ('open XML editor')
478             Inkscape::Selection *selection = sp_desktop_selection (inkscape_active_desktop());
479             for (GSList const *i = selection->itemList(); i != NULL; i = i->next) {
480                 if (!SP_IS_3DBOX (i->data)) continue;
481                 sp_3dbox_switch_front_face (SP_3DBOX (i->data), Box3D::X);
482              }
483             bc->_vpdrag->updateLines();
484             ret = true;
485             break;
486         }
487  
488         case GDK_y:
489         case GDK_Y:
490         {
491             if (MOD__CTRL) break; // Don't catch Ctrl+Y ("redo")
492             Inkscape::Selection *selection = sp_desktop_selection (inkscape_active_desktop());
493             for (GSList const *i = selection->itemList(); i != NULL; i = i->next) {
494                 if (!SP_IS_3DBOX (i->data)) continue;
495                 sp_3dbox_switch_front_face (SP_3DBOX (i->data), Box3D::Y);
496             }
497             bc->_vpdrag->updateLines();
498             ret = true;
499             break;
500         }
502         case GDK_z:
503         case GDK_Z:
504         {
505             if (MOD__CTRL) break; // Don't catch Ctrl+Z ("undo")
506             Inkscape::Selection *selection = sp_desktop_selection (inkscape_active_desktop());
507             for (GSList const *i = selection->itemList(); i != NULL; i = i->next) {
508                 if (!SP_IS_3DBOX (i->data)) continue;
509                 sp_3dbox_switch_front_face (SP_3DBOX (i->data), Box3D::Z);
510             }
511             bc->_vpdrag->updateLines();
512             ret = true;
513             break;
514         }
516         case GDK_Escape:
517             sp_desktop_selection(desktop)->clear();
518             //TODO: make dragging escapable by Esc
519             break;
521         case GDK_space:
522             if (dragging) {
523                 sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate),
524                                       event->button.time);
525                 dragging = false;
526                 if (!event_context->within_tolerance) {
527                     // we've been dragging, finish the box
528                     sp_3dbox_finish(bc);
529                 }
530                 // do not return true, so that space would work switching to selector
531             }
532             break;
534         default:
535             break;
536         }
537         break;
538     case GDK_KEY_RELEASE:
539         switch (get_group0_keyval (&event->key)) {
540         case GDK_Alt_L:
541         case GDK_Alt_R:
542         case GDK_Control_L:
543         case GDK_Control_R:
544         case GDK_Shift_L:
545         case GDK_Shift_R:
546         case GDK_Meta_L:  // Meta is when you press Shift+Alt
547         case GDK_Meta_R:
548             event_context->defaultMessageContext()->clear();
549             break;
550         default:
551             break;
552         }
553         break;
554     default:
555         break;
556     }
558     if (!ret) {
559         if (((SPEventContextClass *) parent_class)->root_handler) {
560             ret = ((SPEventContextClass *) parent_class)->root_handler(event_context, event);
561         }
562     }
564     return ret;
567 static void sp_3dbox_drag(SP3DBoxContext &bc, guint state)
569     SPDesktop *desktop = SP_EVENT_CONTEXT(&bc)->desktop;
571     if (!bc.item) {
573         if (Inkscape::have_viable_layer(desktop, bc._message_context) == false) {
574             return;
575         }
577         /* Create object */
578         Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(&bc));
579         Inkscape::XML::Node *repr = xml_doc->createElement("svg:g");
580         repr->setAttribute("sodipodi:type", "inkscape:3dbox");
582         /* Set style */
583         sp_desktop_apply_style_tool (desktop, repr, "tools.shapes.3dbox", false);
585         bc.item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
586         Inkscape::GC::release(repr);
587         bc.item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
589         /* Hook paths to the faces of the box */
590         for (int i = 0; i < 6; ++i) {
591             SP_3DBOX(bc.item)->faces[i]->hook_path_to_3dbox();
592         }
594         bc.item->updateRepr();
595         sp_3dbox_set_z_orders (SP_3DBOX (bc.item));
597         // TODO: It would be nice to show the VPs during dragging, but since there is no selection
598         //       at this point (only after finishing the box), we must do this "manually"
599         bc._vpdrag->updateDraggers();
601         sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
602     }
604     // FIXME: remove these extra points
605     NR::Point pt = bc.drag_ptB;
606     NR::Point shift_pt = bc.drag_ptC;
608     NR::Rect r;
609     if (!(state & GDK_SHIFT_MASK)) {
610         r = Inkscape::snap_rectangular_box(desktop, bc.item, pt, bc.center, state);
611     } else {
612         r = Inkscape::snap_rectangular_box(desktop, bc.item, shift_pt, bc.center, state);
613     }
615     SPEventContext *ec = SP_EVENT_CONTEXT(&bc);
616     NR::Point origin_w(ec->xp, ec->yp);
617     NR::Point origin(desktop->w2d(origin_w));
618     sp_3dbox_position_set(bc);
619     sp_3dbox_set_z_orders (SP_3DBOX (bc.item));
621     // status text
622     //GString *Ax = SP_PX_TO_METRIC_STRING(origin[NR::X], desktop->namedview->getDefaultMetric());
623     //GString *Ay = SP_PX_TO_METRIC_STRING(origin[NR::Y], desktop->namedview->getDefaultMetric());
624     bc._message_context->setF(Inkscape::NORMAL_MESSAGE, _("<b>3D Box</b>; with <b>Shift</b> to extrude along the Z axis"));
625     //g_string_free(Ax, FALSE);
626     //g_string_free(Ay, FALSE);
629 static void sp_3dbox_finish(SP3DBoxContext *bc)
631     bc->_message_context->clear();
633     if ( bc->item != NULL ) {
634         SPDesktop * desktop;
636         desktop = SP_EVENT_CONTEXT_DESKTOP(bc);
638         SP_OBJECT(bc->item)->updateRepr();
639         sp_3dbox_set_ratios(SP_3DBOX(bc->item));
641         sp_canvas_end_forced_full_redraws(desktop->canvas);
643         sp_desktop_selection(desktop)->set(bc->item);
644         sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX,
645                          _("Create 3D box"));
647         bc->item = NULL;
648     }
650     bc->ctrl_dragged = false;
651     bc->extruded = false;
654 /*
655   Local Variables:
656   mode:c++
657   c-file-style:"stroustrup"
658   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
659   indent-tabs-mode:nil
660   fill-column:99
661   End:
662 */
663 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :