diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index cd2304d79f..89c1a2b58b 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -90,6 +90,7 @@ extern VST3PluginUI* create_mac_vst3_gui (boost::shared_ptr insert, @@ -198,11 +200,22 @@ PluginUIWindow::~PluginUIWindow () cerr << "PluginWindow deleted for " << this << endl; #endif delete _pluginui; + + if (the_plugin_window == this) { + the_plugin_window = 0; + } } void PluginUIWindow::on_show () { + if (UIConfiguration::instance().get_one_plugin_window_only()) { + if (the_plugin_window) { + the_plugin_window->hide (); + } + the_plugin_window = this; + } + set_role("plugin_ui"); if (_pluginui) { diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index dbec804adb..2b3424aa85 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -383,6 +383,8 @@ private: bool create_audiounit_editor (boost::shared_ptr); bool create_lv2_editor (boost::shared_ptr); bool create_vst3_editor (boost::shared_ptr); + + static PluginUIWindow* the_plugin_window; }; #ifdef MACVST_SUPPORT diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 4d14d040ab..1569890e2f 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -3803,6 +3803,16 @@ These settings will only take effect after %1 is restarted.\n\ Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(), _("When enabled plugins will be activated when they are added to tracks/busses. When disabled plugins will be left inactive when they are added to tracks/busses")); + bo = new BoolOption ( + "one-plugin-window-only", + _("Show only one plugin window at a time"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_one_plugin_window_only), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_one_plugin_window_only) + ); + add_option (_("Plugins"), bo); + Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(), + _("When enabled at most one plugin GUI window be on-screen at a time. When disabled, the number of visible plugin GUI windows is unlimited")); + #if (defined WINDOWS_VST_SUPPORT || defined MACVST_SUPPORT || defined LXVST_SUPPORT || defined VST3_SUPPORT) add_option (_("Plugins/VST"), new OptionEditorHeading (_("VST"))); #if 0 diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index e45739dfc2..3aacc76dc3 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -133,3 +133,4 @@ UI_CONFIG_VARIABLE (bool, grid_follows_internal, "grid-follows-internal", false) UI_CONFIG_VARIABLE (bool, show_region_name, "show-region-name", true) UI_CONFIG_VARIABLE (int, time_axis_name_ellipsize_mode, "time-axis-name-ellipsize-mode", 0) UI_CONFIG_VARIABLE (bool, show_triggers_inline, "show-triggers-inline", false) +UI_CONFIG_VARIABLE (bool, one_plugin_window_only, "one-plugin-window-only", false)