summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2009-03-15 22:10:43 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2009-03-15 22:10:43 +0000
commit7fe5d57fe8762253b743c760c5126aa912466191 (patch)
treee533d289fe40f43fde011d2fedfe16ac0dd1d557 /src
parentEnvelope Deform LPE is no longer experimental (diff)
downloadinkscape-7fe5d57fe8762253b743c760c5126aa912466191.tar.gz
inkscape-7fe5d57fe8762253b743c760c5126aa912466191.zip
correctly implement 'resetDefaults()' for LPEs. Now when applying an LPE, all default values are written to SVG. This greatly improves future compatibility.
(bzr r7499)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/effect.cpp6
-rw-r--r--src/live_effects/effect.h3
-rw-r--r--src/live_effects/lpe-bendpath.cpp2
-rw-r--r--src/live_effects/lpe-curvestitch.cpp2
-rwxr-xr-xsrc/live_effects/lpe-envelope.cpp2
-rw-r--r--src/live_effects/lpe-interpolate.cpp2
-rw-r--r--src/live_effects/lpe-lattice.cpp2
-rw-r--r--src/live_effects/lpe-rough-hatches.cpp2
-rw-r--r--src/live_effects/lpe-vonkoch.cpp2
9 files changed, 22 insertions, 1 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index f67ee28a7..3cdb21d6a 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -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
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index ae42e358c..702036f14 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -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);
diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp
index c3be57981..a820fe478 100644
--- a/src/live_effects/lpe-bendpath.cpp
+++ b/src/live_effects/lpe-bendpath.cpp
@@ -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);
diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp
index 2716e45d7..89fdef2f0 100644
--- a/src/live_effects/lpe-curvestitch.cpp
+++ b/src/live_effects/lpe-curvestitch.cpp
@@ -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;
diff --git a/src/live_effects/lpe-envelope.cpp b/src/live_effects/lpe-envelope.cpp
index 553390585..a730f14ff 100755
--- a/src/live_effects/lpe-envelope.cpp
+++ b/src/live_effects/lpe-envelope.cpp
@@ -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());
diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp
index b2f1547a9..e19d2e6e7 100644
--- a/src/live_effects/lpe-interpolate.cpp
+++ b/src/live_effects/lpe-interpolate.cpp
@@ -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;
diff --git a/src/live_effects/lpe-lattice.cpp b/src/live_effects/lpe-lattice.cpp
index f77434f92..0beedb537 100644
--- a/src/live_effects/lpe-lattice.cpp
+++ b/src/live_effects/lpe-lattice.cpp
@@ -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
diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp
index 1bac02ec4..7fa865c01 100644
--- a/src/live_effects/lpe-rough-hatches.cpp
+++ b/src/live_effects/lpe-rough-hatches.cpp
@@ -565,6 +565,8 @@ LPERoughHatches::doBeforeEffect (SPLPEItem */*lpeitem*/)
void
LPERoughHatches::resetDefaults(SPItem * item)
{
+ Effect::resetDefaults(item);
+
Geom::OptRect bbox = item->getBounds(Geom::identity(), SPItem::GEOMETRIC_BBOX);
Geom::Point origin(0.,0.);
Geom::Point vector(50.,0.);
diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp
index 0f105ad60..f18c4011b 100644
--- a/src/live_effects/lpe-vonkoch.cpp
+++ b/src/live_effects/lpe-vonkoch.cpp
@@ -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));