commit 7a37e6fad5616d7d422f7328bae6073b57666a1e parent b2db130b8bfc5fba024a252830d926ead95c4f4d Author: dsp56300 <dsp56300@users.noreply.github.com> Date: Tue, 23 Apr 2024 23:23:27 +0200 remove "Factory" category from preset browser because Vavra/XT do not have factory presets at all Diffstat:
7 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/source/jucePluginEditorLib/patchmanager/datasourcetree.cpp b/source/jucePluginEditorLib/patchmanager/datasourcetree.cpp @@ -2,11 +2,9 @@ namespace jucePluginEditorLib::patchManager { - DatasourceTree::DatasourceTree(PatchManager& _pm): Tree(_pm) + DatasourceTree::DatasourceTree(PatchManager& _pm, const std::initializer_list<GroupType>& _groupTypes) : Tree(_pm) { - addGroup(GroupType::Favourites); - addGroup(GroupType::LocalStorage); - addGroup(GroupType::Factory); - addGroup(GroupType::DataSources); + for (const auto& groupType : _groupTypes) + addGroup(groupType); } } diff --git a/source/jucePluginEditorLib/patchmanager/datasourcetree.h b/source/jucePluginEditorLib/patchmanager/datasourcetree.h @@ -7,6 +7,6 @@ namespace jucePluginEditorLib::patchManager class DatasourceTree : public Tree { public: - explicit DatasourceTree(PatchManager& _pm); + explicit DatasourceTree(PatchManager& _pm, const std::initializer_list<GroupType>& _groupTypes); }; } diff --git a/source/jucePluginEditorLib/patchmanager/patchmanager.cpp b/source/jucePluginEditorLib/patchmanager/patchmanager.cpp @@ -22,7 +22,7 @@ namespace jucePluginEditorLib::patchManager constexpr auto g_searchBarHeight = 32; constexpr int g_padding = 4; - PatchManager::PatchManager(Editor& _editor, Component* _root, const juce::File& _dir) : DB(_dir), m_editor(_editor), m_state(*this) + PatchManager::PatchManager(Editor& _editor, Component* _root, const juce::File& _dir, const std::initializer_list<GroupType>& _groupTypes) : DB(_dir), m_editor(_editor), m_state(*this) { const auto rootW = _root->getWidth() / g_scale; const auto rootH = _root->getHeight() / g_scale; @@ -40,7 +40,7 @@ namespace jucePluginEditorLib::patchManager // 1st column auto w = weight(33); - m_treeDS = new DatasourceTree(*this); + m_treeDS = new DatasourceTree(*this, _groupTypes); m_treeDS->setSize(w - g_padding, rootH - g_searchBarHeight - g_padding); m_searchTreeDS = new SearchTree(*m_treeDS); @@ -119,7 +119,7 @@ namespace jucePluginEditorLib::patchManager addAndMakeVisible(m_resizerBarB); addAndMakeVisible(m_resizerBarC); - resized(); + PatchManager::resized(); startTimer(200); } diff --git a/source/jucePluginEditorLib/patchmanager/patchmanager.h b/source/jucePluginEditorLib/patchmanager/patchmanager.h @@ -6,6 +6,7 @@ #include "juce_gui_basics/juce_gui_basics.h" #include "state.h" +#include "types.h" namespace jucePluginEditorLib { @@ -31,7 +32,9 @@ namespace jucePluginEditorLib::patchManager class PatchManager : public juce::Component, public pluginLib::patchDB::DB, juce::Timer, public juce::ChangeListener { public: - explicit PatchManager(Editor& _editor, Component* _root, const juce::File& _dir); + static constexpr std::initializer_list<GroupType> DefaultGroupTypes{GroupType::Favourites, GroupType::LocalStorage, GroupType::Factory, GroupType::DataSources}; + + explicit PatchManager(Editor& _editor, Component* _root, const juce::File& _dir, const std::initializer_list<GroupType>& _groupTypes = DefaultGroupTypes); ~PatchManager() override; void timerCallback() override; diff --git a/source/mqJucePlugin/mqPatchManager.cpp b/source/mqJucePlugin/mqPatchManager.cpp @@ -6,8 +6,15 @@ namespace mqJucePlugin { + static constexpr std::initializer_list<jucePluginEditorLib::patchManager::GroupType> g_groupTypes = + { + jucePluginEditorLib::patchManager::GroupType::Favourites, + jucePluginEditorLib::patchManager::GroupType::LocalStorage, + jucePluginEditorLib::patchManager::GroupType::DataSources, + }; + PatchManager::PatchManager(Editor& _editor, juce::Component* _root, const juce::File& _dir) - : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, _dir) + : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, _dir, g_groupTypes) , m_editor(_editor) , m_controller(_editor.getMqController()) { diff --git a/source/mqJucePlugin/mqPatchManager.h b/source/mqJucePlugin/mqPatchManager.h @@ -12,7 +12,7 @@ namespace mqJucePlugin { public: PatchManager(Editor& _editor, juce::Component* _root, const juce::File& _dir); - ~PatchManager(); + ~PatchManager() override; // PatchManager overrides bool requestPatchForPart(pluginLib::patchDB::Data& _data, uint32_t _part) override; diff --git a/source/xtJucePlugin/xtPatchManager.cpp b/source/xtJucePlugin/xtPatchManager.cpp @@ -8,8 +8,15 @@ namespace xtJucePlugin { + static constexpr std::initializer_list<jucePluginEditorLib::patchManager::GroupType> g_groupTypes = + { + jucePluginEditorLib::patchManager::GroupType::Favourites, + jucePluginEditorLib::patchManager::GroupType::LocalStorage, + jucePluginEditorLib::patchManager::GroupType::DataSources, + }; + PatchManager::PatchManager(Editor& _editor, juce::Component* _root, const juce::File& _dir) - : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, _dir) + : jucePluginEditorLib::patchManager::PatchManager(_editor, _root, _dir, g_groupTypes) , m_editor(_editor) , m_controller(_editor.getXtController()) {