Code

Filter effects dialog:
[inkscape.git] / src / guide-snapper.cpp
index e247c0451ae843dfd1c7039d738fbcca7ffe96d1..1e4eb02d835e49541de517e29900d7198587f292 100644 (file)
@@ -7,7 +7,7 @@
  *   Frank Felfe <innerspace@iname.com>
  *   Carl Hetherington <inkscape@carlh.net>
  *
- * Copyright (C) 1999-2002 Authors 
+ * Copyright (C) 1999-2002 Authors
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
@@ -25,7 +25,11 @@ Inkscape::GuideSnapper::GuideSnapper(SPNamedView const *nv, NR::Coord const d) :
 Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(NR::Point const &p) const
 {
     LineList s;
-    
+
+    if ( NULL == _named_view || ThisSnapperMightSnap() == false) {
+        return s;
+    }
+
     for (GSList const *l = _named_view->guides; l != NULL; l = l->next) {
         SPGuide const *g = SP_GUIDE(l->data);
 
@@ -40,6 +44,14 @@ Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(NR::Point
     return s;
 }
 
+/**
+ *  \return true if this Snapper will snap at least one kind of point.
+ */
+bool Inkscape::GuideSnapper::ThisSnapperMightSnap() const
+{
+    return _named_view == NULL ? false : (_enabled && _snap_to != 0 && _named_view->showguides);
+}
+
 /*
   Local Variables:
   mode:c++