Code

Refactor snapping mechanisms: in seltrans.cpp, a GSList was converted to a std::list...
authordvlierop2 <dvlierop2@users.sourceforge.net>
Fri, 11 Apr 2008 08:03:13 +0000 (08:03 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Fri, 11 Apr 2008 08:03:13 +0000 (08:03 +0000)
src/line-snapper.cpp
src/line-snapper.h
src/object-snapper.cpp
src/object-snapper.h
src/seltrans.cpp
src/seltrans.h
src/snap.cpp
src/snap.h
src/snapper.cpp
src/snapper.h

index 219bc7482d7501c54d6259087a488acce0d64d0f..b9974c2c04cafdbde915fe954c3a85716ab3b914 100644 (file)
@@ -28,7 +28,7 @@ void Inkscape::LineSnapper::_doFreeSnap(SnappedConstraints &sc,
                                                     NR::Point const &p,
                                                     bool const &f,
                                                     std::vector<NR::Point> &points_to_snap,
-                                                    std::list<SPItem const *> const &it,
+                                                    std::vector<SPItem const *> const &it,
                                                     std::vector<NR::Point> *unselected_nodes) const
 {
     /* Get the lines that we will try to snap to */
@@ -59,7 +59,7 @@ void Inkscape::LineSnapper::_doConstrainedSnap(SnappedConstraints &sc,
                                                bool const &/*f*/,
                                                std::vector<NR::Point> &/*points_to_snap*/,
                                                ConstraintLine const &c,
-                                               std::list<SPItem const *> const &/*it*/) const
+                                               std::vector<SPItem const *> const &/*it*/) const
 
 {
     /* Get the lines that we will try to snap to */
index c1c7da39a7dbc2bba44eddec414345efcec287a7..39df820571cedae35a5cd5498b6ef077241697f5 100644 (file)
@@ -32,7 +32,7 @@ private:
                    NR::Point const &p,
                    bool const &first_point,
                    std::vector<NR::Point> &points_to_snap,
-                   std::list<SPItem const *> const &it,
+                   std::vector<SPItem const *> const &it,
                    std::vector<NR::Point> *unselected_nodes) const;
   
   void _doConstrainedSnap(SnappedConstraints &sc,
@@ -41,7 +41,7 @@ private:
                           bool const &first_point,
                           std::vector<NR::Point> &points_to_snap,
                           ConstraintLine const &c,
-                          std::list<SPItem const *> const &it) const;
+                          std::vector<SPItem const *> const &it) const;
   
   /**
    *  \param p Point that we are trying to snap.
index 9d4745bfea933fc42b49e61e2231e388256fbb59..8c728cd977ba8cf0899f235a1f73eae2f6010671 100644 (file)
@@ -65,7 +65,7 @@ Inkscape::ObjectSnapper::~ObjectSnapper()
  */
 
 void Inkscape::ObjectSnapper::_findCandidates(SPObject* r,
-                                              std::list<SPItem const *> const &it,
+                                              std::vector<SPItem const *> const &it,
                                               bool const &first_point,
                                               std::vector<NR::Point> &points_to_snap,
                                               DimensionToSnap const snap_dim) const
@@ -100,7 +100,7 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* r,
         if (SP_IS_ITEM(o) && !SP_ITEM(o)->isLocked() && !desktop->itemIsHidden(SP_ITEM(o))) {
 
             /* See if this item is on the ignore list */
-            std::list<SPItem const *>::const_iterator i = it.begin();
+            std::vector<SPItem const *>::const_iterator i = it.begin();
             while (i != it.end() && *i != o) {
                 i++;
             }
@@ -552,7 +552,7 @@ void Inkscape::ObjectSnapper::_doFreeSnap(SnappedConstraints &sc,
                                             NR::Point const &p,
                                             bool const &first_point,
                                             std::vector<NR::Point> &points_to_snap,
-                                            std::list<SPItem const *> const &it,
+                                            std::vector<SPItem const *> const &it,
                                             std::vector<NR::Point> *unselected_nodes) const
 {
     if ( NULL == _named_view ) {
@@ -594,7 +594,7 @@ void Inkscape::ObjectSnapper::_doConstrainedSnap( SnappedConstraints &sc,
                                                   bool const &first_point,
                                                   std::vector<NR::Point> &points_to_snap,
                                                   ConstraintLine const &c,
-                                                  std::list<SPItem const *> const &it) const
+                                                  std::vector<SPItem const *> const &it) const
 {
     if ( NULL == _named_view ) {
         return;
@@ -631,7 +631,7 @@ void Inkscape::ObjectSnapper::guideSnap(SnappedConstraints &sc,
     
     /* Get a list of all the SPItems that we will try to snap to */
     std::vector<SPItem*> cand;
-    std::list<SPItem const *> const it; //just an empty list
+    std::vector<SPItem const *> const it; //just an empty list
 
     std::vector<NR::Point> points_to_snap;
     points_to_snap.push_back(p);
index 924c94e07725925242f884dbcb4d2a567f518fd7..29f5954246a7a2cf8e37182f28c712c14b7ad49f 100644 (file)
@@ -111,7 +111,7 @@ private:
                       NR::Point const &p,
                       bool const &first_point,
                       std::vector<NR::Point> &points_to_snap,
-                      std::list<SPItem const *> const &it,
+                      std::vector<SPItem const *> const &it,
                       std::vector<NR::Point> *unselected_nodes) const;
 
   void _doConstrainedSnap(SnappedConstraints &sc,
@@ -120,10 +120,10 @@ private:
                       bool const &first_point,                                                                   
                       std::vector<NR::Point> &points_to_snap,
                       ConstraintLine const &c,
-                      std::list<SPItem const *> const &it) const;
+                      std::vector<SPItem const *> const &it) const;
                        
   void _findCandidates(SPObject* r,
-                       std::list<SPItem const *> const &it,
+                       std::vector<SPItem const *> const &it,
                        bool const &first_point,
                        std::vector<NR::Point> &points_to_snap,
                        DimensionToSnap snap_dim) const;
index d248d31522e55c5d3e48f485899502828bf5fadf..154e828c41bd5eab90cfe7c3258fef92787f191e 100644 (file)
@@ -205,10 +205,12 @@ Inkscape::SelTrans::~SelTrans()
     }
 
     for (unsigned i = 0; i < _items.size(); i++) {
-        sp_object_unref(SP_OBJECT(_items[i].first), NULL);
+        sp_object_unref(SP_OBJECT(_items[i]), NULL);
     }
 
     _items.clear();
+    _items_const.clear();
+    _items_affines.clear();
     _items_centers.clear();
 }
 
@@ -263,9 +265,11 @@ void Inkscape::SelTrans::grab(NR::Point const &p, gdouble x, gdouble y, bool sho
     }
 
     for (GSList const *l = selection->itemList(); l; l = l->next) {
-        SPItem *it = (SPItem*)sp_object_ref(SP_OBJECT(l->data), NULL);
-        _items.push_back(std::pair<SPItem *, NR::Matrix>(it, sp_item_i2d_affine(it)));
-        _items_centers.push_back(std::pair<SPItem *, NR::Point>(it, it->getCenter())); // for content-dragging, we need to remember original centers
+        SPItem *it = (SPItem *)sp_object_ref(SP_OBJECT(l->data), NULL);
+        _items.push_back(it);
+        _items_const.push_back(it);
+        _items_affines.push_back(sp_item_i2d_affine(it));
+        _items_centers.push_back(it->getCenter()); // for content-dragging, we need to remember original centers
     }
 
     _handle_x = x;
@@ -366,8 +370,8 @@ void Inkscape::SelTrans::transform(NR::Matrix const &rel_affine, NR::Point const
     if (_show == SHOW_CONTENT) {
         // update the content
         for (unsigned i = 0; i < _items.size(); i++) {
-            SPItem &item = *_items[i].first;
-            NR::Matrix const &prev_transform = _items[i].second;
+            SPItem &item = *_items[i];
+            NR::Matrix const &prev_transform = _items_affines[i];
             sp_item_set_i2d_affine(&item, prev_transform * affine);
         }
     } else {
@@ -398,7 +402,7 @@ void Inkscape::SelTrans::ungrab()
     _updateVolatileState();
 
     for (unsigned i = 0; i < _items.size(); i++) {
-        sp_object_unref(SP_OBJECT(_items[i].first), NULL);
+        sp_object_unref(SP_OBJECT(_items[i]), NULL);
     }
 
     sp_canvas_item_hide(_norm);
@@ -428,15 +432,17 @@ void Inkscape::SelTrans::ungrab()
 // the new bboxes). So we need to reset the centers from our saved array.
         if (_show != SHOW_OUTLINE && !_current_relative_affine.is_translation()) {
             for (unsigned i = 0; i < _items_centers.size(); i++) {
-                SPItem *currentItem = _items_centers[i].first;
+                SPItem *currentItem = _items[i];
                 if (currentItem->isCenterSet()) { // only if it's already set
-                    currentItem->setCenter (_items_centers[i].second * _current_relative_affine);
+                    currentItem->setCenter (_items_centers[i] * _current_relative_affine);
                     SP_OBJECT(currentItem)->updateRepr();
                 }
             }
         }
 
         _items.clear();
+        _items_const.clear();
+        _items_affines.clear();
         _items_centers.clear();
 
         if (_current_relative_affine.is_translation()) {
@@ -466,6 +472,8 @@ void Inkscape::SelTrans::ungrab()
         }
 
         _items.clear();
+        _items_const.clear();
+        _items_affines.clear();
         _items_centers.clear();
         _updateHandles();
     }
@@ -766,7 +774,7 @@ void Inkscape::SelTrans::handleNewEvent(SPKnot *knot, NR::Point *position, guint
     // in case items have been unhooked from the document, don't
     // try to continue processing events for them.
     for (unsigned int i = 0; i < _items.size(); i++) {
-        if (!SP_OBJECT_DOCUMENT(SP_OBJECT(_items[i].first)) ) {
+        if (!SP_OBJECT_DOCUMENT(SP_OBJECT(_items[i])) ) {
             return;
         }
     }
@@ -909,14 +917,6 @@ gboolean Inkscape::SelTrans::scaleRequest(NR::Point &pt, guint state)
         // In all other cases we should try to snap now
         SnapManager const &m = _desktop->namedview->snap_manager;
         
-        /* Get a STL list of the selected items.
-        ** FIXME: this should probably be done by Inkscape::Selection.
-        */
-        std::list<SPItem const*> it;
-        for (GSList const *i = _selection->itemList(); i != NULL; i = i->next) {
-            it.push_back(reinterpret_cast<SPItem*>(i->data));
-        }
-        
         Inkscape::SnappedPoint bb, sn; 
         NR::Coord bd(NR_HUGE);
         NR::Coord sd(NR_HUGE);
@@ -934,8 +934,8 @@ gboolean Inkscape::SelTrans::scaleRequest(NR::Point &pt, guint state)
             }
 
             // Snap along a suitable constraint vector from the origin.
-            bb = m.constrainedSnapScale(Snapper::SNAPPOINT_BBOX, _bbox_points, it, default_scale, _origin_for_bboxpoints);
-            sn = m.constrainedSnapScale(Snapper::SNAPPOINT_NODE, _snap_points, it, geom_scale, _origin_for_specpoints);
+            bb = m.constrainedSnapScale(Snapper::SNAPPOINT_BBOX, _bbox_points, _items_const, default_scale, _origin_for_bboxpoints);
+            sn = m.constrainedSnapScale(Snapper::SNAPPOINT_NODE, _snap_points, _items_const, geom_scale, _origin_for_specpoints);
     
             /* Choose the smaller difference in scale.  Since s[X] == s[Y] we can
             ** just compare difference in s[X].
@@ -944,8 +944,8 @@ gboolean Inkscape::SelTrans::scaleRequest(NR::Point &pt, guint state)
             sd = sn.getSnapped() ? fabs(sn.getTransformation()[NR::X] - geom_scale[NR::X]) : NR_HUGE;                
         } else {
             /* Scale aspect ratio is unlocked */    
-            bb = m.freeSnapScale(Snapper::SNAPPOINT_BBOX, _bbox_points, it, default_scale, _origin_for_bboxpoints);
-            sn = m.freeSnapScale(Snapper::SNAPPOINT_NODE, _snap_points, it, geom_scale, _origin_for_specpoints);
+            bb = m.freeSnapScale(Snapper::SNAPPOINT_BBOX, _bbox_points, _items_const, default_scale, _origin_for_bboxpoints);
+            sn = m.freeSnapScale(Snapper::SNAPPOINT_NODE, _snap_points, _items_const, geom_scale, _origin_for_specpoints);
     
             /* Pick the snap that puts us closest to the original scale */
             bd = bb.getSnapped() ? fabs(NR::L2(bb.getTransformation()) - NR::L2(default_scale.point())) : NR_HUGE;
@@ -1022,14 +1022,6 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR::
     } else {
         // In all other cases we should try to snap now
         
-        /* Get a STL list of the selected items.
-        ** FIXME: this should probably be done by Inkscape::Selection.
-        */
-        std::list<SPItem const*> it;
-        for (GSList const *i = _selection->itemList(); i != NULL; i = i->next) {
-            it.push_back(reinterpret_cast<SPItem*>(i->data));
-        }
-    
         SnapManager const &m = _desktop->namedview->snap_manager;
         
         Inkscape::SnappedPoint bb, sn; 
@@ -1039,8 +1031,8 @@ gboolean Inkscape::SelTrans::stretchRequest(SPSelTransHandle const &handle, NR::
     
         bool symmetrical = state & GDK_CONTROL_MASK;        
         
-        bb = m.constrainedSnapStretch(Snapper::SNAPPOINT_BBOX, _bbox_points, it, default_scale[axis], _origin_for_bboxpoints, axis, symmetrical);
-        sn = m.constrainedSnapStretch(Snapper::SNAPPOINT_NODE, _snap_points, it, geom_scale[axis], _origin_for_specpoints, axis, symmetrical);
+        bb = m.constrainedSnapStretch(Snapper::SNAPPOINT_BBOX, _bbox_points, _items_const, default_scale[axis], _origin_for_bboxpoints, axis, symmetrical);
+        sn = m.constrainedSnapStretch(Snapper::SNAPPOINT_NODE, _snap_points, _items_const, geom_scale[axis], _origin_for_specpoints, axis, symmetrical);
         
         if (bb.getSnapped()) {
             // We snapped the bbox (which is either visual or geometric)
@@ -1149,20 +1141,12 @@ gboolean Inkscape::SelTrans::skewRequest(SPSelTransHandle const &handle, NR::Poi
     } else {
         // Snap to objects, grids, guides
         
-        /* Get a STL list of the selected items.
-           ** FIXME: this should probably be done by Inkscape::Selection.
-           */
-           std::list<SPItem const*> it;
-           for (GSList const *i = _selection->itemList(); i != NULL; i = i->next) {
-               it.push_back(reinterpret_cast<SPItem*>(i->data));
-           }
-        
         SnapManager const &m = _desktop->namedview->snap_manager;
 
         //TODO: While skewing, scaling in the opposite direction by integer multiples is also allowed. This is not handled though by freeSnapSkew / _snapTransformed yet!
         //TODO: We need a constrainedSnapSkew instead of a freeSnapSkew
-        Inkscape::SnappedPoint bb = m.freeSnapSkew(Inkscape::Snapper::SNAPPOINT_BBOX, _bbox_points, it, skew[dim_a], _origin, dim_b);
-        Inkscape::SnappedPoint sn = m.freeSnapSkew(Inkscape::Snapper::SNAPPOINT_NODE, _snap_points, it, skew[dim_a], _origin, dim_b);
+        Inkscape::SnappedPoint bb = m.freeSnapSkew(Inkscape::Snapper::SNAPPOINT_BBOX, _bbox_points, _items_const, skew[dim_a], _origin, dim_b);
+        Inkscape::SnappedPoint sn = m.freeSnapSkew(Inkscape::Snapper::SNAPPOINT_NODE, _snap_points, _items_const, skew[dim_a], _origin, dim_b);
 
         if (bb.getSnapped() || sn.getSnapped()) {
             // We snapped something, so change the skew to reflect it
@@ -1364,14 +1348,6 @@ void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state)
     /* The amount that we've moved by during this drag */
     NR::Point dxy = xy - _point;
 
-    /* Get a STL list of the selected items.
-    ** FIXME: this should probably be done by Inkscape::Selection.
-    */
-    std::list<SPItem const*> it;
-    for (GSList const *i = _selection->itemList(); i != NULL; i = i->next) {
-        it.push_back(reinterpret_cast<SPItem*>(i->data));
-    }
-
     bool const alt = (state & GDK_MOD1_MASK);
     bool const control = (state & GDK_CONTROL_MASK);
     bool const shift = (state & GDK_SHIFT_MASK);
@@ -1401,13 +1377,13 @@ void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state)
             for (unsigned int dim = 0; dim < 2; dim++) {
                 s.push_back(m.constrainedSnapTranslation(Inkscape::Snapper::SNAPPOINT_BBOX,
                                                          _bbox_points,
-                                                         it,
+                                                         _items_const,
                                                          Inkscape::Snapper::ConstraintLine(component_vectors[dim]),
                                                          dxy));
 
                 s.push_back(m.constrainedSnapTranslation(Inkscape::Snapper::SNAPPOINT_NODE,
                                                          _snap_points,
-                                                         it,
+                                                         _items_const,
                                                          Inkscape::Snapper::ConstraintLine(component_vectors[dim]),
                                                          dxy));
             }
@@ -1421,9 +1397,9 @@ void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state)
 
             /* Snap to things with no constraint */
                        s.push_back(m.freeSnapTranslation(Inkscape::Snapper::SNAPPOINT_BBOX,
-                                              _bbox_points, it, dxy));
+                                              _bbox_points, _items_const, dxy));
             s.push_back(m.freeSnapTranslation(Inkscape::Snapper::SNAPPOINT_NODE,
-                                              _snap_points, it, dxy));
+                                              _snap_points, _items_const, dxy));
 
                /*g_get_current_time(&endtime);
                double elapsed = ((((double)endtime.tv_sec - starttime.tv_sec) * G_USEC_PER_SEC + (endtime.tv_usec - starttime.tv_usec))) / 1000.0;
index 00d7fb1c494dcd865184cb580385cff42ead8348..d06e0527626c7629ae65dc227ead958ffead6c73 100644 (file)
@@ -110,8 +110,10 @@ private:
     
     SPDesktop *_desktop;
 
-    std::vector<std::pair<SPItem *, NR::Matrix> > _items;
-    std::vector<std::pair<SPItem *, NR::Point> > _items_centers;
+    std::vector<SPItem *> _items;
+    std::vector<SPItem const *> _items_const;
+    std::vector<NR::Matrix> _items_affines;
+    std::vector<NR::Point> _items_centers;
     
     std::vector<NR::Point> _snap_points;
     std::vector<NR::Point> _bbox_points;
index 76bda92822f9a2cb708d34163049291a54df1373..2d23a7745458ccb176c56becb561f357a58d7205 100644 (file)
@@ -182,8 +182,10 @@ Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::Snapper::PointType t,
                                              NR::Maybe<NR::Point> point_not_to_snap_to) const
 
 {
-    std::list<SPItem const *> lit;
-    lit.push_back(it);
+    std::vector<SPItem const *> lit;
+    if (it) {
+        lit.push_back(it);
+    }
     
     std::vector<NR::Point> points_to_snap;
     points_to_snap.push_back(p);
@@ -206,8 +208,10 @@ Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::Snapper::PointType t,
                                              std::vector<NR::Point> *unselected_nodes) const
 
 {
-    std::list<SPItem const *> lit;
-    lit.push_back(it);
+    std::vector<SPItem const *> lit;
+    if (it) {
+        lit.push_back(it);
+    }
     
     std::vector<NR::Point> points_to_snap;
     points_to_snap.push_back(p);
@@ -232,7 +236,7 @@ Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::Snapper::PointType t,
                                              NR::Point const &p,
                                              bool const &first_point,
                                              std::vector<NR::Point> &points_to_snap,
-                                             std::list<SPItem const *> const &it,
+                                             std::vector<SPItem const *> const &it,
                                              std::vector<NR::Point> *unselected_nodes) const
 {
     if (!SomeSnapperMightSnap()) {
@@ -266,8 +270,10 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::Snapper::PointType
                                                     Inkscape::Snapper::ConstraintLine const &c,
                                                     SPItem const *it) const
 {
-    std::list<SPItem const *> lit;
-    lit.push_back(it);
+    std::vector<SPItem const *> lit;
+    if (it) {
+        lit.push_back(it);
+    }
     
     std::vector<NR::Point> points_to_snap;
     points_to_snap.push_back(p);
@@ -295,7 +301,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::Snapper::PointType
                                                     bool const &first_point,
                                                     std::vector<NR::Point> &points_to_snap,
                                                     Inkscape::Snapper::ConstraintLine const &c,
-                                                    std::list<SPItem const *> const &it) const
+                                                    std::vector<SPItem const *> const &it) const
 {
     if (!SomeSnapperMightSnap()) {
         return Inkscape::SnappedPoint(p, NR_HUGE, 0, false);
@@ -347,7 +353,7 @@ Inkscape::SnappedPoint SnapManager::guideSnap(NR::Point const &p,
 Inkscape::SnappedPoint SnapManager::_snapTransformed(
     Inkscape::Snapper::PointType type,
     std::vector<NR::Point> const &points,
-    std::list<SPItem const *> const &ignore,
+    std::vector<SPItem const *> const &ignore,
     bool constrained,
     Inkscape::Snapper::ConstraintLine const &constraint,
     Transformation transformation_type,
@@ -593,7 +599,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
 
 Inkscape::SnappedPoint SnapManager::freeSnapTranslation(Inkscape::Snapper::PointType t,
                                                         std::vector<NR::Point> const &p,
-                                                        std::list<SPItem const *> const &it,
+                                                        std::vector<SPItem const *> const &it,
                                                         NR::Point const &tr) const
 {
     return _snapTransformed(t, p, it, false, NR::Point(), TRANSLATION, tr, NR::Point(), NR::X, false);
@@ -615,7 +621,7 @@ Inkscape::SnappedPoint SnapManager::freeSnapTranslation(Inkscape::Snapper::Point
 
 Inkscape::SnappedPoint SnapManager::constrainedSnapTranslation(Inkscape::Snapper::PointType t,
                                                                std::vector<NR::Point> const &p,
-                                                               std::list<SPItem const *> const &it,
+                                                               std::vector<SPItem const *> const &it,
                                                                Inkscape::Snapper::ConstraintLine const &c,
                                                                NR::Point const &tr) const
 {
@@ -637,7 +643,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapTranslation(Inkscape::Snapper
 
 Inkscape::SnappedPoint SnapManager::freeSnapScale(Inkscape::Snapper::PointType t,
                                                   std::vector<NR::Point> const &p,
-                                                  std::list<SPItem const *> const &it,
+                                                  std::vector<SPItem const *> const &it,
                                                   NR::scale const &s,
                                                   NR::Point const &o) const
 {
@@ -660,7 +666,7 @@ Inkscape::SnappedPoint SnapManager::freeSnapScale(Inkscape::Snapper::PointType t
 
 Inkscape::SnappedPoint SnapManager::constrainedSnapScale(Inkscape::Snapper::PointType t,
                                                          std::vector<NR::Point> const &p,
-                                                         std::list<SPItem const *> const &it,
+                                                         std::vector<SPItem const *> const &it,
                                                          NR::scale const &s,
                                                          NR::Point const &o) const
 {
@@ -685,7 +691,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapScale(Inkscape::Snapper::Poin
 
 Inkscape::SnappedPoint SnapManager::constrainedSnapStretch(Inkscape::Snapper::PointType t,
                                                             std::vector<NR::Point> const &p,
-                                                            std::list<SPItem const *> const &it,
+                                                            std::vector<SPItem const *> const &it,
                                                             NR::Coord const &s,
                                                             NR::Point const &o,
                                                             NR::Dim2 d,
@@ -710,7 +716,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapStretch(Inkscape::Snapper::Po
 
 Inkscape::SnappedPoint SnapManager::freeSnapSkew(Inkscape::Snapper::PointType t,
                                                  std::vector<NR::Point> const &p,
-                                                 std::list<SPItem const *> const &it,
+                                                 std::vector<SPItem const *> const &it,
                                                  NR::Coord const &s,
                                                  NR::Point const &o,
                                                  NR::Dim2 d) const
index 8bab5b0cf1d951b7c8f23a0918e008cd4964a9ce..0de8902f45daa676ffea026c2a965e112d76e5d6 100644 (file)
@@ -61,7 +61,7 @@ public:
                                     NR::Point const &p,
                                     bool const &first_point,
                                     std::vector<NR::Point> &points_to_snap,
-                                    std::list<SPItem const *> const &it,
+                                    std::vector<SPItem const *> const &it,
                                     std::vector<NR::Point> *unselected_nodes) const;
 
     Inkscape::SnappedPoint constrainedSnap(Inkscape::Snapper::PointType t,
@@ -74,37 +74,37 @@ public:
                                            bool const &first_point,
                                            std::vector<NR::Point> &points_to_snap,
                                            Inkscape::Snapper::ConstraintLine const &c,
-                                           std::list<SPItem const *> const &it) const;
+                                           std::vector<SPItem const *> const &it) const;
                                            
     Inkscape::SnappedPoint guideSnap(NR::Point const &p,
                                      NR::Point const &guide_normal) const;
 
     Inkscape::SnappedPoint freeSnapTranslation(Inkscape::Snapper::PointType t,
                                                std::vector<NR::Point> const &p,
-                                               std::list<SPItem const *> const &it,
+                                               std::vector<SPItem const *> const &it,
                                                NR::Point const &tr) const;
 
     Inkscape::SnappedPoint constrainedSnapTranslation(Inkscape::Snapper::PointType t,
                                                       std::vector<NR::Point> const &p,
-                                                      std::list<SPItem const *> const &it,
+                                                      std::vector<SPItem const *> const &it,
                                                       Inkscape::Snapper::ConstraintLine const &c,
                                                       NR::Point const &tr) const;
 
     Inkscape::SnappedPoint freeSnapScale(Inkscape::Snapper::PointType t,
                                          std::vector<NR::Point> const &p,
-                                         std::list<SPItem const *> const &it,
+                                         std::vector<SPItem const *> const &it,
                                          NR::scale const &s,
                                          NR::Point const &o) const;
 
     Inkscape::SnappedPoint constrainedSnapScale(Inkscape::Snapper::PointType t,
                                                 std::vector<NR::Point> const &p,
-                                                std::list<SPItem const *> const &it,
+                                                std::vector<SPItem const *> const &it,
                                                 NR::scale const &s,
                                                 NR::Point const &o) const;
 
     Inkscape::SnappedPoint constrainedSnapStretch(Inkscape::Snapper::PointType t,
                                                    std::vector<NR::Point> const &p,
-                                                   std::list<SPItem const *> const &it,
+                                                   std::vector<SPItem const *> const &it,
                                                    NR::Coord const &s,
                                                    NR::Point const &o,
                                                    NR::Dim2 d,
@@ -112,7 +112,7 @@ public:
 
     Inkscape::SnappedPoint freeSnapSkew(Inkscape::Snapper::PointType t,
                                         std::vector<NR::Point> const &p,
-                                        std::list<SPItem const *> const &it,
+                                        std::vector<SPItem const *> const &it,
                                         NR::Coord const &s,
                                         NR::Point const &o,
                                         NR::Dim2 d) const;
@@ -180,7 +180,7 @@ private:
     
     Inkscape::SnappedPoint _snapTransformed(Inkscape::Snapper::PointType type,
                                             std::vector<NR::Point> const &points,
-                                            std::list<SPItem const *> const &ignore,
+                                            std::vector<SPItem const *> const &ignore,
                                             bool constrained,
                                             Inkscape::Snapper::ConstraintLine const &constraint,
                                             Transformation transformation_type,
index 31a96a8716868c21fe052b0718157833b41d942a..803506e7641d88c6468541200b5433546b582ef9 100644 (file)
@@ -104,7 +104,7 @@ void Inkscape::Snapper::freeSnap(SnappedConstraints &sc,
                                                    std::vector<NR::Point> &points_to_snap,                         
                                                    SPItem const *it) const
 {
-    std::list<SPItem const *> lit;
+    std::vector<SPItem const *> lit;
     if (it) {
         lit.push_back(it);
     }
@@ -128,7 +128,7 @@ void Inkscape::Snapper::freeSnap(SnappedConstraints &sc,
                                                    NR::Point const &p,
                                                    bool const &first_point,
                                                    std::vector<NR::Point> &points_to_snap,                     
-                                                   std::list<SPItem const *> const &it,
+                                                   std::vector<SPItem const *> const &it,
                                                    std::vector<NR::Point> *unselected_nodes) const
 {
     if (_snap_enabled == false || getSnapFrom(t) == false) {
@@ -160,8 +160,10 @@ void Inkscape::Snapper::constrainedSnap(SnappedConstraints &sc,
                                                           ConstraintLine const &c,
                                                           SPItem const *it) const
 {
-    std::list<SPItem const *> lit;
-    lit.push_back(it);
+    std::vector<SPItem const *> lit;
+    if (it) {
+        lit.push_back(it);
+    }
     constrainedSnap(sc, t, p, first_point, points_to_snap, c, lit);
 }
 
@@ -183,7 +185,7 @@ void Inkscape::Snapper::constrainedSnap(SnappedConstraints &sc,
                                                           bool const &first_point,
                                                           std::vector<NR::Point> &points_to_snap,                         
                                                           ConstraintLine const &c,
-                                                          std::list<SPItem const *> const &it) const
+                                                          std::vector<SPItem const *> const &it) const
 {
     if (_snap_enabled == false || getSnapFrom(t) == false) {
         return;
index 508ba7b9ad91dee834c396c82465c34bed2f16c6..cad4200ab6e0e237c72af4c8ef9f7e8fa782ed78 100644 (file)
@@ -75,7 +75,7 @@ public:
                           NR::Point const &p,
                           bool const &first_point,                                             
                           std::vector<NR::Point> &points_to_snap,                         
-                          std::list<SPItem const *> const &it,
+                          std::vector<SPItem const *> const &it,
                           std::vector<NR::Point> *unselected_nodes) const;
     
     class ConstraintLine
@@ -117,7 +117,7 @@ public:
                                  bool const &first_point,
                                  std::vector<NR::Point> &points_to_snap,                         
                                  ConstraintLine const &c,
-                                 std::list<SPItem const *> const &it) const;
+                                 std::vector<SPItem const *> const &it) const;
                                  
 protected:
     SPNamedView const *_named_view;
@@ -144,7 +144,7 @@ private:
                                      NR::Point const &p,
                                      bool const &first_point,                                             
                                      std::vector<NR::Point> &points_to_snap,
-                                     std::list<SPItem const *> const &it,
+                                     std::vector<SPItem const *> const &it,
                                      std::vector<NR::Point> *unselected_nodes) const = 0;
 
     /**
@@ -163,7 +163,7 @@ private:
                                             bool const &first_point,
                                             std::vector<NR::Point> &points_to_snap,
                                             ConstraintLine const &c,
-                                            std::list<SPItem const *> const &it) const = 0;
+                                            std::vector<SPItem const *> const &it) const = 0;
 };
 
 }