Code

Add a function doOnApply() for LPEs which is executed once when the effect is applied...
authorcilix42 <cilix42@users.sourceforge.net>
Sun, 18 May 2008 21:02:43 +0000 (21:02 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Sun, 18 May 2008 21:02:43 +0000 (21:02 +0000)
src/live_effects/effect.cpp
src/live_effects/effect.h
src/sp-lpe-item.cpp

index 9f74af3d9633ed1a37bb2c0405b2d3cb908a2fd8..1d448141590b4fa3d2bc715559986854aff53d93 100644 (file)
@@ -162,6 +162,12 @@ Effect::effectType() {
     return lpeobj->effecttype;
 }
 
+void
+Effect::doOnApply (SPLPEItem */*lpeitem*/)
+{
+    // This is performed once when the effect is freshly applied to a path
+}
+
 void
 Effect::doBeforeEffect (SPLPEItem */*lpeitem*/)
 {
index 496d4cbdfa1b327c487fc516e53634d7725c2a7e..b5c1d6aeb2dd6bb80992aede8105ce3479dfca28 100644 (file)
@@ -83,6 +83,8 @@ public:
 
     EffectType effectType ();
 
+    virtual void doOnApply (SPLPEItem *lpeitem);
+
     virtual void doBeforeEffect (SPLPEItem *lpeitem);
 
     virtual void doEffect (SPCurve * curve);
index b6a63e9b92ef53fb094a22188e0f5b05e2a7d416..87e737435ead7e1fcec0e6a8acbbf6adf0e8aa59 100644 (file)
@@ -362,11 +362,15 @@ void sp_lpe_item_set_path_effect(SPLPEItem *lpeitem, gchar *value, bool reset)
         SP_OBJECT_REPR(lpeitem)->setAttribute("inkscape:path-effect", value);
         
         // Ask the path effect to reset itself if it doesn't have parameters yet
-        if (lpeitem->path_effect_ref && reset) {
+        if (lpeitem->path_effect_ref) {
             LivePathEffectObject *lpeobj = lpeitem->path_effect_ref->lpeobject;
             if (lpeobj && lpeobj->lpe) {
-                // has to be called when all the subitems have their lpes applied
-                lpeobj->lpe->resetDefaults(lpeitem);
+                if(reset) {
+                    // has to be called when all the subitems have their lpes applied
+                    lpeobj->lpe->resetDefaults(lpeitem);
+                }
+                // perform this once when the effect is applied
+               lpeobj->lpe->doOnApply(SP_LPE_ITEM(lpeitem));
             }
         }