diff options
author | Robin Gareus <robin@gareus.org> | 2018-01-30 00:45:42 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-01-30 01:34:37 +0100 |
commit | 9e1acce333413c2c547885236dd015de04f1baa3 (patch) | |
tree | 8294964b7e079fd8dc3d6fcb7ea1b3471513aff8 /gtk2_ardour | |
parent | a486ed49970c168933c85c96908c49488d762bd4 (diff) |
Add plugin tag-filter to Mixer-favorites sidebar
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 64 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.h | 9 |
2 files changed, 70 insertions, 3 deletions
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 0e067e6df8..daf0cf46b5 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -247,7 +247,11 @@ Mixer_UI::Mixer_UI () favorite_plugins_frame.set_name ("BaseFrame"); favorite_plugins_frame.set_shadow_type (Gtk::SHADOW_IN); - favorite_plugins_frame.add (favorite_plugins_scroller); + favorite_plugins_frame.add (favorite_plugins_vbox); + + favorite_plugins_vbox.pack_start (favorite_plugins_scroller, true, true); + favorite_plugins_vbox.pack_start (favorite_plugins_tag_combo, false, false); + favorite_plugins_tag_combo.signal_changed().connect (sigc::mem_fun (*this, &Mixer_UI::tag_combo_changed)); rhs_pane1.add (favorite_plugins_frame); rhs_pane1.add (track_display_frame); @@ -362,8 +366,10 @@ Mixer_UI::Mixer_UI () #error implement deferred Plugin-Favorite list #endif PluginManager::instance ().PluginListChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::refill_favorite_plugins, this), gui_context()); - //PluginManager::instance ().PluginStatusesChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::plugin_status_changed, this, _1, _2, _3), gui_context()); + PluginManager::instance ().PluginStatusesChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::plugin_status_changed, this, _1, _2, _3), gui_context()); ARDOUR::Plugin::PresetsChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::refill_favorite_plugins, this), gui_context()); + + PluginManager::instance ().PluginTagsChanged.connect(*this, invalidator (*this), boost::bind (&Mixer_UI::tags_changed, this, _1, _2, _3), gui_context()); } Mixer_UI::~Mixer_UI () @@ -382,6 +388,12 @@ Mixer_UI::escape () select_none (); } +void +Mixer_UI::tag_combo_changed () +{ + refill_favorite_plugins(); +} + Gtk::Window* Mixer_UI::use_own_window (bool and_fill_it) { @@ -1036,6 +1048,7 @@ Mixer_UI::set_session (Session* sess) } refill_favorite_plugins(); + refill_tag_combo(); XMLNode* node = ARDOUR_UI::instance()->mixer_settings(); set_state (*node, 0); @@ -2573,9 +2586,24 @@ Mixer_UI::refiller (PluginInfoList& result, const PluginInfoList& plugs) { PluginManager& manager (PluginManager::instance()); for (PluginInfoList::const_iterator i = plugs.begin(); i != plugs.end(); ++i) { + + /* not a Favorite? skip it */ if (manager.get_status (*i) != PluginManager::Favorite) { continue; } + + /* Check the tag combo selection, and skip this plugin if it doesn't match the selected tag(s) */ + string test = favorite_plugins_tag_combo.get_active_text(); + if (test != _("Show All")) { + vector<string> tags = manager.get_tags(*i); + + //does the selected tag match any of the tags in the plugin? + vector<string>::iterator tt = find (tags.begin(), tags.end(), test); + if (tt == tags.end()) { + continue; + } + } + result.push_back (*i); } } @@ -2639,6 +2667,36 @@ Mixer_UI::refill_favorite_plugins () } void +Mixer_UI::plugin_status_changed (PluginType, std::string, PluginManager::PluginStatusType) +{ + refill_favorite_plugins(); + refill_tag_combo(); +} + +void +Mixer_UI::tags_changed (PluginType t, std::string unique_id, std::string tag) +{ + refill_tag_combo(); +} + +void +Mixer_UI::refill_tag_combo () +{ + PluginManager& mgr (PluginManager::instance()); + + std::vector<std::string> tags = mgr.get_all_tags (true); + + favorite_plugins_tag_combo.clear(); + favorite_plugins_tag_combo.append_text (_("Show All")); + + for (vector<string>::iterator t = tags.begin (); t != tags.end (); ++t) { + favorite_plugins_tag_combo.append_text (*t); + } + + favorite_plugins_tag_combo.set_active_text (_("Show All")); +} + +void Mixer_UI::sync_treeview_favorite_ui_state (const TreeModel::Path& path, const TreeModel::iterator&) { TreeIter iter; @@ -2724,7 +2782,7 @@ Mixer_UI::popup_note_context_menu (GdkEventButton *ev) bool Mixer_UI::plugin_row_button_press (GdkEventButton *ev) { - if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 3) ) { + if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 3)) { TreeModel::Path path; TreeViewColumn* column; int cellx, celly; diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 137913038e..49e60c1b6e 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -26,6 +26,7 @@ #include <gtkmm/scrolledwindow.h> #include <gtkmm/eventbox.h> #include <gtkmm/label.h> +#include <gtkmm/comboboxtext.h> #include <gtkmm/button.h> #include <gtkmm/frame.h> #include <gtkmm/menu.h> @@ -154,6 +155,8 @@ private: Gtk::Frame track_display_frame; Gtk::Frame group_display_frame; Gtk::Frame favorite_plugins_frame; + Gtk::VBox favorite_plugins_vbox; + Gtk::ComboBoxText favorite_plugins_tag_combo; ArdourWidgets::VPane rhs_pane1; ArdourWidgets::VPane rhs_pane2; ArdourWidgets::HPane inner_pane; @@ -365,7 +368,13 @@ private: void store_current_favorite_order(); void refiller (ARDOUR::PluginInfoList& result, const ARDOUR::PluginInfoList& plugs); + void plugin_status_changed (ARDOUR::PluginType t, std::string unique_id, ARDOUR::PluginManager::PluginStatusType s); void refill_favorite_plugins (); + + void refill_tag_combo (); + void tags_changed (ARDOUR::PluginType t, std::string unique_id, std::string tag); + void tag_combo_changed (); + void sync_treeview_from_favorite_order (); void sync_treeview_favorite_ui_state (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&); void save_favorite_ui_state (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path); |