summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 59a0ba0)
raw | patch | inline | side by side (parent: 59a0ba0)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 15 Apr 2007 20:57:15 +0000 (20:57 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 15 Apr 2007 20:57:15 +0000 (20:57 +0000) |
src/desktop.cpp | patch | blob | history |
diff --git a/src/desktop.cpp b/src/desktop.cpp
index a9c4e5d7f7d244c82bba42fbda1121e9bfdcff89..5ab682cd09f13e33d6c90c120d6c93965109548c 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
void SPDesktop::toggleGrid()
{
- if(gridgroup) {
- grids_visible = !grids_visible;
- if (grids_visible) {
- sp_canvas_item_show(SP_CANVAS_ITEM(gridgroup));
- } else {
- sp_canvas_item_hide(SP_CANVAS_ITEM(gridgroup));
+ if (namedview->grids) {
+ if(gridgroup) {
+ grids_visible = !grids_visible;
+ if (grids_visible) {
+ sp_canvas_item_show(SP_CANVAS_ITEM(gridgroup));
+ } else {
+ sp_canvas_item_hide(SP_CANVAS_ITEM(gridgroup));
+ }
}
+ } else {
+ //there is no grid present at the moment. add a rectangular grid and make it visible
+ Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview);
+ Inkscape::CanvasGrid::writeNewGridToRepr(repr, "xygrid");
+ grids_visible = true;
+ sp_canvas_item_show(SP_CANVAS_ITEM(gridgroup));
}
}