Skip to content

Commit

Permalink
mixer: add "search all" mode to sidebar plugin list
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-emmanuel committed Jan 14, 2025
1 parent 6407890 commit cc80458
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
21 changes: 18 additions & 3 deletions gtk2_ardour/mixer_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ static const gchar *_plugin_list_mode_strings[] = {
N_("Favorite Plugins"),
N_("Recent Plugins"),
N_("Top-10 Plugins"),
N_("Search All Plugins"),
0
};

Expand Down Expand Up @@ -290,6 +291,7 @@ Mixer_UI::Mixer_UI ()
favorite_plugins_mode_combo.AddMenuElem (Menu_Helpers::MenuElem (_("Favorite Plugins"), sigc::bind(sigc::mem_fun(*this, &Mixer_UI::set_plugin_list_mode), PLM_Favorite)));
favorite_plugins_mode_combo.AddMenuElem (Menu_Helpers::MenuElem (_("Recent Plugins"), sigc::bind(sigc::mem_fun(*this, &Mixer_UI::set_plugin_list_mode), PLM_Recent)));
favorite_plugins_mode_combo.AddMenuElem (Menu_Helpers::MenuElem (_("Top-10 Plugins"), sigc::bind(sigc::mem_fun(*this, &Mixer_UI::set_plugin_list_mode), PLM_TopHits)));
favorite_plugins_mode_combo.AddMenuElem (Menu_Helpers::MenuElem (_("Search All Plugins"), sigc::bind(sigc::mem_fun(*this, &Mixer_UI::set_plugin_list_mode), PLM_SearchAll)));
favorite_plugins_mode_combo.set_size_request(-1, 24);
set_plugin_list_mode(PLM_Favorite);

Expand Down Expand Up @@ -3165,7 +3167,7 @@ Mixer_UI::set_plugin_list_mode (PluginListMode plm)
favorite_plugins_mode_combo.set_text (str);
}

if (plugin_list_mode == PLM_Favorite) {
if (plugin_list_mode == PLM_Favorite || plugin_list_mode == PLM_SearchAll) {
PBD::Unwinder<bool> uw (ignore_plugin_refill, true);
favorite_plugins_search_hbox.show ();
plugin_search_entry.set_text ("");
Expand All @@ -3178,7 +3180,7 @@ Mixer_UI::set_plugin_list_mode (PluginListMode plm)
void
Mixer_UI::plugin_search_entry_changed ()
{
if (plugin_list_mode == PLM_Favorite) {
if (plugin_list_mode == PLM_Favorite || plugin_list_mode == PLM_SearchAll) {
refill_favorite_plugins ();
}
}
Expand Down Expand Up @@ -3217,6 +3219,18 @@ Mixer_UI::refiller (PluginInfoList& result, const PluginInfoList& plugs)
setup_search_string (tags);
maybe_show |= match_search_strings (tags, searchstr);
}
} else if (plm == PLM_SearchAll) {
maybe_show = false;
if (searchstr.length() > 2) {
/* check name */
std::string compstr = (*i)->name;
setup_search_string (compstr);
maybe_show |= match_search_strings (compstr, searchstr);
/* check tags */
std::string tags = manager.get_tags_as_string (*i);
setup_search_string (tags);
maybe_show |= match_search_strings (tags, searchstr);
}
} else {
int64_t lru;
uint64_t use_count;
Expand Down Expand Up @@ -3266,7 +3280,7 @@ Mixer_UI::refill_favorite_plugins ()

switch (plugin_list_mode) {
default:
/* use favorites as-is */
/* use favorites & search all as-is */
break;
case PLM_TopHits:
{
Expand Down Expand Up @@ -3338,6 +3352,7 @@ Mixer_UI::sync_treeview_from_favorite_order ()
}
break;
case PLM_TopHits:
case PLM_SearchAll:
{
PluginABCSorter cmp;
plugin_list.sort (cmp);
Expand Down
3 changes: 2 additions & 1 deletion gtk2_ardour/mixer_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ class Mixer_UI : public ArdourWidgets::Tabbable, public PBD::ScopedConnectionLis
enum PluginListMode {
PLM_Favorite,
PLM_Recent,
PLM_TopHits
PLM_TopHits,
PLM_SearchAll
};
enum PluginListMode plugin_list_mode;
void set_plugin_list_mode (PluginListMode plm);
Expand Down

0 comments on commit cc80458

Please sign in to comment.