Bug 2343 - Presets: Effect Ids not the same in Presets as for Macros

This commit is contained in:
James Crook 2020-03-05 22:14:17 +00:00
parent 301c511422
commit 95bbe617b8
3 changed files with 14 additions and 2 deletions

View File

@ -35,6 +35,7 @@
#include "../Shuttle.h"
#include "../ViewInfo.h"
#include "../WaveTrack.h"
#include "../Effects/EffectManager.h"
#include "../wxFileNameWrapper.h"
#include "../widgets/ProgressDialog.h"
#include "../ondemand/ODManager.h"
@ -666,7 +667,9 @@ void Effect::ExportPresets()
{
wxString params;
GetAutomationParameters(params);
params = GetSymbol().Internal() + ":" + params;
EffectManager & em = EffectManager::Get();
wxString commandId = em.GetSquashedName(GetSymbol().Internal()).GET();
params = commandId + ":" + params;
auto path = FileNames::DefaultToDocumentsFolder(wxT("Presets/Path"));
@ -741,7 +744,11 @@ void Effect::ImportPresets()
if (f.ReadAll(&params)) {
wxString ident = params.BeforeFirst(':');
params = params.AfterFirst(':');
if (ident != GetSymbol().Internal()) {
EffectManager & em = EffectManager::Get();
wxString commandId = em.GetSquashedName(GetSymbol().Internal()).GET();
if (ident != commandId) {
// effect identifiers are a sensible length!
// must also have some params.
if ((params.Length() < 2 ) || (ident.Length() < 2) || (ident.Length() > 30))

View File

@ -122,7 +122,11 @@ TranslatableString EffectManager::GetVendorName(const PluginID & ID)
CommandID EffectManager::GetCommandIdentifier(const PluginID & ID)
{
wxString name = PluginManager::Get().GetSymbol(ID).Internal();
return GetSquashedName(name);
}
CommandID EffectManager::GetSquashedName(wxString name)
{
// Get rid of leading and trailing white space
name.Trim(true).Trim(false);

View File

@ -94,6 +94,7 @@ public:
ComponentInterfaceSymbol GetCommandSymbol(const PluginID & ID);
TranslatableString GetCommandName(const PluginID & ID);
CommandID GetCommandIdentifier(const PluginID & ID);
CommandID GetSquashedName(wxString name);
TranslatableString GetCommandDescription(const PluginID & ID);
wxString GetCommandUrl(const PluginID & ID);
wxString GetCommandTip(const PluginID & ID);