Code

Corrected initialization order.
[inkscape.git] / src / selcue.cpp
index 1831e8b54a24b869c047b029ffcc2f6ade5344ca..03205d8498a893b08b50785c9fa0cd782d6d287f 100644 (file)
@@ -12,6 +12,8 @@
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
 
+#include <string.h>
+
 #include "desktop-handles.h"
 #include "selection.h"
 #include "display/sp-canvas-util.h"
@@ -21,7 +23,7 @@
 #include "text-editing.h"
 #include "sp-text.h"
 #include "sp-flowtext.h"
-#include "prefs-utils.h"
+#include "preferences.h"
 #include "selcue.h"
 
 Inkscape::SelCue::SelCue(SPDesktop *desktop)
@@ -68,20 +70,22 @@ void Inkscape::SelCue::_updateItemBboxes()
     }
     _text_baselines.clear();
 
-    gint mode = prefs_get_int_attribute ("options.selcue", "value", MARK);
+    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+    gint mode = prefs->getInt("/options/selcue/value", MARK);
     if (mode == NONE) {
         return;
     }
 
     g_return_if_fail(_selection != NULL);
 
+    int prefs_bbox = prefs->getBool("/tools/bounding_box");
+    SPItem::BBoxType bbox_type = !prefs_bbox ? 
+        SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
+    
     for (GSList const *l = _selection->itemList(); l != NULL; l = l->next) {
         SPItem *item = (SPItem *) l->data;
 
-        gchar const *prefs_bbox = prefs_get_string_attribute("tools.select", "bounding_box");
-        SPItem::BBoxType bbox_type = (prefs_bbox == NULL || strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::APPROXIMATE_BBOX;
-
-        NR::Maybe<NR::Rect> const b = sp_item_bbox_desktop(item, bbox_type);
+        Geom::OptRect const b = sp_item_bbox_desktop(item, bbox_type);
 
         SPCanvasItem* box = NULL;
 
@@ -123,7 +127,7 @@ void Inkscape::SelCue::_updateItemBboxes()
         if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { // visualize baseline
             Inkscape::Text::Layout const *layout = te_get_layout(item);
             if (layout != NULL) {
-                NR::Point a = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item);
+                Geom::Point a = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item);
                 baseline_point = sp_canvas_item_new(sp_desktop_controls(_desktop), SP_TYPE_CTRL,
                                                     "mode", SP_CTRL_MODE_XOR,
                                                     "size", 4.0,