Code

Filter effects dialog:
[inkscape.git] / src / box3d-context.cpp
index f9b2a183824ea8af55f096c5baa28e4df7f10635..ada272acd2f88157d70d0758a84b55f5e36f74cc 100644 (file)
@@ -359,20 +359,14 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
             rc->ctrl_dragged  = event->motion.state & GDK_CONTROL_MASK;
 
             if (event->motion.state & GDK_SHIFT_MASK && !rc->extruded) {
-                /* once shift is pressed, set rc->extruded and create the remaining faces */
+                /* once shift is pressed, set rc->extruded (no need to create further faces;
+                   all of them are already created in sp_3dbox_init) */
                 rc->extruded = true;
-                
-                /* The separate faces */
-                SP3DBox *box3d = SP_3DBOX(rc->item);
-                for (int i = 0; i < 6; ++i) {
-                    if (i == 4 || box3d->faces[i]) continue;
-                    box3d->faces[i] = new Box3DFace (box3d);
-                    box3d->faces[i]->hook_path_to_3dbox();
-                }
             }
 
             if (!rc->extruded) {
                rc->drag_ptB = motion_dt;
+               rc->drag_ptC = motion_dt;
             } else {
                 // Without Ctrl, motion of the extruded corner is constrained to the
                 // perspective line from drag_ptB to vanishing point Y.
@@ -398,7 +392,6 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
             
             ret = TRUE;
         }
-        ret = TRUE;
         break;
     case GDK_BUTTON_RELEASE:
         event_context->xp = event_context->yp = 0;
@@ -529,14 +522,16 @@ static void sp_3dbox_drag(SP3DBoxContext &bc, guint state)
         repr->setAttribute("sodipodi:type", "inkscape:3dbox");
 
         /* Set style */
-        //sp_desktop_apply_style_tool (desktop, repr, "tools.shapes.3dbox", false);
+        sp_desktop_apply_style_tool (desktop, repr, "tools.shapes.3dbox", false);
 
         bc.item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
         Inkscape::GC::release(repr);
         bc.item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
 
-        /* Hook path to the only currenctly existing face */
-        SP_3DBOX(bc.item)->faces[4]->hook_path_to_3dbox();
+        /* Hook paths to the faces of the box */
+        for (int i = 0; i < 6; ++i) {
+            SP_3DBOX(bc.item)->faces[i]->hook_path_to_3dbox();
+        }
 
         bc.item->updateRepr();
 
@@ -582,7 +577,7 @@ static void sp_3dbox_finish(SP3DBoxContext *rc)
 
         sp_desktop_selection(desktop)->set(rc->item);
         sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_3DBOX,
-                         _("Create 3d box"));
+                         _("Create 3D box"));
 
         rc->item = NULL;
     }