summaryrefslogtreecommitdiffstats
path: root/src/desktop.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-04-13 14:41:49 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-04-13 14:41:49 +0000
commit49b2bdfaebf7af17e0ad5934f26bab941327939c (patch)
treed10d03f8734b268d6470e443ede113536506c366 /src/desktop.cpp
parenttouch selection update (diff)
downloadinkscape-49b2bdfaebf7af17e0ad5934f26bab941327939c.tar.gz
inkscape-49b2bdfaebf7af17e0ad5934f26bab941327939c.zip
New grids are almost ready to fly!
(bzr r2873)
Diffstat (limited to 'src/desktop.cpp')
-rw-r--r--src/desktop.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 15d5bc9e3..561ab1cf0 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -85,6 +85,8 @@
#include "event-log.h"
#include "display/canvas-grid.h"
+#include "sp-canvas.h"
+
namespace Inkscape { namespace XML { class Node; }}
// Callback declarations
@@ -111,7 +113,7 @@ SPDesktop::SPDesktop()
selection = NULL;
acetate = NULL;
main = NULL;
- grid = NULL;
+ gridgroup = NULL;
guides = NULL;
drawing = NULL;
sketch = NULL;
@@ -201,7 +203,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas)
setDisplayModeNormal();
}
- grid = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
+ gridgroup = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
guides = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
sketch = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
controls = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL);
@@ -298,6 +300,8 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas)
/* setup LayerManager */
// (Setting up after the connections are all in place, as it may use some of them)
layer_manager = new Inkscape::LayerManager( this );
+
+ grids_visible = false;
}
@@ -1101,9 +1105,13 @@ void SPDesktop::clearWaitingCursor()
void SPDesktop::toggleGrid()
{
- for ( GSList const *l = namedview->grids; l != NULL; l = l->next) {
- Inkscape::CanvasGrid *grid = (Inkscape::CanvasGrid*) l->data;
- grid->toggle_visibility();
+ 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));
+ }
}
}