Code

Warning cleanup from unused cursor images.
[inkscape.git] / src / live_effects / lpe-path_length.cpp
index 5ecf2ffa29f74a74a276fe2b96cfd70b43092367..e33a160025ccf7fdbce09ddaeaf4c747371fbdbe 100644 (file)
@@ -22,11 +22,15 @@ namespace LivePathEffect {
 
 LPEPathLength::LPEPathLength(LivePathEffectObject *lpeobject) :
     Effect(lpeobject),
+    scale(_("Scale"), _("Scaling factor"), "scale", &wr, this, 1.0),
     info_text(this),
-    unit(_("Unit"), _("Unit"), "unit", &wr, this)
+    unit(_("Unit"), _("Unit"), "unit", &wr, this),
+    display_unit(_("Display unit"), _("Print unit after path length"), "display_unit", &wr, this, true)
 {
+    registerParameter(dynamic_cast<Parameter *>(&scale));
     registerParameter(dynamic_cast<Parameter *>(&info_text));
     registerParameter(dynamic_cast<Parameter *>(&unit));
+    registerParameter(dynamic_cast<Parameter *>(&display_unit));
 }
 
 LPEPathLength::~LPEPathLength()
@@ -34,7 +38,7 @@ LPEPathLength::~LPEPathLength()
 
 }
 
-bool
+void
 LPEPathLength::hideCanvasText() {
     // this is only used in sp-lpe-item.cpp to hide the canvas text when the effect is invisible
     info_text.param_setValue("");
@@ -46,11 +50,12 @@ LPEPathLength::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & p
     using namespace Geom;
 
     /* convert the measured length to the correct unit ... */
-    double lengthval = Geom::length(pwd2_in);
+    double lengthval = Geom::length(pwd2_in) * scale;
     gboolean success = sp_convert_distance(&lengthval, &sp_unit_get_by_id(SP_UNIT_PX), unit);
 
     /* ... set it as the canvas text ... */
-    gchar *arc_length = g_strdup_printf("%.2f %s", lengthval, success ? unit.get_abbreviation() : "px");
+    gchar *arc_length = g_strdup_printf("%.2f %s", lengthval,
+                                        display_unit ? (success ? unit.get_abbreviation() : "px") : "");
     info_text.param_setValue(arc_length);
     g_free(arc_length);