From a1ecad4cfe80a9a0c39e3c6bb5dd3b47d2a5bfb3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 21 Jan 2012 22:10:07 +0000 Subject: [PATCH] Restore option to open a plugin editor built by Ardour, rather than by the plugin; I erroneously removed this option in a previous commit. git-svn-id: svn://localhost/ardour2/branches/3.0@11295 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour.menus.in | 1 + gtk2_ardour/processor_box.cc | 42 +++++++++++++++++++++++++++++++++++- gtk2_ardour/processor_box.h | 4 +++- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index cd169afe86..e789eef10f 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -548,6 +548,7 @@ + diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index d3ad32bbf5..02a0bfefc8 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -92,7 +92,7 @@ RefPtr ProcessorBox::paste_action; RefPtr ProcessorBox::cut_action; RefPtr ProcessorBox::rename_action; RefPtr ProcessorBox::edit_action; -RefPtr ProcessorBox::controls_action; +RefPtr ProcessorBox::edit_generic_action; Glib::RefPtr ProcessorEntry::_slider_pixbuf; ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr p, Width w) @@ -876,6 +876,9 @@ ProcessorBox::show_processor_menu (int arg) pi = boost::dynamic_pointer_cast (single_selection->processor ()); } + /* allow editing with an Ardour-generated UI for plugin inserts with editors */ + edit_generic_action->set_sensitive (pi && pi->plugin()->has_editor ()); + /* disallow rename for multiple selections, for plugin inserts and for the fader */ rename_action->set_sensitive (single_selection && !pi && !boost::dynamic_pointer_cast (single_selection->processor ())); @@ -2090,6 +2093,29 @@ ProcessorBox::toggle_edit_processor (boost::shared_ptr processor) } } +/** Toggle a generic (Ardour-generated) plugin UI */ +void +ProcessorBox::toggle_edit_generic_processor (boost::shared_ptr processor) +{ + boost::shared_ptr plugin_insert + = boost::dynamic_pointer_cast(processor); + if (!plugin_insert) { + return; + } + + Container* toplevel = get_toplevel(); + Window* win = dynamic_cast(toplevel); + PluginUIWindow* plugin_ui = new PluginUIWindow(win, plugin_insert, true, false); + plugin_ui->set_title(generate_processor_title (plugin_insert)); + + if (plugin_ui->is_visible()) { + plugin_ui->hide(); + } else { + plugin_ui->show_all(); + plugin_ui->present(); + } +} + void ProcessorBox::register_actions () { @@ -2153,9 +2179,23 @@ ProcessorBox::register_actions () popup_act_grp, X_("edit"), _("Edit..."), sigc::ptr_fun (ProcessorBox::rb_edit)); + edit_generic_action = ActionManager::register_action ( + popup_act_grp, X_("edit-generic"), _("Edit with basic controls..."), + sigc::ptr_fun (ProcessorBox::rb_edit_generic)); + ActionManager::add_action_group (popup_act_grp); } +void +ProcessorBox::rb_edit_generic () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->for_selected_processors (&ProcessorBox::toggle_edit_generic_processor); +} + void ProcessorBox::rb_ab_plugins () { diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index c4047cdc83..c183949e17 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -258,6 +258,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD Gtk::Window* get_processor_ui (boost::shared_ptr) const; void toggle_edit_processor (boost::shared_ptr); + void toggle_edit_generic_processor (boost::shared_ptr); void update_gui_object_state (ProcessorEntry *); @@ -357,7 +358,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD static Glib::RefPtr paste_action; static Glib::RefPtr rename_action; static Glib::RefPtr edit_action; - static Glib::RefPtr controls_action; + static Glib::RefPtr edit_generic_action; void paste_processor_state (const XMLNodeList&, boost::shared_ptr); void activate_processor (boost::shared_ptr); @@ -392,6 +393,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD static void rb_deactivate_all (); static void rb_ab_plugins (); static void rb_edit (); + static void rb_edit_generic (); void route_property_changed (const PBD::PropertyChange&); std::string generate_processor_title (boost::shared_ptr pi);