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>
|
|
|
|
#include <lrdf.h>
|
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/table.h>
|
2005-11-27 12:59:03 -05:00
|
|
|
#include <gtkmm/stock.h>
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm/button.h>
|
|
|
|
#include <gtkmm/notebook.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-07-30 18:14:04 -04:00
|
|
|
#include <gtkmm2ext/utils.h>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/convert.h"
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/plugin_manager.h"
|
|
|
|
#include "ardour/plugin.h"
|
|
|
|
#include "ardour/configuration.h"
|
2009-10-30 11:30:22 -04:00
|
|
|
#include "ardour/session.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "plugin_selector.h"
|
|
|
|
#include "gui_thread.h"
|
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
static const char* _filter_mode_strings[] = {
|
2007-07-31 12:03:35 -04:00
|
|
|
N_("Name contains"),
|
|
|
|
N_("Type contains"),
|
2009-04-15 14:04:23 -04:00
|
|
|
N_("Category contains"),
|
2007-07-31 12:03:35 -04:00
|
|
|
N_("Author contains"),
|
|
|
|
N_("Library contains"),
|
2008-09-10 11:03:30 -04:00
|
|
|
N_("Favorites only"),
|
2009-11-08 14:15:28 -05:00
|
|
|
N_("Hidden only"),
|
2007-07-30 18:14:04 -04:00
|
|
|
0
|
|
|
|
};
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
PluginSelector::PluginSelector (PluginManager *mgr)
|
2010-04-27 15:58:31 -04:00
|
|
|
: ArdourDialog (_("Plugin Manager"), true, false),
|
2007-07-31 12:03:35 -04:00
|
|
|
filter_button (Stock::CLEAR)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-09-25 16:33:00 -04:00
|
|
|
set_position (Gtk::WIN_POS_MOUSE);
|
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;
|
2005-09-25 14:42:24 -04:00
|
|
|
manager = mgr;
|
2008-09-10 11:03:30 -04:00
|
|
|
in_row_change = false;
|
|
|
|
|
2010-03-30 11:18:43 -04:00
|
|
|
manager->PluginListChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::build_plugin_menu, this), gui_context());
|
2009-11-15 20:06:33 -05:00
|
|
|
build_plugin_menu ();
|
|
|
|
|
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
|
2009-11-08 14:15:28 -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);
|
2009-11-08 14:15:28 -05:00
|
|
|
plugin_display.append_column (_("Hid"), plugin_columns.hidden);
|
2008-01-10 16:20:59 -05:00
|
|
|
plugin_display.append_column (_("Available Plugins"), plugin_columns.name);
|
|
|
|
plugin_display.append_column (_("Type"), plugin_columns.type_name);
|
|
|
|
plugin_display.append_column (_("Category"), plugin_columns.category);
|
|
|
|
plugin_display.append_column (_("Creator"), plugin_columns.creator);
|
2008-02-20 18:24:51 -05:00
|
|
|
plugin_display.append_column (_("# Audio In"),plugin_columns.audio_ins);
|
|
|
|
plugin_display.append_column (_("# Audio Out"), plugin_columns.audio_outs);
|
|
|
|
plugin_display.append_column (_("# MIDI In"),plugin_columns.midi_ins);
|
|
|
|
plugin_display.append_column (_("# MIDI Out"), plugin_columns.midi_outs);
|
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);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
for (int i = 0; i <=8; i++) {
|
2008-01-10 16:20:59 -05:00
|
|
|
Gtk::TreeView::Column* column = plugin_display.get_column(i);
|
2005-11-22 00:10:12 -05:00
|
|
|
column->set_sort_column(i);
|
|
|
|
}
|
|
|
|
|
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));
|
2010-02-08 19:50:24 -05:00
|
|
|
ARDOUR_UI::instance()->set_tip(*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);
|
2010-02-08 19:50:24 -05:00
|
|
|
ARDOUR_UI::instance()->set_tip(*btn_remove, _("Remove a plugin from the effect list"));
|
2006-04-19 16:42:17 -04:00
|
|
|
Gtk::Button *btn_update = manage(new Gtk::Button(Stock::REFRESH));
|
2010-02-08 19:50:24 -05:00
|
|
|
ARDOUR_UI::instance()->set_tip(*btn_update, _("Update available plugins"));
|
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
|
|
|
|
2007-07-30 18:14:04 -04:00
|
|
|
Gtk::Table* table = manage(new Gtk::Table(7, 11));
|
2005-09-25 16:33:00 -04:00
|
|
|
table->set_size_request(750, 500);
|
2008-01-10 16:20:59 -05:00
|
|
|
table->attach(scroller, 0, 7, 0, 5);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-07-30 18:14:04 -04:00
|
|
|
HBox* filter_box = manage (new HBox);
|
|
|
|
|
|
|
|
vector<string> filter_strings = I18N (_filter_mode_strings);
|
|
|
|
Gtkmm2ext::set_popdown_strings (filter_mode, filter_strings);
|
|
|
|
filter_mode.set_active_text (filter_strings.front());
|
|
|
|
|
|
|
|
filter_box->pack_start (filter_mode, false, false);
|
|
|
|
filter_box->pack_start (filter_entry, true, true);
|
|
|
|
filter_box->pack_start (filter_button, false, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
filter_entry.signal_changed().connect (sigc::mem_fun (*this, &PluginSelector::filter_entry_changed));
|
|
|
|
filter_button.signal_clicked().connect (sigc::mem_fun (*this, &PluginSelector::filter_button_clicked));
|
|
|
|
filter_mode.signal_changed().connect (sigc::mem_fun (*this, &PluginSelector::filter_mode_changed));
|
2007-07-30 18:14:04 -04:00
|
|
|
|
|
|
|
filter_box->show ();
|
|
|
|
filter_mode.show ();
|
|
|
|
filter_entry.show ();
|
|
|
|
filter_button.show ();
|
|
|
|
|
|
|
|
table->attach (*filter_box, 0, 7, 5, 6, FILL|EXPAND, FILL, 5, 5);
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
table->attach(*btn_add, 1, 2, 6, 7, FILL, FILL, 5, 5);
|
2007-07-30 18:14:04 -04:00
|
|
|
table->attach(*btn_remove, 3, 4, 6, 7, FILL, FILL, 5, 5);
|
2007-07-31 12:03:35 -04:00
|
|
|
table->attach(*btn_update, 5, 6, 6, 7, FILL, FILL, 5, 5);
|
2007-07-30 18:14:04 -04:00
|
|
|
|
|
|
|
table->attach(ascroller, 0, 7, 8, 10);
|
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);
|
2005-11-27 12:59:03 -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.set_name("PluginSelectorDisplay");
|
|
|
|
//plugin_display.set_name("PluginSelectorList");
|
2005-11-22 00:10:12 -05:00
|
|
|
added_list.set_name("PluginSelectorList");
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
plugin_display.signal_button_press_event().connect_notify (sigc::mem_fun(*this, &PluginSelector::row_clicked));
|
|
|
|
plugin_display.get_selection()->signal_changed().connect (sigc::mem_fun(*this, &PluginSelector::display_selection_changed));
|
2008-01-10 16:20:59 -05:00
|
|
|
plugin_display.grab_focus();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
btn_update->signal_clicked().connect (sigc::mem_fun(*this, &PluginSelector::btn_update_clicked));
|
|
|
|
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));
|
2005-12-02 14:18:26 -05:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
refill ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-11-15 20:06:33 -05:00
|
|
|
PluginSelector::~PluginSelector ()
|
|
|
|
{
|
|
|
|
delete _plugin_menu;
|
|
|
|
}
|
|
|
|
|
2005-11-22 00:10:12 -05:00
|
|
|
void
|
|
|
|
PluginSelector::row_clicked(GdkEventButton* event)
|
|
|
|
{
|
2009-12-29 16:31:14 -05:00
|
|
|
if (event->type == GDK_2BUTTON_PRESS) {
|
2005-11-22 00:10:12 -05:00
|
|
|
btn_add_clicked();
|
2009-12-29 16:31:14 -05:00
|
|
|
}
|
2005-11-22 00:10:12 -05:00
|
|
|
}
|
|
|
|
|
2007-07-31 12:03:35 -04:00
|
|
|
bool
|
2008-01-10 16:20:59 -05:00
|
|
|
PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& filterstr)
|
2007-07-31 12:03:35 -04:00
|
|
|
{
|
|
|
|
std::string compstr;
|
|
|
|
std::string mode = filter_mode.get_active_text ();
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
if (mode == _("Favorites only")) {
|
2009-11-08 14:15:28 -05:00
|
|
|
return manager->get_status (info) == PluginManager::Favorite;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mode == _("Hidden only")) {
|
|
|
|
return manager->get_status (info) == PluginManager::Hidden;
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
|
|
|
|
2007-07-31 12:03:35 -04:00
|
|
|
if (!filterstr.empty()) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-07-31 12:03:35 -04:00
|
|
|
if (mode == _("Name contains")) {
|
|
|
|
compstr = info->name;
|
2009-04-15 14:04:23 -04:00
|
|
|
} else if (mode == _("Category contains")) {
|
2007-07-31 12:03:35 -04:00
|
|
|
compstr = info->category;
|
2009-04-15 14:04:23 -04:00
|
|
|
} else if (mode == _("Type contains")) {
|
|
|
|
|
|
|
|
switch (info->type) {
|
|
|
|
case LADSPA:
|
|
|
|
compstr = X_("LADSPA");
|
|
|
|
break;
|
|
|
|
case AudioUnit:
|
|
|
|
compstr = X_("AudioUnit");
|
|
|
|
break;
|
|
|
|
case LV2:
|
|
|
|
compstr = X_("LV2");
|
|
|
|
break;
|
|
|
|
case VST:
|
|
|
|
compstr = X_("VST");
|
|
|
|
break;
|
2011-09-20 16:29:47 -04:00
|
|
|
case LXVST:
|
|
|
|
compstr = X_("LXVST");
|
|
|
|
break;
|
2009-04-15 14:04:23 -04:00
|
|
|
}
|
|
|
|
|
2007-07-31 12:03:35 -04:00
|
|
|
} else if (mode == _("Author contains")) {
|
|
|
|
compstr = info->creator;
|
|
|
|
} else if (mode == _("Library contains")) {
|
|
|
|
compstr = info->path;
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-04-15 14:04:23 -04:00
|
|
|
if (compstr.empty()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-07-31 12:03:35 -04:00
|
|
|
transform (compstr.begin(), compstr.end(), compstr.begin(), ::toupper);
|
|
|
|
|
|
|
|
if (compstr.find (filterstr) != string::npos) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::setup_filter_string (string& filterstr)
|
|
|
|
{
|
|
|
|
filterstr = filter_entry.get_text ();
|
|
|
|
transform (filterstr.begin(), filterstr.end(), filterstr.begin(), ::toupper);
|
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
|
|
|
{
|
2008-01-10 16:20:59 -05:00
|
|
|
std::string filterstr;
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
in_row_change = true;
|
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
plugin_model->clear ();
|
2007-07-30 18:14:04 -04:00
|
|
|
|
2007-07-31 12:03:35 -04:00
|
|
|
setup_filter_string (filterstr);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
ladspa_refiller (filterstr);
|
2008-01-18 22:49:52 -05:00
|
|
|
lv2_refiller (filterstr);
|
2008-01-10 16:20:59 -05:00
|
|
|
vst_refiller (filterstr);
|
2011-09-20 16:29:47 -04:00
|
|
|
lxvst_refiller (filterstr);
|
2008-01-10 16:20:59 -05:00
|
|
|
au_refiller (filterstr);
|
2008-09-10 11:03:30 -04:00
|
|
|
|
|
|
|
in_row_change = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-01-10 16:20:59 -05:00
|
|
|
PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& filterstr, 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
|
|
|
|
2007-07-31 12:03:35 -04:00
|
|
|
if (show_this_plugin (*i, filterstr)) {
|
2006-08-01 00:05:15 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
TreeModel::Row newrow = *(plugin_model->append());
|
2009-11-08 14:15:28 -05:00
|
|
|
newrow[plugin_columns.favorite] = (manager->get_status (*i) == PluginManager::Favorite);
|
|
|
|
newrow[plugin_columns.hidden] = (manager->get_status (*i) == PluginManager::Hidden);
|
2008-01-10 16:20:59 -05:00
|
|
|
newrow[plugin_columns.name] = (*i)->name;
|
|
|
|
newrow[plugin_columns.type_name] = type;
|
|
|
|
newrow[plugin_columns.category] = (*i)->category;
|
2006-08-01 00:05:15 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
string creator = (*i)->creator;
|
|
|
|
string::size_type pos = 0;
|
2006-07-31 18:05:28 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
/* stupid LADSPA creator strings */
|
2006-07-31 18:05:28 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
|
|
|
|
creator = creator.substr (0, pos);
|
2006-07-31 18:05:28 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
newrow[plugin_columns.creator] = creator;
|
|
|
|
|
2009-05-04 11:50:51 -04:00
|
|
|
snprintf (buf, sizeof(buf), "%d", (*i)->n_inputs.n_audio());
|
|
|
|
newrow[plugin_columns.audio_ins] = buf;
|
|
|
|
snprintf (buf, sizeof(buf), "%d", (*i)->n_inputs.n_midi());
|
|
|
|
newrow[plugin_columns.midi_ins] = buf;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
|
|
|
snprintf (buf, sizeof(buf), "%d", (*i)->n_outputs.n_audio());
|
2009-05-04 11:50:51 -04:00
|
|
|
newrow[plugin_columns.audio_outs] = buf;
|
2009-10-14 12:10:01 -04:00
|
|
|
snprintf (buf, sizeof(buf), "%d", (*i)->n_outputs.n_midi());
|
2009-05-04 11:50:51 -04:00
|
|
|
newrow[plugin_columns.midi_outs] = buf;
|
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
|
|
|
|
PluginSelector::ladspa_refiller (const std::string& filterstr)
|
|
|
|
{
|
|
|
|
refiller (manager->ladspa_plugin_info(), filterstr, "LADSPA");
|
2006-08-01 00:05:15 -04:00
|
|
|
}
|
|
|
|
|
2008-01-18 22:49:52 -05:00
|
|
|
void
|
|
|
|
PluginSelector::lv2_refiller (const std::string& filterstr)
|
|
|
|
{
|
2011-05-14 17:05:26 -04:00
|
|
|
#ifdef LV2_SUPPORT
|
2008-01-18 22:49:52 -05:00
|
|
|
refiller (manager->lv2_plugin_info(), filterstr, "LV2");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-08-01 00:05:15 -04:00
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
#ifdef VST_SUPPORT
|
2008-01-10 16:20:59 -05:00
|
|
|
PluginSelector::vst_refiller (const std::string& filterstr)
|
2009-07-21 11:55:17 -04:00
|
|
|
#else
|
|
|
|
PluginSelector::vst_refiller (const std::string&)
|
|
|
|
#endif
|
2006-08-01 00:05:15 -04:00
|
|
|
{
|
2008-01-10 16:20:59 -05:00
|
|
|
#ifdef VST_SUPPORT
|
|
|
|
refiller (manager->vst_plugin_info(), filterstr, "VST");
|
|
|
|
#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
|
|
|
|
PluginSelector::lxvst_refiller (const std::string& filterstr)
|
|
|
|
#else
|
|
|
|
PluginSelector::lxvst_refiller (const std::string&)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
#ifdef LXVST_SUPPORT
|
|
|
|
refiller (manager->lxvst_plugin_info(), filterstr, "LXVST");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
void
|
2011-10-18 11:08:42 -04:00
|
|
|
#ifdef AUDIOUNIT_SUPPORT
|
2008-01-10 16:20:59 -05:00
|
|
|
PluginSelector::au_refiller (const std::string& filterstr)
|
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
|
2008-01-10 16:20:59 -05:00
|
|
|
refiller (manager->au_plugin_info(), filterstr, "AU");
|
|
|
|
#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()
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
2005-11-27 12:59:03 -05:00
|
|
|
void
|
|
|
|
PluginSelector::btn_update_clicked()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-27 12:59:03 -05:00
|
|
|
manager->refresh ();
|
2007-07-30 18:14:04 -04:00
|
|
|
refill();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-01-10 16:20:59 -05:00
|
|
|
PluginSelector::display_selection_changed()
|
2007-07-30 18:14:04 -04:00
|
|
|
{
|
2008-01-10 16:20:59 -05:00
|
|
|
if (plugin_display.get_selection()->count_selected_rows() != 0) {
|
2006-08-01 00:05:15 -04:00
|
|
|
btn_add->set_sensitive (true);
|
|
|
|
} else {
|
|
|
|
btn_add->set_sensitive (false);
|
|
|
|
}
|
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);
|
2011-02-24 16:15:45 -05: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);
|
2011-02-24 16:15:45 -05: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;
|
|
|
|
|
|
|
|
return (int) r;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2007-07-30 18:14:04 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::filter_button_clicked ()
|
|
|
|
{
|
|
|
|
filter_entry.set_text ("");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PluginSelector::filter_entry_changed ()
|
|
|
|
{
|
|
|
|
refill ();
|
|
|
|
}
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2007-07-30 18:14:04 -04:00
|
|
|
PluginSelector::filter_mode_changed ()
|
|
|
|
{
|
2008-09-10 11:03:30 -04:00
|
|
|
std::string mode = filter_mode.get_active_text ();
|
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
if (mode == _("Favorites only") || mode == _("Hidden only")) {
|
2008-09-10 11:03:30 -04:00
|
|
|
filter_entry.set_sensitive (false);
|
|
|
|
} else {
|
|
|
|
filter_entry.set_sensitive (true);
|
|
|
|
}
|
|
|
|
|
2007-07-30 18:14:04 -04:00
|
|
|
refill ();
|
|
|
|
}
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
void
|
|
|
|
PluginSelector::on_show ()
|
|
|
|
{
|
|
|
|
ArdourDialog::on_show ();
|
|
|
|
filter_entry.grab_focus ();
|
|
|
|
}
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
struct PluginMenuCompareByCreator {
|
2008-09-10 11:03:30 -04:00
|
|
|
bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
|
|
|
|
int cmp;
|
|
|
|
|
|
|
|
cmp = strcasecmp (a->creator.c_str(), b->creator.c_str());
|
|
|
|
|
|
|
|
if (cmp < 0) {
|
|
|
|
return true;
|
|
|
|
} else if (cmp == 0) {
|
|
|
|
/* same creator ... compare names */
|
|
|
|
if (strcasecmp (a->name.c_str(), b->name.c_str()) < 0) {
|
|
|
|
return true;
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
struct PluginMenuCompareByName {
|
|
|
|
bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
|
|
|
|
int cmp;
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
cmp = strcasecmp (a->name.c_str(), b->name.c_str());
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
if (cmp < 0) {
|
|
|
|
return true;
|
|
|
|
} else if (cmp == 0) {
|
|
|
|
/* same name ... compare type */
|
|
|
|
if (a->type < b->type) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
struct PluginMenuCompareByCategory {
|
|
|
|
bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
|
|
|
|
int cmp;
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
cmp = strcasecmp (a->category.c_str(), b->category.c_str());
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
if (cmp < 0) {
|
|
|
|
return true;
|
|
|
|
} else if (cmp == 0) {
|
|
|
|
/* same category ... compare names */
|
|
|
|
if (strcasecmp (a->name.c_str(), b->name.c_str()) < 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
all_plugs.insert (all_plugs.end(), manager->ladspa_plugin_info().begin(), manager->ladspa_plugin_info().end());
|
|
|
|
#ifdef VST_SUPPORT
|
|
|
|
all_plugs.insert (all_plugs.end(), manager->vst_plugin_info().begin(), manager->vst_plugin_info().end());
|
|
|
|
#endif
|
2011-09-20 16:29:47 -04:00
|
|
|
#ifdef LXVST_SUPPORT
|
|
|
|
all_plugs.insert (all_plugs.end(), manager->lxvst_plugin_info().begin(), manager->lxvst_plugin_info().end());
|
|
|
|
#endif
|
2011-10-18 11:08:42 -04:00
|
|
|
#ifdef AUDIOUNIT_SUPPORT
|
2008-09-10 11:03:30 -04:00
|
|
|
all_plugs.insert (all_plugs.end(), manager->au_plugin_info().begin(), manager->au_plugin_info().end());
|
|
|
|
#endif
|
2011-05-14 17:05:26 -04:00
|
|
|
#ifdef LV2_SUPPORT
|
2008-09-10 11:03:30 -04:00
|
|
|
all_plugs.insert (all_plugs.end(), manager->lv2_plugin_info().begin(), manager->lv2_plugin_info().end());
|
|
|
|
#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
|
|
|
|
|
|
|
Menu* by_category = create_by_category_menu(all_plugs);
|
2009-11-15 12:19:38 -05:00
|
|
|
items.push_back (MenuElem (_("By Category"), *manage (by_category)));
|
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) {
|
|
|
|
if (manager->get_status (*i) == PluginManager::Favorite) {
|
2009-12-11 18:29:48 -05:00
|
|
|
favs->items().push_back (MenuElem ((*i)->name, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))));
|
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)
|
|
|
|
{
|
|
|
|
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) {
|
|
|
|
|
|
|
|
if (manager->get_status (*i) == PluginManager::Hidden) continue;
|
|
|
|
|
|
|
|
string creator = (*i)->creator;
|
|
|
|
|
|
|
|
/* stupid LADSPA creator strings */
|
|
|
|
string::size_type pos = 0;
|
2008-09-10 11:03:30 -04:00
|
|
|
while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
|
|
|
|
creator = creator.substr (0, pos);
|
|
|
|
|
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 {
|
|
|
|
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");
|
|
|
|
}
|
2009-12-11 18:29:48 -05:00
|
|
|
submenu->items().push_back (MenuElem ((*i)->name, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))));
|
2008-09-10 11:03:30 -04: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*
|
|
|
|
PluginSelector::create_by_category_menu (ARDOUR::PluginInfoList& all_plugs)
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
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 category_submenu_map;
|
|
|
|
|
|
|
|
Menu* by_category = new Menu();
|
|
|
|
by_category->set_name("ArdourContextMenu");
|
|
|
|
|
|
|
|
MenuList& by_category_items = by_category->items();
|
|
|
|
PluginMenuCompareByCategory cmp_by_category;
|
|
|
|
all_plugs.sort (cmp_by_category);
|
|
|
|
|
|
|
|
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
|
|
|
|
|
|
|
|
if (manager->get_status (*i) == PluginManager::Hidden) continue;
|
|
|
|
|
|
|
|
string category = (*i)->category;
|
|
|
|
|
|
|
|
SubmenuMap::iterator x;
|
|
|
|
Gtk::Menu* submenu;
|
|
|
|
if ((x = category_submenu_map.find (category)) != category_submenu_map.end()) {
|
|
|
|
submenu = x->second;
|
|
|
|
} else {
|
|
|
|
submenu = new Gtk::Menu;
|
2009-11-15 12:19:38 -05:00
|
|
|
by_category_items.push_back (MenuElem (category, *manage (submenu)));
|
2010-09-14 12:51:02 -04:00
|
|
|
category_submenu_map.insert (pair<std::string,Menu*> (category, submenu));
|
2009-11-08 14:15:28 -05:00
|
|
|
submenu->set_name("ArdourContextMenu");
|
|
|
|
}
|
2009-12-11 18:29:48 -05:00
|
|
|
submenu->items().push_back (MenuElem ((*i)->name, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i))));
|
2009-11-08 14:15:28 -05:00
|
|
|
}
|
|
|
|
return by_category;
|
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 */
|
|
|
|
|
|
|
|
(*iter)[plugin_columns.favorite] = favorite;
|
2009-11-08 14:15:28 -05:00
|
|
|
(*iter)[plugin_columns.hidden] = false;
|
|
|
|
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
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
manager->set_status (pi->type, pi->unique_id, status);
|
|
|
|
|
|
|
|
manager->save_statuses ();
|
2009-11-15 20:06:33 -05:00
|
|
|
|
|
|
|
build_plugin_menu ();
|
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 */
|
|
|
|
|
|
|
|
(*iter)[plugin_columns.favorite] = false;
|
|
|
|
(*iter)[plugin_columns.hidden] = hidden;
|
|
|
|
PluginManager::PluginStatusType status = (hidden ? PluginManager::Hidden : PluginManager::Normal);
|
|
|
|
|
|
|
|
/* save new statuses list */
|
|
|
|
|
|
|
|
pi = (*iter)[plugin_columns.plugin];
|
|
|
|
|
|
|
|
manager->set_status (pi->type, pi->unique_id, status);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-11-08 14:15:28 -05:00
|
|
|
manager->save_statuses ();
|
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;
|
|
|
|
}
|