From 7867b2ae755a4217c14365e3b1b18484ba98712b Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 7 Apr 2012 16:09:58 +0200 Subject: cleanup knotholder code for LPEs (bzr r11170) --- src/live_effects/effect.cpp | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) (limited to 'src/live_effects/effect.cpp') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 0b1fe1160..44e57addf 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -282,7 +282,8 @@ Effect::createAndApply(EffectType type, SPDocument *doc, SPItem *item) } Effect::Effect(LivePathEffectObject *lpeobject) - : oncanvasedit_it(0), + : _provides_knotholder_entities(false), + oncanvasedit_it(0), is_visible(_("Is visible?"), _("If unchecked, the effect remains applied to the object but is temporarily disabled on canvas"), "is_visible", &wr, this, true), show_orig_path(false), lpeobj(lpeobject), @@ -468,12 +469,6 @@ Effect::registerParameter(Parameter * param) param_vector.push_back(param); } -// TODO: should we provide a way to alter the handle's appearance? -void -Effect::registerKnotHolderHandle(KnotHolderEntity* entity, const char* descr) -{ - kh_entity_vector.push_back(std::make_pair(entity, descr)); -} /** * Add all registered LPE knotholder handles to the knotholder @@ -491,23 +486,6 @@ Effect::addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { } } -void -Effect::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { - // TODO: The entities in kh_entity_vector are already instantiated during the call - // to registerKnotHolderHandle(), but they are recreated here. Also, we must not - // delete them when the knotholder is destroyed, whence the clumsy function - // isDeletable(). If we could create entities of different classes dynamically, - // this would be much nicer. How to do this? - std::vector >::iterator i; - for (i = kh_entity_vector.begin(); i != kh_entity_vector.end(); ++i) { - KnotHolderEntity *entity = i->first; - const char *descr = i->second; - - entity->create(desktop, item, knotholder, descr); - knotholder->add(entity); - } -} - /** * Return a vector of PathVectors which contain all helperpaths that should be drawn by the effect. * This is the function called by external code like SPLPEItem. @@ -688,8 +666,9 @@ bool Effect::providesKnotholder() { // does the effect actively provide any knotholder entities of its own? - if (kh_entity_vector.size() > 0) + if (_provides_knotholder_entities) { return true; + } // otherwise: are there any parameters that have knotholderentities? for (std::vector::iterator p = param_vector.begin(); p != param_vector.end(); ++p) { -- cgit v1.2.3