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 b12d2853e2d85ed84d244279cbde16f9e6946c91
parent 18c855178e099b567efb26000a43843f86ccdb33
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sat,  4 May 2024 14:04:46 +0200

add ability to specify custom names for tag types

Diffstat:
Msource/jucePluginEditorLib/patchmanager/patchmanager.cpp | 32+++++++++++++++++++++++++++++++-
Msource/jucePluginEditorLib/patchmanager/patchmanager.h | 8+++++++-
Msource/virusJucePlugin/PatchManager.cpp | 7+++++--
3 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/source/jucePluginEditorLib/patchmanager/patchmanager.cpp b/source/jucePluginEditorLib/patchmanager/patchmanager.cpp @@ -24,6 +24,10 @@ namespace jucePluginEditorLib::patchManager PatchManager::PatchManager(Editor& _editor, Component* _root, const juce::File& _dir, const std::initializer_list<GroupType>& _groupTypes) : DB(_dir), m_editor(_editor), m_state(*this) { + setTagTypeName(pluginLib::patchDB::TagType::Category, "Category"); + setTagTypeName(pluginLib::patchDB::TagType::Tag, "Tag"); + setTagTypeName(pluginLib::patchDB::TagType::Favourites, "Favourite"); + const auto rootW = _root->getWidth() / g_scale; const auto rootH = _root->getHeight() / g_scale; const auto scale = juce::AffineTransform::scale(g_scale); @@ -352,6 +356,27 @@ namespace jucePluginEditorLib::patchManager return countAdded; } + std::string PatchManager::getTagTypeName(const pluginLib::patchDB::TagType _type) const + { + const auto it = m_tagTypeNames.find(_type); + if(it == m_tagTypeNames.end()) + { + return {}; + } + return it->second; + } + + void PatchManager::setTagTypeName(const pluginLib::patchDB::TagType _type, const std::string& _name) + { + if(_name.empty()) + { + m_tagTypeNames.erase(_type); + return; + } + + m_tagTypeNames[_type] = _name; + } + bool PatchManager::selectPrevPreset(const uint32_t _part) { return selectPatch(_part, -1); @@ -420,7 +445,12 @@ namespace jucePluginEditorLib::patchManager return DB::getPatchColor(_patch, ignoreTags); } - bool PatchManager::addGroupTreeItemForTag(const pluginLib::patchDB::TagType _type, const std::string& _name) + bool PatchManager::addGroupTreeItemForTag(const pluginLib::patchDB::TagType _type) const + { + return addGroupTreeItemForTag(_type, getTagTypeName(_type)); + } + + bool PatchManager::addGroupTreeItemForTag(const pluginLib::patchDB::TagType _type, const std::string& _name) const { const auto groupType = toGroupType(_type); if(groupType == GroupType::Invalid) diff --git a/source/jucePluginEditorLib/patchmanager/patchmanager.h b/source/jucePluginEditorLib/patchmanager/patchmanager.h @@ -54,7 +54,8 @@ namespace jucePluginEditorLib::patchManager pluginLib::patchDB::Color getPatchColor(const pluginLib::patchDB::PatchPtr& _patch) const; - bool addGroupTreeItemForTag(pluginLib::patchDB::TagType _type, const std::string& _name); + bool addGroupTreeItemForTag(pluginLib::patchDB::TagType _type) const; + bool addGroupTreeItemForTag(pluginLib::patchDB::TagType _type, const std::string& _name) const; void paint(juce::Graphics& g) override; @@ -81,6 +82,9 @@ namespace jucePluginEditorLib::patchManager uint32_t createSaveMenuEntries(juce::PopupMenu& _menu, uint32_t _part); + std::string getTagTypeName(pluginLib::patchDB::TagType _type) const; + void setTagTypeName(pluginLib::patchDB::TagType _type, const std::string& _name); + private: bool selectPatch(uint32_t _part, int _offset); @@ -133,5 +137,7 @@ namespace jucePluginEditorLib::patchManager ResizerBar m_resizerBarA{*this, &m_stretchableManager, 1}; ResizerBar m_resizerBarB{*this, &m_stretchableManager, 3}; ResizerBar m_resizerBarC{*this, &m_stretchableManager, 5}; + + std::unordered_map<pluginLib::patchDB::TagType, std::string> m_tagTypeNames; }; } diff --git a/source/virusJucePlugin/PatchManager.cpp b/source/virusJucePlugin/PatchManager.cpp @@ -24,6 +24,9 @@ namespace genericVirusUI { PatchManager::PatchManager(VirusEditor& _editor, juce::Component* _root, const juce::File& _dir) : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, _dir), m_controller(_editor.getController()) { + setTagTypeName(pluginLib::patchDB::TagType::CustomA, "Virus Model"); + setTagTypeName(pluginLib::patchDB::TagType::CustomB, "Virus Features"); + addRomPatches(); startLoaderThread(); @@ -51,8 +54,8 @@ namespace genericVirusUI } }; - addGroupTreeItemForTag(pluginLib::patchDB::TagType::CustomA, "Virus Model"); - addGroupTreeItemForTag(pluginLib::patchDB::TagType::CustomB, "Virus Features"); + addGroupTreeItemForTag(pluginLib::patchDB::TagType::CustomA); + addGroupTreeItemForTag(pluginLib::patchDB::TagType::CustomB); } PatchManager::~PatchManager()