diff --git a/gtk2_ardour/plugin_manager_ui.cc b/gtk2_ardour/plugin_manager_ui.cc index 9009c83aa4..57c443e3b7 100644 --- a/gtk2_ardour/plugin_manager_ui.cc +++ b/gtk2_ardour/plugin_manager_ui.cc @@ -28,6 +28,7 @@ #include "ardour/types_convert.h" #include "gtkmm2ext/gui_thread.h" +#include "widgets/paths_dialog.h" #include "ardour_message.h" #include "plugin_manager_ui.h" @@ -150,17 +151,17 @@ PluginManagerUI::PluginManagerUI () #if defined LXVST_SUPPORT ArdourWidgets::ArdourButton* btn_lxvst = Gtk::manage (new ArdourWidgets::ArdourButton (_("Linux VST2 Path"))); - btn_lxvst->signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &PluginManagerUI::edit_vst_path), LXVST)); + btn_lxvst->signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &PluginManagerUI::vst_path_cb), LXVST)); b_paths->pack_start (*btn_lxvst); #endif #ifdef WINDOWS_VST_SUPPORT ArdourWidgets::ArdourButton* btn_winvst = Gtk::manage (new ArdourWidgets::ArdourButton (_("Windows VST2 Path"))); - btn_winvst->signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &PluginManagerUI::edit_vst_path), Windows_VST)); + btn_winvst->signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &PluginManagerUI::vst_path_cb), Windows_VST)); b_paths->pack_start (*btn_winvst); #endif #ifdef VST3_SUPPORT ArdourWidgets::ArdourButton* btn_vst3 = Gtk::manage (new ArdourWidgets::ArdourButton (_("VST3 Path"))); - btn_vst3->signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &PluginManagerUI::edit_vst_path), VST3)); + btn_vst3->signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &PluginManagerUI::vst_path_cb), VST3)); b_paths->pack_start (*btn_vst3); #endif b_paths->pack_start (_btn_prefs); @@ -431,44 +432,62 @@ PluginManagerUI::show_plugin_prefs () } void -PluginManagerUI::edit_vst_path (ARDOUR::PluginType t) +PluginManagerUI::edit_vst_path (std::string const& title, std::string const& dflt, sigc::slot get, sigc::slot set) { - RCOptionEditor* rc_option_editor = ARDOUR_UI::instance()->get_rc_option_editor(); - if (rc_option_editor) { - switch (t) { + /* see also RCOptionEditor::edit_vst_path */ + ArdourWidgets::PathsDialog pd (*this, title, get (), dflt); + if (pd.run () != Gtk::RESPONSE_ACCEPT) { + return; + } + pd.hide(); + set (pd.get_serialized_paths ()); + + ArdourMessageDialog msg (_("Re-scan Plugins now?"), false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, true); + msg.set_default_response (Gtk::RESPONSE_YES); + if (msg.run() != Gtk::RESPONSE_YES) { + return; + } + msg.hide (); + PluginScanDialog psd (false, true, this); + psd.start (); +} + +void +PluginManagerUI::vst_path_cb (ARDOUR::PluginType t) +{ + switch (t) { #ifdef WINDOWS_VST_SUPPORT - case Windows_VST: - rc_option_editor->edit_vst_path ( - _("Set Windows VST2 Search Path"), - PluginManager::instance().get_default_windows_vst_path (), - sigc::mem_fun (*Config, &RCConfiguration::get_plugin_path_vst), - sigc::mem_fun (*Config, &RCConfiguration::set_plugin_path_vst) - ); - break; + case Windows_VST: + edit_vst_path ( + _("Set Windows VST2 Search Path"), + PluginManager::instance().get_default_windows_vst_path (), + sigc::mem_fun (*Config, &RCConfiguration::get_plugin_path_vst), + sigc::mem_fun (*Config, &RCConfiguration::set_plugin_path_vst) + ); + break; #endif #ifdef LXVST_SUPPORT - case LXVST: - rc_option_editor->edit_vst_path ( - _("Set Linux VST2 Search Path"), - PluginManager::instance().get_default_lxvst_path (), - sigc::mem_fun (*Config, &RCConfiguration::get_plugin_path_lxvst), - sigc::mem_fun (*Config, &RCConfiguration::set_plugin_path_lxvst) - ); - break; + case LXVST: + edit_vst_path ( + _("Set Linux VST2 Search Path"), + PluginManager::instance().get_default_lxvst_path (), + sigc::mem_fun (*Config, &RCConfiguration::get_plugin_path_lxvst), + sigc::mem_fun (*Config, &RCConfiguration::set_plugin_path_lxvst) + ); + break; #endif #ifdef VST3_SUPPORT - case VST3: - rc_option_editor->edit_vst_path ( - _("Set Additional VST3 Search Path"), - "", /* default is blank */ - sigc::mem_fun (*Config, &RCConfiguration::get_plugin_path_vst3), - sigc::mem_fun (*Config, &RCConfiguration::set_plugin_path_vst3) - ); - break; + case VST3: + edit_vst_path ( + _("Set Additional VST3 Search Path"), + "", /* default is blank */ + sigc::mem_fun (*Config, &RCConfiguration::get_plugin_path_vst3), + sigc::mem_fun (*Config, &RCConfiguration::set_plugin_path_vst3) + ); + break; #endif - default: - break; - } + default: + break; } } diff --git a/gtk2_ardour/plugin_manager_ui.h b/gtk2_ardour/plugin_manager_ui.h index 102cf51d02..77dd6c6d7f 100644 --- a/gtk2_ardour/plugin_manager_ui.h +++ b/gtk2_ardour/plugin_manager_ui.h @@ -55,7 +55,8 @@ private: void rescan_selected (); void clear_log (); void show_plugin_prefs (); - void edit_vst_path (ARDOUR::PluginType); + void vst_path_cb (ARDOUR::PluginType); + void edit_vst_path (std::string const&, std::string const&, sigc::slot, sigc::slot); void plugin_status_changed (ARDOUR::PluginType, std::string, ARDOUR::PluginManager::PluginStatusType); diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 0ebc8bf835..e6955524b2 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -4651,7 +4651,7 @@ void RCOptionEditor::show_transport_masters () { void RCOptionEditor::plugin_scan_refresh () { /* first argument says discover new plugins, second means be verbose */ - PluginScanDialog psd (false, true); + PluginScanDialog psd (false, true, current_toplevel ()); psd.start (); } @@ -4683,21 +4683,23 @@ void RCOptionEditor::clear_au_blacklist () { PluginManager::instance().clear_au_blacklist(); } -void RCOptionEditor::edit_vst_path (std::string const& title, std::string const& dflt, sigc::slot get, sigc::slot set) { - PathsDialog *pd = new PathsDialog (*current_toplevel(), title, get (), dflt); - ResponseType r = (ResponseType) pd->run (); - pd->hide(); - if (r == RESPONSE_ACCEPT) { - set (pd->get_serialized_paths()); - MessageDialog msg (_("Re-scan Plugins now?"), - false /*no markup*/, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, true /*modal*/); - msg.set_default_response (Gtk::RESPONSE_YES); - if (msg.run() == Gtk::RESPONSE_YES) { - msg.hide (); - plugin_scan_refresh (); - } +void +RCOptionEditor::edit_vst_path (std::string const& title, std::string const& dflt, sigc::slot get, sigc::slot set) +{ + /* see also PluginManagerUI::edit_vst_path */ + PathsDialog pd (*current_toplevel(), title, get (), dflt); + if (pd.run () != Gtk::RESPONSE_ACCEPT) { + return; } - delete pd; + pd.hide(); + set (pd.get_serialized_paths()); + MessageDialog msg (_("Re-scan Plugins now?"), false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, true); + msg.set_default_response (Gtk::RESPONSE_YES); + if (msg.run() != Gtk::RESPONSE_YES) { + return; + } + msg.hide (); + plugin_scan_refresh (); } diff --git a/gtk2_ardour/rc_option_editor.h b/gtk2_ardour/rc_option_editor.h index df286cdde9..3440338e65 100644 --- a/gtk2_ardour/rc_option_editor.h +++ b/gtk2_ardour/rc_option_editor.h @@ -47,7 +47,6 @@ public: XMLNode& get_state (); bool on_key_release_event (GdkEventKey*); - void edit_vst_path (std::string const& title, std::string const& dflt, sigc::slot, sigc::slot); private: void parameter_changed (std::string const &); @@ -78,6 +77,7 @@ private: void clear_vst3_blacklist (); void clear_au_cache (); void clear_au_blacklist (); + void edit_vst_path (std::string const&, std::string const&, sigc::slot, sigc::slot); }; #endif /* __gtk_ardour_rc_option_editor_h__ */