X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fplugin_selector.cc;h=2a1ce85ee393b03c3eb96462ceac2c07ba06e183;hb=2fd506c07c6e6d590137e8c5c197560827be2bc3;hp=9c03bd5c4810c9a46577a212ee112ec05fedd553;hpb=2a6a16f980ff9181b138f7a30aedfbde4426a591;p=ardour.git diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 9c03bd5c48..2a1ce85ee3 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -36,6 +36,7 @@ #include "ardour/plugin_manager.h" #include "ardour/plugin.h" +#include "ardour/utils.h" #include "ardour_ui.h" #include "plugin_selector.h" @@ -72,6 +73,7 @@ PluginSelector::PluginSelector (PluginManager& mgr) in_row_change = false; manager.PluginListChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::build_plugin_menu, this), gui_context()); + manager.PluginListChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::refill, this), gui_context()); build_plugin_menu (); plugin_model = Gtk::ListStore::create (plugin_columns); @@ -185,6 +187,7 @@ PluginSelector::PluginSelector (PluginManager& mgr) btn_add->signal_clicked().connect(sigc::mem_fun(*this, &PluginSelector::btn_add_clicked)); btn_remove->signal_clicked().connect(sigc::mem_fun(*this, &PluginSelector::btn_remove_clicked)); added_list.get_selection()->signal_changed().connect (sigc::mem_fun(*this, &PluginSelector::added_list_selection_changed)); + added_list.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::added_row_clicked)); refill (); } @@ -200,6 +203,13 @@ PluginSelector::row_activated(Gtk::TreeModel::Path, Gtk::TreeViewColumn*) btn_add_clicked(); } +void +PluginSelector::added_row_clicked(GdkEventButton* event) +{ + if (event->type == GDK_2BUTTON_PRESS) + btn_remove_clicked(); +} + bool PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& filterstr) { @@ -309,9 +319,17 @@ PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& filte string::size_type pos = 0; /* stupid LADSPA creator strings */ - +#ifdef PLATFORM_WINDOWS + 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; - creator = creator.substr (0, pos); +#endif + // 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); newrow[plugin_columns.creator] = creator; @@ -432,7 +450,6 @@ void PluginSelector::btn_update_clicked() { manager.refresh (); - refill(); } void @@ -537,13 +554,13 @@ struct PluginMenuCompareByCreator { bool operator() (PluginInfoPtr a, PluginInfoPtr b) const { int cmp; - cmp = g_strcasecmp (a->creator.c_str(), b->creator.c_str()); + cmp = cmp_nocase_utf8 (a->creator, b->creator); if (cmp < 0) { return true; } else if (cmp == 0) { /* same creator ... compare names */ - if (g_strcasecmp (a->name.c_str(), b->name.c_str()) < 0) { + if (cmp_nocase_utf8 (a->name, b->name) < 0) { return true; } } @@ -555,7 +572,7 @@ struct PluginMenuCompareByName { bool operator() (PluginInfoPtr a, PluginInfoPtr b) const { int cmp; - cmp = g_strcasecmp (a->name.c_str(), b->name.c_str()); + cmp = cmp_nocase_utf8 (a->name, b->name); if (cmp < 0) { return true; @@ -573,13 +590,13 @@ struct PluginMenuCompareByCategory { bool operator() (PluginInfoPtr a, PluginInfoPtr b) const { int cmp; - cmp = g_strcasecmp (a->category.c_str(), b->category.c_str()); + cmp = cmp_nocase_utf8 (a->category, b->category); if (cmp < 0) { return true; } else if (cmp == 0) { /* same category ... compare names */ - if (g_strcasecmp (a->name.c_str(), b->name.c_str()) < 0) { + if (cmp_nocase_utf8 (a->name, b->name) < 0) { return true; } } @@ -680,8 +697,21 @@ PluginSelector::create_by_creator_menu (ARDOUR::PluginInfoList& all_plugs) /* stupid LADSPA creator strings */ string::size_type pos = 0; +#ifdef PLATFORM_WINDOWS + while (pos < creator.length() && creator[pos]>(-2) && creator[pos]<256 && (isprint (creator[pos]))) ++pos; +#else while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos; - creator = creator.substr (0, pos); +#endif + + // 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); + } SubmenuMap::iterator x; Gtk::Menu* submenu;