summaryrefslogtreecommitdiffstats
path: root/src/sp-namedview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp-namedview.cpp')
-rw-r--r--src/sp-namedview.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index 7705a21ec..fdbedab4e 100644
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -950,6 +950,20 @@ SPMetric SPNamedView::getDefaultMetric() const
}
}
+/**
+ * Returns the first grid it could find that isEnabled(). Returns NULL, if none is enabled
+ */
+Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedview)
+{
+ for (GSList const * l = namedview->grids; l != NULL; l = l->next) {
+ Inkscape::CanvasGrid * grid = (Inkscape::CanvasGrid*) l->data;
+ if (grid->isEnabled())
+ return grid;
+ }
+
+ return NULL;
+}
+
/*
Local Variables: