Code

Clean up comments and remove (already commented) debugging messages
authorcilix42 <cilix42@users.sourceforge.net>
Fri, 22 Feb 2008 21:28:01 +0000 (21:28 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Fri, 22 Feb 2008 21:28:01 +0000 (21:28 +0000)
src/axis-manip.h
src/box3d-context.cpp
src/box3d-side.cpp
src/box3d-side.h
src/box3d.cpp
src/box3d.h
src/persp3d-reference.cpp
src/persp3d.cpp
src/persp3d.h
src/vanishing-point.cpp

index e39a27d128148bb55895f51f30fe210e0a5ef957..835f67a97458be83be920b22a088d2652804bcd8 100644 (file)
@@ -134,50 +134,7 @@ inline Box3D::Axis toAffine(Proj::Axis axis) {
 
 namespace Box3D {
 
-// Given a bit sequence that unambiguously specifies the face of a 3D box,
-// return a number between 0 and 5 corresponding to that particular face
-// (which is normally used to index an array). Return -1 if the bit sequence
-// does not specify a face. A face can either be given by its plane (e.g, XY)
-// or by the axis that is orthogonal to it (e.g., Z).
-/***
-inline gint face_to_int (guint face_id) {
-    switch (face_id) {
-      case 1:  return 0;
-      case 2:  return 2;
-      case 4:  return 4;
-      case 3:  return 4;
-      case 5:  return 2;
-      case 6:  return 0;
-
-      case 9:  return 1;
-      case 10: return 3;
-      case 12: return 5;
-      case 11: return 5;
-      case 13: return 3;
-      case 14: return 1;
-
-    default: return -1;
-    }
-}
-***/
-
-/***
-inline gint int_to_face (guint id) {
-    switch (id) {
-      case 0: return  6;
-      case 1: return 14;
-      case 2: return  5;
-      case 3: return 13;
-      case 4: return  3;
-      case 5: return 11;
-
-    default: return -1;
-    }
-}
-***/
-
 /* 
- * New version:
  * Identify the axes X, Y, Z with the numbers 0, 1, 2.
  * A box's face is identified by the axis perpendicular to it.
  * For a rear face, add 3.
@@ -247,17 +204,6 @@ inline bool is_single_axis_direction (Box3D::Axis dir) {
     return (!(dir & (dir - 1)) && dir);
 }
 
-/***
-// Warning: We don't check that axis really unambiguously specifies a plane.
-//          Make sure this is the case when calling this function.
-inline gint face_containing_corner (Box3D::Axis axis, guint corner) {
-    if (!is_single_axis_direction (axis)) {
-        axis = (Box3D::Axis) (axis ^ Box3D::XYZ);
-    }
-    return face_to_int (axis ^ ((corner & axis) ? Box3D::REAR : Box3D::FRONT));
-}
-***/
-
 /**
  * Given two axis directions out of {X, Y, Z} or the corresponding plane, return the remaining one
  * We don't check if 'plane' really specifies a plane (i.e., if it consists of precisely two directions).
index 6450fa6d40a7a01a392f49d7668e1f149ac430ac..a1e033955cc98761b2c8b853123d039bc39b2660 100644 (file)
@@ -46,7 +46,7 @@
 #include "perspective-line.h"
 #include "persp3d.h"
 #include "box3d-side.h"
-#include "document-private.h" // for debugging (see case GDK_P)
+#include "document-private.h"
 #include "line-geometry.h"
 
 static void sp_box3d_context_class_init(Box3DContextClass *klass);
@@ -400,19 +400,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
                     bc->drag_ptC_proj = cur_persp->tmat.preimage (motion_dt, bc->drag_ptB_proj[Proj::X], Proj::X);
                 }
                 bc->drag_ptC = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, bc->drag_ptC, bc->item).getPoint();
-                if (bc->ctrl_dragged) {
-                    g_print ("TODO: What should happen here?\n");
-                    // Update bc->drag_ptB in case we are ctrl-dragging
-                    /***
-                    Box3D::PerspectiveLine pl1 (NR::Point (event_context->xp, event_context->yp), Box3D::Y, bc->_vpdrag->document->current_perspective);
-                    Box3D::PerspectiveLine pl2 (bc->drag_ptB, Box3D::X, bc->_vpdrag->document->current_perspective);
-                    NR::Point corner1 = pl1.meet(pl2);
-                       
-                    Box3D::PerspectiveLine pl3 (corner1, Box3D::X, bc->_vpdrag->document->current_perspective);
-                    Box3D::PerspectiveLine pl4 (bc->drag_ptC, Box3D::Z, bc->_vpdrag->document->current_perspective);
-                    bc->drag_ptB = pl3.meet(pl4);
-                    ***/
-                }
             }
 
             sp_box3d_drag(*bc, event->motion.state);
@@ -448,23 +435,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
         break;
     case GDK_KEY_PRESS:
         switch (get_group0_keyval (&event->key)) {
-        case GDK_Alt_L:
-        case GDK_Alt_R:
-        case GDK_Control_L:
-        case GDK_Control_R:
-        case GDK_Shift_L:
-        case GDK_Shift_R:
-        case GDK_Meta_L:  // Meta is when you press Shift+Alt (at least on my machine)
-        case GDK_Meta_R:
-            /***
-            if (!dragging){
-                sp_event_show_modifier_tip (event_context->defaultMessageContext(), event,
-                                            _("<b>Ctrl</b>: make square or integer-ratio rect, lock a rounded corner circular"),
-                                            _("<b>Shift</b>: draw around the starting point"),
-                                            NULL);
-            }
-            ***/
-            break;
         case GDK_Up:
         case GDK_Down:
         case GDK_KP_Up:
@@ -524,15 +494,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
             ret = true;
             break;
 
-        case GDK_I:
-            if (MOD__ALT) {
-                persp3d_print_debugging_info_all (inkscape_active_document());
-            } else {
-                persp3d_print_debugging_info (inkscape_active_document()->current_persp3d);
-            }
-            ret = true;
-            break;
-
         case GDK_g:
         case GDK_G:
             if (MOD__SHIFT_ONLY) {
@@ -541,38 +502,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
             }
             break;
 
-        case GDK_P:
-        {
-            if (MOD__SHIFT && MOD__CTRL) break; // Don't catch Shift+Ctrl+P (Preferences dialog)
-            SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(SP_ACTIVE_DOCUMENT);
-            g_print ("=== Persp3D Objects: ==============================\n");
-            for (SPObject *i = sp_object_first_child(SP_OBJECT(defs)); i != NULL; i = SP_OBJECT_NEXT(i) ) {
-                g_print ("Object encountered\n");
-                if (SP_IS_PERSP3D(i)) {
-                    //g_print ("Encountered a Persp3D in defs\n");
-                    SP_PERSP3D(i)->tmat.print();
-                    g_print ("\n");
-                    g_print ("Computing preimage of point (300, 400)\n");
-                    SP_PERSP3D(i)->tmat.preimage (NR::Point (300, 400), 0, Proj::Z);
-                    g_print ("Computing preimage of point (200, 500)\n");
-                    SP_PERSP3D(i)->tmat.preimage (NR::Point (200, 500), 0, Proj::Z);
-                }
-            }
-            g_print ("===================================================\n");
-
-            ret = true;
-            break;
-        }
-
-        case GDK_V:
-            if (bc->_vpdrag) {
-                bc->_vpdrag->printDraggers();
-                ret = true;
-            } else {
-                g_print ("No VPDrag in Box3DContext.\n");
-            }
-            break;
-
         case GDK_x:
         case GDK_X:
             if (MOD__ALT_ONLY) {
@@ -626,22 +555,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
             break;
         }
         break;
-    case GDK_KEY_RELEASE:
-        switch (get_group0_keyval (&event->key)) {
-        case GDK_Alt_L:
-        case GDK_Alt_R:
-        case GDK_Control_L:
-        case GDK_Control_R:
-        case GDK_Shift_L:
-        case GDK_Shift_R:
-        case GDK_Meta_L:  // Meta is when you press Shift+Alt
-        case GDK_Meta_R:
-            event_context->defaultMessageContext()->clear();
-            break;
-        default:
-            break;
-        }
-        break;
     default:
         break;
     }
@@ -675,7 +588,6 @@ static void sp_box3d_drag(Box3DContext &bc, guint /*state*/)
 
         bc.item = (SPItem *) desktop->currentLayer()->appendChildRepr(repr);
         Inkscape::GC::release(repr);
-        /**** bc.item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer()); ****/
         Inkscape::XML::Node *repr_side;
         // TODO: Incorporate this in box3d-side.cpp!
         for (int i = 0; i < 6; ++i) {
@@ -725,18 +637,13 @@ static void sp_box3d_drag(Box3DContext &bc, guint /*state*/)
     box3d_position_set(box);
 
     // status text
-    //GString *Ax = SP_PX_TO_METRIC_STRING(origin[NR::X], desktop->namedview->getDefaultMetric());
-    //GString *Ay = SP_PX_TO_METRIC_STRING(origin[NR::Y], desktop->namedview->getDefaultMetric());
     bc._message_context->setF(Inkscape::NORMAL_MESSAGE, _("<b>3D Box</b>; with <b>Shift</b> to extrude along the Z axis"));
-    //g_string_free(Ax, FALSE);
-    //g_string_free(Ay, FALSE);
 }
 
 static void sp_box3d_finish(Box3DContext *bc)
 {
     bc->_message_context->clear();
     g_assert (SP_ACTIVE_DOCUMENT->current_persp3d);
-    //Persp3D *cur_persp = SP_ACTIVE_DOCUMENT->current_persp3d;
 
     if ( bc->item != NULL ) {
         SPDesktop * desktop = SP_EVENT_CONTEXT_DESKTOP(bc);
index 9db03c584eec19a6c7d5f6e4df94cb5a761d7442..e3d661e1823a7d39cf2b7ce7652fa920c7ba5504 100644 (file)
@@ -33,15 +33,10 @@ static Inkscape::XML::Node *box3d_side_write (SPObject *object, Inkscape::XML::N
 static void box3d_side_set (SPObject *object, unsigned int key, const gchar *value);
 static void box3d_side_update (SPObject *object, SPCtx *ctx, guint flags);
 
-//static gchar * box3d_side_description (SPItem * item);
-//static void box3d_side_snappoints(SPItem const *item, SnapPointsIter p);
-
-//static void box3d_side_set_shape (SPShape *shape);
-//static void box3d_side_update_patheffect (SPShape *shape, bool write);
+static void box3d_side_set_shape (SPShape *shape);
 
 static Proj::Pt3 box3d_side_corner (Box3DSide *side, guint index);
 static std::vector<Proj::Pt3> box3d_side_corners (Box3DSide *side);
-// static gint box3d_side_descr_to_id (gchar const *descr);
 
 static SPShapeClass *parent_class;
 
@@ -88,11 +83,7 @@ box3d_side_class_init (Box3DSideClass *klass)
     sp_object_class->set = box3d_side_set;
     sp_object_class->update = box3d_side_update;
 
-    //item_class->description = box3d_side_description;
-    //item_class->snappoints = box3d_side_snappoints;
-
     shape_class->set_shape = box3d_side_set_shape;
-    //shape_class->update_patheffect = box3d_side_update_patheffect;
 }
 
 static void
@@ -191,7 +182,6 @@ box3d_side_update (SPObject *object, SPCtx *ctx, guint flags)
         flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // since we change the description, it's not a "just translation" anymore
     }
 
-    //g_print ("box3d_side_update\n");
     if (flags & (SP_OBJECT_MODIFIED_FLAG |
                  SP_OBJECT_STYLE_MODIFIED_FLAG |
                  SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
@@ -202,52 +192,6 @@ box3d_side_update (SPObject *object, SPCtx *ctx, guint flags)
         ((SPObjectClass *) parent_class)->update (object, ctx, flags);
 }
 
-/***
-static void
-box3d_side_update_patheffect(SPShape *shape, bool write)
-{
-    box3d_side_set_shape(shape);
-
-    if (write) {
-        Inkscape::XML::Node *repr = SP_OBJECT_REPR(shape);
-        if ( shape->curve != NULL ) {
-            NArtBpath *abp = sp_curve_first_bpath(shape->curve);
-            if (abp) {
-                gchar *str = sp_svg_write_path(abp);
-                repr->setAttribute("d", str);
-                g_free(str);
-            } else {
-                repr->setAttribute("d", "");
-            }
-        } else {
-            repr->setAttribute("d", NULL);
-        }
-    }
-
-    ((SPObject *)shape)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
-}
-***/
-
-/***
-static gchar *
-box3d_side_description (SPItem *item)
-{
-    Box3DSide *side = SP_BOX3D_SIDE (item);
-
-    // while there will never be less than 3 vertices, we still need to
-    // make calls to ngettext because the pluralization may be different
-    // for various numbers >=3.  The singular form is used as the index.
-    if (side->flatsided == false )
-       return g_strdup_printf (ngettext("<b>Star</b> with %d vertex",
-                                        "<b>Star</b> with %d vertices",
-                                        star->sides), star->sides);
-    else
-        return g_strdup_printf (ngettext("<b>Polygon</b> with %d vertex",
-                                        "<b>Polygon</b> with %d vertices",
-                                        star->sides), star->sides);
-}
-***/
-
 void
 box3d_side_position_set (Box3DSide *side) {
     box3d_side_set_shape (SP_SHAPE (side));
@@ -259,7 +203,6 @@ box3d_side_position_set (Box3DSide *side) {
 void
 box3d_side_set_shape (SPShape *shape)
 {
-    //g_print ("box3d_side_set_shape\n");
     Box3DSide *side = SP_BOX3D_SIDE (shape);
     if (!SP_OBJECT_DOCUMENT(side)->root) {
         // avoid a warning caused by sp_document_height() (which is called from sp_item_i2d_affine() below)
@@ -269,19 +212,11 @@ box3d_side_set_shape (SPShape *shape)
 
     if (!SP_IS_BOX3D(SP_OBJECT(side)->parent)) {
         g_warning ("Parent of 3D box side is not a 3D box.\n");
-        /**
-        g_print ("Removing the inkscape:box3dside attribute and returning from box3d_side_set_shape().\n");
-        SP_OBJECT_REPR (shape)->setAttribute("sodipodi:type", NULL);
-        SP_OBJECT_REPR (shape)->setAttribute("inkscape:box3dside", NULL);
-        **/
         return;
     }
 
     Persp3D *persp = box3d_side_perspective(side);
-    //g_return_if_fail (persp != NULL);
     if (!persp) {
-        //g_warning ("persp != NULL in box3d_side_set_shape failed!\n");
-        //persp = SP_OBJECT_DOCUMENT(side)->current_persp3d;
         return;
     }
 
@@ -302,7 +237,6 @@ box3d_side_set_shape (SPShape *shape)
     sp_curve_lineto (c, persp->tmat.image(corners[3]).affine() * i2d);
 
     sp_curve_closepath (c);
-    //sp_shape_perform_path_effect(c, SP_SHAPE (side));
     sp_shape_set_curve_insync (SP_SHAPE (side), c, TRUE);
     sp_curve_unref (c);
 }
@@ -374,23 +308,6 @@ box3d_side_corners (Box3DSide *side) {
     return corners;
 }
 
-/*
-static gint
-box3d_side_descr_to_id (gchar const *descr)
-{
-    if (!strcmp (descr, "XYrear")) { return 5; }
-    if (!strcmp (descr, "XYfront")) { return 2; }
-    if (!strcmp (descr, "XZbottom")) { return 1; }
-    if (!strcmp (descr, "XZtop")) { return 4; }
-    if (!strcmp (descr, "YZleft")) { return 3; }
-    if (!strcmp (descr, "YZright")) { return 0; }
-
-    g_warning ("Invalid description of 3D box face.\n");
-    g_print ("         (description is: %s)\n", descr);
-    return -1;
-}
-*/
-
 Persp3D *
 box3d_side_perspective(Box3DSide *side) {
     return SP_BOX3D(SP_OBJECT(side)->parent)->persp_ref->getObject();
index 1b6813f466426b602d4abe6a01ab549e8a31e1cb..d40e64b7524311b3f981108783ea26d77f5235ae 100644 (file)
@@ -39,8 +39,6 @@ struct Box3DSideClass {
 
 GType box3d_side_get_type (void);
 
-//void sp_box3d_side_position_set (Box3DSide *side, NR::Point corner1, NR::Point corner2);
-void box3d_side_set_shape (SPShape *shape);
 void box3d_side_position_set (Box3DSide *side); // FIXME: Replace this by box3d_side_set_shape??
 void box3d_side_apply_style (Box3DSide *side);
 gchar *box3d_side_axes_string(Box3DSide *side);
index 72aff25985fcb49d54a502074f6fa6b0225137d1..ec04fc7fbd8756d2f5726c19081edb8d135682ad 100644 (file)
@@ -53,7 +53,6 @@ static NR::Matrix box3d_set_transform(SPItem *item, NR::Matrix const &xform);
 static void box3d_convert_to_guides(SPItem *item);
 
 static void box3d_ref_changed(SPObject *old_ref, SPObject *ref, SPBox3D *box);
-static void box3d_ref_modified(SPObject *href, guint flags, SPBox3D *box);
 
 static SPGroupClass *parent_class;
 
@@ -107,7 +106,6 @@ box3d_init(SPBox3D *box)
 {
     box->persp_href = NULL;
     box->persp_ref = new Persp3DReference(SP_OBJECT(box));
-    new (&box->modified_connection) sigc::connection();
 }
 
 static void
@@ -132,12 +130,6 @@ box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
         g_print ("No document for the box!!!!\n");
         return;
     }
-    /**
-    if (!box->persp3d) {
-        g_print ("Box seems to be newly created since no perspective is referenced yet. We reference the current perspective.\n");
-        box->persp3d = doc->current_persp3d;
-    }
-    **/
 
     box->persp_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(box3d_ref_changed), box));
 
@@ -163,9 +155,6 @@ box3d_release(SPObject *object)
         box->persp_ref = NULL;
     }
 
-    box->modified_connection.disconnect();
-    box->modified_connection.~connection();
-
     //persp3d_remove_box (box3d_get_perspective(box), box);
 
     if (((SPObjectClass *) parent_class)->release)
@@ -199,14 +188,6 @@ box3d_set(SPObject *object, unsigned int key, const gchar *value)
                 } else {
                     // Detach, which emits the changed signal.
                     box->persp_ref->detach();
-                        // TODO: Clean this up (also w.r.t the surrounding if construct)
-                        /***
-                        g_print ("No perspective given. Attaching to current perspective instead.\n");
-                        g_free(box->persp_href);
-                        Inkscape::XML::Node *repr = SP_OBJECT_REPR(inkscape_active_document()->current_persp3d);
-                        box->persp_href = g_strdup(repr->attribute("id"));
-                        box->persp_ref->attach(Inkscape::URI(box->persp_href));
-                        ***/
                 }
             }
 
@@ -233,7 +214,6 @@ box3d_set(SPObject *object, unsigned int key, const gchar *value)
             }
             break;
     }
-    //object->updateRepr(); // This ensures correct update of the box after undo/redo. FIXME: Why is this not present in sp-rect.cpp and similar files?
 }
 
 /**
@@ -251,9 +231,6 @@ box3d_ref_changed(SPObject *old_ref, SPObject *ref, SPBox3D *box)
     }
     if ( SP_IS_PERSP3D(ref) && ref != box ) // FIXME: Comparisons sane?
     {
-        box->modified_connection.disconnect();
-        box->modified_connection = ref->connectModified(sigc::bind(sigc::ptr_fun(&box3d_ref_modified), box));
-        box3d_ref_modified(ref, 0, box);
         persp3d_add_box (SP_PERSP3D(ref), box);
         /* Note: This sometimes leads to attempts to add boxes twice to the list of selected/transformed
            boxes in a perspectives, but this should be uncritical. */
@@ -301,7 +278,6 @@ static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Node *r
                 repr->setAttribute("inkscape:perspectiveID", uri_string);
                 g_free(uri_string);
             } else if (doc) {
-                //persp3d_add_box (doc->current_persp3d, box);
                 Inkscape::XML::Node *persp_repr = SP_OBJECT_REPR(doc->current_persp3d);
                 const gchar *persp_id = persp_repr->attribute("id");
                 gchar *href = g_strdup_printf("#%s", persp_id);
@@ -411,21 +387,6 @@ box3d_set_transform(SPItem *item, NR::Matrix const &xform)
     return NR::identity();
 }
 
-
-/**
- * Gets called when persp(?) repr contents change: i.e. parameter change.
- */
-static void
-box3d_ref_modified(SPObject */*href*/, guint /*flags*/, SPBox3D */*box*/)
-{
-    /***
-    g_print ("FIXME: box3d_ref_modified was called. What should we do?\n");
-    g_print ("Here is at least the the href's id: %s\n", SP_OBJECT_REPR(href)->attribute("id"));
-    g_print ("             ... and the box's, too: %s\n", SP_OBJECT_REPR(box)->attribute("id"));
-    ***/
-
-}
-
 Proj::Pt3
 box3d_get_proj_corner (guint id, Proj::Pt3 const &c0, Proj::Pt3 const &c7) {
     return Proj::Pt3 ((id & Box3D::X) ? c7[Proj::X] : c0[Proj::X],
@@ -446,7 +407,6 @@ NR::Point
 box3d_get_corner_screen (SPBox3D const *box, guint id) {
     Proj::Pt3 proj_corner (box3d_get_proj_corner (box, id));
     if (!box3d_get_perspective(box)) {
-        //g_print ("No perspective present in box!! Should we simply use the currently active perspective?\n");
         return NR::Point (NR_HUGE, NR_HUGE);
     }
     return box3d_get_perspective(box)->tmat.image(proj_corner).affine();
@@ -466,7 +426,6 @@ NR::Point
 box3d_get_center_screen (SPBox3D *box) {
     Proj::Pt3 proj_center (box3d_get_proj_center (box));
     if (!box3d_get_perspective(box)) {
-        //g_print ("No perspective present in box!! Should we simply use the currently active perspective?\n");
         return NR::Point (NR_HUGE, NR_HUGE);
     }
     return box3d_get_perspective(box)->tmat.image(proj_center).affine();
@@ -480,8 +439,7 @@ box3d_get_center_screen (SPBox3D *box) {
 
 // Should we make the threshold settable in the preferences?
 static double remember_snap_threshold = 30;
-//static guint remember_snap_index = 0;
-static guint remember_snap_index_center = 0;
+static guint remember_snap_index = 0;
 
 static Proj::Pt3
 box3d_snap (SPBox3D *box, int id, Proj::Pt3 const &pt_proj, Proj::Pt3 const &start_pt) {
@@ -553,9 +511,9 @@ box3d_snap (SPBox3D *box, int id, Proj::Pt3 const &pt_proj, Proj::Pt3 const &sta
     // if we are within tolerance of the starting point)
     NR::Point result;
     if (within_tolerance) {
-        result = snap_pts[remember_snap_index_center];
+        result = snap_pts[remember_snap_index];
     } else {
-        remember_snap_index_center = snap_index;
+        remember_snap_index = snap_index;
         result = snap_pts[snap_index];
     }
     return box3d_get_perspective(box)->tmat.preimage (result, z_coord, Proj::Z);
@@ -792,41 +750,32 @@ box3d_set_new_z_orders_case0 (SPBox3D *box, int z_orders[6], Box3D::Axis central
 
     bool swapped = box3d_XY_axes_are_swapped(box);
 
-    //g_print ("3 infinite VPs; ");
     switch(central_axis) {
         case Box3D::X:
             if (!swapped) {
-                //g_print ("central axis X (case a)");
                 box3d_aux_set_z_orders (z_orders, 2, 0, 4, 1, 3, 5);
             } else {
-                //g_print ("central axis X (case b)");
                 box3d_aux_set_z_orders (z_orders, 3, 1, 5, 2, 4, 0);
             }
             break;
         case Box3D::Y:
             if (!swapped) {
-                //g_print ("central axis Y (case a)");
                 box3d_aux_set_z_orders (z_orders, 2, 3, 1, 4, 0, 5);
             } else {
-                //g_print ("central axis Y (case b)");
                 box3d_aux_set_z_orders (z_orders, 5, 0, 4, 1, 3, 2);
             }
             break;
         case Box3D::Z:
             if (!swapped) {
-                //g_print ("central axis Z (case a)");
                 box3d_aux_set_z_orders (z_orders, 2, 0, 1, 4, 3, 5);
             } else {
-                //g_print ("central axis Z (case b)");
                 box3d_aux_set_z_orders (z_orders, 5, 3, 4, 1, 0, 2);
             }
             break;
         case Box3D::NONE:
             if (!swapped) {
-                //g_print ("central axis NONE (case a)");
                 box3d_aux_set_z_orders (z_orders, 2, 3, 4, 1, 0, 5);
             } else {
-                //g_print ("central axis NONE (case b)");
                 box3d_aux_set_z_orders (z_orders, 5, 0, 1, 4, 3, 2);
             }
             break;
@@ -834,12 +783,6 @@ box3d_set_new_z_orders_case0 (SPBox3D *box, int z_orders[6], Box3D::Axis central
             g_assert_not_reached();
             break;
     }
-    /**
-    if (swapped) {
-        g_print ("; swapped");
-    }
-    g_print ("\n");
-    **/
 }
 
 /* Precisely one finite VP */
@@ -851,45 +794,30 @@ box3d_set_new_z_orders_case1 (SPBox3D *box, int z_orders[6], Box3D::Axis central
     // note: in some of the case distinctions below we rely upon the fact that oaxis1 and oaxis2 are ordered
     Box3D::Axis oaxis1 = Box3D::get_remaining_axes(fin_axis).first;
     Box3D::Axis oaxis2 = Box3D::get_remaining_axes(fin_axis).second;
-    //g_print ("oaxis1  = %s, oaxis2  = %s\n", Box3D::string_from_axes(oaxis1), Box3D::string_from_axes(oaxis2));
     int inside1 = 0;
     int inside2 = 0;
     inside1 = box3d_pt_lies_in_PL_sector (box, vp, 3, 3 ^ oaxis2, oaxis1);
     inside2 = box3d_pt_lies_in_PL_sector (box, vp, 3, 3 ^ oaxis1, oaxis2);
-    //g_print ("inside1 = %d, inside2 = %d\n", inside1, inside2);
 
     bool swapped = box3d_XY_axes_are_swapped(box);
 
-    //g_print ("2 infinite VPs; ");
-    //g_print ("finite axis: %s; ", Box3D::string_from_axes(fin_axis));
     switch(central_axis) {
         case Box3D::X:
             if (!swapped) {
-                //g_print ("central axis X (case a)");
                 box3d_aux_set_z_orders (z_orders, 2, 4, 0, 1, 3, 5);
             } else {
-                //if (inside2) {
-                    //g_print ("central axis X (case b)");
-                    box3d_aux_set_z_orders (z_orders, 5, 3, 1, 0, 2, 4);
-                //} else {
-                    //g_print ("central axis X (case c)");
-                    //box3d_aux_set_z_orders (z_orders, 5, 3, 1, 2, 0, 4);
-                //}
+                box3d_aux_set_z_orders (z_orders, 5, 3, 1, 0, 2, 4);
             }
             break;
         case Box3D::Y:
             if (inside2 > 0) {
-                //g_print ("central axis Y (case a)");
                 box3d_aux_set_z_orders (z_orders, 1, 2, 3, 0, 5, 4);
             } else if (inside2 < 0) {
-                //g_print ("central axis Y (case b)");
                 box3d_aux_set_z_orders (z_orders, 2, 3, 1, 4, 0, 5);
             } else {
                 if (!swapped) {
-                    //g_print ("central axis Y (case c1)");
                     box3d_aux_set_z_orders (z_orders, 2, 3, 1, 5, 0, 4);
                 } else {
-                    //g_print ("central axis Y (case c2)");
                     box3d_aux_set_z_orders (z_orders, 5, 0, 4, 1, 3, 2);
                 }
             }
@@ -897,52 +825,35 @@ box3d_set_new_z_orders_case1 (SPBox3D *box, int z_orders[6], Box3D::Axis central
         case Box3D::Z:
             if (inside2) {
                 if (!swapped) {
-                    //g_print ("central axis Z (case a1)");
                     box3d_aux_set_z_orders (z_orders, 2, 1, 3, 0, 4, 5);
                 } else {
-                    //g_print ("central axis Z (case a2)");
                     box3d_aux_set_z_orders (z_orders, 5, 3, 4, 0, 1, 2);
                 }
             } else if (inside1) {
                 if (!swapped) {
-                    //g_print ("central axis Z (case b1)");
                     box3d_aux_set_z_orders (z_orders, 2, 0, 1, 4, 3, 5);
                 } else {
-                    //g_print ("central axis Z (case b2)");
                     box3d_aux_set_z_orders (z_orders, 5, 3, 4, 1, 0, 2);
-                    //box3d_aux_set_z_orders (z_orders, 5, 3, 0, 1, 2, 4);
                 }
             } else {
                 // "regular" case
                 if (!swapped) {
-                    //g_print ("central axis Z (case c1)");
                     box3d_aux_set_z_orders (z_orders, 0, 1, 2, 5, 4, 3);
                 } else {
-                    //g_print ("central axis Z (case c2)");
                     box3d_aux_set_z_orders (z_orders, 5, 3, 4, 0, 2, 1);
-                    //box3d_aux_set_z_orders (z_orders, 5, 3, 4, 0, 2, 1);
                 }
             }
             break;
         case Box3D::NONE:
             if (!swapped) {
-                //g_print ("central axis NONE (case a)");
                 box3d_aux_set_z_orders (z_orders, 2, 3, 4, 5, 0, 1);
             } else {
-                //g_print ("central axis NONE (case b)");
                 box3d_aux_set_z_orders (z_orders, 5, 0, 1, 3, 2, 4);
-                //box3d_aux_set_z_orders (z_orders, 2, 3, 4, 1, 0, 5);
             }
             break;
         default:
             g_assert_not_reached();
     }
-    /**
-    if (swapped) {
-        g_print ("; swapped");
-    }
-    g_print ("\n");
-    **/
 }
 
 /* Precisely 2 finite VPs */
@@ -966,36 +877,23 @@ box3d_set_new_z_orders_case2 (SPBox3D *box, int z_orders[6], Box3D::Axis central
     int insidezx = box3d_VP_lies_in_PL_sector (box, Proj::Z, 3, 3 ^ Box3D::Y, Box3D::X);
     int insidezy = box3d_VP_lies_in_PL_sector (box, Proj::Z, 3, 3 ^ Box3D::X, Box3D::Y);
 
-    //g_print ("Insides: xy = %d, xz = %d, yx = %d, yz = %d, zx = %d, zy = %d\n",
-    //         insidexy, insidexz, insideyx, insideyz, insidezx, insidezy);
-    (void)insidexz;
-    (void)insideyx;
-    (void)insidezx;
-
-    //g_print ("1 infinite VP; ");
     switch(central_axis) {
         case Box3D::X:
             if (!swapped) {
                 if (insidezy == -1) {
-                    //g_print ("central axis X (case a1)");
                     box3d_aux_set_z_orders (z_orders, 2, 4, 0, 1, 3, 5);
                 } else if (insidexy == 1) {
-                    //g_print ("central axis X (case a2)");
                     box3d_aux_set_z_orders (z_orders, 2, 4, 0, 5, 1, 3);
                 } else {
-                    //g_print ("central axis X (case a3)");
                     box3d_aux_set_z_orders (z_orders, 2, 4, 0, 1, 3, 5);
                 }
             } else {
                 if (insideyz == -1) {
-                    //g_print ("central axis X (case b1)");
                     box3d_aux_set_z_orders (z_orders, 3, 1, 5, 0, 2, 4);
                 } else {
                     if (!swapped) {
-                        //g_print ("central axis X (case b2)");
                         box3d_aux_set_z_orders (z_orders, 3, 1, 5, 2, 4, 0);
                     } else {
-                        //g_print ("central axis X (case b3)");
                         if (insidexy == 0) {
                             box3d_aux_set_z_orders (z_orders, 3, 5, 1, 0, 2, 4);
                         } else {
@@ -1008,14 +906,11 @@ box3d_set_new_z_orders_case2 (SPBox3D *box, int z_orders[6], Box3D::Axis central
         case Box3D::Y:
             if (!swapped) {
                 if (insideyz == 1) {
-                    //g_print ("central axis Y (case a1)");
                     box3d_aux_set_z_orders (z_orders, 2, 3, 1, 0, 5, 4);
                 } else {
-                    //g_print ("central axis Y (case a2)");
                     box3d_aux_set_z_orders (z_orders, 2, 3, 1, 5, 0, 4);
                 }
             } else {
-                //g_print ("central axis Y (case b)");
                 if (insideyx == 1) {
                     box3d_aux_set_z_orders (z_orders, 4, 0, 5, 1, 3, 2);
                 } else {
@@ -1026,26 +921,20 @@ box3d_set_new_z_orders_case2 (SPBox3D *box, int z_orders[6], Box3D::Axis central
         case Box3D::Z:
             if (!swapped) {
                 if (insidezy == 1) {
-                    //g_print ("central axis Z (case a1)");
                     box3d_aux_set_z_orders (z_orders, 2, 1, 0, 4, 3, 5);
                 } else if (insidexy == -1) {
-                    //g_print ("central axis Z (case a2)");
                     box3d_aux_set_z_orders (z_orders, 2, 1, 0, 5, 4, 3);
                 } else {
-                    //g_print ("central axis Z (case a3)");
                     box3d_aux_set_z_orders (z_orders, 2, 0, 1, 5, 3, 4);
                 }
             } else {
-                //g_print ("central axis Z (case b)");
                 box3d_aux_set_z_orders (z_orders, 3, 4, 5, 1, 0, 2);
             }
             break;
         case Box3D::NONE:
             if (!swapped) {
-                //g_print ("central axis NONE (case a)");
                 box3d_aux_set_z_orders (z_orders, 2, 3, 4, 1, 0, 5);
             } else {
-                //g_print ("central axis NONE (case b)");
                 box3d_aux_set_z_orders (z_orders, 5, 0, 1, 4, 3, 2);
             }
             break;
@@ -1053,12 +942,6 @@ box3d_set_new_z_orders_case2 (SPBox3D *box, int z_orders[6], Box3D::Axis central
             g_assert_not_reached();
             break;
     }
-    /**
-    if (swapped) {
-        g_print ("; swapped");
-    }
-    g_print ("\n");
-    **/
 }
 
 /*
@@ -1108,7 +991,6 @@ bool
 box3d_recompute_z_orders (SPBox3D *box) {
     Persp3D *persp = box3d_get_perspective(box);
 
-    //g_return_val_if_fail(persp, false);
     if (!persp)
         return false;
 
@@ -1179,14 +1061,12 @@ box3d_recompute_z_orders (SPBox3D *box) {
         } else if (box3d_half_line_crosses_joining_line (corner3, vpz, vpx, vpy)) {
             central_axis = Box3D::Z;
         }
-        //g_print ("Crossing: %s\n", Box3D::string_from_axes(central_axis));
 
         unsigned int central_corner = 3 ^ central_axis;
         if (central_axis == Box3D::Z) {
             central_corner = central_corner ^ Box3D::XYZ;
         }
         if (box3d_XY_axes_are_swapped(box)) {
-            //g_print ("Axes X and Y are swapped\n");
             central_corner = central_corner ^ Box3D::XYZ;
         }
 
@@ -1204,7 +1084,6 @@ box3d_recompute_z_orders (SPBox3D *box) {
                     box3d_aux_set_z_orders (z_orders, 2, 3, 1, 5, 0, 4);
                 } else {
                     // degenerate case
-                    //g_print ("Degenerate case #1\n");
                     box3d_aux_set_z_orders (z_orders, 2, 1, 3, 0, 5, 4);
                 }
                 break;
@@ -1212,11 +1091,9 @@ box3d_recompute_z_orders (SPBox3D *box) {
             case Box3D::Z:
                 if (box3d_half_line_crosses_joining_line(vpx, vpz, corner3, corner1)) {
                     // degenerate case
-                    //g_print ("Degenerate case #2\n");
                     box3d_aux_set_z_orders (z_orders, 2, 0, 1, 4, 3, 5);
                 } else if (box3d_half_line_crosses_joining_line(vpx, vpy, corner3, corner7)) {
                     // degenerate case
-                    //g_print ("Degenerate case #3\n");
                     box3d_aux_set_z_orders (z_orders, 2, 1, 0, 5, 3, 4);
                 } else {
                     box3d_aux_set_z_orders (z_orders, 2, 1, 0, 3, 4, 5);
@@ -1226,7 +1103,6 @@ box3d_recompute_z_orders (SPBox3D *box) {
             case Box3D::X:
                 if (box3d_half_line_crosses_joining_line(vpz, vpx, corner3, corner1)) {
                     // degenerate case
-                    //g_print ("Degenerate case #4\n");
                     box3d_aux_set_z_orders (z_orders, 2, 1, 0, 4, 5, 3);
                 } else {
                     box3d_aux_set_z_orders (z_orders, 2, 4, 0, 5, 1, 3);
@@ -1289,13 +1165,6 @@ box3d_set_z_orders (SPBox3D *box) {
                 SP_ITEM((*side).second)->lowerToBottom();
             }
         }
-        /**
-        g_print ("Resetting z-orders: ");
-        for (int i = 0; i < 6; ++i) {
-            g_print ("%d ", box->z_orders[i]);
-        }
-        g_print ("\n");
-        **/
     }
 }
 
@@ -1326,7 +1195,6 @@ box3d_pt_lies_in_PL_sector (SPBox3D const *box, NR::Point const &pt, int id1, in
         NR::Point v2(c2 - vp);
         NR::Point w(pt - vp);
         ret = static_cast<int>(Box3D::lies_in_sector(v1, v2, w));
-        //g_print ("Case 0 - returning %d\n", ret);
     } else {
         Box3D::PerspectiveLine pl1(c1, Box3D::toProj(axis), persp);
         Box3D::PerspectiveLine pl2(c2, Box3D::toProj(axis), persp);
@@ -1340,7 +1208,6 @@ box3d_pt_lies_in_PL_sector (SPBox3D const *box, NR::Point const &pt, int id1, in
                 ret = -1;
             }
         }
-        //g_print ("Case 1 - returning %d\n", ret);
     }
     return ret;
 }
@@ -1366,7 +1233,7 @@ box3d_swap_coords(SPBox3D *box, Proj::Axis axis, bool smaller = true) {
         box->orig_corner0[axis] = box->orig_corner7[axis];
         box->orig_corner7[axis] = tmp;
     }
-    // FIXME: Should we also swap the coordinates of save_corner0 and save_corner7?
+    // Should we also swap the coordinates of save_corner0 and save_corner7?
 }
 
 /* ensure that the coordinates of corner0 and corner7 are in the correct order (to prevent everted boxes) */
@@ -1487,7 +1354,7 @@ box3d_convert_to_group(SPBox3D *box) {
             repr = box3d_side_convert_to_path(SP_BOX3D_SIDE(child));
             grepr->appendChild(repr);
         } else {
-            g_warning("Non-side object encountered as child of a 3D box.\n");
+            g_warning("Non-side item encountered as child of a 3D box.\n");
         }
     }
 
index fae3849d82266ff276cd522fd897a05ba84a049d..2fbf224a5ea57e17ba290b0c56488557ff70b328 100644 (file)
@@ -35,8 +35,6 @@ struct SPBox3D : public SPGroup {
     gchar *persp_href;
     Persp3DReference *persp_ref;
 
-    sigc::connection modified_connection;
-
     Proj::Pt3 orig_corner0;
     Proj::Pt3 orig_corner7;
 
@@ -69,9 +67,7 @@ void box3d_set_z_orders (SPBox3D *box);
 int box3d_pt_lies_in_PL_sector (SPBox3D const *box, NR::Point const &pt, int id1, int id2, Box3D::Axis axis);
 int box3d_VP_lies_in_PL_sector (SPBox3D const *box, Proj::Axis vpdir, int id1, int id2, Box3D::Axis axis);
 
-/* ensures that the coordinates of corner0 and corner7 are in the correct order (to prevent everted boxes) */
 void box3d_relabel_corners(SPBox3D *box);
-
 void box3d_check_for_swapped_coords(SPBox3D *box);
 
 void box3d_add_to_selection(SPBox3D *box);
index 339c8e181ca7bf9db6690daf3e37e16b987cd076..aa5e882ac8d2147ea0fb862960f710d4b797afa7 100644 (file)
 #include "persp3d.h"
 #include "uri.h"
 
-// for testing:
-#include "xml/repr.h"
-#include "box3d.h"
-
 static void persp3dreference_href_changed(SPObject *old_ref, SPObject *ref, Persp3DReference *persp3dref);
 static void persp3dreference_delete_self(SPObject *deleted, Persp3DReference *persp3dref);
 static void persp3dreference_source_modified(SPObject *iSource, guint flags, Persp3DReference *persp3dref);
@@ -22,12 +18,6 @@ static void persp3dreference_source_modified(SPObject *iSource, guint flags, Per
 Persp3DReference::Persp3DReference(SPObject* i_owner) : URIReference(i_owner)
 {
     owner=i_owner;
-    /**
-    if (owner) {
-        g_print ("Owner of newly created Persp3DReference is box #%d ", SP_BOX3D(owner)->my_counter);
-        g_print ("(no ID yet because we are calling from box3d_init()...\n");
-    }
-    **/
     persp_href = NULL;
     persp_repr = NULL;
     persp = NULL;
@@ -50,31 +40,6 @@ Persp3DReference::_acceptObject(SPObject *obj) const
        typically called from a context where the runtime type is not known at compile time. */
 }
 
-/***
-void
-Persp3DReference::link(char *to)
-{
-    if ( to == NULL ) {
-        quit_listening();
-        unlink();
-    } else {
-        if ( !persp_href || ( strcmp(to, persp_href) != 0 ) ) {
-            g_free(persp_href);
-            persp_href = g_strdup(to);
-            try {
-                attach(Inkscape::URI(to));
-            } catch (Inkscape::BadURIException &e) {
-                 // TODO: Proper error handling as per
-                 // http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing.
-                 //
-                g_warning("%s", e.what());
-                detach();
-            }
-        }
-    }
-}
-***/
-
 void
 Persp3DReference::unlink(void)
 {
@@ -93,7 +58,6 @@ Persp3DReference::start_listening(Persp3D* to)
     persp_repr = SP_OBJECT_REPR(to);
     _delete_connection = to->connectDelete(sigc::bind(sigc::ptr_fun(&persp3dreference_delete_self), this));
     _modified_connection = to->connectModified(sigc::bind<2>(sigc::ptr_fun(&persp3dreference_source_modified), this));
-    //box3d_start_listening_to_persp_change (SP_BOX3D(this->owner), to);
 }
 
 void
@@ -111,54 +75,25 @@ Persp3DReference::quit_listening(void)
 static void
 persp3dreference_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, Persp3DReference *persp3dref)
 {
-    //g_print ("persp3dreference_href_changed:\n");
     persp3dref->quit_listening();
-    /**
-    if (SP_IS_PERSP3D(persp3dref->getObject())){
-        g_print ("referenced object is a perspective\n");
-    } else {
-        g_print ("referenced object is NOT a perspective!!!!\n");
-    }
-    **/
     Persp3D *refobj = SP_PERSP3D(persp3dref->getObject());
     if ( refobj ) {
         persp3dref->start_listening(refobj);
-        //g_print ("     start listening to %s\n", SP_OBJECT_REPR(refobj)->attribute("id"));
     }
 
-    /**
-    if (persp3dref->owner) {
-        g_print ("Requesting display update of owner box #%d (%s) from persp3dreference_href_changed()\n",
-                 SP_BOX3D(persp3dref->owner)->my_counter,
-                 SP_OBJECT_REPR(persp3dref->owner)->attribute("id"));
-    }
-    **/
     persp3dref->owner->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
 }
 
 static void
 persp3dreference_delete_self(SPObject */*deleted*/, Persp3DReference *persp3dref)
 {
-    g_print ("persp3dreference_delete_self; FIXME: Can we leave this to the parent URIReference?\n");
-    if (persp3dref->owner) {
-        g_print ("Deleting box #%d (%s) (?) from Persp3DReference\n",
-                 SP_BOX3D(persp3dref->owner)->my_counter,
-                 SP_OBJECT_REPR(persp3dref->owner)->attribute("id"));
-    }
+    g_return_if_fail(persp3dref->owner);
     persp3dref->owner->deleteObject();
 }
 
 static void
 persp3dreference_source_modified(SPObject */*iSource*/, guint /*flags*/, Persp3DReference *persp3dref)
 {
-    /**
-    g_print ("persp3dreference_source_modified; FIXME: Can we leave this to the parent URIReference?\n");
-    if (persp3dref->owner) {
-        g_print ("Requesting display update of box #%d (%s) from persp3dreference_source_modified\n",
-                 SP_BOX3D(persp3dref->owner)->my_counter,
-                 SP_OBJECT_REPR(persp3dref->owner)->attribute("id"));
-    }
-    **/
     persp3dref->owner->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
 }
 
index 9182d9dbeeee5779f2fcdfd79456fed59169588a..d6ae5bd244b5dff6fbb2820a064ae0156095b893 100644 (file)
@@ -93,7 +93,6 @@ persp3d_init(Persp3D *persp)
 {
     persp->tmat = Proj::TransfMat3x4 ();
 
-    //persp->boxes = NULL;
     persp->boxes_transformed.clear();
     persp->document = NULL;
 
@@ -118,27 +117,13 @@ static void persp3d_build(SPObject *object, SPDocument *document, Inkscape::XML:
     if (repr) {
         repr->addListener (&persp3d_repr_events, object);
     }
-
-    // FIXME: What precisely does this do and is it necessary for perspectives?
-    /* Register ourselves */
-    //sp_document_add_resource(document, "persp3d", object);
 }
 
 /**
  * Virtual release of Persp3D members before destruction.
  */
 static void persp3d_release(SPObject *object) {
-    //Persp3D *persp = (Persp3D *) object;
-
     SP_OBJECT_REPR(object)->removeListenerByData(object);
-
-    // FIXME: What precisely does this do and is it necessary for perspectives?
-    /**
-    if (SP_OBJECT_DOCUMENT(object)) {
-        // Unregister ourselves
-        sp_document_remove_resource(SP_OBJECT_DOCUMENT(object), "persp3d", SP_OBJECT(object));
-    }
-    **/
 }
 
 
@@ -330,7 +315,6 @@ persp3d_toggle_VP (Persp3D *persp, Proj::Axis axis, bool set_undo) {
     //        On the other hand, vp_drag_sel_modified() would update all boxes;
     //        here we can confine ourselves to the boxes of this particular perspective.
     persp3d_update_box_reprs (persp);
-    //persp3d_update_z_orders (persp);
     SP_OBJECT(persp)->updateRepr(SP_OBJECT_WRITE_EXT);
     if (set_undo) {
         sp_document_done(sp_desktop_document(inkscape_active_desktop()), SP_VERB_CONTEXT_3DBOX,
@@ -369,7 +353,6 @@ persp3d_rotate_VP (Persp3D *persp, Proj::Axis axis, double angle, bool alt_press
     persp->tmat.set_infinite_direction (axis, a);
 
     persp3d_update_box_reprs (persp);
-    //persp3d_update_z_orders (persp);
     SP_OBJECT(persp)->updateRepr(SP_OBJECT_WRITE_EXT);
 }
 
@@ -394,15 +377,12 @@ persp3d_pt_to_str (Persp3D *persp, Proj::Axis const axis)
 void
 persp3d_add_box (Persp3D *persp, SPBox3D *box) {
     if (!box) {
-        //g_warning ("Trying to add NULL box to perspective.\n");
         return;
     }
     if (std::find (persp->boxes.begin(), persp->boxes.end(), box) != persp->boxes.end()) {
-        //g_warning ("Attempting to add already existent box to perspective.\n");
         return;
     }
     persp->boxes.push_back(box);
-    //SP_OBJECT_REPR(box)->setAttribute("inkscape:perspectiveID", SP_OBJECT_REPR(persp)->attribute("id"));
 }
 
 void
@@ -496,7 +476,6 @@ void
 persp3d_update_box_displays (Persp3D *persp) {
     if (persp->boxes.empty())
         return;
-    //g_print ("Requesting display update for %d boxes in the perspective.\n", persp->boxes.size());
     for (std::vector<SPBox3D *>::iterator i = persp->boxes.begin(); i != persp->boxes.end(); ++i) {
         box3d_position_set(*i);
     }
@@ -506,7 +485,6 @@ void
 persp3d_update_box_reprs (Persp3D *persp) {
     if (persp->boxes.empty())
         return;
-    //g_print ("Requesting repr update for %d boxes in the perspective.\n", persp->boxes.size());
     for (std::vector<SPBox3D *>::iterator i = persp->boxes.begin(); i != persp->boxes.end(); ++i) {
         SP_OBJECT(*i)->updateRepr(SP_OBJECT_WRITE_EXT);
         box3d_set_z_orders(*i);
@@ -565,15 +543,11 @@ persp3d_on_repr_attr_changed ( Inkscape::XML::Node * /*repr*/,
                                bool /*is_interactive*/,
                                void * data )
 {
-    //g_print("persp3d_on_repr_attr_changed!!!! TODO: Do we need to trigger any further updates than the box reprs?");
-
     if (!data)
         return;
 
     Persp3D *persp = (Persp3D*) data;
     persp3d_update_box_displays (persp);
-
-    //lpeobj->requestModified(SP_OBJECT_MODIFIED_FLAG);
 }
 
 /* returns a std::set() of all perspectives of the currently selected boxes */
@@ -617,6 +591,8 @@ persp3d_selected_boxes (Persp3D *persp) {
     return sel;
 }
 
+/* some debugging stuff follows */
+
 void
 persp3d_print_debugging_info (Persp3D *persp) {
     g_print ("=== Info for Persp3D %d ===\n", persp->my_counter);
@@ -653,12 +629,6 @@ persp3d_print_debugging_info_all(SPDocument *document) {
 
 void
 persp3d_print_all_selected() {
-    /**
-    if (persp3d->boxes_transformed.empty()) {
-        g_print ("No selected perspectives in document\n");
-        return;
-    }
-    **/
     g_print ("\n======================================\n");
     g_print ("Selected perspectives and their boxes:\n");
 
index ce4587f62f4f8eef556e1036b4f5401d7b8e32ec..0ab04fe3920180bc19a92274f179aa31de29c24c 100644 (file)
@@ -32,10 +32,10 @@ class Box3DContext;
 struct Persp3D : public SPObject {
     Proj::TransfMat3x4 tmat;
 
-    // TODO: Also write the list of boxes into the xml repr and vice versa link boxes to their persp3d?
+    // Also write the list of boxes into the xml repr and vice versa link boxes to their persp3d?
     std::vector<SPBox3D *> boxes;
     std::map<SPBox3D *, bool> boxes_transformed; // TODO: eventually we should merge this with 'boxes'
-    SPDocument *document; // FIXME: should this rather be the SPDesktop?
+    SPDocument *document; // should this rather be the SPDesktop?
 
     // for debugging only
     int my_counter;
index 8bedaec5d479b8545e3615ff54bb42daba2741f8..c781f8e4dbc6f67627a3e74b138ea36d70c64c5a 100644 (file)
@@ -94,17 +94,8 @@ vp_knot_moved_handler (SPKnot */*knot*/, NR::Point const *ppointer, guint state,
     if (!dragger->dragging_started && (state & GDK_SHIFT_MASK)) {
         /* with Shift; if there is more than one box linked to this VP
            we need to split it and create a new perspective */
-        //g_print ("Number of boxes in dragger: %d\n", dragger->numberOfBoxes());
         if (dragger->numberOfBoxes() > 1) { // FIXME: Don't do anything if *all* boxes of a VP are selected
-            //g_print ("We need to split the VPDragger\n");
             std::set<VanishingPoint*, less_ptr> sel_vps = dragger->VPsOfSelectedBoxes();
-            /**
-            g_print ("===== VPs of selected boxes: ===========================\n");
-            for (std::set<VanishingPoint*, less_ptr>::iterator i = sel_vps.begin(); i != sel_vps.end(); ++i) {
-                (*i)->printPt();
-            }
-            g_print ("========================================================\n");
-            **/
 
             std::list<SPBox3D *> sel_boxes;
             for (std::set<VanishingPoint*, less_ptr>::iterator vp = sel_vps.begin(); vp != sel_vps.end(); ++vp) {
@@ -120,11 +111,9 @@ vp_knot_moved_handler (SPKnot */*knot*/, NR::Point const *ppointer, guint state,
                           the correct boxes are kept with the VP being moved */
                 std::list<SPBox3D *> bx_lst = persp3d_list_of_boxes(old_persp);
                 for (std::list<SPBox3D *>::iterator i = bx_lst.begin(); i != bx_lst.end(); ++i) {
-                    //g_print ("Iterating over box #%d\n", (*i)->my_counter);
                     if (std::find(sel_boxes.begin(), sel_boxes.end(), *i) == sel_boxes.end()) {
                         /* if a box in the VP is unselected, move it to the
                            newly created perspective so that it doesn't get dragged **/
-                        //g_print ("   switching box #%d to new perspective.\n", (*i)->my_counter);
                         box3d_switch_perspectives(*i, old_persp, new_persp);
                     }
                 }
@@ -165,7 +154,6 @@ vp_knot_moved_handler (SPKnot */*knot*/, NR::Point const *ppointer, guint state,
                 d_new->mergePerspectives();
 
                 // TODO: Update the new merged dragger
-                //d_new->updateKnotShape ();
                 d_new->updateTip();
 
                 d_new->parent->updateBoxDisplays (); // FIXME: Only update boxes in current dragger!
@@ -198,18 +186,6 @@ vp_knot_moved_handler (SPKnot */*knot*/, NR::Point const *ppointer, guint state,
     dragger->dragging_started = true;
 }
 
-/* helpful for debugging */
-static void
-vp_knot_clicked_handler(SPKnot */*knot*/, guint /*state*/, gpointer data)
-{
-    VPDragger *dragger = (VPDragger *) data;
-    g_print ("\nVPDragger contains the following VPs: ");
-    for (std::list<VanishingPoint>::iterator i = dragger->vps.begin(); i != dragger->vps.end(); ++i) {
-        g_print("%d (%d)  ", (*i).my_counter, (*i).get_perspective()->my_counter);
-    }
-    g_print("\n");
-}
-
 void
 vp_knot_grabbed_handler (SPKnot */*knot*/, unsigned int /*state*/, gpointer data)
 {
@@ -224,8 +200,6 @@ vp_knot_ungrabbed_handler (SPKnot *knot, guint /*state*/, gpointer data)
 {
     VPDragger *dragger = (VPDragger *) data;
 
-    //sp_canvas_end_forced_full_redraws(dragger->parent->desktop->canvas);
-
     dragger->point_original = dragger->point = knot->pos;
 
     dragger->dragging_started = false;
@@ -237,7 +211,6 @@ vp_knot_ungrabbed_handler (SPKnot *knot, guint /*state*/, gpointer data)
     }
 
     dragger->parent->updateDraggers ();
-    //dragger->updateBoxReprs ();
     dragger->parent->updateLines ();
     dragger->parent->updateBoxHandles ();
 
@@ -277,8 +250,6 @@ VanishingPoint::selectedBoxes(Inkscape::Selection *sel) {
 
 VPDragger::VPDragger(VPDrag *parent, NR::Point p, VanishingPoint &vp)
 {
-    //this->vps = NULL;
-
     this->parent = parent;
 
     this->point = p;
@@ -300,38 +271,22 @@ VPDragger::VPDragger(VPDrag *parent, NR::Point p, VanishingPoint &vp)
 
         // connect knot's signals
         g_signal_connect (G_OBJECT (this->knot), "moved", G_CALLBACK (vp_knot_moved_handler), this);
-        g_signal_connect (G_OBJECT (this->knot), "clicked", G_CALLBACK (vp_knot_clicked_handler), this);
         g_signal_connect (G_OBJECT (this->knot), "grabbed", G_CALLBACK (vp_knot_grabbed_handler), this);
         g_signal_connect (G_OBJECT (this->knot), "ungrabbed", G_CALLBACK (vp_knot_ungrabbed_handler), this);
-        /***
-        g_signal_connect (G_OBJECT (this->knot), "doubleclicked", G_CALLBACK (vp_knot_doubleclicked_handler), this);
-        ***/
 
         // add the initial VP (which may be NULL!)
         this->addVP (vp);
-        //updateKnotShape();
     }
 }
 
 VPDragger::~VPDragger()
 {
-    // unselect if it was selected
-    //this->parent->setDeselected(this);
-
     // disconnect signals
     g_signal_handlers_disconnect_by_func(G_OBJECT(this->knot), (gpointer) G_CALLBACK (vp_knot_moved_handler), this);
-    g_signal_handlers_disconnect_by_func(G_OBJECT(this->knot), (gpointer) G_CALLBACK (vp_knot_clicked_handler), this);
     g_signal_handlers_disconnect_by_func(G_OBJECT(this->knot), (gpointer) G_CALLBACK (vp_knot_grabbed_handler), this);
     g_signal_handlers_disconnect_by_func(G_OBJECT(this->knot), (gpointer) G_CALLBACK (vp_knot_ungrabbed_handler), this);
-    /***
-    g_signal_handlers_disconnect_by_func(G_OBJECT(this->knot), (gpointer) G_CALLBACK (vp_knot_doubleclicked_handler), this);
-    ***/
-
     /* unref should call destroy */
     g_object_unref (G_OBJECT (this->knot));
-
-    //g_slist_free (this->vps);
-    //this->vps = NULL;
 }
 
 /**
@@ -380,7 +335,6 @@ VPDragger::updateTip ()
 void
 VPDragger::addVP (VanishingPoint &vp, bool update_pos)
 {
-    //if (!vp.is_finite() || g_slist_find (this->vps, vp)) {
     if (!vp.is_finite() || std::find (vps.begin(), vps.end(), vp) != vps.end()) {
         // don't add infinite VPs; don't add the same VP twice
         return;
@@ -389,9 +343,7 @@ VPDragger::addVP (VanishingPoint &vp, bool update_pos)
     if (update_pos) {
         vp.set_pos (this->point);
     }
-    //this->vps = g_slist_prepend (this->vps, vp);
     this->vps.push_front (vp);
-    //this->persps.include (vp.get_perspective());
 
     this->updateTip();
 }
@@ -521,7 +473,6 @@ VPDrag::VPDrag (SPDocument *document)
     this->show_lines = true;
     this->front_or_rear_lines = 0x1;
 
-    //this->selected = NULL;
     this->dragging = false;
 
     this->sel_changed_connection = this->selection->connectChanged(
@@ -777,7 +728,6 @@ VPDrag::addDragger (VanishingPoint &vp)
         if (NR::L2 (dragger->point - p) < MERGE_DIST) {
             // distance is small, merge this draggable into dragger, no need to create new dragger
             dragger->addVP (vp);
-            //dragger->updateKnotShape();
             return;
         }
     }