Eliminate duplications of string literal "Nyquist Prompt"

This commit is contained in:
Paul Licameli 2021-05-14 13:02:51 -04:00
parent 9e70fa71ba
commit cf948ece52
7 changed files with 14 additions and 6 deletions

View File

@ -1973,7 +1973,7 @@ void PluginManager::Load()
// These particular config edits were originally written to fix Bug 1914.
if (regver <= "1.0") {
// Nyquist prompt is a built-in that has moved to the tools menu.
if (effectSymbol == "Nyquist Prompt") {
if (effectSymbol == NYQUIST_PROMPT_ID) {
registry.Write(KEY_EFFECTTYPE, "Tool");
// Old version of SDE was in Analyze menu. Now it is in Tools.
// We don't want both the old and the new.

View File

@ -324,4 +324,11 @@ private:
friend class PluginRegistrationDialog;
};
// Defining these special names in the low-level PluginManager.h
// is unfortunate
// Internal name should be stable across versions
#define NYQUIST_PROMPT_ID wxT("Nyquist Prompt")
// User-visible name might change in later versions
#define NYQUIST_PROMPT_NAME XO("Nyquist Prompt")
#endif /* __AUDACITY_PLUGINMANAGER_H__ */

View File

@ -57,7 +57,6 @@ class WaveTrack;
name into another alphabet. */
#define NYQUISTEFFECTS_FAMILY ( EffectFamilySymbol{ XO("Nyquist") } )
#define NYQUIST_PROMPT_ID wxT("Nyquist Prompt")
#define NYQUIST_WORKER_ID wxT("Nyquist Worker")
// TODO: Apr-06-2015

View File

@ -1982,7 +1982,7 @@ wxDialog *EffectUI::DialogFactory( wxWindow &parent, EffectHostInterface *pHost,
menuManager.mLastTool = ID;
menuManager.mLastToolRegistration = MenuCreator::repeattypeplugin;
menuManager.mRepeatToolFlags = EffectManager::kConfigured;
if (shortDesc == XO("Nyquist Prompt")) {
if (shortDesc == NYQUIST_PROMPT_NAME) {
menuManager.mRepeatToolFlags = EffectManager::kRepeatNyquistPrompt; //Nyquist Prompt is not configured
}
break;

View File

@ -17,6 +17,7 @@
#include "Nyquist.h"
#include "../../FileNames.h"
#include "../../PluginManager.h"
// ============================================================================
// List of effects that ship with Audacity. These will be autoregistered.

View File

@ -57,6 +57,7 @@ effects from this one class.
#include "../../NoteTrack.h"
#include "../../TimeTrack.h"
#include "../../prefs/SpectrogramSettings.h"
#include "../../PluginManager.h"
#include "../../Project.h"
#include "../../ProjectSettings.h"
#include "../../ShuttleGetDefinition.h"
@ -164,7 +165,7 @@ NyquistEffect::NyquistEffect(const wxString &fName)
// Interactive Nyquist
if (fName == NYQUIST_PROMPT_ID) {
mName = XO("Nyquist Prompt");
mName = NYQUIST_PROMPT_NAME;
mType = EffectTypeTool;
mIsTool = true;
mPromptName = mName;
@ -209,7 +210,7 @@ PluginPath NyquistEffect::GetPath()
ComponentInterfaceSymbol NyquistEffect::GetSymbol()
{
if (mIsPrompt)
return XO("Nyquist Prompt");
return { NYQUIST_PROMPT_ID, NYQUIST_PROMPT_NAME };
return mName;
}

View File

@ -316,7 +316,7 @@ MenuTable::BaseItemPtrs PopulateEffectsMenu(
&& (plug->GetSymbol() !=
ComponentInterfaceSymbol("Nyquist Effects Prompt"))
&& (plug->GetSymbol() != ComponentInterfaceSymbol("Nyquist Tools Prompt"))
&& (plug->GetSymbol() != ComponentInterfaceSymbol("Nyquist Prompt"))
&& (plug->GetSymbol() != ComponentInterfaceSymbol(NYQUIST_PROMPT_ID))
#endif
)
defplugs.push_back(plug);