summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6f2291d)
raw | patch | inline | side by side (parent: 6f2291d)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 1 Apr 2007 22:32:34 +0000 (22:32 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 1 Apr 2007 22:32:34 +0000 (22:32 +0000) |
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 0d7d43646f9353752289ae27dbd04a42fc9a1c32..187dcd010d4e441a98506f926bf1eaecce1b5135 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
sp_event_context_update_cursor(sp_desktop_event_context(this));
}
+void SPDesktop::toggleGrid()
+{
+ for ( GSList const *l = namedview->grids; l != NULL; l = l->next) {
+ Inkscape::CanvasGrid *grid = (Inkscape::CanvasGrid*) l->data;
+ grid->toggle_visibility();
+ }
+}
+
//----------------------------------------------------------------------
// Callback implementations. The virtual ones are connected by the view.
diff --git a/src/desktop.h b/src/desktop.h
index e5f9cdacc1a1b473460d732f340efbf386effbda..1770af9f5d7b45aa84d27f4629e037fdc01d01e8 100644 (file)
--- a/src/desktop.h
+++ b/src/desktop.h
void setWaitingCursor();
void clearWaitingCursor();
+ void toggleGrid();
+
void fullscreen();
void registerEditWidget (Inkscape::UI::View::EditWidgetInterface *widget)
index 643ffccdc1aac7b9ab80b77e785caec59386283a..f343077c3550c3e5aed36afc4f10ead5a5a80842 100644 (file)
gtk_object_ref(GTK_OBJECT(canvasitem)); // since we're keeping a copy, we need to bump up the ref count
canvasitem->grid = this;
- enabled = false;
+ snapenabled = false;
visible = false;
// sp_canvas_item_hide(canvasitem);
// deref canvasitem
gtk_object_unref(GTK_OBJECT(canvasitem));
g_free(canvasitem);
- g_message("~CanvasGrid");
}
/*
{
sp_canvas_item_hide(canvasitem);
visible = false;
+ disable_snapping(); // temporary hack, because at the moment visibilty and snapping are linked
}
void
{
sp_canvas_item_show(canvasitem);
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
index c501ab3f38a9fbdc50391b3ac6b33336c48d933b..54a57d3d0dc2130dd0ec298613df3df9213dd682 100644 (file)
virtual Gtk::Widget & getWidget() = 0;
- bool enabled;
- bool visible;
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;
Gtk::VBox vbox;
+ bool snapenabled;
+ bool visible;
+
private:
CanvasGrid(const CanvasGrid&);
CanvasGrid& operator=(const CanvasGrid&);
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index 0928de19e2b1af9fa5173f53000d4f40052ca393..26c53c8e0d6b02cd5dd9dd9bfb75570d799539ee 100644 (file)
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -527,8 +527,6 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
{
-g_message("named view:: child added");
-
SPNamedView *nv = (SPNamedView *) object;
if (((SPObjectClass *) (parent_class))->child_added) {
Inkscape::CanvasXYGrid* addedgrid = new Inkscape::CanvasXYGrid(desktop, child);
if (addedgrid) {
grids = g_slist_append(grids, addedgrid);
- addedgrid->enabled = true;
+ addedgrid->enable_snapping();
addedgrid->show();
}
}
index 3f84c18089f1e0b88a016808330dfd19a6197fdb..fff815d8c88d1baf2f1f79d7bf4dbe62eced6aa3 100644 (file)
}
_grids_notebook.show_all();
- const Gtk::Widget* widget_array[] =
- {
- (Gtk::Widget*) &_grids_notebook, 0
- };
- attach_all (_page_grids.table(), widget_array, sizeof(widget_array),3); // FIXME: a hack to let GTK show all tabs, otherwise XML manually added grids setting widgets do no show.
+ _page_grids.table().resize_children();
}
/**
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 28e0084861f29e037d530e451dfa00b7a9d6d6ea..172b5220c321fd070d76a2827129e26e04ede083 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
break;
case SP_VERB_TOGGLE_GRID:
sp_namedview_toggle_grid(doc, repr);
+ dt->toggleGrid();
break;
#ifdef HAVE_GTK_WINDOW_FULLSCREEN
case SP_VERB_FULLSCREEN: