summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-04-13 20:49:26 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-04-13 20:49:26 +0000
commit0b9f1821ef6908d509c4b2a4c94fb0df35e6079a (patch)
treede3a332e27b3f0d9cca5f3fc63924bbc74a1509b /src
parentAdd global preference for selector tool, chosing between GEOMETRIC_BBOX or VI... (diff)
downloadinkscape-0b9f1821ef6908d509c4b2a4c94fb0df35e6079a.tar.gz
inkscape-0b9f1821ef6908d509c4b2a4c94fb0df35e6079a.zip
New Grids are now ready to go. bug testing can start i think.
(bzr r2878)
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp2
-rw-r--r--src/display/canvas-grid.cpp48
-rw-r--r--src/display/canvas-grid.h11
-rw-r--r--src/snap.cpp13
-rw-r--r--src/snap.h3
-rw-r--r--src/sp-namedview.cpp1
-rw-r--r--src/ui/dialog/document-properties.cpp2
7 files changed, 11 insertions, 69 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 23a3bf959..4236fd7d8 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -301,7 +301,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas)
// (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;
+ grids_visible = true;
}
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 6644092df..6ca6b7f83 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -137,9 +137,6 @@ grid_canvasitem_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i
CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr)
{
- snapenabled = true;
- visible = true;
-
repr = in_repr;
if (repr) {
repr->addListener (&_repr_events, this);
@@ -221,11 +218,7 @@ CanvasGrid::createCanvasItem(SPDesktop * desktop)
GridCanvasItem * item = INKSCAPE_GRID_CANVASITEM( sp_canvas_item_new(sp_desktop_gridgroup(desktop), INKSCAPE_TYPE_GRID_CANVASITEM, NULL) );
item->grid = this;
- if (desktop->gridsEnabled()) {
- sp_canvas_item_show(SP_CANVAS_ITEM(item));
- } else {
- sp_canvas_item_hide(SP_CANVAS_ITEM(item));
- }
+ sp_canvas_item_show(SP_CANVAS_ITEM(item));
gtk_object_ref(GTK_OBJECT(item)); // since we're keeping a link to this item, we need to bump up the ref count
canvasitems = g_slist_prepend(canvasitems, item);
@@ -233,45 +226,6 @@ CanvasGrid::createCanvasItem(SPDesktop * desktop)
return item;
}
-
-void
-CanvasGrid::hide()
-{
- for (GSList *l = canvasitems; l != NULL; l = l->next) {
- sp_canvas_item_hide ( SP_CANVAS_ITEM(l->data) );
- }
- visible = false;
- disable_snapping(); // temporary hack, because at the moment visibilty and snapping are linked
-}
-
-void
-CanvasGrid::show()
-{
- for (GSList *l = canvasitems; l != NULL; l = l->next) {
- sp_canvas_item_show ( SP_CANVAS_ITEM(l->data) );
- }
- visible = true;
- enable_snapping(); // temporary hack, because at the moment visibilty and snapping are linked
-}
-
-void
-CanvasGrid::set_visibility(bool visible)
-{
- this->visible = visible;
- if(visible) {
- show();
- } else {
- hide();
- }
-}
-
-void
-CanvasGrid::toggle_visibility()
-{
- visible = !visible;
- set_visibility(visible);
-}
-
void
CanvasGrid::on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data)
{
diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h
index db0f29f40..984ddad79 100644
--- a/src/display/canvas-grid.h
+++ b/src/display/canvas-grid.h
@@ -75,14 +75,6 @@ public:
virtual Gtk::Widget & getWidget() = 0;
- void hide();
- void show();
- void set_visibility(bool visible);
- void toggle_visibility();
- void enable_snapping() { snapenabled = true; snapper->setEnabled(true); } ;
- void disable_snapping() { snapenabled = false; snapper->setEnabled(false); } ;
- void toggle_snapping() { snapenabled = !snapenabled; snapper->setEnabled(snapenabled);};
-
Inkscape::XML::Node * repr;
Inkscape::Snapper* snapper;
@@ -96,9 +88,6 @@ protected:
Gtk::VBox vbox;
- bool snapenabled;
- bool visible;
-
private:
CanvasGrid(const CanvasGrid&);
CanvasGrid& operator=(const CanvasGrid&);
diff --git a/src/snap.cpp b/src/snap.cpp
index e9bdb7063..4f871e736 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -23,6 +23,9 @@
#include "display/canvas-grid.h"
+#include "inkscape.h"
+#include "desktop.h"
+
/**
* Construct a SnapManager for a SPNamedView.
*
@@ -50,16 +53,14 @@ SnapManager::SnapperList SnapManager::getSnappers() const
s.push_back(&guide);
s.push_back(&object);
- //add new grid snappers that are active for this desktop
-// SPDesktop* desktop = SP_ACTIVE_DESKTOP;
-// if (desktop) {
-
+ //FIXME: this code should do this: add new grid snappers that are active for this desktop
+ SPDesktop* desktop = SP_ACTIVE_DESKTOP;
+ if (desktop && desktop->gridsEnabled()) {
for ( GSList const *l = _named_view->grids; l != NULL; l = l->next) {
Inkscape::CanvasGrid *grid = (Inkscape::CanvasGrid*) l->data;
s.push_back(grid->snapper);
}
-
-// }
+ }
return s;
}
diff --git a/src/snap.h b/src/snap.h
index 09c527c74..2f8e83b13 100644
--- a/src/snap.h
+++ b/src/snap.h
@@ -10,7 +10,7 @@
* Frank Felfe <innerspace@iname.com>
* Carl Hetherington <inkscape@carlh.net>
*
- * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
+ * Copyright (C) 2006-2007 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 2000-2002 Lauris Kaplinski
*
* Released under GNU GPL, read the file 'COPYING' for more information
@@ -106,7 +106,6 @@ public:
typedef std::list<const Inkscape::Snapper*> SnapperList;
SnapperList getSnappers() const;
- SnapperList gridSnappers; ///< List of grid snappers to enable multiple grids
protected:
SPNamedView const *_named_view;
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index c62c6b62e..a11904570 100644
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -563,7 +563,6 @@ sp_namedview_add_grid(SPNamedView *nv, Inkscape::XML::Node *repr, SPDesktop *des
//add canvasitem only for specified desktop
grid->createCanvasItem(desktop);
}
- grid->show();
return grid;
}
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 8a6955003..fa1ea4750 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -9,7 +9,7 @@
* Jon Phillips <jon@rejon.org>
* Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
*
- * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
+ * Copyright (C) 2006-2007 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 2000 - 2005 Authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information