Code

now that selection description includes style (filtered, clipped), we need to update...
[inkscape.git] / src / snapper.h
index 7ad548ab401b377aef828868aff4591364920dc6..49f2774113d8062ee5afe6942e3f38d6fc8b2847 100644 (file)
@@ -42,27 +42,25 @@ class Snapper
 {
 public:
        Snapper() {}
-       Snapper(SnapManager const *sm, ::Geom::Coord const t);
+       Snapper(SnapManager *sm, ::Geom::Coord const t);
        virtual ~Snapper() {}
-       
-    void setSnapperTolerance(Geom::Coord t);
-    Geom::Coord getSnapperTolerance() const; //returns the tolerance of the snapper in screen pixels (i.e. independent of zoom)
-    bool getSnapperAlwaysSnap() const; //if true, then the snapper will always snap, regardless of its tolerance
+
+    virtual Geom::Coord getSnapperTolerance() const = 0; //returns the tolerance of the snapper in screen pixels (i.e. independent of zoom)
+    virtual bool getSnapperAlwaysSnap() const = 0; //if true, then the snapper will always snap, regardless of its tolerance
 
     /**
     *  \return true if this Snapper will snap at least one kind of point.
     */
-    //virtual bool ThisSnapperMightSnap() const;
     virtual bool ThisSnapperMightSnap() const {return _snap_enabled;} // will likely be overridden by derived classes
 
-    void setEnabled(bool s);
+    void setEnabled(bool s); // This is only used for grids, for which snapping can be enabled individually
     bool getEnabled() const {return _snap_enabled;}
 
     virtual void freeSnap(SnappedConstraints &/*sc*/,
                           SnapPreferences::PointType const &/*t*/,
                           Geom::Point const &/*p*/,
                           bool const &/*first_point*/,
-                          boost::optional<Geom::Rect> const &/*bbox_to_snap*/,
+                          Geom::OptRect const &/*bbox_to_snap*/,
                           std::vector<SPItem const *> const */*it*/,
                           std::vector<Geom::Point> */*unselected_nodes*/) const {};
 
@@ -83,10 +81,10 @@ public:
         Geom::Point getDirection() const {
             return _direction;
         }
-        
+
         void setPoint(Geom::Point const &p) {
             _point = p;
-            _has_point = true;        
+            _has_point = true;
         }
 
     private:
@@ -100,19 +98,15 @@ public:
                                                         SnapPreferences::PointType const &/*t*/,
                                  Geom::Point const &/*p*/,
                                  bool const &/*first_point*/,
-                                 boost::optional<Geom::Rect> const &/*bbox_to_snap*/,
+                                 Geom::OptRect const &/*bbox_to_snap*/,
                                  ConstraintLine const &/*c*/,
                                  std::vector<SPItem const *> const */*it*/) const {};
 
 protected:
-       SnapManager const *_snapmanager;
-       
-       bool _snap_enabled; ///< true if this snapper is enabled, otherwise false
+       SnapManager *_snapmanager;
 
-private:
-       Geom::Coord _snapper_tolerance;   ///< snap tolerance in desktop coordinates
-                                    // must be private to enforce the usage of getTolerance(), which retrieves
-                                    // the tolerance in screen pixels (making it zoom independent)
+       bool _snap_enabled; ///< true if this snapper is enabled, otherwise false
+                                               // This is only used for grids, for which snapping can be enabled individually
 };
 
 }