Code

correctly implement 'resetDefaults()' for LPEs. Now when applying an LPE, all default...
authorjohanengelen <johanengelen@users.sourceforge.net>
Sun, 15 Mar 2009 22:10:43 +0000 (22:10 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Sun, 15 Mar 2009 22:10:43 +0000 (22:10 +0000)
src/live_effects/effect.cpp
src/live_effects/effect.h
src/live_effects/lpe-bendpath.cpp
src/live_effects/lpe-curvestitch.cpp
src/live_effects/lpe-envelope.cpp
src/live_effects/lpe-interpolate.cpp
src/live_effects/lpe-lattice.cpp
src/live_effects/lpe-rough-hatches.cpp
src/live_effects/lpe-vonkoch.cpp

index f67ee28a739d517995d66daa572358fd5b72eba9..3cdb21d6aee3f631242251ba20c03730a9d0eee7 100644 (file)
@@ -647,7 +647,11 @@ Effect::editNextParamOncanvas(SPItem * item, SPDesktop * desktop)
 void
 Effect::resetDefaults(SPItem * /*item*/)
 {
-    // do nothing for simple effects
+    std::vector<Inkscape::LivePathEffect::Parameter *>::iterator p;
+    for (p = param_vector.begin(); p != param_vector.end(); ++p) {
+        (*p)->param_set_default();
+        (*p)->write_to_SVG();
+    }
 }
 
 void
index ae42e358c2ef3e03bb1fc5d7e48d8d2ef89fdb70..702036f14c7d54a3634ad0c037d793757a15e0bb 100644 (file)
@@ -85,6 +85,9 @@ public:
 
     virtual Gtk::Widget * newWidget(Gtk::Tooltips * tooltips);
 
+    /**
+     * Sets all parameters to their default values and writes them to SVG.
+     */
     virtual void resetDefaults(SPItem * item);
 
     virtual void setup_nodepath(Inkscape::NodePath::Path *np);
index c3be5798155cae819908696ee15d19293343c990..a820fe4788e5b080feb296d0710ad32ab7740329 100644 (file)
@@ -124,6 +124,8 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
 void
 LPEBendPath::resetDefaults(SPItem * item)
 {
+    Effect::resetDefaults(item);
+
     original_bbox(SP_LPE_ITEM(item));
 
     Geom::Point start(boundingbox_X.min(), (boundingbox_Y.max()+boundingbox_Y.min())/2);
index 2716e45d72a6951d96235e7f85aa23ae5d590eae..89fdef2f0531225b5d95a1d327ae8a7bcacd0d20 100644 (file)
@@ -153,6 +153,8 @@ LPECurveStitch::doEffect_path (std::vector<Geom::Path> const & path_in)
 void
 LPECurveStitch::resetDefaults(SPItem * item)
 {
+    Effect::resetDefaults(item);
+
     if (!SP_IS_PATH(item)) return;
 
     using namespace Geom;
index 553390585d7473b6e6250173e0ae51cc12389253..a730f14ff2c8f9f0f25aa9f82a7da7a028465781 100755 (executable)
@@ -220,6 +220,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());
index b2f1547a97b1820330d4f5b1e5c72dbcf8737414..e19d2e6e744701bacce89e7116d6610101b7b1b1 100644 (file)
@@ -95,6 +95,8 @@ LPEInterpolate::doEffect_path (Geom::PathVector const & path_in)
 void
 LPEInterpolate::resetDefaults(SPItem * item)
 {
+    Effect::resetDefaults(item);
+
     if (!SP_IS_PATH(item))
         return;
 
index f77434f92dad7c2bcb6da0f494909f8b0d3ebd99..0beedb5374618514456f8131318f87ab18e15a1b 100644 (file)
@@ -183,6 +183,8 @@ LPELattice::doBeforeEffect (SPLPEItem *lpeitem)
 void
 LPELattice::resetDefaults(SPItem * item)
 {
+    Effect::resetDefaults(item);
+
     original_bbox(SP_LPE_ITEM(item), false);
     
     // place the 16 control points
index 1bac02ec488cc343c3f4fdb197db98df6c838592..7fa865c01098ca49ba18d50c65711ec453685abd 100644 (file)
@@ -565,6 +565,8 @@ LPERoughHatches::doBeforeEffect (SPLPEItem */*lpeitem*/)
 void\r
 LPERoughHatches::resetDefaults(SPItem * item)\r
 {\r
+    Effect::resetDefaults(item);\r
+\r
     Geom::OptRect bbox = item->getBounds(Geom::identity(), SPItem::GEOMETRIC_BBOX);\r
     Geom::Point origin(0.,0.);\r
     Geom::Point vector(50.,0.);\r
index 0f105ad608d2bae9dafb242cbd02262b8361759a..f18c4011be1c75cfebfda25cb284ef79768bf984 100644 (file)
@@ -271,6 +271,8 @@ LPEVonKoch::doBeforeEffect (SPLPEItem *lpeitem)
 void
 LPEVonKoch::resetDefaults(SPItem * item)
 {
+    Effect::resetDefaults(item);
+
     using namespace Geom;
     original_bbox(SP_LPE_ITEM(item));