gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 7643cdb334d93d7920fbada2781020fd3b68ced7
parent 60736b06ec77417134f0127383c180e8c8e69222
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sun,  5 May 2024 16:19:16 +0200

fix duplicated save entry / add separator if replace is an option

Diffstat:
Msource/jucePluginEditorLib/patchmanager/patchmanager.cpp | 36+++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)

diff --git a/source/jucePluginEditorLib/patchmanager/patchmanager.cpp b/source/jucePluginEditorLib/patchmanager/patchmanager.cpp @@ -336,32 +336,26 @@ namespace jucePluginEditorLib::patchManager } } - auto createSaveToUserBankEntry = [this, &countAdded, _part, &_menu](const pluginLib::patchDB::DataSourceNodePtr& _ds) - { - ++countAdded; - _menu.addItem("Add to user bank '" + _ds->name + "'", true, false, [this, _ds, _part] - { - const auto newPatch = requestPatchForPart(_part); - - if(!newPatch) - return; - - copyPatchesToLocalStorage(_ds, {newPatch}, static_cast<int>(_part)); - }); - }; - - if(const auto ds = getSelectedDataSource()) - { - if(ds->type == pluginLib::patchDB::SourceType::LocalStorage) - createSaveToUserBankEntry(ds); - } - const auto existingLocalDS = getDataSourcesOfSourceType(pluginLib::patchDB::SourceType::LocalStorage); if(!existingLocalDS.empty()) { + if(countAdded) + _menu.addSeparator(); + for (const auto& ds : existingLocalDS) - createSaveToUserBankEntry(ds); + { + ++countAdded; + _menu.addItem("Add to user bank '" + ds->name + "'", true, false, [this, ds, _part] + { + const auto newPatch = requestPatchForPart(_part); + + if(!newPatch) + return; + + copyPatchesToLocalStorage(ds, {newPatch}, static_cast<int>(_part)); + }); + } } else {