Code

make rotations, scales and flips work with the object's rotation axis
[inkscape.git] / src / grid-snapper.cpp
index 5c94b9a97d4772bb0648647125534271b5fe151f..818f0abd9c2751af2c3e869a8920cf3ebe69051d 100644 (file)
@@ -7,6 +7,7 @@
  *   Frank Felfe <innerspace@iname.com>
  *   Carl Hetherington <inkscape@carlh.net>
  *
+ * Copyright (C) 2006      Johan Engelen <johan@shouraizou.nl>
  * Copyright (C) 1999-2002 Authors
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
@@ -16,6 +17,7 @@
 #include "inkscape.h"
 #include "desktop.h"
 #include "display/canvas-grid.h"
+#include "display/canvas-axonomgrid.h"
 
 /**
  * \return x rounded to the nearest multiple of c1 plus c0.
@@ -37,7 +39,8 @@ Inkscape::GridSnapper::GridSnapper(SPNamedView const *nv, NR::Coord const d) : L
 
 }
 
-Inkscape::LineSnapper::LineList Inkscape::GridSnapper::_getSnapLines(NR::Point const &p) const
+Inkscape::LineSnapper::LineList 
+Inkscape::GridSnapper::_getSnapLines(NR::Point const &p) const
 {
     LineList s;
 
@@ -45,14 +48,16 @@ Inkscape::LineSnapper::LineList Inkscape::GridSnapper::_getSnapLines(NR::Point c
         return s;
     }
 
-    SPCGrid *griditem = NULL;
+    CXYGrid *griditem = NULL;
     for (GSList *l = _named_view->gridviews; l != NULL; l = l->next) {
         // FIXME : this is a hack since there is only one view for now
         //                 but when we'll handle multiple views, snapping should
         //                 must be rethought and maybe only the current view
         //                 should give back it's SHOWN lines to snap to
-        //                 For now, the last SPCGrid in _named_view->gridviews will be used.
-        griditem = SP_CGRID(l->data);
+        //                 For now, the last CXYGrid in _named_view->gridviews will be used.
+        if ( INKSCAPE_IS_CXYGRID(GTK_OBJECT(l->data)) ) {
+            griditem = INKSCAPE_CXYGRID(l->data);
+        }
     }
 
     g_assert(griditem != NULL);