From 848b66f4fae73d1e3236dfe1b402682a01013075 Mon Sep 17 00:00:00 2001 From: James Crook Date: Sat, 14 Jul 2018 17:38:57 +0100 Subject: [PATCH] Make title of Nyquist Prompt dialog change appropriately. Previously it was being overwritten each Init() by the string suitable for the Nyquist Effects Prompt. --- src/effects/nyquist/LoadNyquist.cpp | 10 +++++----- src/effects/nyquist/Nyquist.cpp | 12 ++++++++---- src/effects/nyquist/Nyquist.h | 4 +++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/effects/nyquist/LoadNyquist.cpp b/src/effects/nyquist/LoadNyquist.cpp index 1fe7ada49..3b933bf57 100644 --- a/src/effects/nyquist/LoadNyquist.cpp +++ b/src/effects/nyquist/LoadNyquist.cpp @@ -175,10 +175,10 @@ bool NyquistEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm) wxArrayString files; wxString ignoredErrMsg; - if (!pm.IsPluginRegistered(NYQUIST_PROMPT_ID)) + if (!pm.IsPluginRegistered(NYQUIST_EFFECTS_PROMPT_ID)) { // No checking of error ? - DiscoverPluginsAtPath(NYQUIST_PROMPT_ID, ignoredErrMsg, + DiscoverPluginsAtPath(NYQUIST_EFFECTS_PROMPT_ID, ignoredErrMsg, PluginManagerInterface::DefaultRegistrationCallback); } if (!pm.IsPluginRegistered(NYQUIST_TOOLS_PROMPT_ID)) @@ -212,8 +212,8 @@ wxArrayString NyquistEffectsModule::FindPluginPaths(PluginManagerInterface & pm) wxArrayString pathList = NyquistEffect::GetNyquistSearchPath(); wxArrayString files; - // Add the Nyquist prompt effect - files.Add(NYQUIST_PROMPT_ID); + // Add the Nyquist prompt effect and tool. + files.Add(NYQUIST_EFFECTS_PROMPT_ID); files.Add(NYQUIST_TOOLS_PROMPT_ID); // Load .ny plug-ins @@ -246,7 +246,7 @@ bool NyquistEffectsModule::IsPluginValid(const wxString & path, bool bFast) // Ignores bFast parameter, since checking file exists is fast enough for // the small number of Nyquist plug-ins that we have. static_cast(bFast); - if((path == NYQUIST_PROMPT_ID) || (path == NYQUIST_TOOLS_PROMPT_ID)) + if((path == NYQUIST_EFFECTS_PROMPT_ID) || (path == NYQUIST_TOOLS_PROMPT_ID)) return true; return wxFileName::FileExists(path); diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 1ff2f7615..851f8effb 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -151,9 +151,11 @@ NyquistEffect::NyquistEffect(const wxString &fName) mMaxLen = NYQ_MAX_LEN; // Interactive Nyquist (for effects) - if (fName == NYQUIST_PROMPT_ID) { + if (fName == NYQUIST_EFFECTS_PROMPT_ID) { mName = XO("Nyquist Effects Prompt"); mType = EffectTypeProcess; + mPromptName = mName; + mPromptType = mType; mOK = true; mIsPrompt = true; return; @@ -163,6 +165,8 @@ NyquistEffect::NyquistEffect(const wxString &fName) if (fName == NYQUIST_TOOLS_PROMPT_ID) { mName = XO("Nyquist Tools Prompt"); mType = EffectTypeTool; + mPromptName = mName; + mPromptType = mType; mOK = true; mIsPrompt = true; return; @@ -195,7 +199,7 @@ wxString NyquistEffect::GetPath() if (mIsPrompt) return (mType == EffectTypeTool) ? NYQUIST_TOOLS_PROMPT_ID : - NYQUIST_PROMPT_ID; + NYQUIST_EFFECTS_PROMPT_ID; return mFileName.GetFullPath(); } @@ -512,9 +516,9 @@ bool NyquistEffect::Init() // EffectType may not be defined in script, so // reset each time we call the Nyquist Prompt. if (mIsPrompt) { - mName = XO("Nyquist Effects Prompt"); + mName = mPromptName; // Reset effect type each time we call the Nyquist Prompt. - mType = EffectTypeProcess; + mType = mPromptType; mIsSpectral = false; mDebugButton = true; // Debug button always enabled for Nyquist Prompt. mEnablePreview = true; // Preview button always enabled for Nyquist Prompt. diff --git a/src/effects/nyquist/Nyquist.h b/src/effects/nyquist/Nyquist.h index 66ab99ced..103d6fb7b 100644 --- a/src/effects/nyquist/Nyquist.h +++ b/src/effects/nyquist/Nyquist.h @@ -34,7 +34,7 @@ name into another alphabet. */ #define NYQUISTEFFECTS_FAMILY ( IdentInterfaceSymbol{ XO("Nyquist") } ) -#define NYQUIST_PROMPT_ID wxT("Nyquist Effects Prompt") +#define NYQUIST_EFFECTS_PROMPT_ID wxT("Nyquist Effects Prompt") #define NYQUIST_TOOLS_PROMPT_ID wxT("Nyquist Tools Prompt") #define NYQUIST_WORKER_ID wxT("Nyquist Worker") @@ -228,6 +228,7 @@ private: wxString mInputCmd; // history: exactly what the user typed wxString mCmd; // the command to be processed wxString mName; ///< Name of the Effect (untranslated) + wxString mPromptName; // If a prompt, we need to remember original name. wxString mAction; // translatable wxString mInfo; // translatable wxString mAuthor; @@ -240,6 +241,7 @@ private: wxString mHelpFile; bool mHelpFileExists; EffectType mType; + EffectType mPromptType; // If a prompt, need ot remember original type. bool mEnablePreview; bool mDebugButton; // Set to false to disable Debug button.