Code

UI fixes (a.o. Bug #560751 )
[inkscape.git] / src / live_effects / lpe-patternalongpath.cpp
index 29c5517bfe4485814fc4a2fd7704e648035a2fa4..36f257333260fba589ac676a7d323cabea219e9d 100644 (file)
@@ -33,7 +33,7 @@ B is a map t --> B(t) = ( a(t), b(t) ).
 The first step is to re-parametrize B by its arc length: this is the parametrization in which a point p on B is located by its distance s from start. One obtains a new map s --> U(s) = (a'(s),b'(s)), that still describes the same path B, but where the distance along B from start to
 U(s) is s itself.
 
-We also need a unit normal to the path. This can be obtained by computing a unit tangent vector, and rotate it by 90°. Call this normal vector N(s).
+We also need a unit normal to the path. This can be obtained by computing a unit tangent vector, and rotate it by 90. Call this normal vector N(s).
 
 The basic deformation associated to B is then given by:
 
@@ -58,25 +58,25 @@ static const Util::EnumDataConverter<PAPCopyType> PAPCopyTypeConverter(PAPCopyTy
 
 LPEPatternAlongPath::LPEPatternAlongPath(LivePathEffectObject *lpeobject) :
     Effect(lpeobject),
-    pattern(_("Pattern source"), _("Path to put along the skeleton path"), "pattern", &wr, this, "M0,0 L1,0"),
-    copytype(_("Pattern copies"), _("How many pattern copies to place along the skeleton path"),
+    pattern(_("Pattern source:"), _("Path to put along the skeleton path"), "pattern", &wr, this, "M0,0 L1,0"),
+    copytype(_("Pattern copies:"), _("How many pattern copies to place along the skeleton path"),
         "copytype", PAPCopyTypeConverter, &wr, this, PAPCT_SINGLE_STRETCHED),
-    prop_scale(_("Width"), _("Width of the pattern"), "prop_scale", &wr, this, 1),
+    prop_scale(_("Width:"), _("Width of the pattern"), "prop_scale", &wr, this, 1),
     scale_y_rel(_("Width in units of length"),
         _("Scale the width of the pattern in units of its length"),
         "scale_y_rel", &wr, this, false),
-    spacing(_("Spacing"),
+    spacing(_("Spacing:"),
         // xgettext:no-c-format
         _("Space between copies of the pattern. Negative values allowed, but are limited to -90% of pattern width."),
         "spacing", &wr, this, 0),
-    normal_offset(_("Normal offset"), "", "normal_offset", &wr, this, 0),
-    tang_offset(_("Tangential offset"), "", "tang_offset", &wr, this, 0),
+    normal_offset(_("Normal offset:"), "", "normal_offset", &wr, this, 0),
+    tang_offset(_("Tangential offset:"), "", "tang_offset", &wr, this, 0),
     prop_units(_("Offsets in unit of pattern size"),
         _("Spacing, tangential and normal offset are expressed as a ratio of width/height"),
         "prop_units", &wr, this, false),
     vertical_pattern(_("Pattern is vertical"), _("Rotate pattern 90 deg before applying"),
         "vertical_pattern", &wr, this, false),
-    fuse_tolerance(_("Fuse nearby ends"), _("Fuse ends closer than this number. 0 means don't fuse."),
+    fuse_tolerance(_("Fuse nearby ends:"), _("Fuse ends closer than this number. 0 means don't fuse."),
         "fuse_tolerance", &wr, this, 0)
 {
     registerParameter( dynamic_cast<Parameter *>(&pattern) );
@@ -104,6 +104,11 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
 {
     using namespace Geom;
 
+    // Don't allow empty path parameter:
+    if ( pattern.get_pathvector().empty() ) {
+        return pwd2_in;
+    }
+
 /* Much credit should go to jfb and mgsloan of lib2geom development for the code below! */
     Piecewise<D2<SBasis> > output;
     std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > pre_output;