From 20fbb163d2c9b6a73dca2cee69f6b576fa825968 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Wed, 29 Apr 2015 09:54:48 -0500 Subject: [PATCH] Fix a few things with chain/effect parameters as reported by Gale --- src/BatchCommands.cpp | 11 ++++++++++- src/PluginManager.cpp | 14 +++++++++++++- src/effects/EffectManager.cpp | 7 +++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/BatchCommands.cpp b/src/BatchCommands.cpp index 66647197b..4023d2bad 100644 --- a/src/BatchCommands.cpp +++ b/src/BatchCommands.cpp @@ -349,7 +349,16 @@ wxString BatchCommands::PromptForPresetFor(const wxString & command, const wxStr return wxEmptyString; // effect not found. } - return EffectManager::Get().GetPreset(ID, params, parent); + wxString preset = EffectManager::Get().GetPreset(ID, params, parent); + + // Preset will be empty if the user cancelled the dialog, so return the original + // parameter value. + if (preset.IsEmpty()) + { + return params; + } + + return preset; } double BatchCommands::GetEndTime() diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index 6843a3f1c..bbd3bfd10 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -2289,7 +2289,19 @@ wxFileConfig *PluginManager::GetSettings() bool PluginManager::HasGroup(const wxString & group) { - return GetSettings()->HasGroup(group); + wxFileConfig *settings = GetSettings(); + + bool res = settings->HasGroup(group); + if (res) + { + // The group exists, but empty groups aren't considered valid + wxString oldPath = settings->GetPath(); + settings->SetPath(group); + res = settings->GetNumberOfEntries() || settings->GetNumberOfGroups(); + settings->SetPath(oldPath); + } + + return res; } bool PluginManager::GetSubgroups(const wxString & group, wxArrayString & subgroups) diff --git a/src/effects/EffectManager.cpp b/src/effects/EffectManager.cpp index 56a43afae..14ca7b0be 100644 --- a/src/effects/EffectManager.cpp +++ b/src/effects/EffectManager.cpp @@ -168,6 +168,13 @@ wxString EffectManager::GetEffectParameters(const PluginID & ID) effect->GetAutomationParameters(parms); + // Some effects don't have automatable parameters and will not return + // anything, so try to get the active preset (current or factory). + if (parms.IsEmpty()) + { + parms = GetDefaultPreset(ID); + } + return parms; }