re-work VST paths configuration.
environment vars provide the "default", but are no longer relevant once ardour-internal paths are configured.
This commit is contained in:
@@ -1106,7 +1106,7 @@ private:
|
||||
Gtkmm2ext::PathsDialog *pd = new Gtkmm2ext::PathsDialog (
|
||||
_("Set Windows VST Search Path"),
|
||||
_rc_config->get_plugin_path_vst(),
|
||||
PluginManager::instance().get_windows_vst_path()
|
||||
PluginManager::instance().get_default_windows_vst_path()
|
||||
);
|
||||
ResponseType r = (ResponseType) pd->run ();
|
||||
pd->hide();
|
||||
@@ -1121,7 +1121,7 @@ private:
|
||||
Gtkmm2ext::PathsDialog *pd = new Gtkmm2ext::PathsDialog (
|
||||
_("Set Linux VST Search Path"),
|
||||
_rc_config->get_plugin_path_lxvst(),
|
||||
PluginManager::instance().get_lxvst_path()
|
||||
PluginManager::instance().get_default_lxvst_path()
|
||||
);
|
||||
ResponseType r = (ResponseType) pd->run ();
|
||||
pd->hide();
|
||||
|
||||
@@ -56,10 +56,8 @@ class LIBARDOUR_API PluginManager : public boost::noncopyable {
|
||||
void clear_vst_cache ();
|
||||
void clear_vst_blacklist ();
|
||||
|
||||
const std::string get_windows_vst_path() const { return windows_vst_path; }
|
||||
const std::string get_lxvst_path() const { return lxvst_path; }
|
||||
const std::string windows_vst_search_path() const;
|
||||
const std::string lxvst_search_path() const;
|
||||
const std::string get_default_windows_vst_path() const { return windows_vst_path; }
|
||||
const std::string get_default_lxvst_path() const { return lxvst_path; }
|
||||
|
||||
bool cancelled () { return cancel_scan; }
|
||||
|
||||
|
||||
@@ -208,10 +208,8 @@ CONFIG_VARIABLE (bool, show_plugin_scan_window, "show-plugin-scan-window", false
|
||||
CONFIG_VARIABLE (bool, discover_vst_on_start, "discover-vst-on-start", false)
|
||||
|
||||
/* custom user plugin paths */
|
||||
CONFIG_VARIABLE (std::string, plugin_path_ladspa, "plugin-path-ladspa,", "")
|
||||
CONFIG_VARIABLE (std::string, plugin_path_lv2, "plugin-path-lv2,", "")
|
||||
CONFIG_VARIABLE (std::string, plugin_path_vst, "plugin-path-vst,", "")
|
||||
CONFIG_VARIABLE (std::string, plugin_path_lxvst, "plugin-path-lxvst,", "")
|
||||
CONFIG_VARIABLE (std::string, plugin_path_vst, "plugin-path-vst", "@default@")
|
||||
CONFIG_VARIABLE (std::string, plugin_path_lxvst, "plugin-path-lxvst", "@default@")
|
||||
|
||||
/* denormal management */
|
||||
|
||||
|
||||
@@ -172,6 +172,14 @@ PluginManager::PluginManager ()
|
||||
"/usr/lib/vst:/usr/local/lib/vst";
|
||||
}
|
||||
|
||||
/* first time setup, use 'default' path */
|
||||
if (Config->get_plugin_path_lxvst() == X_("@default@")) {
|
||||
Config->set_plugin_path_lxvst(get_default_lxvst_path());
|
||||
}
|
||||
if (Config->get_plugin_path_vst() == X_("@default@")) {
|
||||
Config->set_plugin_path_vst(get_default_windows_vst_path());
|
||||
}
|
||||
|
||||
if (_instance == 0) {
|
||||
_instance = this;
|
||||
}
|
||||
@@ -184,55 +192,38 @@ PluginManager::~PluginManager()
|
||||
{
|
||||
}
|
||||
|
||||
const std::string
|
||||
PluginManager::lxvst_search_path() const
|
||||
{
|
||||
std::string searchpath = lxvst_path;
|
||||
if (!Config->get_plugin_path_lxvst().empty()) {
|
||||
searchpath += G_SEARCHPATH_SEPARATOR;
|
||||
searchpath += Config->get_plugin_path_lxvst();
|
||||
}
|
||||
return searchpath;
|
||||
}
|
||||
|
||||
const std::string
|
||||
PluginManager::windows_vst_search_path() const
|
||||
{
|
||||
std::string searchpath = windows_vst_path;
|
||||
if (!Config->get_plugin_path_vst().empty()) {
|
||||
searchpath += G_SEARCHPATH_SEPARATOR;
|
||||
searchpath += Config->get_plugin_path_vst();
|
||||
}
|
||||
return searchpath;
|
||||
}
|
||||
|
||||
void
|
||||
PluginManager::refresh (bool cache_only)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::PluginManager, "PluginManager::refresh\n");
|
||||
BootMessage (_("Discovering Plugins"));
|
||||
cancel_scan = false;
|
||||
|
||||
BootMessage (_("Scanning LADSPA Plugins"));
|
||||
ladspa_refresh ();
|
||||
#ifdef LV2_SUPPORT
|
||||
BootMessage (_("Scanning LV2 Plugins"));
|
||||
lv2_refresh ();
|
||||
#endif
|
||||
#ifdef WINDOWS_VST_SUPPORT
|
||||
if (Config->get_use_windows_vst()) {
|
||||
BootMessage (_("Scanning Windows VST Plugins"));
|
||||
windows_vst_refresh (cache_only);
|
||||
}
|
||||
#endif // WINDOWS_VST_SUPPORT
|
||||
|
||||
#ifdef LXVST_SUPPORT
|
||||
if(Config->get_use_lxvst()) {
|
||||
BootMessage (_("Scanning Linux VST Plugins"));
|
||||
lxvst_refresh(cache_only);
|
||||
}
|
||||
#endif //Native linuxVST SUPPORT
|
||||
|
||||
#ifdef AUDIOUNIT_SUPPORT
|
||||
BootMessage (_("Scanning AU Plugins"));
|
||||
au_refresh ();
|
||||
#endif
|
||||
|
||||
BootMessage (_("Plugin Scan Complete..."));
|
||||
PluginListChanged (); /* EMIT SIGNAL */
|
||||
PluginScanMessage(X_("closeme"), "", false);
|
||||
cancel_scan = false;
|
||||
@@ -253,7 +244,7 @@ PluginManager::clear_vst_cache ()
|
||||
PathScanner scanner;
|
||||
vector<string *> *fsi_files;
|
||||
|
||||
fsi_files = scanner (windows_vst_search_path(), "\\.fsi$", true, true, -1, false);
|
||||
fsi_files = scanner (Config->get_plugin_path_vst(), "\\.fsi$", true, true, -1, false);
|
||||
if (fsi_files) {
|
||||
for (vector<string *>::iterator i = fsi_files->begin(); i != fsi_files->end (); ++i) {
|
||||
::g_unlink((*i)->c_str());
|
||||
@@ -267,7 +258,7 @@ PluginManager::clear_vst_cache ()
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string *> *fsi_files;
|
||||
fsi_files = scanner (lxvst_search_path(), "\\.fsi$", true, true, -1, false);
|
||||
fsi_files = scanner (Config->get_plugin_path_lxvst(), "\\.fsi$", true, true, -1, false);
|
||||
if (fsi_files) {
|
||||
for (vector<string *>::iterator i = fsi_files->begin(); i != fsi_files->end (); ++i) {
|
||||
::g_unlink((*i)->c_str());
|
||||
@@ -301,7 +292,7 @@ PluginManager::clear_vst_blacklist ()
|
||||
PathScanner scanner;
|
||||
vector<string *> *fsi_files;
|
||||
|
||||
fsi_files = scanner (windows_vst_search_path(), "\\.fsb$", true, true, -1, false);
|
||||
fsi_files = scanner (Config->get_plugin_path_vst(), "\\.fsb$", true, true, -1, false);
|
||||
if (fsi_files) {
|
||||
for (vector<string *>::iterator i = fsi_files->begin(); i != fsi_files->end (); ++i) {
|
||||
::g_unlink((*i)->c_str());
|
||||
@@ -315,7 +306,7 @@ PluginManager::clear_vst_blacklist ()
|
||||
{
|
||||
PathScanner scanner;
|
||||
vector<string *> *fsi_files;
|
||||
fsi_files = scanner (lxvst_search_path(), "\\.fsb$", true, true, -1, false);
|
||||
fsi_files = scanner (Config->get_plugin_path_lxvst(), "\\.fsb$", true, true, -1, false);
|
||||
if (fsi_files) {
|
||||
for (vector<string *>::iterator i = fsi_files->begin(); i != fsi_files->end (); ++i) {
|
||||
::g_unlink((*i)->c_str());
|
||||
@@ -648,7 +639,7 @@ PluginManager::windows_vst_refresh (bool cache_only)
|
||||
_windows_vst_plugin_info = new ARDOUR::PluginInfoList();
|
||||
}
|
||||
|
||||
windows_vst_discover_from_path (windows_vst_search_path(), cache_only);
|
||||
windows_vst_discover_from_path (Config->get_plugin_path_vst(), cache_only);
|
||||
}
|
||||
|
||||
static bool windows_vst_filter (const string& str, void * /*arg*/)
|
||||
@@ -668,7 +659,7 @@ PluginManager::windows_vst_discover_from_path (string path, bool cache_only)
|
||||
|
||||
DEBUG_TRACE (DEBUG::PluginManager, string_compose ("detecting Windows VST plugins along %1\n", path));
|
||||
|
||||
plugin_objects = scanner (windows_vst_search_path(), windows_vst_filter, 0, false, true);
|
||||
plugin_objects = scanner (Config->get_plugin_path_vst(), windows_vst_filter, 0, false, true);
|
||||
|
||||
if (plugin_objects) {
|
||||
for (x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
|
||||
@@ -766,7 +757,7 @@ PluginManager::lxvst_refresh (bool cache_only)
|
||||
_lxvst_plugin_info = new ARDOUR::PluginInfoList();
|
||||
}
|
||||
|
||||
lxvst_discover_from_path (lxvst_search_path(), cache_only);
|
||||
lxvst_discover_from_path (Config->get_plugin_path_lxvst(), cache_only);
|
||||
}
|
||||
|
||||
static bool lxvst_filter (const string& str, void *)
|
||||
@@ -790,7 +781,7 @@ PluginManager::lxvst_discover_from_path (string path, bool cache_only)
|
||||
|
||||
DEBUG_TRACE (DEBUG::PluginManager, string_compose ("Discovering linuxVST plugins along %1\n", path));
|
||||
|
||||
plugin_objects = scanner (lxvst_search_path(), lxvst_filter, 0, false, true);
|
||||
plugin_objects = scanner (Config->get_plugin_path_lxvst(), lxvst_filter, 0, false, true);
|
||||
|
||||
if (plugin_objects) {
|
||||
for (x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
|
||||
|
||||
@@ -28,10 +28,10 @@ namespace Gtkmm2ext {
|
||||
class PathsDialog : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
PathsDialog (std::string, std::string, std::string);
|
||||
PathsDialog (std::string, std::string current_paths = "", std::string default_paths = "");
|
||||
~PathsDialog ();
|
||||
|
||||
std::string get_serialized_paths (bool include_fixed = false);
|
||||
std::string get_serialized_paths ();
|
||||
|
||||
private:
|
||||
void on_show ();
|
||||
@@ -40,10 +40,14 @@ class PathsDialog : public Gtk::Dialog
|
||||
|
||||
Gtk::Button add_path_button;
|
||||
Gtk::Button remove_path_button;
|
||||
Gtk::Button set_default_button;
|
||||
|
||||
void selection_changed();
|
||||
void add_path();
|
||||
void remove_path();
|
||||
void set_default();
|
||||
|
||||
std::string _default_paths;
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
||||
@@ -26,11 +26,13 @@ using namespace Gtk;
|
||||
using namespace std;
|
||||
using namespace Gtkmm2ext;
|
||||
|
||||
PathsDialog::PathsDialog (std::string title, std::string user_paths, std::string fixed_paths)
|
||||
PathsDialog::PathsDialog (std::string title, std::string current_paths, std::string default_paths)
|
||||
: Dialog (title, true)
|
||||
, paths_list_view(2, false, Gtk::SELECTION_SINGLE)
|
||||
, paths_list_view(1, false, Gtk::SELECTION_SINGLE)
|
||||
, add_path_button(_("Add"))
|
||||
, remove_path_button(_("Delete"))
|
||||
, set_default_button(_("Reset to Default"))
|
||||
, _default_paths(default_paths)
|
||||
{
|
||||
set_name ("PathsDialog");
|
||||
set_skip_taskbar_hint (true);
|
||||
@@ -41,35 +43,34 @@ PathsDialog::PathsDialog (std::string title, std::string user_paths, std::string
|
||||
|
||||
add_path_button.signal_clicked().connect (sigc::mem_fun (*this, &PathsDialog::add_path));
|
||||
remove_path_button.signal_clicked().connect (sigc::mem_fun (*this, &PathsDialog::remove_path));
|
||||
set_default_button.signal_clicked().connect (sigc::mem_fun (*this, &PathsDialog::set_default));
|
||||
remove_path_button.set_sensitive(false);
|
||||
|
||||
paths_list_view.set_column_title(0,"Type");
|
||||
paths_list_view.set_column_title(1,"Path");
|
||||
paths_list_view.set_column_title(0,"Path");
|
||||
|
||||
/* TODO fill in Text View */
|
||||
std::vector <std::string> a = PBD::parse_path(user_paths);
|
||||
std::vector <std::string> a = PBD::parse_path(current_paths);
|
||||
for(vector<std::string>::const_iterator i = a.begin(); i != a.end(); ++i) {
|
||||
int row = paths_list_view.append(_("user"));
|
||||
paths_list_view.set_text(row, 1, *i);
|
||||
}
|
||||
a = PBD::parse_path(fixed_paths);
|
||||
for(vector<std::string>::const_iterator i = a.begin(); i != a.end(); ++i) {
|
||||
int row = paths_list_view.append( _("sys"));
|
||||
paths_list_view.set_text(row, 1, *i);
|
||||
paths_list_view.append(*i);
|
||||
}
|
||||
|
||||
paths_list_view.get_selection()->signal_changed().connect (mem_fun (*this, &PathsDialog::selection_changed));
|
||||
|
||||
VBox *vbox = manage (new VBox);
|
||||
vbox->pack_start (add_path_button, false, false);
|
||||
vbox->pack_start (remove_path_button, false, false);
|
||||
vbox->pack_start (set_default_button, false, false);
|
||||
|
||||
/* Overall layout */
|
||||
HBox *hbox = manage (new HBox);
|
||||
hbox->pack_start (paths_list_view, true, true);
|
||||
hbox->pack_start (*vbox, false, false);
|
||||
hbox->pack_start (paths_list_view, true, true); // TODO, wrap in scroll-area ?!
|
||||
hbox->set_spacing (4);
|
||||
|
||||
get_vbox()->set_spacing (4);
|
||||
get_vbox()->pack_start (*hbox, true, true);
|
||||
|
||||
add_button (Stock::CANCEL, RESPONSE_CANCEL);
|
||||
add_button (Stock::OK, RESPONSE_ACCEPT);
|
||||
get_action_area()->pack_start (add_path_button, false, false);
|
||||
get_action_area()->pack_start (remove_path_button, false, false);
|
||||
|
||||
show_all_children ();
|
||||
}
|
||||
@@ -84,12 +85,11 @@ PathsDialog::on_show() {
|
||||
}
|
||||
|
||||
std::string
|
||||
PathsDialog::get_serialized_paths(bool include_fixed) {
|
||||
PathsDialog::get_serialized_paths() {
|
||||
std::string path;
|
||||
for (unsigned int i = 0; i < paths_list_view.size(); ++i) {
|
||||
if (!include_fixed && paths_list_view.get_text(i, 0) != _("user")) continue;
|
||||
if (i > 0) path += G_SEARCHPATH_SEPARATOR;
|
||||
path += paths_list_view.get_text(i, 1);
|
||||
path += paths_list_view.get_text(i, 0);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
@@ -98,13 +98,10 @@ void
|
||||
PathsDialog::selection_changed () {
|
||||
std::vector<int> selection = paths_list_view.get_selected();
|
||||
if (selection.size() > 0) {
|
||||
const int row = selection.at(0);
|
||||
if (paths_list_view.get_text(row, 0) == _("user")) {
|
||||
remove_path_button.set_sensitive(true);
|
||||
return;
|
||||
}
|
||||
remove_path_button.set_sensitive(true);
|
||||
} else {
|
||||
remove_path_button.set_sensitive(false);
|
||||
}
|
||||
remove_path_button.set_sensitive(false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -118,14 +115,13 @@ PathsDialog::add_path() {
|
||||
if (Glib::file_test (dir, Glib::FILE_TEST_IS_DIR|Glib::FILE_TEST_EXISTS)) {
|
||||
bool dup = false;
|
||||
for (unsigned int i = 0; i < paths_list_view.size(); ++i) {
|
||||
if (paths_list_view.get_text(i, 1) == dir) {
|
||||
if (paths_list_view.get_text(i, 0) == dir) {
|
||||
dup = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dup) {
|
||||
paths_list_view.prepend(_("user"));
|
||||
paths_list_view.set_text(0, 1, dir);
|
||||
paths_list_view.prepend(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,9 +130,7 @@ PathsDialog::add_path() {
|
||||
void
|
||||
PathsDialog::remove_path() {
|
||||
std::vector<int> selection = paths_list_view.get_selected();
|
||||
if (selection.size() != 1) { return ; }
|
||||
const int row = selection.at(0);
|
||||
if (paths_list_view.get_text(row, 0) != _("user")) { return ; }
|
||||
if (selection.size() == 0 ) { return ; }
|
||||
|
||||
/* Gtk::ListViewText internals to delete row(s) */
|
||||
Gtk::TreeModel::iterator row_it = paths_list_view.get_selection()->get_selected();
|
||||
@@ -152,3 +146,13 @@ PathsDialog::remove_path() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PathsDialog::set_default() {
|
||||
|
||||
paths_list_view.clear_items();
|
||||
std::vector <std::string> a = PBD::parse_path(_default_paths);
|
||||
for(vector<std::string>::const_iterator i = a.begin(); i != a.end(); ++i) {
|
||||
paths_list_view.append(*i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user