2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000-2006 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
2009-07-12 20:26:28 -04:00
|
|
|
#ifdef WAF_BUILD
|
|
|
|
#include "gtk2ardour-config.h"
|
|
|
|
#endif
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include <cstdio>
|
2008-09-10 11:03:30 -04:00
|
|
|
#include <map>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-07-30 18:14:04 -04:00
|
|
|
#include <algorithm>
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm/button.h>
|
2017-07-16 22:55:52 -04:00
|
|
|
#include <gtkmm/comboboxtext.h>
|
|
|
|
#include <gtkmm/frame.h>
|
|
|
|
#include <gtkmm/messagedialog.h>
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm/notebook.h>
|
2017-07-16 22:55:52 -04:00
|
|
|
#include <gtkmm/stock.h>
|
|
|
|
#include <gtkmm/table.h>
|
2018-03-19 13:13:37 -04:00
|
|
|
#include <gtkmm/treestore.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
#include "gtkmm2ext/utils.h"
|
2018-01-29 19:32:15 -05:00
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
#include "widgets/tooltips.h"
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
#include "pbd/convert.h"
|
|
|
|
#include "pbd/tokenizer.h"
|
|
|
|
|
2013-12-10 15:31:57 -05:00
|
|
|
#include "ardour/utils.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "plugin_selector.h"
|
|
|
|
#include "gui_thread.h"
|
2018-01-30 10:27:55 -05:00
|
|
|
#include "ui_config.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
using namespace ARDOUR;
|
2006-06-21 19:01:03 -04:00
|
|
|
using namespace PBD;
|
2005-11-27 12:59:03 -05:00
|
|
|
using namespace Gtk;
|
2007-07-30 18:14:04 -04:00
|
|
|
using namespace std;
|
2017-07-15 11:38:28 -04:00
|
|
|
using namespace ArdourWidgets;
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
static const uint32_t MAX_CREATOR_LEN = 24;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-11-14 12:41:29 -05:00
|
|
|
PluginSelector::PluginSelector (PluginManager& mgr)
|
|
|
|
: ArdourDialog (_("Plugin Manager"), true, false)
|
2018-01-29 19:32:15 -05:00
|
|
|
, search_clear_button (Stock::CLEAR)
|
2011-11-14 12:41:29 -05:00
|
|
|
, manager (mgr)
|
2018-03-19 13:13:37 -04:00
|
|
|
, _inhibit_refill (false)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
set_name ("PluginSelectorWindow");
|
2005-09-25 16:33:00 -04:00
|
|
|
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-11-15 20:06:33 -05:00
|
|
|
_plugin_menu = 0;
|
2008-09-10 11:03:30 -04:00
|
|
|
in_row_change = false;
|
|
|
|
|
2018-02-02 20:25:01 -05:00
|
|
|
//anytime the list changes ( Status, Tags, or scanned plugins ) we need to rebuild redirect-box plugin selector menu
|
2011-11-14 12:41:29 -05:00
|
|
|
manager.PluginListChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::build_plugin_menu, this), gui_context());
|
2018-02-02 20:25:01 -05:00
|
|
|
|
|
|
|
//these are used to update the info of specific entries, while they are being edited
|
|
|
|
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());
|
2009-11-15 20:06:33 -05:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
plugin_model = Gtk::ListStore::create (plugin_columns);
|
|
|
|
plugin_display.set_model (plugin_model);
|
2008-09-10 11:03:30 -04:00
|
|
|
/* XXX translators: try to convert "Fav" into a short term
|
2018-01-29 19:32:15 -05:00
|
|
|
* related to "favorite" and "Hid" into a short term
|
|
|
|
* related to "hidden"
|
|
|
|
*/
|
2008-09-10 11:03:30 -04:00
|
|
|
plugin_display.append_column (_("Fav"), plugin_columns.favorite);
|
2013-03-29 12:36:03 -04:00
|
|
|
plugin_display.append_column (_("Hide"), plugin_columns.hidden);
|
2018-01-29 19:32:15 -05:00
|
|
|
plugin_display.append_column (_("Name"), plugin_columns.name);
|
|
|
|
plugin_display.append_column (_("Tags"), plugin_columns.tags);
|
2008-01-10 16:20:59 -05:00
|
|
|
plugin_display.append_column (_("Creator"), plugin_columns.creator);
|
2018-01-29 19:32:15 -05:00
|
|
|
plugin_display.append_column (_("Type"), plugin_columns.type_name);
|
|
|
|
plugin_display.append_column (_("Audio I/O"),plugin_columns.audio_io);
|
|
|
|
plugin_display.append_column (_("MIDI I/O"), plugin_columns.midi_io);
|
2008-01-10 16:20:59 -05:00
|
|
|
plugin_display.set_headers_visible (true);
|
|
|
|
plugin_display.set_headers_clickable (true);
|
|
|
|
plugin_display.set_reorderable (false);
|
2008-09-10 11:03:30 -04:00
|
|
|
plugin_display.set_rules_hint (true);
|
2015-12-23 12:23:11 -05:00
|
|
|
plugin_display.add_object_drag (plugin_columns.plugin.index(), "PluginInfoPtr");
|
2015-12-24 11:28:23 -05:00
|
|
|
plugin_display.set_drag_column (plugin_columns.name.index());
|
2015-12-23 12:23:11 -05:00
|
|
|
|
|
|
|
// setting a sort-column prevents re-ordering via Drag/Drop
|
|
|
|
plugin_model->set_sort_column (plugin_columns.name.index(), Gtk::SORT_ASCENDING);
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
plugin_display.set_name("PluginSelectorDisplay");
|
|
|
|
plugin_display.signal_row_activated().connect_notify (sigc::mem_fun(*this, &PluginSelector::row_activated));
|
|
|
|
plugin_display.get_selection()->signal_changed().connect (sigc::mem_fun(*this, &PluginSelector::display_selection_changed));
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
CellRendererToggle* fav_cell = dynamic_cast<CellRendererToggle*>(plugin_display.get_column_cell_renderer (0));
|
|
|
|
fav_cell->property_activatable() = true;
|
2009-11-08 14:15:28 -05:00
|
|
|
fav_cell->property_radio() = true;
|
2009-12-11 18:29:48 -05:00
|
|
|
fav_cell->signal_toggled().connect (sigc::mem_fun (*this, &PluginSelector::favorite_changed));
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
CellRendererToggle* hidden_cell = dynamic_cast<CellRendererToggle*>(plugin_display.get_column_cell_renderer (1));
|
|
|
|
hidden_cell->property_activatable() = true;
|
|
|
|
hidden_cell->property_radio() = true;
|
2009-12-11 18:29:48 -05:00
|
|
|
hidden_cell->signal_toggled().connect (sigc::mem_fun (*this, &PluginSelector::hidden_changed));
|
2009-11-08 14:15:28 -05:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
scroller.set_border_width(10);
|
|
|
|
scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
|
|
|
scroller.add(plugin_display);
|
2005-11-22 00:10:12 -05:00
|
|
|
|
|
|
|
amodel = Gtk::ListStore::create(acols);
|
|
|
|
added_list.set_model (amodel);
|
2007-07-31 12:03:35 -04:00
|
|
|
added_list.append_column (_("Plugins to be connected"), acols.text);
|
2005-11-22 00:10:12 -05:00
|
|
|
added_list.set_headers_visible (true);
|
|
|
|
added_list.set_reorderable (false);
|
|
|
|
|
2018-01-30 07:10:32 -05:00
|
|
|
for (int i = 2; i <= 7; ++i) {
|
2008-01-10 16:20:59 -05:00
|
|
|
Gtk::TreeView::Column* column = plugin_display.get_column(i);
|
2018-01-29 19:32:15 -05:00
|
|
|
if (column) {
|
|
|
|
column->set_sort_column(i);
|
|
|
|
}
|
2005-11-22 00:10:12 -05:00
|
|
|
}
|
|
|
|
|
2005-12-06 02:59:46 -05:00
|
|
|
ascroller.set_border_width(10);
|
|
|
|
ascroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
|
|
|
ascroller.add(added_list);
|
2006-04-26 12:04:04 -04:00
|
|
|
btn_add = manage(new Gtk::Button(Stock::ADD));
|
2015-01-05 00:32:14 -05:00
|
|
|
set_tooltip(*btn_add, _("Add a plugin to the effect list"));
|
2006-04-26 12:04:04 -04:00
|
|
|
btn_add->set_sensitive (false);
|
|
|
|
btn_remove = manage(new Gtk::Button(Stock::REMOVE));
|
|
|
|
btn_remove->set_sensitive (false);
|
2015-01-05 00:32:14 -05:00
|
|
|
set_tooltip(*btn_remove, _("Remove a plugin from the effect list"));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
btn_add->set_name("PluginSelectorButton");
|
|
|
|
btn_remove->set_name("PluginSelectorButton");
|
2005-12-02 14:18:26 -05:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
/* SEARCH */
|
|
|
|
|
|
|
|
Gtk::Table* search_table = manage(new Gtk::Table(2, 2));
|
2015-11-18 11:20:36 -05:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
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));
|
2015-11-17 21:46:50 -05:00
|
|
|
|
2018-01-30 13:51:45 -05:00
|
|
|
_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");
|
2015-11-17 21:46:50 -05:00
|
|
|
|
2018-01-30 13:51:45 -05:00
|
|
|
_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");
|
2015-11-17 21:46:50 -05:00
|
|
|
|
2018-01-30 13:51:45 -05:00
|
|
|
_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");
|
2015-11-17 21:46:50 -05:00
|
|
|
|
2018-01-31 09:21:00 -05:00
|
|
|
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 find \"dynamic de-esser\" but not \"de-esser\"."), Gtk::ALIGN_LEFT));
|
2015-11-17 21:46:50 -05:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
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_name_checkbox, 0, 1, 1, 2, FILL, FILL);
|
|
|
|
search_table->attach (*_search_tags_checkbox, 1, 2, 1, 2, FILL, FILL);
|
|
|
|
search_table->attach (*_search_ignore_checkbox,2, 3, 1, 2, FILL, FILL);
|
2018-01-31 09:21:00 -05:00
|
|
|
search_table->attach (*search_help_label1, 0, 3, 2, 3, FILL, FILL);
|
|
|
|
search_table->attach (*search_help_label2, 0, 3, 3, 4, FILL, FILL);
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
search_table->set_border_width (4);
|
2018-01-29 21:15:06 -05:00
|
|
|
search_table->set_col_spacings (4);
|
2018-01-29 19:32:15 -05:00
|
|
|
search_table->set_row_spacings (4);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
Frame* search_frame = manage (new Frame);
|
|
|
|
search_frame->set_name ("BaseFrame");
|
|
|
|
search_frame->set_label (_("Search"));
|
|
|
|
search_frame->add (*search_table);
|
|
|
|
search_frame->show_all ();
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2018-01-30 13:51:45 -05:00
|
|
|
_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));
|
2015-11-18 11:20:36 -05:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
/* FILTER */
|
|
|
|
|
|
|
|
Gtk::RadioButtonGroup fil_radio_group;
|
|
|
|
|
|
|
|
_fil_effects_radio = manage (new RadioButton (fil_radio_group, _("Show Effects Only")));
|
|
|
|
_fil_instruments_radio = manage (new RadioButton (fil_radio_group, _("Show Instruments Only")));
|
|
|
|
_fil_utils_radio = manage (new RadioButton (fil_radio_group, _("Show Utilities Only")));
|
|
|
|
_fil_favorites_radio = manage (new RadioButton (fil_radio_group, _("Show Favorites Only")));
|
|
|
|
_fil_hidden_radio = manage (new RadioButton (fil_radio_group, _("Show Hidden Only")));
|
|
|
|
_fil_all_radio = manage (new RadioButton (fil_radio_group, _("Show All")));
|
|
|
|
|
2018-01-30 10:27:55 -05:00
|
|
|
//_fil_type_combo = manage (new ComboBoxText);
|
|
|
|
_fil_type_combo.append_text_item (_("Show All Formats"));
|
|
|
|
_fil_type_combo.append_text_item (X_("VST"));
|
2018-01-29 19:32:15 -05:00
|
|
|
#ifdef AUDIOUNIT_SUPPORT
|
2018-01-30 10:27:55 -05:00
|
|
|
_fil_type_combo.append_text_item (X_("AudioUnit"));
|
2018-01-29 19:32:15 -05:00
|
|
|
#endif
|
|
|
|
#ifdef LV2_SUPPORT
|
2018-01-30 10:27:55 -05:00
|
|
|
_fil_type_combo.append_text_item (X_("LV2"));
|
2018-01-29 19:32:15 -05:00
|
|
|
#endif
|
2018-03-19 13:18:35 -04:00
|
|
|
_fil_type_combo.append_text_item (X_("Lua"));
|
2018-01-30 10:27:55 -05:00
|
|
|
_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);
|
2015-11-18 11:20:36 -05:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
Frame* filter_frame = manage (new Frame);
|
|
|
|
filter_frame->set_name ("BaseFrame");
|
|
|
|
filter_frame->set_label (_("Filter"));
|
2018-01-30 10:27:55 -05:00
|
|
|
filter_frame->add (*filter_vbox);
|
2018-01-29 19:32:15 -05:00
|
|
|
filter_frame->show_all ();
|
|
|
|
|
|
|
|
_fil_effects_radio->signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::refill));
|
|
|
|
_fil_instruments_radio->signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::refill));
|
|
|
|
_fil_utils_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));
|
|
|
|
|
2018-01-30 10:27:55 -05:00
|
|
|
_fil_type_combo.StateChanged.connect (sigc::mem_fun (*this, &PluginSelector::refill));
|
|
|
|
_fil_creator_combo.StateChanged.connect (sigc::mem_fun (*this, &PluginSelector::refill));
|
2018-01-29 19:32:15 -05:00
|
|
|
|
|
|
|
/* TAG entry */
|
2015-11-18 11:20:36 -05:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
Gtk::Table* tagging_table = manage(new Gtk::Table(1, 2));
|
|
|
|
tagging_table->set_border_width (4);
|
|
|
|
tagging_table->set_col_spacings (4);
|
|
|
|
tagging_table->set_row_spacings (4);
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
tag_entry = manage (new Gtk::Entry);
|
|
|
|
tag_entry_connection = tag_entry->signal_changed().connect (sigc::mem_fun (*this, &PluginSelector::tag_entry_changed));
|
2016-07-06 18:25:57 -04:00
|
|
|
|
2018-01-30 22:50:22 -05:00
|
|
|
tag_reset_button = manage (new Button (_("Reset")));
|
2018-01-29 19:32:15 -05:00
|
|
|
tag_reset_button->signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::tag_reset_button_clicked));
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2018-01-31 09:21:00 -05:00
|
|
|
Gtk::Label* tagging_help_label1 = manage (new Label(
|
|
|
|
_("Enter space-separated, one-word Tags for the selected plugin."), Gtk::ALIGN_LEFT));
|
|
|
|
|
|
|
|
Gtk::Label* tagging_help_label2 = manage (new Label(
|
|
|
|
_("You can include dashes, colons or underscores in a Tag."), Gtk::ALIGN_LEFT));
|
|
|
|
|
|
|
|
Gtk::Label* tagging_help_label3 = manage (new Label(
|
|
|
|
_("Ex: \"dynamic de-esser vocal\" applies 3 Tags."), Gtk::ALIGN_LEFT));
|
2018-01-29 19:32:15 -05:00
|
|
|
|
2018-01-30 10:27:55 -05:00
|
|
|
int p = 0;
|
2018-01-29 19:32:15 -05:00
|
|
|
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++;
|
2018-01-31 09:21:00 -05:00
|
|
|
tagging_table->attach (*tagging_help_label1, 0, 2, p, p+1, FILL, FILL); p++;
|
|
|
|
tagging_table->attach (*tagging_help_label2, 0, 2, p, p+1, FILL, FILL); p++;
|
|
|
|
tagging_table->attach (*tagging_help_label3, 0, 2, p, p+1, FILL, FILL); p++;
|
2018-01-29 19:32:15 -05:00
|
|
|
|
|
|
|
Frame* tag_frame = manage (new Frame);
|
|
|
|
tag_frame->set_name ("BaseFrame");
|
|
|
|
tag_frame->set_label (_("Tags for Selected Plugin"));
|
|
|
|
tag_frame->add (*tagging_table);
|
|
|
|
tag_frame->show_all ();
|
|
|
|
|
|
|
|
/* Add & remove buttons */
|
2016-07-06 18:25:57 -04:00
|
|
|
|
|
|
|
HBox* add_remove = manage (new HBox);
|
|
|
|
add_remove->pack_start (*btn_add, true, true);
|
|
|
|
add_remove->pack_start (*btn_remove, true, true);
|
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
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));
|
|
|
|
|
|
|
|
added_list.set_name("PluginSelectorList");
|
|
|
|
|
|
|
|
/* Top-level Layout */
|
2016-07-06 18:25:57 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
VBox* to_be_inserted_vbox = manage (new VBox);
|
|
|
|
to_be_inserted_vbox->pack_start (ascroller);
|
|
|
|
to_be_inserted_vbox->pack_start (*add_remove, false, false);
|
|
|
|
to_be_inserted_vbox->set_size_request (200, -1);
|
|
|
|
|
|
|
|
Gtk::Table* table = manage(new Gtk::Table(3, 3));
|
|
|
|
table->set_size_request(-1, 600);
|
|
|
|
table->attach (scroller, 0, 3, 0, 5); /* this is the main plugin list */
|
|
|
|
table->attach (*search_frame, 0, 1, 6, 7, FILL, FILL, 5, 5);
|
|
|
|
table->attach (*tag_frame, 0, 1, 7, 8, FILL, FILL, 5, 5);
|
|
|
|
table->attach (*filter_frame, 1, 2, 6, 8, FILL, FILL, 5, 5);
|
|
|
|
table->attach (*to_be_inserted_vbox, 2, 3, 6, 8, FILL|EXPAND, FILL, 5, 5); /* to be inserted... */
|
2005-11-27 12:59:03 -05:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
add_button (Stock::CLOSE, RESPONSE_CLOSE);
|
2008-01-10 16:20:59 -05:00
|
|
|
add_button (_("Insert Plugin(s)"), RESPONSE_APPLY);
|
2006-04-19 16:42:17 -04:00
|
|
|
set_default_response (RESPONSE_APPLY);
|
2006-04-26 12:04:04 -04:00
|
|
|
set_response_sensitive (RESPONSE_APPLY, false);
|
2018-01-29 19:32:15 -05:00
|
|
|
get_vbox()->pack_start (*table);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
table->set_name("PluginSelectorTable");
|
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
plugin_display.grab_focus();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
build_plugin_menu ();
|
2018-01-30 22:50:22 -05:00
|
|
|
display_selection_changed ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-11-15 20:06:33 -05:00
|
|
|
PluginSelector::~PluginSelector ()
|
|
|
|
{
|
|
|
|
delete _plugin_menu;
|
|
|
|
}
|
|
|
|
|
2012-04-20 15:51:35 -04:00
|
|
|
void
|
2012-05-02 16:29:46 -04:00
|
|
|
PluginSelector::row_activated(Gtk::TreeModel::Path, Gtk::TreeViewColumn*)
|
2012-04-20 15:51:35 -04:00
|
|
|
{
|
|
|
|
btn_add_clicked();
|
|
|
|
}
|
|
|
|
|
2014-07-23 12:38:24 -04:00
|
|
|
void
|
|
|
|
PluginSelector::added_row_clicked(GdkEventButton* event)
|
|
|
|
{
|
|
|
|
if (event->type == GDK_2BUTTON_PRESS)
|
|
|
|
btn_remove_clicked();
|
|
|
|
}
|
|
|
|
|
2007-07-31 12:03:35 -04:00
|
|
|
bool
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& searchstr)
|
2007-07-31 12:03:35 -04:00
|
|
|
{
|
2018-01-29 19:32:15 -05:00
|
|
|
string mode;
|
|
|
|
bool maybe_show = false;
|
2007-07-31 12:03:35 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!maybe_show) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* user asked to ignore filters */
|
|
|
|
if (maybe_show && _search_ignore_checkbox->get_active()) {
|
2018-01-31 09:16:49 -05:00
|
|
|
if (manager.get_status (info) == PluginManager::Hidden) {
|
|
|
|
return false;
|
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
return true;
|
|
|
|
}
|
2009-11-08 14:15:28 -05:00
|
|
|
}
|
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
if (_fil_effects_radio->get_active() && !info->is_effect()) {
|
|
|
|
return false;
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
if (_fil_instruments_radio->get_active() && !info->is_instrument()) {
|
2015-11-17 21:46:50 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
if (_fil_utils_radio->get_active() && !(info->is_utility() || info->is_analyzer())) {
|
2015-11-17 21:46:50 -05:00
|
|
|
return false;
|
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
|
|
|
|
if (_fil_favorites_radio->get_active() && !(manager.get_status (info) == PluginManager::Favorite)) {
|
2015-11-17 21:46:50 -05:00
|
|
|
return false;
|
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
|
|
|
|
if (_fil_hidden_radio->get_active() && !(manager.get_status (info) == PluginManager::Hidden)) {
|
2015-11-17 21:46:50 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-01-31 09:16:49 -05:00
|
|
|
if (!_fil_hidden_radio->get_active() && manager.get_status (info) == PluginManager::Hidden) {
|
|
|
|
return false;
|
2015-11-17 21:46:50 -05:00
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
|
|
|
|
/* Filter "type" combobox */
|
|
|
|
|
2018-01-30 10:27:55 -05:00
|
|
|
if (_fil_type_combo.get_text() == X_("VST") && PluginManager::to_generic_vst(info->type) != LXVST) {
|
2018-01-29 19:32:15 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-01-30 10:27:55 -05:00
|
|
|
if (_fil_type_combo.get_text() == X_("AudioUnit") && info->type != AudioUnit) {
|
2018-01-29 19:32:15 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef LV2_SUPPORT
|
2018-01-30 10:27:55 -05:00
|
|
|
if (_fil_type_combo.get_text() == X_("LV2") && info->type != LV2) {
|
2018-01-29 19:32:15 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-03-19 13:18:35 -04:00
|
|
|
if (_fil_type_combo.get_text() == X_("Lua") && info->type != Lua) {
|
2018-01-29 19:32:15 -05:00
|
|
|
return false;
|
2015-11-17 21:46:50 -05:00
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
|
2018-01-30 10:27:55 -05:00
|
|
|
if (_fil_type_combo.get_text() == X_("LADSPA") && info->type != LADSPA) {
|
2018-01-29 19:32:15 -05:00
|
|
|
return false;
|
2015-11-17 21:46:50 -05:00
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
|
|
|
|
/* Filter "creator" combobox */
|
|
|
|
|
2018-01-30 10:27:55 -05:00
|
|
|
if (_fil_creator_combo.get_text() != _("Show All Creators")) {
|
|
|
|
if (_fil_creator_combo.get_text() != info->creator) {
|
2015-11-17 21:46:50 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-31 12:03:35 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::setup_search_string (string& searchstr)
|
|
|
|
{
|
|
|
|
searchstr = search_entry.get_text ();
|
|
|
|
transform (searchstr.begin(), searchstr.end(), searchstr.begin(), ::toupper);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::set_sensitive_widgets ()
|
2007-07-31 12:03:35 -04:00
|
|
|
{
|
2018-01-30 06:40:06 -05:00
|
|
|
if (_search_ignore_checkbox->get_active() && !search_entry.get_text().empty()) {
|
2018-01-29 19:32:15 -05:00
|
|
|
_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);
|
2018-03-19 13:13:37 -04:00
|
|
|
_inhibit_refill = true;
|
2018-01-30 10:27:55 -05:00
|
|
|
_fil_type_combo.set_sensitive(false);
|
|
|
|
_fil_creator_combo.set_sensitive(false);
|
2018-03-19 13:13:37 -04:00
|
|
|
_inhibit_refill = false;
|
2018-01-29 19:32:15 -05:00
|
|
|
} else {
|
|
|
|
_fil_effects_radio->set_sensitive(true);
|
|
|
|
_fil_instruments_radio->set_sensitive(true);
|
|
|
|
_fil_utils_radio->set_sensitive(true);
|
|
|
|
_fil_favorites_radio->set_sensitive(true);
|
|
|
|
_fil_hidden_radio->set_sensitive(true);
|
|
|
|
_fil_all_radio->set_sensitive(true);
|
2018-03-19 13:13:37 -04:00
|
|
|
_inhibit_refill = true;
|
2018-01-30 10:27:55 -05:00
|
|
|
_fil_type_combo.set_sensitive(true);
|
|
|
|
_fil_creator_combo.set_sensitive(true);
|
2018-03-19 13:13:37 -04:00
|
|
|
_inhibit_refill = false;
|
2018-01-29 19:32:15 -05:00
|
|
|
}
|
2018-01-30 06:40:06 -05:00
|
|
|
if (!search_entry.get_text().empty()) {
|
|
|
|
refill ();
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2007-07-31 12:03:35 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2008-01-10 16:20:59 -05:00
|
|
|
PluginSelector::refill ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2018-03-19 13:13:37 -04:00
|
|
|
if (_inhibit_refill) {
|
2018-01-29 19:32:15 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string searchstr;
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
in_row_change = true;
|
|
|
|
|
2018-03-19 13:13:37 -04:00
|
|
|
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);
|
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
plugin_model->clear ();
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
setup_search_string (searchstr);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
ladspa_refiller (searchstr);
|
|
|
|
lv2_refiller (searchstr);
|
|
|
|
vst_refiller (searchstr);
|
|
|
|
lxvst_refiller (searchstr);
|
|
|
|
mac_vst_refiller (searchstr);
|
|
|
|
au_refiller (searchstr);
|
|
|
|
lua_refiller (searchstr);
|
2008-09-10 11:03:30 -04:00
|
|
|
|
|
|
|
in_row_change = false;
|
2018-03-19 13:13:37 -04:00
|
|
|
|
|
|
|
plugin_display.set_model (plugin_model);
|
|
|
|
if (sorted) {
|
|
|
|
plugin_model->set_sort_column (sort_col, sort_type);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& searchstr, const char* type)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2008-01-10 16:20:59 -05:00
|
|
|
char buf[16];
|
|
|
|
|
|
|
|
for (PluginInfoList::const_iterator i = plugs.begin(); i != plugs.end(); ++i) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
if (show_this_plugin (*i, searchstr)) {
|
2006-08-01 00:05:15 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
TreeModel::Row newrow = *(plugin_model->append());
|
2011-11-14 12:41:29 -05:00
|
|
|
newrow[plugin_columns.favorite] = (manager.get_status (*i) == PluginManager::Favorite);
|
|
|
|
newrow[plugin_columns.hidden] = (manager.get_status (*i) == PluginManager::Hidden);
|
2018-01-29 19:32:15 -05:00
|
|
|
|
|
|
|
string name = (*i)->name;
|
|
|
|
if (name.length() > 48) {
|
|
|
|
name = name.substr (0, 48);
|
|
|
|
name.append("...");
|
|
|
|
}
|
|
|
|
newrow[plugin_columns.name] = name;
|
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
newrow[plugin_columns.type_name] = type;
|
2006-08-01 00:05:15 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
/* Creator */
|
2008-01-10 16:20:59 -05:00
|
|
|
string creator = (*i)->creator;
|
|
|
|
string::size_type pos = 0;
|
2016-05-01 10:27:11 -04:00
|
|
|
if ((*i)->type == ARDOUR::LADSPA) {
|
|
|
|
/* stupid LADSPA creator strings */
|
2014-04-17 17:24:37 -04:00
|
|
|
#ifdef PLATFORM_WINDOWS
|
2016-05-01 10:27:11 -04:00
|
|
|
while (pos < creator.length() && creator[pos] > -2 && creator[pos] < 256 && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
|
2014-04-17 17:24:37 -04:00
|
|
|
#else
|
2016-05-01 10:27:11 -04:00
|
|
|
while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
|
2014-04-17 17:24:37 -04:00
|
|
|
#endif
|
2016-05-01 10:27:11 -04:00
|
|
|
} else {
|
|
|
|
pos = creator.length ();
|
|
|
|
}
|
2014-05-10 03:32:14 -04:00
|
|
|
// If there were too few characters to create a
|
2014-05-10 03:41:49 -04:00
|
|
|
// meaningful name, mark this creator as 'Unknown'
|
2016-05-01 10:27:11 -04:00
|
|
|
if (creator.length() < 2 || pos < 3) {
|
2014-05-10 03:32:14 -04:00
|
|
|
creator = "Unknown";
|
2016-05-01 10:27:11 -04:00
|
|
|
} else{
|
2014-05-10 03:32:14 -04:00
|
|
|
creator = creator.substr (0, pos);
|
2016-05-01 10:27:11 -04:00
|
|
|
}
|
2006-07-31 18:05:28 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
if (creator.length() > MAX_CREATOR_LEN) {
|
|
|
|
creator = creator.substr (0, MAX_CREATOR_LEN);
|
|
|
|
creator.append("...");
|
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
newrow[plugin_columns.creator] = creator;
|
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
/* Tags */
|
|
|
|
string tags = manager.get_tags_as_string(*i);
|
|
|
|
if (tags.length() > 32) {
|
|
|
|
tags = tags.substr (0, 32);
|
|
|
|
tags.append("...");
|
|
|
|
}
|
|
|
|
newrow[plugin_columns.tags] = tags;
|
|
|
|
|
2012-05-07 18:01:54 -04:00
|
|
|
if ((*i)->reconfigurable_io ()) {
|
2018-01-29 19:32:15 -05:00
|
|
|
newrow[plugin_columns.audio_io] = "* / *";
|
|
|
|
newrow[plugin_columns.midi_io] = "* / *";
|
2012-05-07 18:01:54 -04:00
|
|
|
} else {
|
2018-01-29 19:32:15 -05:00
|
|
|
snprintf (buf, sizeof(buf), "%d / %d", (*i)->n_inputs.n_audio(), (*i)->n_outputs.n_audio());
|
|
|
|
newrow[plugin_columns.audio_io] = buf;
|
2018-03-24 15:05:17 -04:00
|
|
|
snprintf (buf, sizeof(buf), "%d / %d", (*i)->n_inputs.n_midi(), (*i)->n_outputs.n_midi());
|
2018-01-29 19:32:15 -05:00
|
|
|
newrow[plugin_columns.midi_io] = buf;
|
2012-05-07 18:01:54 -04:00
|
|
|
}
|
2007-07-31 12:03:35 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
newrow[plugin_columns.plugin] = *i;
|
2007-07-31 12:03:35 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
}
|
2007-07-31 12:03:35 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
void
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::ladspa_refiller (const std::string& searchstr)
|
2008-01-10 16:20:59 -05:00
|
|
|
{
|
2018-01-29 19:32:15 -05:00
|
|
|
refiller (manager.ladspa_plugin_info(), searchstr, "LADSPA");
|
2006-08-01 00:05:15 -04:00
|
|
|
}
|
|
|
|
|
2016-04-28 19:26:46 -04:00
|
|
|
void
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::lua_refiller (const std::string& searchstr)
|
2016-04-28 19:26:46 -04:00
|
|
|
{
|
2018-01-29 19:32:15 -05:00
|
|
|
refiller (manager.lua_plugin_info(), searchstr, "Lua");
|
2016-04-28 19:26:46 -04:00
|
|
|
}
|
|
|
|
|
2008-01-18 22:49:52 -05:00
|
|
|
void
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::lv2_refiller (const std::string& searchstr)
|
2008-01-18 22:49:52 -05:00
|
|
|
{
|
2011-05-14 17:05:26 -04:00
|
|
|
#ifdef LV2_SUPPORT
|
2018-01-29 19:32:15 -05:00
|
|
|
refiller (manager.lv2_plugin_info(), searchstr, "LV2");
|
2008-01-18 22:49:52 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-08-01 00:05:15 -04:00
|
|
|
void
|
2011-11-21 12:42:29 -05:00
|
|
|
#ifdef WINDOWS_VST_SUPPORT
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::vst_refiller (const std::string& searchstr)
|
2009-07-21 11:55:17 -04:00
|
|
|
#else
|
|
|
|
PluginSelector::vst_refiller (const std::string&)
|
|
|
|
#endif
|
2006-08-01 00:05:15 -04:00
|
|
|
{
|
2011-11-21 12:42:29 -05:00
|
|
|
#ifdef WINDOWS_VST_SUPPORT
|
2018-01-29 19:32:15 -05:00
|
|
|
refiller (manager.windows_vst_plugin_info(), searchstr, "VST");
|
2008-01-10 16:20:59 -05:00
|
|
|
#endif
|
2006-07-31 18:05:28 -04:00
|
|
|
}
|
2006-08-01 00:05:15 -04:00
|
|
|
|
2011-09-20 16:29:47 -04:00
|
|
|
void
|
|
|
|
#ifdef LXVST_SUPPORT
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::lxvst_refiller (const std::string& searchstr)
|
2011-09-20 16:29:47 -04:00
|
|
|
#else
|
|
|
|
PluginSelector::lxvst_refiller (const std::string&)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
#ifdef LXVST_SUPPORT
|
2018-01-29 19:32:15 -05:00
|
|
|
refiller (manager.lxvst_plugin_info(), searchstr, "LXVST");
|
2011-09-20 16:29:47 -04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-11-13 10:32:30 -05:00
|
|
|
void
|
|
|
|
#ifdef MACVST_SUPPORT
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::mac_vst_refiller (const std::string& searchstr)
|
2016-11-13 10:32:30 -05:00
|
|
|
#else
|
|
|
|
PluginSelector::mac_vst_refiller (const std::string&)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
#ifdef MACVST_SUPPORT
|
2018-01-29 19:32:15 -05:00
|
|
|
refiller (manager.mac_vst_plugin_info(), searchstr, "MacVST");
|
2016-11-13 10:32:30 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
void
|
2011-10-18 11:08:42 -04:00
|
|
|
#ifdef AUDIOUNIT_SUPPORT
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::au_refiller (const std::string& searchstr)
|
2009-07-21 11:55:17 -04:00
|
|
|
#else
|
|
|
|
PluginSelector::au_refiller (const std::string&)
|
2009-10-14 12:10:01 -04:00
|
|
|
#endif
|
2008-01-10 16:20:59 -05:00
|
|
|
{
|
2011-10-18 11:08:42 -04:00
|
|
|
#ifdef AUDIOUNIT_SUPPORT
|
2018-01-29 19:32:15 -05:00
|
|
|
refiller (manager.au_plugin_info(), searchstr, "AU");
|
2008-01-10 16:20:59 -05:00
|
|
|
#endif
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
PluginPtr
|
|
|
|
PluginSelector::load_plugin (PluginInfoPtr pi)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session == 0) {
|
2008-09-10 11:03:30 -04:00
|
|
|
return PluginPtr();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
return pi->load (*_session);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::btn_add_clicked()
|
|
|
|
{
|
2018-01-30 22:50:22 -05:00
|
|
|
if (plugin_display.get_selection()->count_selected_rows() == 0) {
|
|
|
|
/* may happen with ctrl + double-click un-selecting but activating a row */
|
|
|
|
return;
|
|
|
|
}
|
2005-11-22 00:10:12 -05:00
|
|
|
std::string name;
|
2006-08-01 17:11:55 -04:00
|
|
|
PluginInfoPtr pi;
|
2007-07-30 18:14:04 -04:00
|
|
|
TreeModel::Row newrow = *(amodel->append());
|
|
|
|
TreeModel::Row row;
|
2006-07-31 18:05:28 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
row = *(plugin_display.get_selection()->get_selected());
|
|
|
|
name = row[plugin_columns.name];
|
|
|
|
pi = row[plugin_columns.plugin];
|
2006-07-31 18:05:28 -04:00
|
|
|
|
2005-11-22 00:10:12 -05:00
|
|
|
newrow[acols.text] = name;
|
|
|
|
newrow[acols.plugin] = pi;
|
2006-04-26 12:04:04 -04:00
|
|
|
|
|
|
|
if (!amodel->children().empty()) {
|
2006-07-31 18:05:28 -04:00
|
|
|
set_response_sensitive (RESPONSE_APPLY, true);
|
2006-04-26 12:04:04 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::btn_remove_clicked()
|
|
|
|
{
|
2007-07-30 18:14:04 -04:00
|
|
|
TreeModel::iterator iter = added_list.get_selection()->get_selected();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-12-05 07:07:34 -05:00
|
|
|
amodel->erase(iter);
|
2006-04-26 12:04:04 -04:00
|
|
|
if (amodel->children().empty()) {
|
2006-08-01 17:11:55 -04:00
|
|
|
set_response_sensitive (RESPONSE_APPLY, false);
|
2006-04-26 12:04:04 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2007-07-30 18:14:04 -04:00
|
|
|
void
|
2008-01-10 16:20:59 -05:00
|
|
|
PluginSelector::display_selection_changed()
|
2007-07-30 18:14:04 -04:00
|
|
|
{
|
2018-01-29 19:32:15 -05:00
|
|
|
tag_entry_connection.block ();
|
2008-01-10 16:20:59 -05:00
|
|
|
if (plugin_display.get_selection()->count_selected_rows() != 0) {
|
2018-01-29 19:32:15 -05:00
|
|
|
|
|
|
|
/* a plugin row is selected; allow the user to edit the "tags" on it. */
|
|
|
|
TreeModel::Row row = *(plugin_display.get_selection()->get_selected());
|
|
|
|
string tags = manager.get_tags_as_string (row[plugin_columns.plugin]);
|
|
|
|
tag_entry->set_text (tags);
|
|
|
|
|
|
|
|
tag_entry->set_sensitive (true);
|
2018-01-30 22:50:22 -05:00
|
|
|
tag_reset_button->set_sensitive (true);
|
2006-08-01 00:05:15 -04:00
|
|
|
btn_add->set_sensitive (true);
|
2018-01-29 19:32:15 -05:00
|
|
|
|
2006-08-01 00:05:15 -04:00
|
|
|
} else {
|
2018-01-29 19:32:15 -05:00
|
|
|
tag_entry->set_text ("");
|
|
|
|
|
|
|
|
tag_entry->set_sensitive (false);
|
2018-01-30 22:50:22 -05:00
|
|
|
tag_reset_button->set_sensitive (false);
|
2006-08-01 00:05:15 -04:00
|
|
|
btn_add->set_sensitive (false);
|
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
tag_entry_connection.unblock ();
|
2006-04-26 12:04:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::added_list_selection_changed()
|
|
|
|
{
|
2007-02-26 14:26:49 -05:00
|
|
|
if (added_list.get_selection()->count_selected_rows() != 0) {
|
|
|
|
btn_remove->set_sensitive (true);
|
|
|
|
} else {
|
|
|
|
btn_remove->set_sensitive (false);
|
|
|
|
}
|
2006-04-26 12:04:04 -04:00
|
|
|
}
|
|
|
|
|
2005-11-27 12:59:03 -05:00
|
|
|
int
|
|
|
|
PluginSelector::run ()
|
|
|
|
{
|
|
|
|
ResponseType r;
|
2006-08-01 17:11:55 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-04-27 15:58:31 -04:00
|
|
|
bool finish = false;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-27 15:58:31 -04:00
|
|
|
while (!finish) {
|
|
|
|
|
|
|
|
SelectedPlugins plugins;
|
|
|
|
r = (ResponseType) Dialog::run ();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-27 15:58:31 -04:00
|
|
|
switch (r) {
|
|
|
|
case RESPONSE_APPLY:
|
|
|
|
for (i = amodel->children().begin(); i != amodel->children().end(); ++i) {
|
|
|
|
PluginInfoPtr pp = (*i)[acols.plugin];
|
|
|
|
PluginPtr p = load_plugin (pp);
|
|
|
|
if (p) {
|
|
|
|
plugins.push_back (p);
|
2017-07-01 12:42:24 -04:00
|
|
|
} 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 ();
|
|
|
|
}
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
2010-04-27 15:58:31 -04:00
|
|
|
if (interested_object && !plugins.empty()) {
|
|
|
|
finish = !interested_object->use_plugins (plugins);
|
2017-07-01 12:42:24 -04:00
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-27 15:58:31 -04:00
|
|
|
break;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-27 15:58:31 -04:00
|
|
|
default:
|
|
|
|
finish = true;
|
|
|
|
break;
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
hide();
|
2006-02-18 16:10:48 -05:00
|
|
|
amodel->clear();
|
2008-09-10 11:03:30 -04:00
|
|
|
interested_object = 0;
|
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
if (_need_tag_save) {
|
|
|
|
manager.save_tags();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_need_status_save) {
|
|
|
|
manager.save_statuses();
|
|
|
|
}
|
|
|
|
|
2018-02-02 20:25:01 -05:00
|
|
|
if ( _need_tag_save || _need_status_save || _need_menu_rebuild ) {
|
|
|
|
manager.PluginListChanged(); //emit signal
|
2018-01-29 19:32:15 -05:00
|
|
|
}
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
return (int) r;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2007-07-30 18:14:04 -04:00
|
|
|
|
|
|
|
void
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::search_clear_button_clicked ()
|
|
|
|
{
|
|
|
|
search_entry.set_text ("");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::tag_reset_button_clicked ()
|
2007-07-30 18:14:04 -04:00
|
|
|
{
|
2018-01-29 19:32:15 -05:00
|
|
|
if (plugin_display.get_selection()->count_selected_rows() != 0) {
|
|
|
|
TreeModel::Row row = *(plugin_display.get_selection()->get_selected());
|
|
|
|
ARDOUR::PluginInfoPtr pi = row[plugin_columns.plugin];
|
2018-03-01 19:26:09 -05:00
|
|
|
manager.reset_tags (pi);
|
2018-01-30 07:10:32 -05:00
|
|
|
display_selection_changed ();
|
2018-01-29 19:32:15 -05:00
|
|
|
_need_tag_save = true;
|
2018-02-02 20:25:01 -05:00
|
|
|
_need_menu_rebuild = true;
|
2018-01-29 19:32:15 -05:00
|
|
|
}
|
2007-07-30 18:14:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::search_entry_changed ()
|
2007-07-30 18:14:04 -04:00
|
|
|
{
|
2018-01-29 19:32:15 -05:00
|
|
|
set_sensitive_widgets();
|
2018-01-30 06:40:06 -05:00
|
|
|
if (search_entry.get_text().empty()) {
|
|
|
|
refill ();
|
|
|
|
}
|
2007-07-30 18:14:04 -04:00
|
|
|
}
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::tag_entry_changed ()
|
2007-07-30 18:14:04 -04:00
|
|
|
{
|
2018-01-29 19:32:15 -05:00
|
|
|
if (plugin_display.get_selection()->count_selected_rows() != 0) {
|
|
|
|
TreeModel::Row row = *(plugin_display.get_selection()->get_selected());
|
|
|
|
|
|
|
|
ARDOUR::PluginInfoPtr pi = row[plugin_columns.plugin];
|
2018-03-01 09:59:48 -05:00
|
|
|
manager.set_tags (pi->type, pi->unique_id, tag_entry->get_text(), pi->name, PluginManager::FromGui);
|
2018-01-29 19:32:15 -05:00
|
|
|
|
|
|
|
_need_tag_save = true;
|
2018-02-02 20:25:01 -05:00
|
|
|
_need_menu_rebuild = true;
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
}
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
void
|
|
|
|
PluginSelector::tags_changed (PluginType t, std::string unique_id, std::string tags)
|
|
|
|
{
|
|
|
|
if (plugin_display.get_selection()->count_selected_rows() != 0) {
|
|
|
|
TreeModel::Row row = *(plugin_display.get_selection()->get_selected());
|
|
|
|
if (tags.length() > 32) {
|
|
|
|
tags = tags.substr (0, 32);
|
|
|
|
tags.append ("...");
|
|
|
|
}
|
|
|
|
row[plugin_columns.tags] = tags;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::plugin_status_changed (PluginType t, std::string uid, PluginManager::PluginStatusType stat)
|
|
|
|
{
|
|
|
|
Gtk::TreeModel::iterator i;
|
|
|
|
for (i = plugin_model->children().begin(); i != plugin_model->children().end(); ++i) {
|
|
|
|
PluginInfoPtr pp = (*i)[plugin_columns.plugin];
|
|
|
|
if ((pp->type == t) && (pp->unique_id == uid)) {
|
|
|
|
(*i)[plugin_columns.favorite] = (stat == PluginManager::Favorite) ? true : false;
|
|
|
|
(*i)[plugin_columns.hidden] = (stat == PluginManager::Hidden) ? true : false;
|
|
|
|
|
|
|
|
/* if plug was hidden, remove it from the view */
|
2018-01-30 06:40:06 -05:00
|
|
|
if (stat == PluginManager::Hidden) {
|
|
|
|
if (!_fil_hidden_radio->get_active() && !_fil_all_radio->get_active()) {
|
|
|
|
plugin_model->erase(i);
|
|
|
|
}
|
|
|
|
} else if (_fil_hidden_radio->get_active()) {
|
2018-01-29 19:32:15 -05:00
|
|
|
plugin_model->erase(i);
|
|
|
|
}
|
2018-01-30 06:40:06 -05:00
|
|
|
/* if no longer a favorite, remove it from the view */
|
|
|
|
if (stat != PluginManager::Favorite && _fil_favorites_radio->get_active()) {
|
|
|
|
plugin_model->erase(i);
|
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2007-07-30 18:14:04 -04:00
|
|
|
}
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
void
|
|
|
|
PluginSelector::on_show ()
|
|
|
|
{
|
|
|
|
ArdourDialog::on_show ();
|
2018-01-29 19:32:15 -05:00
|
|
|
search_entry.grab_focus ();
|
|
|
|
|
|
|
|
refill ();
|
|
|
|
|
|
|
|
_need_tag_save = false;
|
|
|
|
_need_status_save = false;
|
|
|
|
_need_menu_rebuild = false;
|
2008-03-17 16:54:03 -04:00
|
|
|
}
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
struct PluginMenuCompareByCreator {
|
2017-07-01 12:42:24 -04:00
|
|
|
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;
|
|
|
|
}
|
2008-09-10 11:03:30 -04:00
|
|
|
};
|
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
struct PluginMenuCompareByName {
|
2017-07-01 12:42:24 -04:00
|
|
|
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;
|
|
|
|
}
|
2009-11-08 14:15:28 -05:00
|
|
|
};
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-15 20:06:33 -05:00
|
|
|
/** @return Plugin menu. The caller should not delete it */
|
2009-11-15 12:19:38 -05:00
|
|
|
Gtk::Menu*
|
2009-11-08 14:15:28 -05:00
|
|
|
PluginSelector::plugin_menu()
|
2009-11-15 20:06:33 -05:00
|
|
|
{
|
|
|
|
return _plugin_menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::build_plugin_menu ()
|
2009-11-08 14:15:28 -05:00
|
|
|
{
|
2008-09-10 11:03:30 -04:00
|
|
|
PluginInfoList all_plugs;
|
|
|
|
|
2011-11-14 12:41:29 -05:00
|
|
|
all_plugs.insert (all_plugs.end(), manager.ladspa_plugin_info().begin(), manager.ladspa_plugin_info().end());
|
2016-04-28 19:26:46 -04:00
|
|
|
all_plugs.insert (all_plugs.end(), manager.lua_plugin_info().begin(), manager.lua_plugin_info().end());
|
2011-11-21 12:42:29 -05:00
|
|
|
#ifdef WINDOWS_VST_SUPPORT
|
|
|
|
all_plugs.insert (all_plugs.end(), manager.windows_vst_plugin_info().begin(), manager.windows_vst_plugin_info().end());
|
2008-09-10 11:03:30 -04:00
|
|
|
#endif
|
2011-09-20 16:29:47 -04:00
|
|
|
#ifdef LXVST_SUPPORT
|
2011-11-14 12:41:29 -05:00
|
|
|
all_plugs.insert (all_plugs.end(), manager.lxvst_plugin_info().begin(), manager.lxvst_plugin_info().end());
|
2011-09-20 16:29:47 -04:00
|
|
|
#endif
|
2016-11-13 10:32:30 -05:00
|
|
|
#ifdef MACVST_SUPPORT
|
|
|
|
all_plugs.insert (all_plugs.end(), manager.mac_vst_plugin_info().begin(), manager.mac_vst_plugin_info().end());
|
|
|
|
#endif
|
2011-10-18 11:08:42 -04:00
|
|
|
#ifdef AUDIOUNIT_SUPPORT
|
2011-11-14 12:41:29 -05:00
|
|
|
all_plugs.insert (all_plugs.end(), manager.au_plugin_info().begin(), manager.au_plugin_info().end());
|
2008-09-10 11:03:30 -04:00
|
|
|
#endif
|
2011-05-14 17:05:26 -04:00
|
|
|
#ifdef LV2_SUPPORT
|
2011-11-14 12:41:29 -05:00
|
|
|
all_plugs.insert (all_plugs.end(), manager.lv2_plugin_info().begin(), manager.lv2_plugin_info().end());
|
2008-09-10 11:03:30 -04:00
|
|
|
#endif
|
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
using namespace Menu_Helpers;
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-15 20:06:33 -05:00
|
|
|
delete _plugin_menu;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-04-20 22:24:38 -04:00
|
|
|
_plugin_menu = manage (new Menu);
|
2009-11-15 20:06:33 -05:00
|
|
|
_plugin_menu->set_name("ArdourContextMenu");
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-11-15 20:06:33 -05:00
|
|
|
MenuList& items = _plugin_menu->items();
|
2009-11-08 14:15:28 -05:00
|
|
|
items.clear ();
|
|
|
|
|
|
|
|
Gtk::Menu* favs = create_favs_menu(all_plugs);
|
2009-11-15 12:19:38 -05:00
|
|
|
items.push_back (MenuElem (_("Favorites"), *manage (favs)));
|
2009-11-08 14:15:28 -05:00
|
|
|
|
2010-07-26 23:09:28 -04:00
|
|
|
items.push_back (MenuElem (_("Plugin Manager..."), sigc::mem_fun (*this, &PluginSelector::show_manager)));
|
2009-11-08 14:15:28 -05:00
|
|
|
items.push_back (SeparatorElem ());
|
|
|
|
|
|
|
|
Menu* by_creator = create_by_creator_menu(all_plugs);
|
2009-11-15 12:19:38 -05:00
|
|
|
items.push_back (MenuElem (_("By Creator"), *manage (by_creator)));
|
2009-11-08 14:15:28 -05:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
Menu* by_tags = create_by_tags_menu(all_plugs);
|
|
|
|
items.push_back (MenuElem (_("By Tags"), *manage (by_tags)));
|
2009-11-08 14:15:28 -05:00
|
|
|
}
|
|
|
|
|
2017-01-11 17:51:39 -05:00
|
|
|
string
|
|
|
|
GetPluginTypeStr(PluginInfoPtr info)
|
|
|
|
{
|
|
|
|
string type;
|
2018-01-29 19:32:15 -05:00
|
|
|
|
2017-01-11 17:51:39 -05:00
|
|
|
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;
|
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
|
2017-01-11 17:51:39 -05:00
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
Gtk::Menu*
|
|
|
|
PluginSelector::create_favs_menu (PluginInfoList& all_plugs)
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
|
|
|
Menu* favs = new Menu();
|
|
|
|
favs->set_name("ArdourContextMenu");
|
|
|
|
|
|
|
|
PluginMenuCompareByName cmp_by_name;
|
|
|
|
all_plugs.sort (cmp_by_name);
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
|
2011-11-14 12:41:29 -05:00
|
|
|
if (manager.get_status (*i) == PluginManager::Favorite) {
|
2017-01-11 17:51:39 -05:00
|
|
|
string typ = GetPluginTypeStr(*i);
|
|
|
|
MenuElem elem ((*i)->name + typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)));
|
2011-11-22 07:12:11 -05:00
|
|
|
elem.get_child()->set_use_underline (false);
|
|
|
|
favs->items().push_back (elem);
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
2009-11-08 14:15:28 -05:00
|
|
|
}
|
|
|
|
return favs;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
Gtk::Menu*
|
|
|
|
PluginSelector::create_by_creator_menu (ARDOUR::PluginInfoList& all_plugs)
|
|
|
|
{
|
2018-03-19 13:13:37 -04:00
|
|
|
_inhibit_refill = true;
|
2018-01-30 10:27:55 -05:00
|
|
|
_fil_creator_combo.clear_items ();
|
|
|
|
_fil_creator_combo.append_text_item (_("Show All Creators"));
|
|
|
|
_fil_creator_combo.set_text (_("Show All Creators"));
|
2018-03-19 13:13:37 -04:00
|
|
|
_inhibit_refill = false;
|
2018-01-29 19:32:15 -05:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
using namespace Menu_Helpers;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
typedef std::map<std::string,Gtk::Menu*> SubmenuMap;
|
2009-11-08 14:15:28 -05:00
|
|
|
SubmenuMap creator_submenu_map;
|
|
|
|
|
|
|
|
Menu* by_creator = new Menu();
|
|
|
|
by_creator->set_name("ArdourContextMenu");
|
|
|
|
|
|
|
|
MenuList& by_creator_items = by_creator->items();
|
|
|
|
PluginMenuCompareByCreator cmp_by_creator;
|
|
|
|
all_plugs.sort (cmp_by_creator);
|
|
|
|
|
|
|
|
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
|
|
|
|
|
2011-11-14 12:41:29 -05:00
|
|
|
if (manager.get_status (*i) == PluginManager::Hidden) continue;
|
2009-11-08 14:15:28 -05:00
|
|
|
|
|
|
|
string creator = (*i)->creator;
|
2014-05-10 03:32:14 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
/* If there were too few characters to create a
|
|
|
|
* meaningful name, mark this creator as 'Unknown'
|
|
|
|
*/
|
2018-01-30 13:12:47 -05:00
|
|
|
if (creator.length() < 2) {
|
2016-05-01 10:27:11 -04:00
|
|
|
creator = "Unknown";
|
2014-05-10 03:32:14 -04:00
|
|
|
}
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
SubmenuMap::iterator x;
|
|
|
|
Gtk::Menu* submenu;
|
|
|
|
if ((x = creator_submenu_map.find (creator)) != creator_submenu_map.end()) {
|
2008-09-10 11:03:30 -04:00
|
|
|
submenu = x->second;
|
|
|
|
} else {
|
2018-01-29 19:32:15 -05:00
|
|
|
|
2018-01-30 10:27:55 -05:00
|
|
|
_fil_creator_combo.append_text_item (creator);
|
2018-01-29 19:32:15 -05:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
submenu = new Gtk::Menu;
|
2009-11-15 12:19:38 -05:00
|
|
|
by_creator_items.push_back (MenuElem (creator, *manage (submenu)));
|
2010-09-14 12:51:02 -04:00
|
|
|
creator_submenu_map.insert (pair<std::string,Menu*> (creator, submenu));
|
2008-09-10 11:03:30 -04:00
|
|
|
submenu->set_name("ArdourContextMenu");
|
|
|
|
}
|
2017-01-11 17:51:39 -05:00
|
|
|
string typ = GetPluginTypeStr(*i);
|
|
|
|
MenuElem elem ((*i)->name+typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)));
|
2011-11-22 07:12:11 -05:00
|
|
|
elem.get_child()->set_use_underline (false);
|
|
|
|
submenu->items().push_back (elem);
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
return by_creator;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
Gtk::Menu*
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginSelector::create_by_tags_menu (ARDOUR::PluginInfoList& all_plugs)
|
2009-11-08 14:15:28 -05:00
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
typedef std::map<std::string,Gtk::Menu*> SubmenuMap;
|
2018-01-29 19:32:15 -05:00
|
|
|
SubmenuMap tags_submenu_map;
|
|
|
|
|
|
|
|
Menu* by_tags = new Menu();
|
|
|
|
by_tags->set_name("ArdourContextMenu");
|
|
|
|
MenuList& by_tags_items = by_tags->items();
|
|
|
|
|
2018-01-31 08:04:14 -05:00
|
|
|
std::vector<std::string> all_tags = manager.get_all_tags (PluginManager::NoHidden);
|
2018-01-29 19:32:15 -05:00
|
|
|
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)));
|
|
|
|
tags_submenu_map.insert (pair<std::string,Menu*> (*t, submenu));
|
|
|
|
submenu->set_name("ArdourContextMenu");
|
|
|
|
}
|
2009-11-08 14:15:28 -05:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
PluginMenuCompareByName cmp_by_name;
|
|
|
|
all_plugs.sort (cmp_by_name);
|
2009-11-08 14:15:28 -05:00
|
|
|
|
|
|
|
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
|
|
|
|
|
2011-11-14 12:41:29 -05:00
|
|
|
if (manager.get_status (*i) == PluginManager::Hidden) continue;
|
2009-11-08 14:15:28 -05:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
/* for each tag in the plugins tag list, add it to that submenu */
|
|
|
|
vector<string> tokens = manager.get_tags(*i);
|
|
|
|
for (vector<string>::iterator t = tokens.begin(); t != tokens.end(); ++t) {
|
|
|
|
SubmenuMap::iterator x;
|
|
|
|
Gtk::Menu* submenu;
|
|
|
|
if ((x = tags_submenu_map.find (*t)) != tags_submenu_map.end()) {
|
|
|
|
submenu = x->second;
|
2018-02-02 20:25:01 -05:00
|
|
|
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);
|
2018-01-29 19:32:15 -05:00
|
|
|
}
|
2009-11-08 14:15:28 -05:00
|
|
|
}
|
|
|
|
}
|
2018-01-29 19:32:15 -05:00
|
|
|
return by_tags;
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::plugin_chosen_from_menu (const PluginInfoPtr& pi)
|
|
|
|
{
|
|
|
|
PluginPtr p = load_plugin (pi);
|
|
|
|
|
|
|
|
if (p && interested_object) {
|
|
|
|
SelectedPlugins plugins;
|
|
|
|
plugins.push_back (p);
|
|
|
|
interested_object->use_plugins (plugins);
|
|
|
|
}
|
|
|
|
|
|
|
|
interested_object = 0;
|
|
|
|
}
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2010-09-14 12:51:02 -04:00
|
|
|
PluginSelector::favorite_changed (const std::string& path)
|
2008-09-10 11:03:30 -04:00
|
|
|
{
|
|
|
|
PluginInfoPtr pi;
|
|
|
|
|
|
|
|
if (in_row_change) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
in_row_change = true;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
TreeModel::iterator iter = plugin_model->get_iter (path);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
if (iter) {
|
|
|
|
|
|
|
|
bool favorite = !(*iter)[plugin_columns.favorite];
|
|
|
|
|
|
|
|
/* change state */
|
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
PluginManager::PluginStatusType status = (favorite ? PluginManager::Favorite : PluginManager::Normal);
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
/* save new statuses list */
|
2008-09-10 11:03:30 -04:00
|
|
|
|
|
|
|
pi = (*iter)[plugin_columns.plugin];
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-11-14 12:41:29 -05:00
|
|
|
manager.set_status (pi->type, pi->unique_id, status);
|
2009-11-08 14:15:28 -05:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
_need_status_save = true;
|
2018-02-02 20:25:01 -05:00
|
|
|
_need_menu_rebuild = true;
|
2009-11-08 14:15:28 -05:00
|
|
|
}
|
|
|
|
in_row_change = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-09-14 12:51:02 -04:00
|
|
|
PluginSelector::hidden_changed (const std::string& path)
|
2009-11-08 14:15:28 -05:00
|
|
|
{
|
|
|
|
PluginInfoPtr pi;
|
|
|
|
|
|
|
|
if (in_row_change) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
in_row_change = true;
|
|
|
|
|
|
|
|
TreeModel::iterator iter = plugin_model->get_iter (path);
|
|
|
|
|
|
|
|
if (iter) {
|
|
|
|
|
|
|
|
bool hidden = !(*iter)[plugin_columns.hidden];
|
|
|
|
|
|
|
|
/* change state */
|
|
|
|
|
|
|
|
PluginManager::PluginStatusType status = (hidden ? PluginManager::Hidden : PluginManager::Normal);
|
|
|
|
|
|
|
|
/* save new statuses list */
|
|
|
|
|
|
|
|
pi = (*iter)[plugin_columns.plugin];
|
|
|
|
|
2011-11-14 12:41:29 -05:00
|
|
|
manager.set_status (pi->type, pi->unique_id, status);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2018-01-29 19:32:15 -05:00
|
|
|
_need_status_save = true;
|
2018-02-02 20:25:01 -05:00
|
|
|
_need_menu_rebuild = true;
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
|
|
|
in_row_change = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::show_manager ()
|
|
|
|
{
|
|
|
|
show_all();
|
|
|
|
run ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::set_interested_object (PluginInterestedObject& obj)
|
|
|
|
{
|
|
|
|
interested_object = &obj;
|
|
|
|
}
|