From 09e193c09778a365a309e42adeb564548a8a40a1 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 15 Mar 2016 12:40:53 -0400 Subject: [PATCH] give ProcessorBox its own bindings --- gtk2_ardour/processor_box.cc | 92 ++++++++++++++++++++++++------------ gtk2_ardour/processor_box.h | 8 +++- 2 files changed, 67 insertions(+), 33 deletions(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index ab25394d59..8463241049 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -107,7 +107,9 @@ RefPtr ProcessorBox::rename_action; RefPtr ProcessorBox::delete_action; RefPtr ProcessorBox::edit_action; RefPtr ProcessorBox::edit_generic_action; -ActionMap ProcessorBox::processor_box_actions (X_("processor box")); +RefPtr ProcessorBox::processor_box_actions; +Gtkmm2ext::ActionMap ProcessorBox::myactions (X_("processor box")); +Gtkmm2ext::Bindings* ProcessorBox::bindings = 0; static const uint32_t audio_port_color = 0x4A8A0EFF; // Green static const uint32_t midi_port_color = 0x960909FF; //Red @@ -1368,10 +1370,16 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::functiondetail == GDK_NOTIFY_INFERIOR) { + return false; + } + + Widget* top = get_toplevel(); + + if (top->is_toplevel()) { + Window* win = dynamic_cast (top); + gtk_window_set_focus (win->gobj(), 0); + } + return false; } @@ -1808,8 +1828,9 @@ ProcessorBox::processor_operation (ProcessorOperation op) } */ - if ( (op == ProcessorsDelete) && targets.empty() ) + if ((op == ProcessorsDelete) && targets.empty()) { return false; //nothing to delete. return false so the editor-mixer, because the user was probably intending to delete something in the editor + } switch (op) { case ProcessorsSelectAll: @@ -2578,7 +2599,7 @@ ProcessorBox::copy_processors (const ProcSelection& to_be_copied) (boost::dynamic_pointer_cast((*i)) != 0)) { node->add_child_nocopy ((*i)->get_state()); } - } + } _rr_selection.set (node); } @@ -3085,73 +3106,76 @@ ProcessorBox::get_generic_editor_window (boost::shared_ptr processor) void ProcessorBox::register_actions () { - Glib::RefPtr popup_act_grp = processor_box_actions.create_action_group (X_("ProcessorMenu")); + processor_box_actions = myactions.create_action_group (X_("ProcessorMenu")); + Glib::RefPtr act; /* new stuff */ - processor_box_actions.register_action (popup_act_grp, X_("newplugin"), _("New Plugin"), + myactions.register_action (processor_box_actions, X_("newplugin"), _("New Plugin"), sigc::ptr_fun (ProcessorBox::rb_choose_plugin)); - act = processor_box_actions.register_action (popup_act_grp, X_("newlua"), _("New Lua Proc"), + act = myactions.register_action (processor_box_actions, X_("newlua"), _("New Lua Proc"), sigc::ptr_fun (ProcessorBox::rb_choose_lua)); - act = processor_box_actions.register_action (popup_act_grp, X_("newinsert"), _("New Insert"), + act = myactions.register_action (processor_box_actions, X_("newinsert"), _("New Insert"), sigc::ptr_fun (ProcessorBox::rb_choose_insert)); ActionManager::engine_sensitive_actions.push_back (act); - act = processor_box_actions.register_action (popup_act_grp, X_("newsend"), _("New External Send ..."), + act = myactions.register_action (processor_box_actions, X_("newsend"), _("New External Send ..."), sigc::ptr_fun (ProcessorBox::rb_choose_send)); ActionManager::engine_sensitive_actions.push_back (act); - processor_box_actions.register_action (popup_act_grp, X_("newaux"), _("New Aux Send ...")); + myactions.register_action (processor_box_actions, X_("newaux"), _("New Aux Send ...")); - processor_box_actions.register_action (popup_act_grp, X_("controls"), _("Controls")); - processor_box_actions.register_action (popup_act_grp, X_("send_options"), _("Send Options")); + myactions.register_action (processor_box_actions, X_("controls"), _("Controls")); + myactions.register_action (processor_box_actions, X_("send_options"), _("Send Options")); - processor_box_actions.register_action (popup_act_grp, X_("clear"), _("Clear (all)"), + myactions.register_action (processor_box_actions, X_("clear"), _("Clear (all)"), sigc::ptr_fun (ProcessorBox::rb_clear)); - processor_box_actions.register_action (popup_act_grp, X_("clear_pre"), _("Clear (pre-fader)"), + myactions.register_action (processor_box_actions, X_("clear_pre"), _("Clear (pre-fader)"), sigc::ptr_fun (ProcessorBox::rb_clear_pre)); - processor_box_actions.register_action (popup_act_grp, X_("clear_post"), _("Clear (post-fader)"), + myactions.register_action (processor_box_actions, X_("clear_post"), _("Clear (post-fader)"), sigc::ptr_fun (ProcessorBox::rb_clear_post)); /* standard editing stuff */ - cut_action = processor_box_actions.register_action (popup_act_grp, X_("cut"), _("Cut"), + cut_action = myactions.register_action (processor_box_actions, X_("cut"), _("Cut"), sigc::ptr_fun (ProcessorBox::rb_cut)); - copy_action = processor_box_actions.register_action (popup_act_grp, X_("copy"), _("Copy"), + copy_action = myactions.register_action (processor_box_actions, X_("copy"), _("Copy"), sigc::ptr_fun (ProcessorBox::rb_copy)); - delete_action = processor_box_actions.register_action (popup_act_grp, X_("delete"), _("Delete"), + delete_action = myactions.register_action (processor_box_actions, X_("delete"), _("Delete"), sigc::ptr_fun (ProcessorBox::rb_delete)); ActionManager::plugin_selection_sensitive_actions.push_back (cut_action); ActionManager::plugin_selection_sensitive_actions.push_back (copy_action); ActionManager::plugin_selection_sensitive_actions.push_back (delete_action); - paste_action = processor_box_actions.register_action (popup_act_grp, X_("paste"), _("Paste"), + paste_action = myactions.register_action (processor_box_actions, X_("paste"), _("Paste"), sigc::ptr_fun (ProcessorBox::rb_paste)); - rename_action = processor_box_actions.register_action (popup_act_grp, X_("rename"), _("Rename"), + rename_action = myactions.register_action (processor_box_actions, X_("rename"), _("Rename"), sigc::ptr_fun (ProcessorBox::rb_rename)); - processor_box_actions.register_action (popup_act_grp, X_("selectall"), _("Select All"), + myactions.register_action (processor_box_actions, X_("selectall"), _("Select All"), sigc::ptr_fun (ProcessorBox::rb_select_all)); - processor_box_actions.register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), + myactions.register_action (processor_box_actions, X_("deselectall"), _("Deselect All"), sigc::ptr_fun (ProcessorBox::rb_deselect_all)); /* activation etc. */ - processor_box_actions.register_action (popup_act_grp, X_("activate_all"), _("Activate All"), + myactions.register_action (processor_box_actions, X_("activate_all"), _("Activate All"), sigc::ptr_fun (ProcessorBox::rb_activate_all)); - processor_box_actions.register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate All"), + myactions.register_action (processor_box_actions, X_("deactivate_all"), _("Deactivate All"), sigc::ptr_fun (ProcessorBox::rb_deactivate_all)); - processor_box_actions.register_action (popup_act_grp, X_("ab_plugins"), _("A/B Plugins"), + myactions.register_action (processor_box_actions, X_("ab_plugins"), _("A/B Plugins"), sigc::ptr_fun (ProcessorBox::rb_ab_plugins)); /* show editors */ - edit_action = processor_box_actions.register_action ( - popup_act_grp, X_("edit"), _("Edit..."), + edit_action = myactions.register_action ( + processor_box_actions, X_("edit"), _("Edit..."), sigc::ptr_fun (ProcessorBox::rb_edit)); - edit_generic_action = processor_box_actions.register_action ( - popup_act_grp, X_("edit-generic"), _("Edit with generic controls..."), + edit_generic_action = myactions.register_action ( + processor_box_actions, X_("edit-generic"), _("Edit with generic controls..."), sigc::ptr_fun (ProcessorBox::rb_edit_generic)); + + load_bindings (); } void @@ -3420,7 +3444,7 @@ ProcessorBox::route_property_changed (const PropertyChange& what_changed) for (list::iterator iter = children.begin(); iter != children.end(); ++iter) { - processor = (*iter)->processor (); + processor = (*iter)->processor (); if (!processor) { continue; @@ -3682,3 +3706,9 @@ ProcessorWindowProxy::show_the_right_window () toggle (); } + +void +ProcessorBox::load_bindings () +{ + bindings = Bindings::get_bindings (X_("processor box"), myactions); +} diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 0ac276d57b..bf58380d5d 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -335,7 +335,9 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD sigc::signal > ProcessorSelected; sigc::signal > ProcessorUnselected; + static Glib::RefPtr processor_box_actions; static void register_actions(); + #ifndef NDEBUG static bool show_all_processors; #endif @@ -362,6 +364,10 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD uint32_t _visible_prefader_processors; RouteProcessorSelection& _rr_selection; + static Gtkmm2ext::ActionMap myactions; + static Gtkmm2ext::Bindings* bindings; + + static void load_bindings (); void route_going_away (); @@ -493,8 +499,6 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD XMLNode* entry_gui_object_state (ProcessorEntry *); PBD::ScopedConnection amp_config_connection; - - static Gtkmm2ext::ActionMap processor_box_actions; }; #endif /* __ardour_gtk_processor_box__ */