/*
- Copyright (C) 2000-2006 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2005-2006 Doug McLain <doug@nostar.net>
+ * Copyright (C) 2005-2007 Taybin Rutkin <taybin@taybin.com>
+ * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2006 Nick Mainsbridge <mainsbridge@gmail.com>
+ * Copyright (C) 2007-2012 David Robillard <d@drobilla.net>
+ * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2013-2014 John Emmas <john@creativepost.co.uk>
+ * Copyright (C) 2014-2018 Ben Loftis <ben@harrisonconsoles.com>
+ * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
#ifdef WAF_BUILD
#include "gtk2ardour-config.h"
#endif
#include <map>
#include <algorithm>
+#include <boost/tokenizer.hpp>
#include <gtkmm/button.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/notebook.h>
#include <gtkmm/stock.h>
#include <gtkmm/table.h>
+#include <gtkmm/treestore.h>
#include "gtkmm2ext/utils.h"
#include "plugin_selector.h"
#include "gui_thread.h"
+#include "ui_config.h"
#include "pbd/i18n.h"
: ArdourDialog (_("Plugin Manager"), true, false)
, search_clear_button (Stock::CLEAR)
, manager (mgr)
- , inhibit_refill (false)
+ , _need_tag_save (false)
+ , _need_status_save (false)
+ , _need_menu_rebuild (false)
+ , _inhibit_refill (false)
{
set_name ("PluginSelectorWindow");
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
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());
- manager.PluginStatusesChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::plugin_status_changed, this, _1, _2, _3), gui_context());
- manager.PluginTagsChanged.connect(plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::tags_changed, this, _1, _2, _3), gui_context());
+ manager.PluginStatusChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::build_plugin_menu, this), gui_context());
+ manager.PluginTagChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::build_plugin_menu, this), gui_context());
+
+ manager.PluginStatusChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::plugin_status_changed, this, _1, _2, _3), gui_context());
+ manager.PluginTagChanged.connect(plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::tags_changed, this, _1, _2, _3), gui_context());
plugin_model = Gtk::ListStore::create (plugin_columns);
plugin_display.set_model (plugin_model);
added_list.set_headers_visible (true);
added_list.set_reorderable (false);
- for (int i = 2; i <=7; i++) {
+ for (int i = 2; i <= 7; ++i) {
Gtk::TreeView::Column* column = plugin_display.get_column(i);
if (column) {
column->set_sort_column(i);
search_entry.signal_changed().connect (sigc::mem_fun (*this, &PluginSelector::search_entry_changed));
search_clear_button.signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::search_clear_button_clicked));
- _search_name_checkbox = manage (new CheckButton (_("Name")));
- _search_name_checkbox->set_active();
+ _search_name_checkbox = manage (new ArdourButton (_("Name"), ArdourButton::led_default_elements, true));
+ _search_name_checkbox->set_active(true);
+ _search_name_checkbox->set_name ("pluginlist filter button");
- _search_tags_checkbox = manage (new CheckButton (_("Tags")));
- _search_tags_checkbox->set_active();
+ _search_tags_checkbox = manage (new ArdourButton (_("Tags"), ArdourButton::led_default_elements, true));
+ _search_tags_checkbox->set_active(true);
+ _search_tags_checkbox->set_name ("pluginlist filter button");
- _search_ignore_checkbox = manage (new CheckButton(_("Ignore Filters when searching")));
- _search_ignore_checkbox->set_active();
- _search_ignore_checkbox->signal_toggled().connect (sigc::mem_fun (*this, &PluginSelector::set_sensitive_widgets));
+ _search_ignore_checkbox = manage (new ArdourButton(_("Ignore Filters when searching"), ArdourButton::led_default_elements, true));
+ _search_ignore_checkbox->set_active(true);
+ _search_ignore_checkbox->set_name ("pluginlist filter button");
Gtk::Label* search_help_label1 = manage (new Label(
_("All search terms must be matched."), Gtk::ALIGN_LEFT));
Gtk::Label* search_help_label2 = manage (new Label(
- _("Ex: \"ess dyn\" will return \"dynamic de-esser\" but not \"de-esser\"."), Gtk::ALIGN_LEFT));
+ _("Ex: \"ess dyn\" will find \"dynamic de-esser\" but not \"de-esser\"."), Gtk::ALIGN_LEFT));
search_table->attach (search_entry, 0, 3, 0, 1, FILL|EXPAND, FILL);
search_table->attach (search_clear_button, 3, 4, 0, 1, FILL, FILL);
search_table->attach (*search_help_label2, 0, 3, 3, 4, FILL, FILL);
search_table->set_border_width (4);
- search_table->set_col_spacings (2);
+ search_table->set_col_spacings (4);
search_table->set_row_spacings (4);
Frame* search_frame = manage (new Frame);
search_frame->add (*search_table);
search_frame->show_all ();
- _search_name_checkbox->signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::refill));
- _search_tags_checkbox->signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::refill));
+ _search_name_checkbox->signal_clicked.connect (sigc::mem_fun (*this, &PluginSelector::refill));
+ _search_tags_checkbox->signal_clicked.connect (sigc::mem_fun (*this, &PluginSelector::refill));
+ _search_ignore_checkbox->signal_clicked.connect (sigc::mem_fun (*this, &PluginSelector::set_sensitive_widgets));
/* FILTER */
- Gtk::Table* filter_table = manage(new Gtk::Table(1, 10));
-
Gtk::RadioButtonGroup fil_radio_group;
_fil_effects_radio = manage (new RadioButton (fil_radio_group, _("Show Effects Only")));
_fil_hidden_radio = manage (new RadioButton (fil_radio_group, _("Show Hidden Only")));
_fil_all_radio = manage (new RadioButton (fil_radio_group, _("Show All")));
-#ifndef MIXBUS
- _fil_all_radio->set_active ();
-#endif
-
- _fil_type_combo = manage (new ComboBoxText);
- _fil_type_combo->append_text (_("Show All Formats"));
- _fil_type_combo->append_text (X_("VST"));
+ //_fil_type_combo = manage (new ComboBoxText);
+ _fil_type_combo.append_text_item (_("Show All Formats"));
+ _fil_type_combo.append_text_item (X_("VST"));
#ifdef AUDIOUNIT_SUPPORT
- _fil_type_combo->append_text (X_("AudioUnit"));
+ _fil_type_combo.append_text_item (X_("AudioUnit"));
#endif
#ifdef LV2_SUPPORT
- _fil_type_combo->append_text (X_("LV2"));
-#endif
- _fil_type_combo->append_text (X_("LUA"));
- _fil_type_combo->append_text (X_("LADSPA"));
- _fil_type_combo->set_active_text (_("Show All Formats"));
-
- _fil_creator_combo = manage (new ComboBoxText);
- //note: _fil_creator_combo menu gets filled in build_plugin_menu
-
- _fil_channel_combo = manage (new ComboBoxText);
- _fil_channel_combo->append_text (_("Audio I/O"));
- _fil_channel_combo->append_text (_("Mono Audio I/O"));
- _fil_channel_combo->append_text (_("Stereo Audio I/O"));
- _fil_channel_combo->append_text (_("MIDI I/O (only)"));
- _fil_channel_combo->append_text (_("Show All I/O"));
-#ifdef MIXBUS
- _fil_channel_combo->set_active_text (_("Audio I/O"));
-#else
- _fil_channel_combo->set_active_text (_("Show All I/O"));
+ _fil_type_combo.append_text_item (X_("LV2"));
#endif
-
- int p = 0;
- filter_table->attach (*_fil_effects_radio, 2, 3, p, p+1, FILL, FILL); p++;
- filter_table->attach (*_fil_instruments_radio, 2, 3, p, p+1, FILL, FILL); p++;
- filter_table->attach (*_fil_utils_radio, 2, 3, p, p+1, FILL, FILL); p++;
- filter_table->attach (*_fil_favorites_radio, 2, 3, p, p+1, FILL, FILL); p++;
- filter_table->attach (*_fil_hidden_radio, 2, 3, p, p+1, FILL, FILL); p++;
- filter_table->attach (*_fil_all_radio, 2, 3, p, p+1, FILL, FILL); p++;
- filter_table->attach (*_fil_type_combo, 2, 3, p, p+1, FILL, FILL); p++;
- filter_table->attach (*_fil_creator_combo, 2, 3, p, p+1, FILL, FILL); p++;
- filter_table->attach (*_fil_channel_combo, 2, 3, p, p+1, FILL, FILL); p++;
-
- filter_table->set_border_width (4);
- filter_table->set_col_spacings (4);
- filter_table->set_row_spacings (4);
+ _fil_type_combo.append_text_item (X_("Lua"));
+ _fil_type_combo.append_text_item (X_("LADSPA"));
+ _fil_type_combo.set_text (_("Show All Formats"));
+
+ /* note: _fil_creator_combo menu gets filled in build_plugin_menu */
+ _fil_creator_combo.set_text_ellipsize (Pango::ELLIPSIZE_END);
+ _fil_creator_combo.set_layout_ellipsize_width (PANGO_SCALE * 160 * UIConfiguration::instance ().get_ui_scale ());
+
+ VBox* filter_vbox = manage (new VBox);
+ filter_vbox->pack_start (*_fil_effects_radio, false, false);
+ filter_vbox->pack_start (*_fil_instruments_radio, false, false);
+ filter_vbox->pack_start (*_fil_utils_radio, false, false);
+ filter_vbox->pack_start (*_fil_favorites_radio, false, false);
+ filter_vbox->pack_start (*_fil_hidden_radio, false, false);
+ filter_vbox->pack_start (*_fil_all_radio, false, false);
+ filter_vbox->pack_start (_fil_type_combo, false, false);
+ filter_vbox->pack_start (_fil_creator_combo, false, false);
+
+ filter_vbox->set_border_width (4);
+ filter_vbox->set_spacing (4);
Frame* filter_frame = manage (new Frame);
filter_frame->set_name ("BaseFrame");
filter_frame->set_label (_("Filter"));
- filter_frame->add (*filter_table);
+ filter_frame->add (*filter_vbox);
filter_frame->show_all ();
_fil_effects_radio->signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::refill));
_fil_favorites_radio->signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::refill));
_fil_hidden_radio->signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::refill));
- _fil_type_combo->signal_changed().connect (sigc::mem_fun (*this, &PluginSelector::refill));
- _fil_creator_combo->signal_changed().connect (sigc::mem_fun (*this, &PluginSelector::refill));
- _fil_channel_combo->signal_changed().connect (sigc::mem_fun (*this, &PluginSelector::refill));
+ _fil_type_combo.StateChanged.connect (sigc::mem_fun (*this, &PluginSelector::refill));
+ _fil_creator_combo.StateChanged.connect (sigc::mem_fun (*this, &PluginSelector::refill));
/* TAG entry */
tag_entry = manage (new Gtk::Entry);
tag_entry_connection = tag_entry->signal_changed().connect (sigc::mem_fun (*this, &PluginSelector::tag_entry_changed));
- Gtk::Button* tag_reset_button = manage (new Button (_("Reset")));
+ tag_reset_button = manage (new Button (_("Reset")));
tag_reset_button->signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::tag_reset_button_clicked));
Gtk::Label* tagging_help_label1 = manage (new Label(
Gtk::Label* tagging_help_label3 = manage (new Label(
_("Ex: \"dynamic de-esser vocal\" applies 3 Tags."), Gtk::ALIGN_LEFT));
- p = 0;
+ int p = 0;
tagging_table->attach (*tag_entry, 0, 1, p, p+1, FILL|EXPAND, FILL);
tagging_table->attach (*tag_reset_button, 1, 2, p, p+1, FILL, FILL); p++;
tagging_table->attach (*tagging_help_label1, 0, 2, p, p+1, FILL, FILL); p++;
plugin_display.grab_focus();
build_plugin_menu ();
+ display_selection_changed ();
}
PluginSelector::~PluginSelector ()
btn_remove_clicked();
}
+
+static void
+setup_search_string (string& searchstr)
+{
+ transform (searchstr.begin(), searchstr.end(), searchstr.begin(), ::toupper);
+}
+
+static bool
+match_search_strings (string const& haystack, string const& needle)
+{
+ boost::char_separator<char> sep (" ");
+ typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+ tokenizer t (needle, sep);
+ for (tokenizer::iterator ti = t.begin(); ti != t.end(); ++ti) {
+ if (haystack.find (*ti) == string::npos) {
+ return false;
+ }
+ }
+ return true;
+}
+
bool
PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& searchstr)
{
string mode;
bool maybe_show = false;
+ PluginManager::PluginStatusType status = manager.get_status (info);
if (!searchstr.empty()) {
- std::string compstr;
-
if (_search_name_checkbox->get_active()) { /* name contains */
- compstr = info->name;
- transform (compstr.begin(), compstr.end(), compstr.begin(), ::toupper);
- if (compstr.find (searchstr) != string::npos) {
- maybe_show = true;
- }
+ std::string compstr = info->name;
+ setup_search_string (compstr);
+ maybe_show |= match_search_strings (compstr, searchstr);
}
if (_search_tags_checkbox->get_active()) { /* tag contains */
- compstr = manager.get_tags_as_string (info);
- transform (compstr.begin(), compstr.end(), compstr.begin(), ::toupper);
- if (compstr.find (searchstr) != string::npos) {
- maybe_show = true;
- }
+ std::string compstr = manager.get_tags_as_string (info);
+ setup_search_string (compstr);
+ maybe_show |= match_search_strings (compstr, searchstr);
}
if (!maybe_show) {
/* user asked to ignore filters */
if (maybe_show && _search_ignore_checkbox->get_active()) {
+ if (status == PluginManager::Hidden) {
+ return false;
+ }
+ if (status == PluginManager::Concealed) {
+ return false;
+ }
return true;
}
}
return false;
}
- if (_fil_favorites_radio->get_active() && !(manager.get_status (info) == PluginManager::Favorite)) {
+ if (_fil_favorites_radio->get_active() && status != PluginManager::Favorite) {
return false;
}
- if (_fil_hidden_radio->get_active() && !(manager.get_status (info) == PluginManager::Hidden)) {
+ if (_fil_hidden_radio->get_active() && (status != PluginManager::Hidden && status != PluginManager::Concealed)) {
return false;
}
- if (manager.get_status (info) == PluginManager::Hidden) {
- if (!_fil_hidden_radio->get_active() && !_fil_all_radio->get_active()) {
- return false;
- }
+ if (!_fil_hidden_radio->get_active() && status == PluginManager::Hidden) {
+ return false;
+ }
+
+ if (!_fil_hidden_radio->get_active() && status == PluginManager::Concealed) {
+ return false;
}
/* Filter "type" combobox */
- if (_fil_type_combo->get_active_text() == X_("VST") && PluginManager::to_generic_vst(info->type) != LXVST) {
+ if (_fil_type_combo.get_text() == X_("VST") && PluginManager::to_generic_vst(info->type) != LXVST) {
return false;
}
- if (_fil_type_combo->get_active_text() == X_("AudioUnit") && info->type != AudioUnit) {
+ if (_fil_type_combo.get_text() == X_("AudioUnit") && info->type != AudioUnit) {
return false;
}
#ifdef LV2_SUPPORT
- if (_fil_type_combo->get_active_text() == X_("LV2") && info->type != LV2) {
+ if (_fil_type_combo.get_text() == X_("LV2") && info->type != LV2) {
return false;
}
#endif
- if (_fil_type_combo->get_active_text() == X_("LUA") && info->type != Lua) {
+ if (_fil_type_combo.get_text() == X_("Lua") && info->type != Lua) {
return false;
}
- if (_fil_type_combo->get_active_text() == X_("LADSPA") && info->type != LADSPA) {
+ if (_fil_type_combo.get_text() == X_("LADSPA") && info->type != LADSPA) {
return false;
}
/* Filter "creator" combobox */
- if (_fil_creator_combo->get_active_text() != _("Show All Creators")) {
- string cmp = info->creator;
- if (cmp.length() > MAX_CREATOR_LEN) {
- cmp = cmp.substr (0, MAX_CREATOR_LEN);
- cmp.append("...");
- }
- if (_fil_creator_combo->get_active_text() != cmp) {
+ if (_fil_creator_combo.get_text() != _("Show All Creators")) {
+ if (_fil_creator_combo.get_text() != info->creator) {
return false;
}
}
- /* Filter "I/O" combobox */
-
- if (_fil_channel_combo->get_active_text() != _("Show All I/O") || info->reconfigurable_io ()) {
-
-#if 0
- if (info->reconfigurable_io ()) {
- return true; // who knows.... ?
- }
-#endif
-
- if (_fil_channel_combo->get_active_text() == _("Audio I/O")) {
- if ((info->n_inputs.n_audio() == 0 || info->n_outputs.n_audio() == 0)) {
- return false;
- }
- }
-
- if (_fil_channel_combo->get_active_text() == _("Mono Audio I/O")) {
- if (info->n_inputs.n_audio() != 1 || info->n_outputs.n_audio() != 1) {
- return false;
- }
- }
-
- if (_fil_channel_combo->get_active_text() == _("Stereo Audio I/O")) {
- if (info->n_inputs.n_audio() != 2 || info->n_outputs.n_audio() != 2) {
- return false;
- }
- }
-
- if (_fil_channel_combo->get_active_text() == _("MIDI I/O (only)")) {
- if ((info->n_inputs.n_audio() != 0 || info->n_outputs.n_audio() == 0)) {
- return false;
- }
- }
-
- }
-
return true;
}
-void
-PluginSelector::setup_search_string (string& searchstr)
-{
- searchstr = search_entry.get_text ();
- transform (searchstr.begin(), searchstr.end(), searchstr.begin(), ::toupper);
-}
-
void
PluginSelector::set_sensitive_widgets ()
{
- if (_search_ignore_checkbox->get_active() && (search_entry.get_text() != "")) {
+ if (_search_ignore_checkbox->get_active() && !search_entry.get_text().empty()) {
_fil_effects_radio->set_sensitive(false);
_fil_instruments_radio->set_sensitive(false);
_fil_utils_radio->set_sensitive(false);
_fil_favorites_radio->set_sensitive(false);
_fil_hidden_radio->set_sensitive(false);
_fil_all_radio->set_sensitive(false);
- _fil_type_combo->set_sensitive(false);
- _fil_creator_combo->set_sensitive(false);
- _fil_channel_combo->set_sensitive(false);
+ _inhibit_refill = true;
+ _fil_type_combo.set_sensitive(false);
+ _fil_creator_combo.set_sensitive(false);
+ _inhibit_refill = false;
} else {
_fil_effects_radio->set_sensitive(true);
_fil_instruments_radio->set_sensitive(true);
_fil_favorites_radio->set_sensitive(true);
_fil_hidden_radio->set_sensitive(true);
_fil_all_radio->set_sensitive(true);
- _fil_type_combo->set_sensitive(true);
- _fil_creator_combo->set_sensitive(true);
- _fil_channel_combo->set_sensitive(true);
+ _inhibit_refill = true;
+ _fil_type_combo.set_sensitive(true);
+ _fil_creator_combo.set_sensitive(true);
+ _inhibit_refill = false;
+ }
+ if (!search_entry.get_text().empty()) {
+ refill ();
}
}
void
PluginSelector::refill ()
{
- if (inhibit_refill) {
+ if (_inhibit_refill) {
return;
}
- std::string searchstr;
-
in_row_change = true;
+ plugin_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
+
+ int sort_col;
+ SortType sort_type;
+ bool sorted = plugin_model->get_sort_column_id (sort_col, sort_type);
+
+ /* Disable sorting to gain performance */
+ plugin_model->set_sort_column (-2, SORT_ASCENDING);
+
plugin_model->clear ();
+ std::string searchstr = search_entry.get_text ();
setup_search_string (searchstr);
ladspa_refiller (searchstr);
lua_refiller (searchstr);
in_row_change = false;
+
+ plugin_display.set_model (plugin_model);
+ if (sorted) {
+ plugin_model->set_sort_column (sort_col, sort_type);
+ }
}
void
if (show_this_plugin (*i, searchstr)) {
TreeModel::Row newrow = *(plugin_model->append());
- newrow[plugin_columns.favorite] = (manager.get_status (*i) == PluginManager::Favorite);
- newrow[plugin_columns.hidden] = (manager.get_status (*i) == PluginManager::Hidden);
+
+ PluginManager::PluginStatusType status = manager.get_status (*i);
+ newrow[plugin_columns.favorite] = status == PluginManager::Favorite;
+ newrow[plugin_columns.hidden] = status == PluginManager::Hidden;
string name = (*i)->name;
if (name.length() > 48) {
newrow[plugin_columns.name] = name;
newrow[plugin_columns.type_name] = type;
- newrow[plugin_columns.category] = (*i)->category;
/* Creator */
string creator = (*i)->creator;
} else {
snprintf (buf, sizeof(buf), "%d / %d", (*i)->n_inputs.n_audio(), (*i)->n_outputs.n_audio());
newrow[plugin_columns.audio_io] = buf;
- snprintf (buf, sizeof(buf), "%d / %d", (*i)->n_inputs.n_audio(), (*i)->n_outputs.n_audio());
+ snprintf (buf, sizeof(buf), "%d / %d", (*i)->n_inputs.n_midi(), (*i)->n_outputs.n_midi());
newrow[plugin_columns.midi_io] = buf;
}
void
PluginSelector::btn_add_clicked()
{
+ if (plugin_display.get_selection()->count_selected_rows() == 0) {
+ /* may happen with ctrl + double-click un-selecting but activating a row */
+ return;
+ }
std::string name;
PluginInfoPtr pi;
TreeModel::Row newrow = *(amodel->append());
tag_entry->set_text (tags);
tag_entry->set_sensitive (true);
+ tag_reset_button->set_sensitive (true);
btn_add->set_sensitive (true);
} else {
tag_entry->set_text ("");
tag_entry->set_sensitive (false);
+ tag_reset_button->set_sensitive (false);
btn_add->set_sensitive (false);
}
tag_entry_connection.unblock ();
if (_need_status_save) {
manager.save_statuses();
}
-
if (_need_menu_rebuild) {
- build_plugin_menu();
+ build_plugin_menu ();
}
return (int) r;
void
PluginSelector::tag_reset_button_clicked ()
{
- /* XXX: this should probably be a backend function
- * -> remove "category" from GUI and code-dup to set
- * factory tags in PluginManager */
if (plugin_display.get_selection()->count_selected_rows() != 0) {
TreeModel::Row row = *(plugin_display.get_selection()->get_selected());
- std::string str = row[plugin_columns.category];
- std::transform (str.begin(), str.end(), str.begin(), ::tolower);
-
ARDOUR::PluginInfoPtr pi = row[plugin_columns.plugin];
- manager.set_tags (pi->type, pi->unique_id, str, true, true);
+ manager.reset_tags (pi);
+ display_selection_changed ();
_need_tag_save = true;
}
}
PluginSelector::search_entry_changed ()
{
set_sensitive_widgets();
- refill ();
+ if (search_entry.get_text().empty()) {
+ refill ();
+ }
}
void
TreeModel::Row row = *(plugin_display.get_selection()->get_selected());
ARDOUR::PluginInfoPtr pi = row[plugin_columns.plugin];
- manager.set_tags (pi->type, pi->unique_id, tag_entry->get_text(), false);
+ manager.set_tags (pi->type, pi->unique_id, tag_entry->get_text(), pi->name, PluginManager::FromGui);
_need_tag_save = true;
}
}
row[plugin_columns.tags] = tags;
}
-
- /* A plugin's tags change while the user is entering them.
- * defer a rebuilding of the "tag" menu until the dialog is closed.
- */
- _need_menu_rebuild = true;
}
void
(*i)[plugin_columns.hidden] = (stat == PluginManager::Hidden) ? true : false;
/* if plug was hidden, remove it from the view */
- if (stat==PluginManager::Hidden) {
+ if (stat == PluginManager::Hidden || stat == PluginManager::Concealed) {
+ if (!_fil_hidden_radio->get_active() && !_fil_all_radio->get_active()) {
+ plugin_model->erase(i);
+ }
+ } else if (_fil_hidden_radio->get_active()) {
plugin_model->erase(i);
}
-
- /* plugin menu must be re-built to accommodate Hidden and Favorite plugins */
- build_plugin_menu();
+ /* if no longer a favorite, remove it from the view */
+ if (stat != PluginManager::Favorite && _fil_favorites_radio->get_active()) {
+ plugin_model->erase(i);
+ }
return;
}
_need_tag_save = false;
_need_status_save = false;
- _need_menu_rebuild = false;
}
struct PluginMenuCompareByCreator {
void
PluginSelector::build_plugin_menu ()
{
+ if (is_visible ()) {
+ _need_menu_rebuild = true;
+ return;
+ }
+ _need_menu_rebuild = false;
PluginInfoList all_plugs;
all_plugs.insert (all_plugs.end(), manager.ladspa_plugin_info().begin(), manager.ladspa_plugin_info().end());
delete _plugin_menu;
- _plugin_menu = manage (new Menu);
+ _plugin_menu = new Menu;
_plugin_menu->set_name("ArdourContextMenu");
MenuList& items = _plugin_menu->items();
Gtk::Menu*
PluginSelector::create_by_creator_menu (ARDOUR::PluginInfoList& all_plugs)
{
- inhibit_refill = true;
- _fil_creator_combo->clear();
- _fil_creator_combo->append_text (_("Show All Creators"));
- _fil_creator_combo->set_active_text (_("Show All Creators"));
- inhibit_refill = false;
+ _inhibit_refill = true;
+ _fil_creator_combo.clear_items ();
+ _fil_creator_combo.append_text_item (_("Show All Creators"));
+ _fil_creator_combo.set_text (_("Show All Creators"));
+ _inhibit_refill = false;
using namespace Menu_Helpers;
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
- if (manager.get_status (*i) == PluginManager::Hidden) continue;
+ PluginManager::PluginStatusType status = manager.get_status (*i);
+ if (status == PluginManager::Hidden) continue;
+ if (status == PluginManager::Concealed) continue;
string creator = (*i)->creator;
- 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 && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
-#else
- 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) {
creator = "Unknown";
- } else{
- creator = creator.substr (0, pos);
- }
-
- /* trim the creator length so we don't make a giant pulldown menu */
- if (creator.length() > MAX_CREATOR_LEN) {
- creator = creator.substr (0, MAX_CREATOR_LEN);
- creator.append("...");
}
SubmenuMap::iterator x;
submenu = x->second;
} else {
- _fil_creator_combo->append_text(creator);
+ _fil_creator_combo.append_text_item (creator);
submenu = new Gtk::Menu;
by_creator_items.push_back (MenuElem (creator, *manage (submenu)));
by_tags->set_name("ArdourContextMenu");
MenuList& by_tags_items = by_tags->items();
- std::vector<std::string> all_tags = manager.get_all_tags(false);
+ std::vector<std::string> all_tags = manager.get_all_tags (PluginManager::NoHidden);
for (vector<string>::iterator t = all_tags.begin(); t != all_tags.end(); ++t) {
Gtk::Menu *submenu = new Gtk::Menu;
by_tags_items.push_back (MenuElem (*t, *manage (submenu)));
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
- if (manager.get_status (*i) == PluginManager::Hidden) continue;
+ PluginManager::PluginStatusType status = manager.get_status (*i);
+ if (status == PluginManager::Hidden) continue;
+ if (status == PluginManager::Concealed) continue;
/* for each tag in the plugins tag list, add it to that submenu */
vector<string> tokens = manager.get_tags(*i);
Gtk::Menu* submenu;
if ((x = tags_submenu_map.find (*t)) != tags_submenu_map.end()) {
submenu = x->second;
- } else {
+ 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);
}
- 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);
}
}
return by_tags;