#include <algorithm>
-#include <gtkmm/table.h>
-#include <gtkmm/stock.h>
#include <gtkmm/button.h>
+#include <gtkmm/comboboxtext.h>
+#include <gtkmm/frame.h>
+#include <gtkmm/messagedialog.h>
#include <gtkmm/notebook.h>
+#include <gtkmm/stock.h>
+#include <gtkmm/table.h>
-#include <gtkmm2ext/utils.h>
-
+#include "gtkmm2ext/utils.h"
#include "pbd/convert.h"
+#include "widgets/tooltips.h"
#include "ardour/plugin_manager.h"
#include "ardour/plugin.h"
#include "plugin_selector.h"
#include "gui_thread.h"
-#include "tooltips.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace ARDOUR;
using namespace PBD;
using namespace Gtk;
using namespace std;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
static const char* _filter_mode_strings[] = {
N_("Name contains"),
manager.PluginListChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::build_plugin_menu, this), gui_context());
manager.PluginListChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::refill, this), gui_context());
+ manager.PluginStatusesChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::build_plugin_menu, this), gui_context());
+ manager.PluginStatusesChanged.connect (plugin_list_changed_connection, invalidator (*this), boost::bind (&PluginSelector::refill, this), gui_context());
build_plugin_menu ();
plugin_model = Gtk::ListStore::create (plugin_columns);
plugin_display.set_headers_clickable (true);
plugin_display.set_reorderable (false);
plugin_display.set_rules_hint (true);
+ plugin_display.add_object_drag (plugin_columns.plugin.index(), "PluginInfoPtr");
+ plugin_display.set_drag_column (plugin_columns.name.index());
+
+ // setting a sort-column prevents re-ordering via Drag/Drop
+ plugin_model->set_sort_column (plugin_columns.name.index(), Gtk::SORT_ASCENDING);
CellRendererToggle* fav_cell = dynamic_cast<CellRendererToggle*>(plugin_display.get_column_cell_renderer (0));
fav_cell->property_activatable() = true;
btn_add->set_name("PluginSelectorButton");
btn_remove->set_name("PluginSelectorButton");
+
Gtk::Table* table = manage(new Gtk::Table(7, 11));
table->set_size_request(750, 500);
- HBox* select_box = manage (new HBox);
+ Gtk::Table* filter_table = manage(new Gtk::Table(2, 5));
fil_hidden_button.set_name ("pluginlist hide button");
fil_hidden_button.set_text (_("Show Hidden"));
fil_hidden_button.set_active (_show_hidden);
- fil_hidden_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PluginSelector::fil_hidden_button_release), false);
set_tooltip (fil_hidden_button, _("Include hidden plugins in list."));
fil_instruments_button.set_name ("pluginlist filter button");
fil_instruments_button.set_text (_("Instruments"));
fil_instruments_button.set_active_state (_show_instruments);
- fil_instruments_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PluginSelector::fil_instruments_button_release), false);
- set_tooltip (fil_instruments_button, _("cycle display of instrument plugins (if any)."));
+ set_tooltip (fil_instruments_button, _("Cycle display of instrument plugins (if any)."));
fil_analysis_button.set_name ("pluginlist filter button");
fil_analysis_button.set_text (_("Analyzers"));
fil_analysis_button.set_active_state (_show_analysers);
- fil_analysis_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PluginSelector::fil_analysis_button_release), false);
set_tooltip (fil_analysis_button, _("Cycle display of analysis plugins (if any)."));
fil_utils_button.set_name ("pluginlist filter button");
fil_utils_button.set_text (_("Utils"));
fil_utils_button.set_active_state (_show_utils);
- fil_utils_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PluginSelector::fil_utils_button_release), false);
set_tooltip (fil_utils_button, _("Cycle display of utility plugins (if any)."));
- select_box->pack_start (fil_hidden_button, true, false);
- select_box->pack_start (fil_instruments_button, true, false);
- select_box->pack_start (fil_analysis_button, true, false);
- select_box->pack_start (fil_utils_button, true, false);
-
- select_box->show_all();
-
- 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);
+ fil_hidden_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PluginSelector::fil_hidden_button_release), false);
+ fil_instruments_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PluginSelector::fil_instruments_button_release), false);
+ fil_analysis_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PluginSelector::fil_analysis_button_release), false);
+ fil_utils_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PluginSelector::fil_utils_button_release), false);
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));
- filter_box->show ();
- filter_mode.show ();
- filter_entry.show ();
- filter_button.show ();
+ filter_table->attach (filter_mode, 0, 1, 0, 1, FILL, FILL);
+ filter_table->attach (filter_entry, 1, 4, 0, 1, FILL|EXPAND, FILL);
+ filter_table->attach (filter_button, 4, 5, 0, 1, FILL, FILL);
+
+ filter_table->attach (fil_hidden_button, 1, 2, 1, 2, FILL, FILL);
+ filter_table->attach (fil_instruments_button, 2, 3, 1, 2, FILL, FILL);
+ filter_table->attach (fil_analysis_button, 3, 4, 1, 2, FILL, FILL);
+ filter_table->attach (fil_utils_button, 4, 5, 1, 2, FILL, FILL);
+
+ filter_table->set_border_width (4);
+ filter_table->set_col_spacings (2);
+ filter_table->set_row_spacings (4);
+
+ Frame* filter_frame = manage (new Frame);
+ filter_frame->set_name ("BaseFrame");
+ filter_frame->set_label (_("Filter"));
+ filter_frame->add (*filter_table);
+
+ filter_frame->show_all ();
+
+ HBox* side_by_side = manage (new HBox);
+ VBox* right_side = manage (new VBox);
table->attach (scroller, 0, 7, 0, 5);
- table->attach (*select_box, 0, 7, 5, 6, FILL|EXPAND, FILL, 5, 5);
- table->attach (*filter_box, 0, 7, 6, 7, FILL|EXPAND, FILL, 5, 5);
- table->attach(*btn_add, 1, 2, 7, 8, FILL, FILL, 5, 5);
- table->attach(*btn_remove, 5, 6, 7, 8, FILL, FILL, 5, 5);
+ table->attach (*filter_frame, 0, 7, 6, 7, FILL|EXPAND, FILL, 5, 5);
- table->attach(ascroller, 0, 7, 8, 10);
+ right_side->pack_start (ascroller);
+
+ HBox* add_remove = manage (new HBox);
+ add_remove->pack_start (*btn_add, true, true);
+ add_remove->pack_start (*btn_remove, true, true);
+
+ right_side->pack_start (*add_remove, false, false);
+ right_side->set_size_request (200, -1);
+
+ side_by_side->pack_start (*table);
+ side_by_side->pack_start (*right_side);
add_button (Stock::CLOSE, RESPONSE_CLOSE);
add_button (_("Insert Plugin(s)"), RESPONSE_APPLY);
set_default_response (RESPONSE_APPLY);
set_response_sensitive (RESPONSE_APPLY, false);
- get_vbox()->pack_start (*table);
+ get_vbox()->pack_start (*side_by_side);
table->set_name("PluginSelectorTable");
plugin_display.set_name("PluginSelectorDisplay");
btn_remove_clicked();
}
+static bool is_analyzer (const PluginInfoPtr& info) {
+ // Anaylsis, Analyzer are for backwards compatibility (vst cache)
+ return info->in_category ("Analyser") || info->in_category ("Anaylsis") || info->in_category ("Analyzer");
+}
+
+static bool is_util (const PluginInfoPtr& info) {
+ // all MIDI plugins which are not Instruments are Utils.
+ return info->in_category ("Utility") || info->in_category ("MIDI") || info->in_category ("Generator");
+}
+
bool
PluginSelector::show_this_plugin (const PluginInfoPtr& info, const std::string& filterstr)
{
if (_show_instruments == Gtkmm2ext::Off && info->is_instrument()) {
return false;
}
- if (_show_analysers == Gtkmm2ext::Off && info->category == "Analyser") {
+ if (_show_analysers == Gtkmm2ext::Off && is_analyzer (info)) {
return false;
}
- if (_show_utils == Gtkmm2ext::Off && info->category == "Utility") {
+ if (_show_utils == Gtkmm2ext::Off && is_util (info)) {
return false;
}
if (_show_instruments == Gtkmm2ext::ExplicitActive && info->is_instrument()) {
exp_ok = true;
}
- if (_show_analysers == Gtkmm2ext::ExplicitActive && info->category == "Analyser") {
+ if (_show_analysers == Gtkmm2ext::ExplicitActive && is_analyzer(info)) {
exp_ok = true;
}
- if (_show_utils == Gtkmm2ext::ExplicitActive && info->category == "Utility") {
+ if (_show_utils == Gtkmm2ext::ExplicitActive && is_util (info)) {
exp_ok = true;
}
if (_show_instruments == Gtkmm2ext::ExplicitActive || _show_analysers == Gtkmm2ext::ExplicitActive || _show_utils == Gtkmm2ext::ExplicitActive) {
case LXVST:
compstr = X_("LXVST");
break;
+ case MacVST:
+ compstr = X_("MacVST");
+ break;
+ case Lua:
+ compstr = X_("Lua");
+ break;
}
} else if (mode == _("Author contains")) {
lv2_refiller (filterstr);
vst_refiller (filterstr);
lxvst_refiller (filterstr);
+ mac_vst_refiller (filterstr);
au_refiller (filterstr);
+ lua_refiller (filterstr);
in_row_change = false;
}
string creator = (*i)->creator;
string::size_type pos = 0;
- /* stupid LADSPA creator strings */
+ if ((*i)->type == ARDOUR::LADSPA) {
+ /* stupid LADSPA creator strings */
#ifdef PLATFORM_WINDOWS
- while (pos < creator.length() && creator[pos] > -2 && creator[pos] < 256 && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
+ while (pos < creator.length() && creator[pos] > -2 && creator[pos] < 256 && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
#else
- while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
+ while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
#endif
+ } else {
+ pos = creator.length ();
+ }
// If there were too few characters to create a
// meaningful name, mark this creator as 'Unknown'
- if (creator.length()<2 || pos<3)
+ if (creator.length() < 2 || pos < 3) {
creator = "Unknown";
- else
+ } else{
creator = creator.substr (0, pos);
+ }
newrow[plugin_columns.creator] = creator;
refiller (manager.ladspa_plugin_info(), filterstr, "LADSPA");
}
+void
+PluginSelector::lua_refiller (const std::string& filterstr)
+{
+ refiller (manager.lua_plugin_info(), filterstr, "Lua");
+}
+
void
PluginSelector::lv2_refiller (const std::string& filterstr)
{
#endif
}
+void
+#ifdef MACVST_SUPPORT
+PluginSelector::mac_vst_refiller (const std::string& filterstr)
+#else
+PluginSelector::mac_vst_refiller (const std::string&)
+#endif
+{
+#ifdef MACVST_SUPPORT
+ refiller (manager.mac_vst_plugin_info(), filterstr, "MacVST");
+#endif
+}
+
void
#ifdef AUDIOUNIT_SUPPORT
PluginSelector::au_refiller (const std::string& filterstr)
PluginPtr p = load_plugin (pp);
if (p) {
plugins.push_back (p);
- } else {
- MessageDialog msg (string_compose (_("The plugin \"%1\" could not be loaded\n\nSee the Log window for more details (maybe)"), pp->name));
- msg.run ();
- }
+ } else {
+ MessageDialog msg (string_compose (_("The plugin \"%1\" could not be loaded\n\nSee the Log window for more details (maybe)"), pp->name));
+ msg.run ();
+ }
}
if (interested_object && !plugins.empty()) {
finish = !interested_object->use_plugins (plugins);
- }
+ }
break;
if (mode == _("Favorites only") || mode == _("Hidden only")) {
filter_entry.set_sensitive (false);
+ filter_button.set_sensitive (false);
+ fil_hidden_button.set_sensitive (false);
+ fil_instruments_button.set_sensitive (false);
+ fil_analysis_button.set_sensitive (false);
+ fil_utils_button.set_sensitive (false);
} else {
filter_entry.set_sensitive (true);
+ filter_button.set_sensitive (true);
+ fil_hidden_button.set_sensitive (true);
+ fil_instruments_button.set_sensitive (true);
+ fil_analysis_button.set_sensitive (true);
+ fil_utils_button.set_sensitive (true);
}
refill ();
}
struct PluginMenuCompareByCreator {
- bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
- int cmp;
-
- cmp = cmp_nocase_utf8 (a->creator, b->creator);
-
- if (cmp < 0) {
- return true;
- } else if (cmp == 0) {
- /* same creator ... compare names */
- if (cmp_nocase_utf8 (a->name, b->name) < 0) {
- return true;
- }
- }
- return false;
- }
+ bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
+ int cmp;
+
+ cmp = cmp_nocase_utf8 (a->creator, b->creator);
+
+ if (cmp < 0) {
+ return true;
+ } else if (cmp == 0) {
+ /* same creator ... compare names */
+ if (cmp_nocase_utf8 (a->name, b->name) < 0) {
+ return true;
+ }
+ }
+ return false;
+ }
};
struct PluginMenuCompareByName {
- bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
- int cmp;
-
- cmp = cmp_nocase_utf8 (a->name, b->name);
-
- if (cmp < 0) {
- return true;
- } else if (cmp == 0) {
- /* same name ... compare type */
- if (a->type < b->type) {
- return true;
- }
- }
- return false;
- }
+ bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
+ int cmp;
+
+ cmp = cmp_nocase_utf8 (a->name, b->name);
+
+ if (cmp < 0) {
+ return true;
+ } else if (cmp == 0) {
+ /* same name ... compare type */
+ if (a->type < b->type) {
+ return true;
+ }
+ }
+ return false;
+ }
};
struct PluginMenuCompareByCategory {
- bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
- int cmp;
-
- cmp = cmp_nocase_utf8 (a->category, b->category);
-
- if (cmp < 0) {
- return true;
- } else if (cmp == 0) {
- /* same category ... compare names */
- if (cmp_nocase_utf8 (a->name, b->name) < 0) {
- return true;
- }
- }
- return false;
- }
+ bool operator() (PluginInfoPtr a, PluginInfoPtr b) const {
+ int cmp;
+
+ cmp = cmp_nocase_utf8 (a->category, b->category);
+
+ if (cmp < 0) {
+ return true;
+ } else if (cmp == 0) {
+ /* same category ... compare names */
+ if (cmp_nocase_utf8 (a->name, b->name) < 0) {
+ return true;
+ }
+ }
+ return false;
+ }
};
/** @return Plugin menu. The caller should not delete it */
PluginInfoList all_plugs;
all_plugs.insert (all_plugs.end(), manager.ladspa_plugin_info().begin(), manager.ladspa_plugin_info().end());
+ all_plugs.insert (all_plugs.end(), manager.lua_plugin_info().begin(), manager.lua_plugin_info().end());
#ifdef WINDOWS_VST_SUPPORT
all_plugs.insert (all_plugs.end(), manager.windows_vst_plugin_info().begin(), manager.windows_vst_plugin_info().end());
#endif
#ifdef LXVST_SUPPORT
all_plugs.insert (all_plugs.end(), manager.lxvst_plugin_info().begin(), manager.lxvst_plugin_info().end());
#endif
+#ifdef MACVST_SUPPORT
+ all_plugs.insert (all_plugs.end(), manager.mac_vst_plugin_info().begin(), manager.mac_vst_plugin_info().end());
+#endif
#ifdef AUDIOUNIT_SUPPORT
all_plugs.insert (all_plugs.end(), manager.au_plugin_info().begin(), manager.au_plugin_info().end());
#endif
items.push_back (MenuElem (_("By Category"), *manage (by_category)));
}
+string
+GetPluginTypeStr(PluginInfoPtr info)
+{
+ string type;
+
+ switch (info->type) {
+ case LADSPA:
+ type = X_(" (LADSPA)");
+ break;
+ case AudioUnit:
+ type = X_(" (AU)");
+ break;
+ case LV2:
+ type = X_(" (LV2)");
+ break;
+ case Windows_VST:
+ case LXVST:
+ case MacVST:
+ type = X_(" (VST)");
+ break;
+ case Lua:
+ type = X_(" (Lua)");
+ break;
+ }
+
+ return type;
+}
+
Gtk::Menu*
PluginSelector::create_favs_menu (PluginInfoList& all_plugs)
{
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
if (manager.get_status (*i) == PluginManager::Favorite) {
- MenuElem elem ((*i)->name, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)));
+ string typ = GetPluginTypeStr(*i);
+ MenuElem elem ((*i)->name + typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)));
elem.get_child()->set_use_underline (false);
favs->items().push_back (elem);
}
if (manager.get_status (*i) == PluginManager::Hidden) continue;
string creator = (*i)->creator;
-
- /* stupid LADSPA creator strings */
string::size_type pos = 0;
+
+ if ((*i)->type == ARDOUR::LADSPA) {
+ /* stupid LADSPA creator strings */
#ifdef PLATFORM_WINDOWS
- while (pos < creator.length() && creator[pos]>(-2) && creator[pos]<256 && (isprint (creator[pos]))) ++pos;
+ while (pos < creator.length() && creator[pos] > -2 && creator[pos] < 256 && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
#else
- while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
+ while (pos < creator.length() && (isalnum (creator[pos]) || isspace (creator[pos]))) ++pos;
#endif
+ } else {
+ pos = creator.length ();
+ }
- // Check to see if we found any invalid characters.
- if (creator.length() != pos) {
- // If there were too few characters to create a
- // meaningful name, mark this creator as 'Unknown'
- if (pos<3)
- creator = "Unknown?";
- else
- creator = creator.substr (0, pos);
+ // If there were too few characters to create a
+ // meaningful name, mark this creator as 'Unknown'
+ if (creator.length() < 2 || pos < 3) {
+ creator = "Unknown";
+ } else{
+ creator = creator.substr (0, pos);
}
SubmenuMap::iterator x;
creator_submenu_map.insert (pair<std::string,Menu*> (creator, submenu));
submenu->set_name("ArdourContextMenu");
}
- MenuElem elem ((*i)->name, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)));
+ string typ = GetPluginTypeStr(*i);
+ MenuElem elem ((*i)->name+typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)));
elem.get_child()->set_use_underline (false);
submenu->items().push_back (elem);
}
category_submenu_map.insert (pair<std::string,Menu*> (category, submenu));
submenu->set_name("ArdourContextMenu");
}
- MenuElem elem ((*i)->name, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)));
+ string typ = GetPluginTypeStr(*i);
+ MenuElem elem ((*i)->name + typ, (sigc::bind (sigc::mem_fun (*this, &PluginSelector::plugin_chosen_from_menu), *i)));
elem.get_child()->set_use_underline (false);
submenu->items().push_back (elem);
}
_show_hidden = (fil_hidden_button.active_state() == 0);
fil_hidden_button.set_active (_show_hidden);
refill ();
- return true;
+ return false;
}
static Gtkmm2ext::ActiveState next_state (Gtkmm2ext::ActiveState s){
case Gtkmm2ext::ExplicitActive:
return Gtkmm2ext::Off;
break;
+ default: assert(0); break; // not reached
}
+ /* impossible, but keep some compiles happy */
+ fatal << string_compose (_("programming error: %1"),
+ X_("Illegal Active State."))
+ << endmsg;
+ abort(); /*NOTREACHED*/
+ return Gtkmm2ext::Off;
}
static Gtkmm2ext::ActiveState prev_state (Gtkmm2ext::ActiveState s){
case Gtkmm2ext::ExplicitActive:
return Gtkmm2ext::ImplicitActive;
break;
+ default: assert(0); break; // not reached
}
+ /* impossible, but keep some compiles happy */
+ fatal << string_compose (_("programming error: %1"),
+ X_("Illegal Active State."))
+ << endmsg;
+ abort(); /*NOTREACHED*/
+ return Gtkmm2ext::Off;
}
bool
}
fil_instruments_button.set_active_state (_show_instruments);
refill ();
- return true;
+ return false;
}
bool
}
fil_analysis_button.set_active_state (_show_analysers);
refill ();
- return true;
+ return false;
}
bool
}
fil_utils_button.set_active_state (_show_utils);
refill ();
- return true;
+ return false;
}
void