Code

Extensions. Add option to choose dxf output units
[inkscape.git] / src / sp-use-reference.cpp
index 5b5011381a41fd18758d3bd9a6e3bdd30a41589c..a05dc0e93d498ddbcaef2ea23012b6d80d90e902 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "display/curve.h"
 #include "livarot/Path.h"
-#include "prefs-utils.h"
+#include "preferences.h"
 #include "sp-shape.h"
 #include "sp-text.h"
 #include "uri.h"
@@ -41,7 +41,7 @@ bool SPUseReference::_acceptObject(SPObject * const obj) const
 
 
 static void sp_usepath_href_changed(SPObject *old_ref, SPObject *ref, SPUsePath *offset);
-static void sp_usepath_move_compensate(NR::Matrix const *mp, SPItem *original, SPUsePath *self);
+static void sp_usepath_move_compensate(Geom::Matrix const *mp, SPItem *original, SPUsePath *self);
 static void sp_usepath_delete_self(SPObject *deleted, SPUsePath *offset);
 static void sp_usepath_source_modified(SPObject *iSource, guint flags, SPUsePath *offset);
 
@@ -139,9 +139,10 @@ sp_usepath_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUsePath *off
 }
 
 static void
-sp_usepath_move_compensate(NR::Matrix const *mp, SPItem *original, SPUsePath *self)
+sp_usepath_move_compensate(Geom::Matrix const *mp, SPItem *original, SPUsePath *self)
 {
-    guint mode = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_PARALLEL);
+    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+    guint mode = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_PARALLEL);
     if (mode == SP_CLONE_COMPENSATION_NONE) {
         return;
     }
@@ -149,15 +150,15 @@ sp_usepath_move_compensate(NR::Matrix const *mp, SPItem *original, SPUsePath *se
 
 // TODO kill naughty naughty #if 0
 #if 0
-    NR::Matrix m(*mp);
+    Geom::Matrix m(*mp);
     if (!(m.is_translation())) {
         return;
     }
-    NR::Matrix const t(item->transform);
-    NR::Matrix clone_move = t.inverse() * m * t;
+    Geom::Matrix const t(item->transform);
+    Geom::Matrix clone_move = t.inverse() * m * t;
 
     // Calculate the compensation matrix and the advertized movement matrix.
-    NR::Matrix advertized_move;
+    Geom::Matrix advertized_move;
     if (mode == SP_CLONE_COMPENSATION_PARALLEL) {
         //clone_move = clone_move.inverse();
         advertized_move.set_identity();
@@ -183,7 +184,8 @@ sp_usepath_move_compensate(NR::Matrix const *mp, SPItem *original, SPUsePath *se
 static void
 sp_usepath_delete_self(SPObject */*deleted*/, SPUsePath *offset)
 {
-    guint const mode = prefs_get_int_attribute("options.cloneorphans", "value", SP_CLONE_ORPHANS_UNLINK);
+    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+    guint const mode = prefs->getInt("/options/cloneorphans/value", SP_CLONE_ORPHANS_UNLINK);
 
     if (mode == SP_CLONE_ORPHANS_UNLINK) {
         // leave it be. just forget about the source
@@ -220,7 +222,7 @@ void SPUsePath::refresh_source()
         return;
     }
     if (SP_IS_SHAPE(item)) {
-        curve = sp_shape_get_curve(SP_SHAPE(item));
+        curve = SP_SHAPE(item)->getCurve();
         if (curve == NULL)
             return;
     }
@@ -231,7 +233,7 @@ void SPUsePath::refresh_source()
         }
     }
     originalPath = new Path;
-    originalPath->LoadPathVector(curve->get_pathvector(), to_2geom(item->transform), true);
+    originalPath->LoadPathVector(curve->get_pathvector(), item->transform, true);
     curve->unref();
 }