1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Initialize tables of effect and command names properly

This commit is contained in:
Paul Licameli 2018-04-12 16:45:40 -04:00
parent effab49a6f
commit 0c99501bfb
2 changed files with 32 additions and 23 deletions

View File

@ -100,14 +100,16 @@ enum
// Redefine COMMAND() to add the COMMAND's name to an array
//
#undef COMMAND
#define COMMAND(n, i, args) (n ## _PLUGIN_SYMBOL).Internal(),
#define COMMAND(n, i, args) results.push_back( (n ## _PLUGIN_SYMBOL).Internal() );
//
// Create the COMMAND name array
//
static const wxChar *kCOMMANDNames[] =
static const std::vector<wxString> kCOMMANDNames()
{
COMMAND_LIST
std::vector<wxString> results;
COMMAND_LIST;
return results;
};
/*
@ -203,10 +205,11 @@ wxString BuiltinCommandsModule::GetDescription()
bool BuiltinCommandsModule::Initialize()
{
for (size_t i = 0; i < WXSIZEOF(kCOMMANDNames); i++)
const auto &names = kCOMMANDNames();
for (const auto &name : names)
{
wxLogDebug("Adding %s", kCOMMANDNames[i] );
mNames.Add(wxString(BUILTIN_GENERIC_COMMAND_PREFIX) + kCOMMANDNames[i]);
wxLogDebug("Adding %s", name );
mNames.Add(wxString(BUILTIN_GENERIC_COMMAND_PREFIX) + name);
}
/*
@ -228,9 +231,10 @@ void BuiltinCommandsModule::Terminate()
bool BuiltinCommandsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
{
wxString ignoredErrMsg;
for (size_t i = 0; i < WXSIZEOF(kCOMMANDNames); i++)
const auto &names = kCOMMANDNames();
for (const auto &name : names)
{
wxString path(wxString(BUILTIN_GENERIC_COMMAND_PREFIX) + kCOMMANDNames[i]);
wxString path(wxString(BUILTIN_GENERIC_COMMAND_PREFIX) + name);
if (!pm.IsPluginRegistered(path))
{

View File

@ -164,23 +164,25 @@ enum
// Redefine EFFECT() to add the effect's name to an array
//
#undef EFFECT
#define EFFECT(n, i, args) (n ## _PLUGIN_SYMBOL).Internal(),
#define EFFECT(n, i, args) results.push_back((n ## _PLUGIN_SYMBOL).Internal());
//
// Create the effect name array
//
static const wxChar *kEffectNames[] =
{
EFFECT_LIST
};
static const std::vector<wxString> kEffectNames() {
std::vector<wxString> results;
EFFECT_LIST;
return results;
}
//
// Create the effect name array of excluded effects
//
static const wxChar *kExcludedNames[] =
{
EXCLUDE_LIST
};
static const std::vector<wxString> kExcludedNames() {
std::vector<wxString> results;
EXCLUDE_LIST;
return results;
}
//
// Redefine EFFECT() to generate a case statement for the lookup switch
@ -266,14 +268,16 @@ wxString BuiltinEffectsModule::GetDescription()
bool BuiltinEffectsModule::Initialize()
{
for (size_t i = 0; i < WXSIZEOF(kEffectNames); i++)
const auto &names = kEffectNames();
for (const auto &name : names)
{
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + name);
}
for (size_t i = 0; i < WXSIZEOF(kExcludedNames); i++)
const auto &excluded = kExcludedNames();
for (const auto &name : excluded)
{
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + kExcludedNames[i]);
mNames.Add(wxString(BUILTIN_EFFECT_PREFIX) + name);
}
return true;
@ -288,9 +292,10 @@ void BuiltinEffectsModule::Terminate()
bool BuiltinEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
{
wxString ignoredErrMsg;
for (size_t i = 0; i < WXSIZEOF(kEffectNames); i++)
const auto &names = kEffectNames();
for (const auto &name : names)
{
wxString path(wxString(BUILTIN_EFFECT_PREFIX) + kEffectNames[i]);
wxString path(wxString(BUILTIN_EFFECT_PREFIX) + name);
if (!pm.IsPluginRegistered(path))
{