Code

Mnemonics in "Input devices", and LPE dialogs (Bug 170765)
[inkscape.git] / src / live_effects / lpe-envelope.cpp
old mode 100755 (executable)
new mode 100644 (file)
index ef3d4cc..49f2944
@@ -12,9 +12,6 @@
 #include "sp-path.h"
 #include "sp-item-group.h"
 #include "display/curve.h"
-#include <libnr/n-art-bpath.h>
-#include <libnr/nr-matrix-fns.h>
-#include "libnr/n-art-bpath-2geom.h"
 #include "svg/svg.h"
 #include "ui/widget/scalar.h"
 
@@ -33,12 +30,12 @@ namespace LivePathEffect {
 
 LPEEnvelope::LPEEnvelope(LivePathEffectObject *lpeobject) :
     Effect(lpeobject),
-    bend_path1(_("Top bend path"), _("Top path along which to bend the original path"), "bendpath1", &wr, this, "M0,0 L1,0"),
-    bend_path2(_("Right bend path"), _("Right path along which to bend the original path"), "bendpath2", &wr, this, "M0,0 L1,0"),
-    bend_path3(_("Bottom bend path"), _("Bottom path along which to bend the original path"), "bendpath3", &wr, this, "M0,0 L1,0"),
-    bend_path4(_("Left bend path"), _("Left path along which to bend the original path"), "bendpath4", &wr, this, "M0,0 L1,0"),
-    xx(_("Enable left & right paths"), _("Enable the left and right deformation paths"), "xx", &wr, this, true),
-    yy(_("Enable top & bottom paths"), _("Enable the top and bottom deformation paths"), "yy", &wr, this, true)
+    bend_path1(_("Top bend path:"), _("Top path along which to bend the original path"), "bendpath1", &wr, this, "M0,0 L1,0"),
+    bend_path2(_("Right bend path:"), _("Right path along which to bend the original path"), "bendpath2", &wr, this, "M0,0 L1,0"),
+    bend_path3(_("Bottom bend path:"), _("Bottom path along which to bend the original path"), "bendpath3", &wr, this, "M0,0 L1,0"),
+    bend_path4(_("Left bend path:"), _("Left path along which to bend the original path"), "bendpath4", &wr, this, "M0,0 L1,0"),
+    xx(_("E_nable left & right paths"), _("Enable the left and right deformation paths"), "xx", &wr, this, true),
+    yy(_("_Enable top & bottom paths"), _("Enable the top and bottom deformation paths"), "yy", &wr, this, true)
 {
     registerParameter( dynamic_cast<Parameter *>(&yy) );
     registerParameter( dynamic_cast<Parameter *>(&xx) );
@@ -72,6 +69,15 @@ LPEEnvelope::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
 
     using namespace Geom;
 
+    // Don't allow empty path parameters:
+    if ( bend_path1.get_pathvector().empty()
+         || bend_path2.get_pathvector().empty()
+         || bend_path3.get_pathvector().empty()
+         || bend_path4.get_pathvector().empty() )
+    {
+        return pwd2_in;
+    }
+
     /*
     The code below is inspired from the Bend Path code developed by jfb and mgsloan
     Please, read it before tring to understand this one
@@ -223,6 +229,8 @@ LPEEnvelope::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
 void
 LPEEnvelope::resetDefaults(SPItem * item)
 {
+    Effect::resetDefaults(item);
+
     original_bbox(SP_LPE_ITEM(item));
 
     Geom::Point Up_Left(boundingbox_X.min(), boundingbox_Y.min());
@@ -251,13 +259,6 @@ LPEEnvelope::resetDefaults(SPItem * item)
     bend_path4.set_new_value( path4.toPwSb(), true );
 }
 
-void
-LPEEnvelope::transform_multiply(Geom::Matrix const& postmul, bool set)
-{
-    // TODO: implement correct transformation instead of this default behavior
-    Effect::transform_multiply(postmul, set);
-}
-
 
 } // namespace LivePathEffect
 } /* namespace Inkscape */