diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-05-18 21:02:43 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-05-18 21:02:43 +0000 |
| commit | e4df289bd436daf43602c3bac2a7628f45b789c8 (patch) | |
| tree | 34ac3c6ea3c9fef799a5c24fcee17bb3583e0f88 /src | |
| parent | noop: correct spelling in comment (diff) | |
| download | inkscape-e4df289bd436daf43602c3bac2a7628f45b789c8.tar.gz inkscape-e4df289bd436daf43602c3bac2a7628f45b789c8.zip | |
Add a function doOnApply() for LPEs which is executed once when the effect is applied to an item (contrary to doBeforeEffect() which is executed, e.g., each time a parameter changes
(bzr r5698)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/effect.cpp | 6 | ||||
| -rw-r--r-- | src/live_effects/effect.h | 2 | ||||
| -rw-r--r-- | src/sp-lpe-item.cpp | 10 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 9f74af3d9..1d4481415 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -163,6 +163,12 @@ Effect::effectType() { } void +Effect::doOnApply (SPLPEItem */*lpeitem*/) +{ + // This is performed once when the effect is freshly applied to a path +} + +void Effect::doBeforeEffect (SPLPEItem */*lpeitem*/) { //Do nothing for simple effects diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index 496d4cbdf..b5c1d6aeb 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -83,6 +83,8 @@ public: EffectType effectType (); + virtual void doOnApply (SPLPEItem *lpeitem); + virtual void doBeforeEffect (SPLPEItem *lpeitem); virtual void doEffect (SPCurve * curve); diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index b6a63e9b9..87e737435 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -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)); } } |
