Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / sp-namedview.cpp
index 61685b3217e2b73fc6b93779f35b12b511c52950..59ef4762da6f8433a8d804a942bffb82324e7355 100644 (file)
@@ -1,11 +1,11 @@
-#define __SP_NAMEDVIEW_C__
-
 /*
  * <sodipodi:namedview> implementation
  *
  * Authors:
  *   Lauris Kaplinski <lauris@kaplinski.com>
  *   bulia byak <buliabyak@users.sf.net>
+ *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2006      Johan Engelen <johan@shouraizou.nl>
  * Copyright (C) 1999-2008 Authors
@@ -35,6 +35,8 @@
 #include "desktop.h"
 #include "conn-avoid-ref.h" // for defaultConnSpacing.
 
+using Inkscape::DocumentUndo;
+
 #define DEFAULTGRIDCOLOR 0x3f3fff25
 #define DEFAULTGRIDEMPCOLOR 0x3f3fff60
 #define DEFAULTGRIDEMPSPACING 5
@@ -176,7 +178,7 @@ static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *doc
         // generate new xy grid with the correct settings
         // first create the child xml node, then hook it to repr. This order is important, to not set off listeners to repr before the new node is complete.
 
-        Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
+        Inkscape::XML::Document *xml_doc = document->getReprDoc();
         Inkscape::XML::Node *newnode = xml_doc->createElement("inkscape:grid");
         newnode->setAttribute("id", "GridFromPre046Settings");
         newnode->setAttribute("type", Inkscape::CanvasGrid::getSVGName(Inkscape::GRID_RECTANGULAR));
@@ -217,56 +219,57 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
         (* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
     }
 
-    object->readAttr( "inkscape:document-units");
-    object->readAttr( "viewonly");
-    object->readAttr( "showguides");
-    object->readAttr( "showgrid");
-    object->readAttr( "gridtolerance");
-    object->readAttr( "guidetolerance");
-    object->readAttr( "objecttolerance");
-    object->readAttr( "guidecolor");
-    object->readAttr( "guideopacity");
-    object->readAttr( "guidehicolor");
-    object->readAttr( "guidehiopacity");
-    object->readAttr( "showborder");
-    object->readAttr( "inkscape:showpageshadow");
-    object->readAttr( "borderlayer");
-    object->readAttr( "bordercolor");
-    object->readAttr( "borderopacity");
-    object->readAttr( "pagecolor");
-    object->readAttr( "inkscape:pageopacity");
-    object->readAttr( "inkscape:pageshadow");
-    object->readAttr( "inkscape:zoom");
-    object->readAttr( "inkscape:cx");
-    object->readAttr( "inkscape:cy");
-    object->readAttr( "inkscape:window-width");
-    object->readAttr( "inkscape:window-height");
-    object->readAttr( "inkscape:window-x");
-    object->readAttr( "inkscape:window-y");
-    object->readAttr( "inkscape:window-maximized");
-    object->readAttr( "inkscape:snap-global");
-    object->readAttr( "inkscape:snap-bbox");
-    object->readAttr( "inkscape:snap-nodes");
-    object->readAttr( "inkscape:snap-from-guide");
-    object->readAttr( "inkscape:snap-center");
-    object->readAttr( "inkscape:snap-smooth-nodes");
-    object->readAttr( "inkscape:snap-midpoints");
-    object->readAttr( "inkscape:snap-object-midpoints");
-    object->readAttr( "inkscape:snap-bbox-edge-midpoints");
-    object->readAttr( "inkscape:snap-bbox-midpoints");
-       object->readAttr( "inkscape:snap-to-guides");
-       object->readAttr( "inkscape:snap-grids");
-    object->readAttr( "inkscape:snap-intersection-paths");
-    object->readAttr( "inkscape:object-paths");
-    object->readAttr( "inkscape:object-nodes");
-    object->readAttr( "inkscape:bbox-paths");
-    object->readAttr( "inkscape:bbox-nodes");
-    object->readAttr( "inkscape:snap-page");
-    object->readAttr( "inkscape:current-layer");
-    object->readAttr( "inkscape:connector-spacing");
+    object->readAttr( "inkscape:document-units" );
+    object->readAttr( "units" );
+    object->readAttr( "viewonly" );
+    object->readAttr( "showguides" );
+    object->readAttr( "showgrid" );
+    object->readAttr( "gridtolerance" );
+    object->readAttr( "guidetolerance" );
+    object->readAttr( "objecttolerance" );
+    object->readAttr( "guidecolor" );
+    object->readAttr( "guideopacity" );
+    object->readAttr( "guidehicolor" );
+    object->readAttr( "guidehiopacity" );
+    object->readAttr( "showborder" );
+    object->readAttr( "inkscape:showpageshadow" );
+    object->readAttr( "borderlayer" );
+    object->readAttr( "bordercolor" );
+    object->readAttr( "borderopacity" );
+    object->readAttr( "pagecolor" );
+    object->readAttr( "inkscape:pageopacity" );
+    object->readAttr( "inkscape:pageshadow" );
+    object->readAttr( "inkscape:zoom" );
+    object->readAttr( "inkscape:cx" );
+    object->readAttr( "inkscape:cy" );
+    object->readAttr( "inkscape:window-width" );
+    object->readAttr( "inkscape:window-height" );
+    object->readAttr( "inkscape:window-x" );
+    object->readAttr( "inkscape:window-y" );
+    object->readAttr( "inkscape:window-maximized" );
+    object->readAttr( "inkscape:snap-global" );
+    object->readAttr( "inkscape:snap-bbox" );
+    object->readAttr( "inkscape:snap-nodes" );
+    object->readAttr( "inkscape:snap-from-guide" );
+    object->readAttr( "inkscape:snap-center" );
+    object->readAttr( "inkscape:snap-smooth-nodes" );
+    object->readAttr( "inkscape:snap-midpoints" );
+    object->readAttr( "inkscape:snap-object-midpoints" );
+    object->readAttr( "inkscape:snap-bbox-edge-midpoints" );
+    object->readAttr( "inkscape:snap-bbox-midpoints" );
+    object->readAttr( "inkscape:snap-to-guides" );
+    object->readAttr( "inkscape:snap-grids" );
+    object->readAttr( "inkscape:snap-intersection-paths" );
+    object->readAttr( "inkscape:object-paths" );
+    object->readAttr( "inkscape:object-nodes" );
+    object->readAttr( "inkscape:bbox-paths" );
+    object->readAttr( "inkscape:bbox-nodes" );
+    object->readAttr( "inkscape:snap-page" );
+    object->readAttr( "inkscape:current-layer" );
+    object->readAttr( "inkscape:connector-spacing" );
 
     /* Construct guideline list */
-    for (SPObject *o = SP_OBJECT(og)->first_child() ; o != NULL; o = SP_OBJECT_NEXT(o) ) {
+    for (SPObject *o = SP_OBJECT(og)->firstChild() ; o; o = o->getNext() ) {
         if (SP_IS_GUIDE(o)) {
             SPGuide * g = SP_GUIDE(o);
             nv->guides = g_slist_prepend(nv->guides, g);
@@ -330,17 +333,17 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
     case SP_ATTR_GRIDTOLERANCE:
-                       nv->snap_manager.snapprefs.setGridTolerance(value ? g_ascii_strtod(value, NULL) : 10000);
-                       object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-                       break;
+        nv->snap_manager.snapprefs.setGridTolerance(value ? g_ascii_strtod(value, NULL) : 10000);
+        object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+        break;
     case SP_ATTR_GUIDETOLERANCE:
-                       nv->snap_manager.snapprefs.setGuideTolerance(value ? g_ascii_strtod(value, NULL) : 20);
-            object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-            break;
+        nv->snap_manager.snapprefs.setGuideTolerance(value ? g_ascii_strtod(value, NULL) : 20);
+        object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+        break;
     case SP_ATTR_OBJECTTOLERANCE:
-                       nv->snap_manager.snapprefs.setObjectTolerance(value ? g_ascii_strtod(value, NULL) : 20);
-            object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-            break;
+        nv->snap_manager.snapprefs.setObjectTolerance(value ? g_ascii_strtod(value, NULL) : 20);
+        object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+        break;
     case SP_ATTR_GUIDECOLOR:
             nv->guidecolor = (nv->guidecolor & 0xff) | (DEFAULTGUIDECOLOR & 0xffffff00);
             if (value) {
@@ -447,10 +450,10 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
     case SP_ATTR_INKSCAPE_WINDOW_MAXIMIZED:
-                       nv->window_maximized = value ? atoi(value) : 0;
-                       object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-                       break;
-       case SP_ATTR_INKSCAPE_SNAP_GLOBAL:
+        nv->window_maximized = value ? atoi(value) : 0;
+        object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+        break;
+    case SP_ATTR_INKSCAPE_SNAP_GLOBAL:
             nv->snap_manager.snapprefs.setSnapEnabledGlobally(value ? sp_str_to_bool(value) : TRUE);
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
@@ -467,14 +470,14 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
     case SP_ATTR_INKSCAPE_SNAP_GRIDS:
-                       nv->snap_manager.snapprefs.setSnapToGrids(value ? sp_str_to_bool(value) : TRUE);
-                       object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-                       break;
+        nv->snap_manager.snapprefs.setSnapToGrids(value ? sp_str_to_bool(value) : TRUE);
+        object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+        break;
     case SP_ATTR_INKSCAPE_SNAP_TO_GUIDES:
-                       nv->snap_manager.snapprefs.setSnapToGuides(value ? sp_str_to_bool(value) : TRUE);
-                       object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-                       break;
-       case SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES:
+        nv->snap_manager.snapprefs.setSnapToGuides(value ? sp_str_to_bool(value) : TRUE);
+        object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+        break;
+    case SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES:
             nv->snap_manager.snapprefs.setSnapSmoothNodes(value ? sp_str_to_bool(value) : FALSE);
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
@@ -483,18 +486,18 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
     case SP_ATTR_INKSCAPE_SNAP_OBJECT_MIDPOINTS:
-                       nv->snap_manager.snapprefs.setSnapObjectMidpoints(value ? sp_str_to_bool(value) : FALSE);
-                       object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-                       break;
+        nv->snap_manager.snapprefs.setSnapObjectMidpoints(value ? sp_str_to_bool(value) : FALSE);
+        object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+        break;
     case SP_ATTR_INKSCAPE_SNAP_BBOX_EDGE_MIDPOINTS:
-                       nv->snap_manager.snapprefs.setSnapBBoxEdgeMidpoints(value ? sp_str_to_bool(value) : FALSE);
-                       object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-                       break;
-       case SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS:
-                       nv->snap_manager.snapprefs.setSnapBBoxMidpoints(value ? sp_str_to_bool(value) : FALSE);
-                       object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-                       break;
-       case SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE:
+        nv->snap_manager.snapprefs.setSnapBBoxEdgeMidpoints(value ? sp_str_to_bool(value) : FALSE);
+        object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+        break;
+    case SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS:
+        nv->snap_manager.snapprefs.setSnapBBoxMidpoints(value ? sp_str_to_bool(value) : FALSE);
+        object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+        break;
+    case SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE:
             nv->snap_manager.snapprefs.setSnapModeGuide(value ? sp_str_to_bool(value) : TRUE);
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
@@ -572,6 +575,30 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
     }
+    case SP_ATTR_UNITS: {
+            SPUnit const *new_unit = NULL;
+
+            if (value) {
+                SPUnit const *const req_unit = sp_unit_get_by_abbreviation(value);
+                if ( req_unit == NULL ) {
+                    g_warning("Unrecognized unit `%s'", value);
+                    /* fixme: Document errors should be reported in the status bar or
+                     * the like (e.g. as per
+                     * http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing); g_log
+                     * should be only for programmer errors. */
+                } else if ( req_unit->base == SP_UNIT_ABSOLUTE ||
+                            req_unit->base == SP_UNIT_DEVICE     ) {
+                    new_unit = req_unit;
+                } else {
+                    g_warning("Document units must be absolute like `mm', `pt' or `px', but found `%s'",
+                              value);
+                    /* fixme: Don't use g_log (see above). */
+                }
+            }
+            nv->units = new_unit;
+            object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+            break;
+    }
     default:
             if (((SPObjectClass *) (parent_class))->set) {
                 ((SPObjectClass *) (parent_class))->set(object, key, value);
@@ -728,8 +755,8 @@ void SPNamedView::show(SPDesktop *desktop)
 
 void SPNamedView::writeNewGrid(SPDocument *document,int gridtype)
 {
-       g_assert(this->getRepr() != NULL);
-       Inkscape::CanvasGrid::writeNewGridToRepr(this->getRepr(),document,static_cast<Inkscape::GridType>(gridtype));
+    g_assert(this->getRepr() != NULL);
+    Inkscape::CanvasGrid::writeNewGridToRepr(this->getRepr(),document,static_cast<Inkscape::GridType>(gridtype));
 }
 
 /*
@@ -743,25 +770,25 @@ void sp_namedview_window_from_document(SPDesktop *desktop)
 
     // restore window size and position stored with the document
     if (geometry_from_file) {
-       if (nv->window_maximized) {
-               Gtk::Window *win = desktop->getToplevel();
-               if (win){
-                       win->maximize();
-               }
-       } else {
-               gint w = MIN(gdk_screen_width(), nv->window_width);
-                       gint h = MIN(gdk_screen_height(), nv->window_height);
-                       // prevent the window from moving off the screen to the right or to the bottom
-                       gint x = MIN(gdk_screen_width() - MIN_ONSCREEN_DISTANCE, nv->window_x);
-                       gint y = MIN(gdk_screen_height() - MIN_ONSCREEN_DISTANCE, nv->window_y);
-                       // prevent the window from moving off the screen to the left or to the top
-                       x = MAX(MIN_ONSCREEN_DISTANCE - nv->window_width, x);
-                       y = MAX(MIN_ONSCREEN_DISTANCE - nv->window_height, y);
-                       if (w>0 && h>0) {
-                               desktop->setWindowSize(w, h);
-                               desktop->setWindowPosition(Geom::Point(x, y));
-                       }
-       }
+        if (nv->window_maximized) {
+            Gtk::Window *win = desktop->getToplevel();
+            if (win){
+                win->maximize();
+            }
+        } else {
+            gint w = MIN(gdk_screen_width(), nv->window_width);
+            gint h = MIN(gdk_screen_height(), nv->window_height);
+            // prevent the window from moving off the screen to the right or to the bottom
+            gint x = MIN(gdk_screen_width() - MIN_ONSCREEN_DISTANCE, nv->window_x);
+            gint y = MIN(gdk_screen_height() - MIN_ONSCREEN_DISTANCE, nv->window_y);
+            // prevent the window from moving off the screen to the left or to the top
+            x = MAX(MIN_ONSCREEN_DISTANCE - nv->window_width, x);
+            y = MAX(MIN_ONSCREEN_DISTANCE - nv->window_height, y);
+            if (w>0 && h>0) {
+                desktop->setWindowSize(w, h);
+                desktop->setWindowPosition(Geom::Point(x, y));
+            }
+        }
     }
 
     // restore zoom and view
@@ -782,13 +809,13 @@ void sp_namedview_window_from_document(SPDesktop *desktop)
 
 bool SPNamedView::getSnapGlobal() const
 {
-       return this->snap_manager.snapprefs.getSnapEnabledGlobally();
+    return this->snap_manager.snapprefs.getSnapEnabledGlobally();
 }
 
 void SPNamedView::setSnapGlobal(bool v)
 {
-       g_assert(this->getRepr() != NULL);
-       sp_repr_set_boolean(this->getRepr(), "inkscape:snap-global", v);
+    g_assert(this->getRepr() != NULL);
+    sp_repr_set_boolean(this->getRepr(), "inkscape:snap-global", v);
 }
 
 void sp_namedview_update_layers_from_document (SPDesktop *desktop)
@@ -805,8 +832,7 @@ void sp_namedview_update_layers_from_document (SPDesktop *desktop)
     }
     // if that didn't work out, look for the topmost layer
     if (!layer) {
-        SPObject *iter = SP_DOCUMENT_ROOT(document)->first_child();
-        for ( ; iter ; iter = SP_OBJECT_NEXT(iter) ) {
+        for ( SPObject *iter = document->getRoot()->firstChild(); iter ; iter = iter->getNext() ) {
             if (desktop->isLayer(iter)) {
                 layer = iter;
             }
@@ -828,15 +854,15 @@ void sp_namedview_document_from_window(SPDesktop *desktop)
     Geom::Rect const r = desktop->get_display_area();
 
     // saving window geometry is not undoable
-    bool saved = SPDocumentUndo::get_undo_sensitive(sp_desktop_document(desktop));
-       SPDocumentUndo::set_undo_sensitive(sp_desktop_document(desktop), false);
+    bool saved = DocumentUndo::getUndoSensitive(sp_desktop_document(desktop));
+    DocumentUndo::setUndoSensitive(sp_desktop_document(desktop), false);
 
     sp_repr_set_svg_double(view, "inkscape:zoom", desktop->current_zoom());
     sp_repr_set_svg_double(view, "inkscape:cx", r.midpoint()[Geom::X]);
     sp_repr_set_svg_double(view, "inkscape:cy", r.midpoint()[Geom::Y]);
 
     if (save_geometry_in_file) {
-       gint w, h, x, y;
+        gint w, h, x, y;
         desktop->getWindowGeometry(x, y, w, h);
         sp_repr_set_int(view, "inkscape:window-width", w);
         sp_repr_set_int(view, "inkscape:window-height", h);
@@ -848,7 +874,7 @@ void sp_namedview_document_from_window(SPDesktop *desktop)
     view->setAttribute("inkscape:current-layer", desktop->currentLayer()->getId());
 
     // restore undoability
-       SPDocumentUndo::set_undo_sensitive(sp_desktop_document(desktop), saved);
+    DocumentUndo::setUndoSensitive(sp_desktop_document(desktop), saved);
 }
 
 void SPNamedView::hide(SPDesktop const *desktop)
@@ -878,21 +904,21 @@ void SPNamedView::activateGuides(gpointer desktop, gboolean active)
 static void sp_namedview_setup_guides(SPNamedView *nv)
 {
     for (GSList *l = nv->guides; l != NULL; l = l->next) {
-       sp_namedview_show_single_guide(SP_GUIDE(l->data), nv->showguides);
+        sp_namedview_show_single_guide(SP_GUIDE(l->data), nv->showguides);
     }
 }
 
 static void sp_namedview_show_single_guide(SPGuide* guide, bool show)
 {
-       for (GSList *v = guide->views; v != NULL; v = v->next) {
-               if (show) {
-                       sp_canvas_item_show(SP_CANVAS_ITEM(v->data));
-                       sp_canvas_item_show(SP_CANVAS_ITEM(SP_GUIDELINE(v->data)->origin));
-               } else {
-                       sp_canvas_item_hide(SP_CANVAS_ITEM(v->data));
-                       sp_canvas_item_hide(SP_CANVAS_ITEM(SP_GUIDELINE(v->data)->origin));
-               }
-       }
+    for (GSList *v = guide->views; v != NULL; v = v->next) {
+        if (show) {
+            sp_canvas_item_show(SP_CANVAS_ITEM(v->data));
+            sp_canvas_item_show(SP_CANVAS_ITEM(SP_GUIDELINE(v->data)->origin));
+        } else {
+            sp_canvas_item_hide(SP_CANVAS_ITEM(v->data));
+            sp_canvas_item_hide(SP_CANVAS_ITEM(SP_GUIDELINE(v->data)->origin));
+        }
+    }
 }
 
 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr)
@@ -905,10 +931,10 @@ void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr)
         v = !v;
     }
 
-    bool saved = SPDocumentUndo::get_undo_sensitive(doc);
-       SPDocumentUndo::set_undo_sensitive(doc, false);
+    bool saved = DocumentUndo::getUndoSensitive(doc);
+    DocumentUndo::setUndoSensitive(doc, false);
     sp_repr_set_boolean(repr, "showguides", v);
-       SPDocumentUndo::set_undo_sensitive(doc, saved);
+    DocumentUndo::setUndoSensitive(doc, saved);
 
     doc->setModifiedSinceSave();
 }
@@ -920,10 +946,10 @@ void sp_namedview_show_grids(SPNamedView * namedview, bool show, bool dirty_docu
     SPDocument *doc = SP_OBJECT_DOCUMENT (namedview);
     Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview);
 
-    bool saved = SPDocumentUndo::get_undo_sensitive(doc);
-       SPDocumentUndo::set_undo_sensitive(doc, false);
+    bool saved = DocumentUndo::getUndoSensitive(doc);
+    DocumentUndo::setUndoSensitive(doc, false);
     sp_repr_set_boolean(repr, "showgrid", namedview->grids_visible);
-       SPDocumentUndo::set_undo_sensitive(doc, saved);
+    DocumentUndo::setUndoSensitive(doc, saved);
 
     /* we don't want the document to get dirty on startup; that's when
        we call this function with dirty_document = false */
@@ -1003,10 +1029,9 @@ SPNamedView *sp_document_namedview(SPDocument *document, const gchar *id)
 
 void SPNamedView::setGuides(bool v)
 {
-       g_assert(this->getRepr() != NULL);
-       sp_repr_set_boolean(this->getRepr(), "showguides", v);
-       sp_repr_set_boolean(this->getRepr(), "inkscape:guide-bbox", v);
-
+    g_assert(this->getRepr() != NULL);
+    sp_repr_set_boolean(this->getRepr(), "showguides", v);
+    sp_repr_set_boolean(this->getRepr(), "inkscape:guide-bbox", v);
 }
 
 /**
@@ -1030,7 +1055,7 @@ double SPNamedView::getMarginLength(gchar const * const key,
                              bool const use_width)
 {
     double value;
-       if(!this->storeAsDouble(key,&value)) {
+    if(!this->storeAsDouble(key,&value)) {
         return 0.0;
     }
     if (margin_units == &sp_unit_get_by_id (SP_UNIT_PERCENT)) {
@@ -1096,4 +1121,4 @@ void SPNamedView::scrollAllDesktops(double dx, double dy, bool is_scrolling) {
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :