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 02e24ad137a5520831f6caa45bce1efb21cc66b1
parent b12d2853e2d85ed84d244279cbde16f9e6946c91
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sat,  4 May 2024 14:05:30 +0200

allow to remove tags via context menu

Diffstat:
Msource/jucePluginEditorLib/patchmanager/list.cpp | 52++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/source/jucePluginEditorLib/patchmanager/list.cpp b/source/jucePluginEditorLib/patchmanager/list.cpp @@ -145,6 +145,11 @@ namespace jucePluginEditorLib::patchManager { menu.addSeparator(); + pluginLib::patchDB::TypedTags tags; + + for (const auto& selectedPatch : selectedPatches) + tags.add(selectedPatch->getTags()); + if(selectedPatches.size() == 1) { const auto& patch = *selectedPatches.begin(); @@ -168,7 +173,7 @@ namespace jucePluginEditorLib::patchManager if(!m_search->request.tags.empty()) { - menu.addItem("Remove selected", [this, s = std::move(selectedPatches)] + menu.addItem("Remove selected", [this, s = selectedPatches] { const std::vector<pluginLib::patchDB::PatchPtr> patches(s.begin(), s.end()); pluginLib::patchDB::TypedTags removeTags; @@ -189,7 +194,7 @@ namespace jucePluginEditorLib::patchManager } else if(getSourceType() == pluginLib::patchDB::SourceType::LocalStorage) { - menu.addItem("Deleted selected", [this, s = std::move(selectedPatches)] + menu.addItem("Deleted selected", [this, s = selectedPatches] { if(showDeleteConfirmationMessageBox()) { @@ -198,6 +203,49 @@ namespace jucePluginEditorLib::patchManager } }); } + + if(tags.containsAdded()) + { + bool haveSeparator = false; + + for (const auto& it : tags.get()) + { + const auto type = it.first; + + const auto& t = it.second; + + if(t.empty()) + continue; + + const auto tagTypeName = m_patchManager.getTagTypeName(type); + + if(tagTypeName.empty()) + continue; + + juce::PopupMenu tagMenu; + + for (const auto& tag : t.getAdded()) + { + pluginLib::patchDB::TypedTags removeTags; + removeTags.addRemoved(type, tag); + + std::vector<pluginLib::patchDB::PatchPtr> patches{selectedPatches.begin(), selectedPatches.end()}; + + tagMenu.addItem(tag, [this, s = std::move(patches), removeTags] + { + m_patchManager.modifyTags(s, removeTags); + }); + } + + if(!haveSeparator) + { + menu.addSeparator(); + haveSeparator = true; + } + + menu.addSubMenu("Remove from " + tagTypeName, tagMenu); + } + } } menu.addSeparator(); menu.addItem("Hide Duplicates", true, m_hideDuplicates, [this]