document-properties.cpp revision 7073d105e612f7dc898c292742bee9655d2a51b2
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Document properties dialog, Gtkmm-style
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * bulia byak <buliabyak@users.sf.net>
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Bryce W. Harrington <bryce@bryceharrington.org>
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Lauris Kaplinski <lauris@kaplinski.com>
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Jon Phillips <jon@rejon.org>
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Ralf Stephan <ralf@ark.in-berlin.de> (Gtkmm)
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Copyright (C) 2006-2008 Johan Engelen <johan@shouraizou.nl>
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Copyright (C) 2000 - 2005 Authors
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Released under GNU GPL. Read the file 'COPYING' for more information
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixnamespace UI {
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix//===================================================
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix//---------------------------------------------------
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixstatic void on_child_added(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, void * data);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixstatic void on_child_removed(Inkscape::XML::Node *repr, Inkscape::XML::Node *child, Inkscape::XML::Node *ref, void * data);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixstatic void on_repr_attr_changed (Inkscape::XML::Node *, gchar const *, gchar const *, gchar const *, bool, gpointer);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixstatic Inkscape::XML::NodeEventVector const _repr_events = {
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix DocumentProperties &instance = *new DocumentProperties();
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix : UI::Widget::Panel ("", "dialogs.documentoptions", SP_VERB_DIALOG_NAMEDVIEW),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _grids_button_remove(_("_Remove"), _("Remove selected grid.")),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _notebook.append_page(_page_snap_dtls, _("Snap points"));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _grids_button_new.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::onNewGrid));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _grids_button_remove.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::onRemoveGrid));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix signalDocumentReplaced().connect(sigc::mem_fun(*this, &DocumentProperties::_handleDocumentReplaced));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix signalActivateDesktop().connect(sigc::mem_fun(*this, &DocumentProperties::_handleActivateDesktop));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix signalDeactiveDesktop().connect(sigc::mem_fun(*this, &DocumentProperties::_handleDeactivateDesktop));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(getDesktop()));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix Inkscape::XML::Node *root = SP_OBJECT_REPR(sp_desktop_document(getDesktop())->root);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(getDesktop()));
fa90912de6e92199e5fa5957d1d47fd485abc011cilix Inkscape::XML::Node *root = SP_OBJECT_REPR(sp_desktop_document(getDesktop())->root);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix//========================================================================
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Helper function that attaches widgets in a 3xn table. The widgets come in an
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * array that has two entries per table row. The two entries code for four
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * possible cases: (0,0) means insert space in first column; (0, non-0) means
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * widget in columns 2-3; (non-0, 0) means label in columns 1-3; and
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * (non-0, non-0) means two widgets in columns 2 and 3.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixattach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned const n, int start = 0)
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix else if (arr[i])
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix Gtk::Label& label = reinterpret_cast<Gtk::Label&>(*arr[i]);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Back_ground:"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Background color"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Color and transparency of the page background (also used for bitmap export)"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Show page _border"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("If set, rectangular page border is shown"), "showborder", _wr, false) );
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Border on _top of drawing"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("If set, border is always on top of the drawing"), "borderlayer", _wr, false) );
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcp_bord.init (_("Border _color:"), _("Page border color"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Color of the page border"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("_Show border shadow"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("If set, page border shows a shadow on its right and lower side"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rum_deflt.init (_("Default _units:"), "inkscape:document-units", _wr);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix attach_all(_page_page.table(), widget_array, G_N_ELEMENTS(widget_array));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Show _guides"), _("Show or hide guides"), "showguides", _wr) );
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcp_gui.init (_("Guide co_lor:"), _("Guideline color"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Color of guidelines"), "guidecolor", "guideopacity", _wr);
850cbc29823aa92a03e97caba1e3102b53d7c833cilix _rcp_hgui.init (_("_Highlight color:"), _("Highlighted guideline color"),
850cbc29823aa92a03e97caba1e3102b53d7c833cilix _("Color of a guideline when it is under mouse"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("_Snap guides while dragging"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("While dragging a guide, snap to object nodes or bounding box corners ('Snap to nodes' or 'snap to bounding box corners' must be enabled in the 'Snap' tab; only a small part of the guide near the cursor will snap)"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix attach_all(_page_guides.table(), widget_array, G_N_ELEMENTS(widget_array));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //General options
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsg = Gtk::manage( new RegisteredCheckButton( _("_Enable snapping"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Toggle snapping on or off"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnbb = Gtk::manage( new RegisteredCheckButton( _("_Bounding box corners"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Only available in the selector tool: snap bounding box corners to guides, to grids, and to other bounding boxes (but not to nodes or paths)"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnn = Gtk::manage( new RegisteredCheckButton( _("_Nodes"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Snap nodes (e.g. path nodes, special points in shapes, gradient handles, text base points, transformation origins, etc.) to guides, to grids, to paths and to other nodes"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //Options for snapping to objects
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnop = Gtk::manage( new RegisteredCheckButton( _("Snap to path_s"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Snap nodes to object paths"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnon = Gtk::manage( new RegisteredCheckButton( _("Snap to n_odes"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Snap nodes and guides to object nodes"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnbbn = Gtk::manage( new RegisteredCheckButton( _("Snap to bounding box co_rners"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Snap bounding box corners to other bounding box corners"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnbbp = Gtk::manage( new RegisteredCheckButton( _("Snap to bounding bo_x edges"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Snap bounding box corners and guides to bounding box edges"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rsu_sno.init (_("Snap _distance"), _("Snap only when _closer than:"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Snapping distance, in screen pixels, for snapping to objects"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("If set, objects only snap to another object when it's within the range specified below"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //Options for snapping to grids
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rsu_sn.init (_("Snap d_istance"), _("Snap only when c_loser than:"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Snapping distance, in screen pixels, for snapping to grid"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("If set, objects only snap to a grid line when it's within the range specified below"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //Options for snapping to guides
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rsu_gusn.init (_("Snap dist_ance"), _("Snap only when close_r than:"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Snapping distance, in screen pixels, for snapping to guides"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("If set, objects only snap to a guide when it's within the range specified below"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //Other options to locate here: e.g. visual snapping indicators on/off
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix attach_all(_page_snap.table(), array, G_N_ELEMENTS(array));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsigg = Gtk::manage( new RegisteredCheckButton( _("_Grid with guides"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Snap to grid-guide intersections"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsils = Gtk::manage( new RegisteredCheckButton( _("_Line segments"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Snap to intersections of line segments ('snap to paths' must be enabled, see the previous tab)"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //Applies to both nodes and guides, but not to bboxes, that's why its located here
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbic = Gtk::manage( new RegisteredCheckButton( _("Rotation _center"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _("Consider the rotation center of an object when snapping"),
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //Other options to locate here: e.g. visual snapping indicators on/off
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix label_i->set_markup (_("<b>Snapping to intersections of</b>"));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix label_m->set_markup (_("<b>Snapping to special nodes</b>"));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix attach_all(_page_snap_dtls.table(), array, G_N_ELEMENTS(array));
13223d251a0eca100512280a15dc9b2213a28809cilix* Called for _updating_ the dialog (e.g. when a new grid was manually added in XML)
13223d251a0eca100512280a15dc9b2213a28809cilix //remove all tabs
13223d251a0eca100512280a15dc9b2213a28809cilix _grids_notebook.remove_page(-1); // this also deletes the page.
13223d251a0eca100512280a15dc9b2213a28809cilix bool grids_present = false;
13223d251a0eca100512280a15dc9b2213a28809cilix for (GSList const * l = nv->grids; l != NULL; l = l->next) {
13223d251a0eca100512280a15dc9b2213a28809cilix Inkscape::CanvasGrid * grid = (Inkscape::CanvasGrid*) l->data;
13223d251a0eca100512280a15dc9b2213a28809cilix if (!grid->repr->attribute("id")) continue; // update_gridspage is called again when "id" is added
13223d251a0eca100512280a15dc9b2213a28809cilix _grids_notebook.append_page(*grid->newWidget(), _createPageTabLabel(name, icon));
13223d251a0eca100512280a15dc9b2213a28809cilix * Build grid page of dialog.
13223d251a0eca100512280a15dc9b2213a28809cilix /// \todo FIXME: gray out snapping when grid is off.
13223d251a0eca100512280a15dc9b2213a28809cilix /// Dissenting view: you want snapping without grid.
13223d251a0eca100512280a15dc9b2213a28809cilix _grids_label_def.set_markup(_("<b>Defined grids</b>"));
13223d251a0eca100512280a15dc9b2213a28809cilix _grids_hbox_crea.pack_start(_grids_combo_gridtype, true, true);
13223d251a0eca100512280a15dc9b2213a28809cilix _grids_hbox_crea.pack_start(_grids_button_new, true, true);
13223d251a0eca100512280a15dc9b2213a28809cilix _grids_combo_gridtype.append_text( CanvasGrid::getName( (GridType) t ) );
13223d251a0eca100512280a15dc9b2213a28809cilix _grids_combo_gridtype.set_active_text( CanvasGrid::getName(GRID_RECTANGULAR) );
13223d251a0eca100512280a15dc9b2213a28809cilix _grids_space.set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y);
13223d251a0eca100512280a15dc9b2213a28809cilix _grids_vbox.pack_start(_grids_label_crea, false, false);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _grids_vbox.pack_start(_grids_hbox_crea, false, false);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _grids_vbox.pack_start(_grids_label_def, false, false);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _grids_vbox.pack_start(_grids_notebook, false, false);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _grids_vbox.pack_start(_grids_button_remove, false, false);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Update dialog widgets from desktop. Also call updateWidget routines of the grids.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //-----------------------------------------------------------page page
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcb_bord->setActive (nv->borderlayer == SP_BORDER_LAYER_TOP);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix double const doc_w_px = sp_document_width(sp_desktop_document(dt));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix double const doc_h_px = sp_document_height(sp_desktop_document(dt));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //-----------------------------------------------------------guide
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //-----------------------------------------------------------snap
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnbb->setActive (nv->snap_manager.getSnapModeBBox());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnn->setActive (nv->snap_manager.getSnapModeNode());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsng->setActive (nv->snap_manager.getSnapModeGuide());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbic->setActive (nv->snap_manager.getIncludeItemCenter());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsigg->setActive (nv->snap_manager.getSnapIntersectionGG());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsils->setActive (nv->snap_manager.getSnapIntersectionLS());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnop->setActive(nv->snap_manager.object.getSnapToItemPath());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnon->setActive(nv->snap_manager.object.getSnapToItemNode());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnbbp->setActive(nv->snap_manager.object.getSnapToBBoxPath());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsnbbn->setActive(nv->snap_manager.object.getSnapToBBoxNode());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _rcbsg->setActive (nv->snap_manager.getSnapEnabledGlobally());
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix //-----------------------------------------------------------grids page
67f112a66b477fe7fb28c644a4deaf0793533838joncruz// TODO: copied from fill-and-stroke.cpp factor out into new ui/widget file?
67f112a66b477fe7fb28c644a4deaf0793533838joncruzDocumentProperties::_createPageTabLabel(const Glib::ustring& label, const char *label_image)
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix Gtk::HBox *_tab_label_box = manage(new Gtk::HBox(false, 0));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix _tab_label_box->pack_start(*Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_DECORATION,
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix Gtk::Label *_tab_label = manage(new Gtk::Label(label, true));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix//--------------------------------------------------------------------
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix if (id == Gtk::RESPONSE_DELETE_EVENT || id == Gtk::RESPONSE_CLOSE)
fa90912de6e92199e5fa5957d1d47fd485abc011cilixDocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *document)
fa90912de6e92199e5fa5957d1d47fd485abc011cilix Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop));
fa90912de6e92199e5fa5957d1d47fd485abc011cilix Inkscape::XML::Node *root = SP_OBJECT_REPR(document->root);
fa90912de6e92199e5fa5957d1d47fd485abc011cilixDocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *desktop)
fa90912de6e92199e5fa5957d1d47fd485abc011cilix Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop));
fa90912de6e92199e5fa5957d1d47fd485abc011cilix Inkscape::XML::Node *root = SP_OBJECT_REPR(sp_desktop_document(desktop)->root);
fa90912de6e92199e5fa5957d1d47fd485abc011cilixDocumentProperties::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop *desktop)
fa90912de6e92199e5fa5957d1d47fd485abc011cilix Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop));
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix Inkscape::XML::Node *root = SP_OBJECT_REPR(sp_desktop_document(desktop)->root);
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixon_child_added(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node */*child*/, Inkscape::XML::Node */*ref*/, void *data)
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix if (DocumentProperties *dialog = static_cast<DocumentProperties *>(data))
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixon_child_removed(Inkscape::XML::Node */*repr*/, Inkscape::XML::Node */*child*/, Inkscape::XML::Node */*ref*/, void *data)
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix if (DocumentProperties *dialog = static_cast<DocumentProperties *>(data))
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix * Called when XML node attribute changed; updates dialog widgets.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilixon_repr_attr_changed (Inkscape::XML::Node *, gchar const *, gchar const *, gchar const *, bool, gpointer data)
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix if (DocumentProperties *dialog = static_cast<DocumentProperties *>(data))
13223d251a0eca100512280a15dc9b2213a28809cilix/*########################################################################
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix# BUTTON CLICK HANDLERS (callbacks)
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix########################################################################*/
13223d251a0eca100512280a15dc9b2213a28809cilix Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(dt));
13223d251a0eca100512280a15dc9b2213a28809cilix Glib::ustring typestring = _grids_combo_gridtype.get_active_text();
13223d251a0eca100512280a15dc9b2213a28809cilix CanvasGrid::writeNewGridToRepr(repr, doc, CanvasGrid::getGridTypeFromName(typestring.c_str()));
13223d251a0eca100512280a15dc9b2213a28809cilix // toggle grid showing to ON:
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix for (GSList const * l = nv->grids; l != NULL; l = l->next, i++) { // not a very nice fix, but works.
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix Inkscape::CanvasGrid * grid = (Inkscape::CanvasGrid*) l->data;
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix if (pagenum == i) {
4358ff6156766a315e38e72a5c3c83d6d5f7486bcilix break; // break out of for-loop