void EffectManager::RegisterEffect(Effect *f, int NewFlags) { f->SetEffectID(mNumEffects++); if( NewFlags != 0) { f->SetEffectFlags( NewFlags ); } // This will go away after all effects have been converted mEffects[PluginManager::Get().RegisterLegacyEffectPlugin(f)] = f; #ifdef EFFECT_CATEGORIES // Add the effect in the right categories std::set<wxString> catUris = f->GetEffectCategories(); bool oneValid = false; std::set<wxString>::const_iterator iter; for (iter = catUris.begin(); iter != catUris.end(); ++iter) { EffectCategory* cat = LookupCategory(*iter); if (cat != 0) { cat->AddEffect(f); oneValid = true; } } if (!oneValid) mUnsorted->insert(f); #endif }
void EffectManager::RegisterEffect(Effect *f, int NewFlags) { f->mID = mNumEffects; mNumEffects++; if( NewFlags != 0) f->SetEffectFlags( NewFlags ); // Insert the effect into the list in alphabetical order // A linear search is good enough as long as there are // only a few dozen or even a few hundred effects. wxString name = Effect::StripAmpersand(f->GetEffectName()); int len = mEffects.GetCount(); int i; for(i=0; i<len; i++) if (name.CmpNoCase(Effect::StripAmpersand(mEffects[i]->GetEffectName())) < 0) { mEffects.Insert(f, i); break; } if (i==len) mEffects.Add(f); #ifdef EFFECT_CATEGORIES // Add the effect in the right categories std::set<wxString> catUris = f->GetEffectCategories(); bool oneValid = false; std::set<wxString>::const_iterator iter; for (iter = catUris.begin(); iter != catUris.end(); ++iter) { EffectCategory* cat = LookupCategory(*iter); if (cat != 0) { cat->AddEffect(f); oneValid = true; } } if (!oneValid) mUnsorted->insert(f); #endif }