From: johanengelen Date: Fri, 13 Apr 2007 20:49:26 +0000 (+0000) Subject: New Grids are now ready to go. bug testing can start i think. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e028f2923eba0794a5323b536b76fc24d19f2f0a;p=inkscape.git New Grids are now ready to go. bug testing can start i think. --- 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 * Carl Hetherington * - * Copyright (C) 2006 Johan Engelen + * Copyright (C) 2006-2007 Johan Engelen * 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 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 * Ralf Stephan (Gtkmm) * - * Copyright (C) 2006 Johan Engelen + * Copyright (C) 2006-2007 Johan Engelen * Copyright (C) 2000 - 2005 Authors * * Released under GNU GPL. Read the file 'COPYING' for more information