Code

Filter effects dialog:
[inkscape.git] / src / ui / dialog / document-properties.cpp
index 4fc3e5497c91a748c719e36251caf419be363d98..0817b06aba7418c8e5cb774cf6fcf2ed1fdd5f4c 100644 (file)
@@ -152,16 +152,16 @@ DocumentProperties::~DocumentProperties()
 //========================================================================
 
 /**
- * Helper function that attachs widgets in a 3xn table. The widgets come in an
+ * Helper function that attaches widgets in a 3xn table. The widgets come in an
  * array that has two entries per table row. The two entries code for four
  * possible cases: (0,0) means insert space in first column; (0, non-0) means
  * widget in columns 2-3; (non-0, 0) means label in columns 1-3; and
  * (non-0, non-0) means two widgets in columns 2 and 3.
 **/
 inline void
-attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned size, int start = 0)
+attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned const n, int start = 0)
 {
-    for (unsigned i=0, r=start; i<size/sizeof(Gtk::Widget*); i+=2)
+    for (unsigned i = 0, r = start; i < n; i += 2)
     {
         if (arr[i] && arr[i+1])
         {
@@ -233,7 +233,7 @@ DocumentProperties::build_page()
         _rcp_bord._label,  _rcp_bord._cp,
     };
 
-    attach_all (_page_page.table(), widget_array, sizeof(widget_array));
+    attach_all(_page_page.table(), widget_array, G_N_ELEMENTS(widget_array));
 }
 
 void
@@ -258,7 +258,7 @@ DocumentProperties::build_guides()
         _rcp_hgui._label, _rcp_hgui._cp,
     };
 
-    attach_all (_page_guides.table(), widget_array, sizeof(widget_array));
+    attach_all(_page_guides.table(), widget_array, G_N_ELEMENTS(widget_array));
 }
 
 void
@@ -305,7 +305,7 @@ DocumentProperties::build_snap()
         0,                _rsu_gusn._vbox,
     };
 
-    attach_all (_page_snap.table(), array, sizeof(array));
+    attach_all(_page_snap.table(), array, G_N_ELEMENTS(array));
  }
 
 /**
@@ -370,11 +370,11 @@ DocumentProperties::build_gridspage()
         label_crea, 0,
         label_crea_type, (Gtk::Widget*) &_grids_combo_gridtype,
         (Gtk::Widget*) &_grids_button_new,         (Gtk::Widget*) &_grids_button_remove, 
-        label_def,         0,
-        (Gtk::Widget*) &_grids_notebook, 0
+        label_def,         0
     };
-
-    attach_all (_page_grids.table(), widget_array, sizeof(widget_array));
+    attach_all(_page_grids.table(), widget_array, G_N_ELEMENTS(widget_array));
+    _page_grids.table().attach(_grids_notebook, 0, 3, 4, 5,
+                              Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
 }
 
 
@@ -529,10 +529,12 @@ on_doc_replaced (SPDesktop* dt, SPDocument* doc)
 void
 DocumentProperties::onNewGrid()
 {
-    Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(SP_ACTIVE_DESKTOP));
+    SPDesktop *dt = SP_ACTIVE_DESKTOP;
+    Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(dt));
+    SPDocument *doc = sp_desktop_document(dt);
 
     Glib::ustring typestring = _grids_combo_gridtype.get_active_text();
-    CanvasGrid::writeNewGridToRepr(repr, CanvasGrid::getGridTypeFromName(typestring.c_str()));
+    CanvasGrid::writeNewGridToRepr(repr, doc, CanvasGrid::getGridTypeFromName(typestring.c_str()));
 }
 
 
@@ -564,7 +566,7 @@ DocumentProperties::onRemoveGrid()
         // delete the grid that corresponds with the selected tab
         // when the grid is deleted from SVG, the SPNamedview handler automatically deletes the object, so found_grid becomes an invalid pointer!
         found_grid->repr->parent()->removeChild(found_grid->repr);
-       sp_document_done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid"));
+        sp_document_done(sp_desktop_document(dt), SP_VERB_DIALOG_NAMEDVIEW, _("Remove grid"));
     }
 }