X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fplugin_selector.cc;h=c67af473a0723f5b13eeb1db58af116487527a8f;hb=b976bf8986290e8f4812a50e7fdd98b9cbeb4249;hp=8161c9da055e1e56b2ae3b4a2ed866695b2dccd2;hpb=bb79b63c93ba6d2951deb85591b032227e283637;p=ardour.git diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 8161c9da05..c67af473a0 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -42,7 +42,7 @@ #include "gui_thread.h" #include "tooltips.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace ARDOUR; using namespace PBD; @@ -210,18 +210,29 @@ PluginSelector::PluginSelector (PluginManager& mgr) filter_frame->show_all (); + HBox* side_by_side = manage (new HBox); + VBox* right_side = manage (new VBox); + table->attach (scroller, 0, 7, 0, 5); table->attach (*filter_frame, 0, 7, 6, 7, FILL|EXPAND, FILL, 5, 5); - table->attach(*btn_add, 1, 2, 7, 8, FILL, FILL, 5, 5); - table->attach(*btn_remove, 5, 6, 7, 8, FILL, FILL, 5, 5); - table->attach(ascroller, 0, 7, 8, 10); + right_side->pack_start (ascroller); + + HBox* add_remove = manage (new HBox); + add_remove->pack_start (*btn_add, true, true); + add_remove->pack_start (*btn_remove, true, true); + + right_side->pack_start (*add_remove, false, false); + right_side->set_size_request (200, -1); + + side_by_side->pack_start (*table); + side_by_side->pack_start (*right_side); add_button (Stock::CLOSE, RESPONSE_CLOSE); add_button (_("Insert Plugin(s)"), RESPONSE_APPLY); set_default_response (RESPONSE_APPLY); set_response_sensitive (RESPONSE_APPLY, false); - get_vbox()->pack_start (*table); + get_vbox()->pack_start (*side_by_side); table->set_name("PluginSelectorTable"); plugin_display.set_name("PluginSelectorDisplay"); @@ -258,6 +269,16 @@ PluginSelector::added_row_clicked(GdkEventButton* event) btn_remove_clicked(); } +static bool is_analyzer (const PluginInfoPtr& info) { + // Anaylsis, Analyzer are for backwards compatibility (vst cache) + return info->in_category ("Analyser") || info->in_category ("Anaylsis") || info->in_category ("Analyzer"); +} + +static bool is_util (const PluginInfoPtr& info) { + // all MIDI plugins which are not Instruments are Utils. + return info->in_category ("Utility") || info->in_category ("MIDI") || info->in_category ("Generator"); +} + bool PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& filterstr) { @@ -279,10 +300,10 @@ PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& if (_show_instruments == Gtkmm2ext::Off && info->is_instrument()) { return false; } - if (_show_analysers == Gtkmm2ext::Off && info->in_category ("Analyser")) { + if (_show_analysers == Gtkmm2ext::Off && is_analyzer (info)) { return false; } - if (_show_utils == Gtkmm2ext::Off && info->in_category ("Utility")) { + if (_show_utils == Gtkmm2ext::Off && is_util (info)) { return false; } @@ -294,10 +315,10 @@ PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& if (_show_instruments == Gtkmm2ext::ExplicitActive && info->is_instrument()) { exp_ok = true; } - if (_show_analysers == Gtkmm2ext::ExplicitActive && info->in_category ("Analyser")) { + if (_show_analysers == Gtkmm2ext::ExplicitActive && is_analyzer(info)) { exp_ok = true; } - if (_show_utils == Gtkmm2ext::ExplicitActive && info->in_category ("Utility")) { + if (_show_utils == Gtkmm2ext::ExplicitActive && is_util (info)) { exp_ok = true; } if (_show_instruments == Gtkmm2ext::ExplicitActive || _show_analysers == Gtkmm2ext::ExplicitActive || _show_utils == Gtkmm2ext::ExplicitActive) { @@ -330,7 +351,11 @@ PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& case LXVST: compstr = X_("LXVST"); break; + case MacVST: + compstr = X_("MacVST"); + break; case Lua: + compstr = X_("Lua"); break; } @@ -378,7 +403,9 @@ PluginSelector::refill () lv2_refiller (filterstr); vst_refiller (filterstr); lxvst_refiller (filterstr); + mac_vst_refiller (filterstr); au_refiller (filterstr); + lua_refiller (filterstr); in_row_change = false; } @@ -402,18 +429,23 @@ PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& filte string creator = (*i)->creator; string::size_type pos = 0; - /* stupid LADSPA creator strings */ + if ((*i)->type == ARDOUR::LADSPA) { + /* stupid LADSPA creator strings */ #ifdef PLATFORM_WINDOWS - while (pos < creator.length() && creator[pos] > -2 && creator[pos] < 256 && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; + while (pos < creator.length() && creator[pos] > -2 && creator[pos] < 256 && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; #else - while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; + while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; #endif + } else { + pos = creator.length (); + } // If there were too few characters to create a // meaningful name, mark this creator as 'Unknown' - if (creator.length()<2 || pos<3) + if (creator.length() < 2 || pos < 3) { creator = "Unknown"; - else + } else{ creator = creator.substr (0, pos); + } newrow[plugin_columns.creator] = creator; @@ -445,6 +477,12 @@ PluginSelector::ladspa_refiller (const std::string& filterstr) refiller (manager.ladspa_plugin_info(), filterstr, "LADSPA"); } +void +PluginSelector::lua_refiller (const std::string& filterstr) +{ + refiller (manager.lua_plugin_info(), filterstr, "Lua"); +} + void PluginSelector::lv2_refiller (const std::string& filterstr) { @@ -477,6 +515,18 @@ PluginSelector::lxvst_refiller (const std::string&) #endif } +void +#ifdef MACVST_SUPPORT +PluginSelector::mac_vst_refiller (const std::string& filterstr) +#else +PluginSelector::mac_vst_refiller (const std::string&) +#endif +{ +#ifdef MACVST_SUPPORT + refiller (manager.mac_vst_plugin_info(), filterstr, "MacVST"); +#endif +} + void #ifdef AUDIOUNIT_SUPPORT PluginSelector::au_refiller (const std::string& filterstr) @@ -570,14 +620,14 @@ PluginSelector::run () PluginPtr p = load_plugin (pp); if (p) { plugins.push_back (p); - } else { - MessageDialog msg (string_compose (_("The plugin \"%1\" could not be loaded\n\nSee the Log window for more details (maybe)"), pp->name)); - msg.run (); - } + } else { + MessageDialog msg (string_compose (_("The plugin \"%1\" could not be loaded\n\nSee the Log window for more details (maybe)"), pp->name)); + msg.run (); + } } if (interested_object && !plugins.empty()) { finish = !interested_object->use_plugins (plugins); - } + } break; @@ -639,57 +689,57 @@ PluginSelector::on_show () } struct PluginMenuCompareByCreator { - bool operator() (PluginInfoPtr a, PluginInfoPtr b) const { - int cmp; - - cmp = cmp_nocase_utf8 (a->creator, b->creator); - - if (cmp < 0) { - return true; - } else if (cmp == 0) { - /* same creator ... compare names */ - if (cmp_nocase_utf8 (a->name, b->name) < 0) { - return true; - } - } - return false; - } + bool operator() (PluginInfoPtr a, PluginInfoPtr b) const { + int cmp; + + cmp = cmp_nocase_utf8 (a->creator, b->creator); + + if (cmp < 0) { + return true; + } else if (cmp == 0) { + /* same creator ... compare names */ + if (cmp_nocase_utf8 (a->name, b->name) < 0) { + return true; + } + } + return false; + } }; struct PluginMenuCompareByName { - bool operator() (PluginInfoPtr a, PluginInfoPtr b) const { - int cmp; - - cmp = cmp_nocase_utf8 (a->name, b->name); - - if (cmp < 0) { - return true; - } else if (cmp == 0) { - /* same name ... compare type */ - if (a->type < b->type) { - return true; - } - } - return false; - } + bool operator() (PluginInfoPtr a, PluginInfoPtr b) const { + int cmp; + + cmp = cmp_nocase_utf8 (a->name, b->name); + + if (cmp < 0) { + return true; + } else if (cmp == 0) { + /* same name ... compare type */ + if (a->type < b->type) { + return true; + } + } + return false; + } }; struct PluginMenuCompareByCategory { - bool operator() (PluginInfoPtr a, PluginInfoPtr b) const { - int cmp; - - cmp = cmp_nocase_utf8 (a->category, b->category); - - if (cmp < 0) { - return true; - } else if (cmp == 0) { - /* same category ... compare names */ - if (cmp_nocase_utf8 (a->name, b->name) < 0) { - return true; - } - } - return false; - } + bool operator() (PluginInfoPtr a, PluginInfoPtr b) const { + int cmp; + + cmp = cmp_nocase_utf8 (a->category, b->category); + + if (cmp < 0) { + return true; + } else if (cmp == 0) { + /* same category ... compare names */ + if (cmp_nocase_utf8 (a->name, b->name) < 0) { + return true; + } + } + return false; + } }; /** @return Plugin menu. The caller should not delete it */ @@ -705,12 +755,16 @@ PluginSelector::build_plugin_menu () PluginInfoList all_plugs; all_plugs.insert (all_plugs.end(), manager.ladspa_plugin_info().begin(), manager.ladspa_plugin_info().end()); + all_plugs.insert (all_plugs.end(), manager.lua_plugin_info().begin(), manager.lua_plugin_info().end()); #ifdef WINDOWS_VST_SUPPORT all_plugs.insert (all_plugs.end(), manager.windows_vst_plugin_info().begin(), manager.windows_vst_plugin_info().end()); #endif #ifdef LXVST_SUPPORT all_plugs.insert (all_plugs.end(), manager.lxvst_plugin_info().begin(), manager.lxvst_plugin_info().end()); #endif +#ifdef MACVST_SUPPORT + all_plugs.insert (all_plugs.end(), manager.mac_vst_plugin_info().begin(), manager.mac_vst_plugin_info().end()); +#endif #ifdef AUDIOUNIT_SUPPORT all_plugs.insert (all_plugs.end(), manager.au_plugin_info().begin(), manager.au_plugin_info().end()); #endif @@ -741,6 +795,34 @@ PluginSelector::build_plugin_menu () items.push_back (MenuElem (_("By Category"), *manage (by_category))); } +string +GetPluginTypeStr(PluginInfoPtr info) +{ + string type; + + switch (info->type) { + case LADSPA: + type = X_(" (LADSPA)"); + break; + case AudioUnit: + type = X_(" (AU)"); + break; + case LV2: + type = X_(" (LV2)"); + break; + case Windows_VST: + case LXVST: + case MacVST: + type = X_(" (VST)"); + break; + case Lua: + type = X_(" (Lua)"); + break; + } + + return type; +} + Gtk::Menu* PluginSelector::create_favs_menu (PluginInfoList& all_plugs) { @@ -754,7 +836,8 @@ PluginSelector::create_favs_menu (PluginInfoList& all_plugs) for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) { if (manager.get_status (*i) == PluginManager::Favorite) { - MenuElem elem ((*i)->name, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))); + string typ = GetPluginTypeStr(*i); + MenuElem elem ((*i)->name + typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))); elem.get_child()->set_use_underline (false); favs->items().push_back (elem); } @@ -782,23 +865,25 @@ PluginSelector::create_by_creator_menu (ARDOUR::PluginInfoList& all_plugs) if (manager.get_status (*i) == PluginManager::Hidden) continue; string creator = (*i)->creator; - - /* stupid LADSPA creator strings */ string::size_type pos = 0; + + if ((*i)->type == ARDOUR::LADSPA) { + /* stupid LADSPA creator strings */ #ifdef PLATFORM_WINDOWS - while (pos < creator.length() && creator[pos]>(-2) && creator[pos]<256 && (isprint (creator[pos]))) ++pos; + while (pos < creator.length() && creator[pos] > -2 && creator[pos] < 256 && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; #else - while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; + while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; #endif + } else { + pos = creator.length (); + } - // Check to see if we found any invalid characters. - if (creator.length() != pos) { - // If there were too few characters to create a - // meaningful name, mark this creator as 'Unknown' - if (pos<3) - creator = "Unknown?"; - else - creator = creator.substr (0, pos); + // If there were too few characters to create a + // meaningful name, mark this creator as 'Unknown' + if (creator.length() < 2 || pos < 3) { + creator = "Unknown"; + } else{ + creator = creator.substr (0, pos); } SubmenuMap::iterator x; @@ -811,7 +896,8 @@ PluginSelector::create_by_creator_menu (ARDOUR::PluginInfoList& all_plugs) creator_submenu_map.insert (pair (creator, submenu)); submenu->set_name("ArdourContextMenu"); } - MenuElem elem ((*i)->name, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))); + string typ = GetPluginTypeStr(*i); + MenuElem elem ((*i)->name+typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))); elem.get_child()->set_use_underline (false); submenu->items().push_back (elem); } @@ -849,7 +935,8 @@ PluginSelector::create_by_category_menu (ARDOUR::PluginInfoList& all_plugs) category_submenu_map.insert (pair (category, submenu)); submenu->set_name("ArdourContextMenu"); } - MenuElem elem ((*i)->name, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))); + string typ = GetPluginTypeStr(*i); + MenuElem elem ((*i)->name + typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))); elem.get_child()->set_use_underline (false); submenu->items().push_back (elem); }