fix display of negative minsec values; fix handling scroll events on audioclocks
[ardour.git] / gtk2_ardour / processor_box.cc
index c56c18ab009a53c672a20df2bb022e1b85ae9b62..d5699c3651f61d4cbe3a392b06cca376f34f3179 100644 (file)
@@ -460,7 +460,7 @@ PluginInsertProcessorEntry::SplittingIcon::on_expose_event (GdkEventExpose* ev)
 }
 
 ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelector*()> get_plugin_selector,
-                           RouteRedirectSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
+                           RouteProcessorSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
        : _parent_strip (parent)
        , _owner_is_mixer (owner_is_mixer)
        , ab_direction (true)
@@ -493,7 +493,6 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelecto
 
        processor_display.Reordered.connect (sigc::mem_fun (*this, &ProcessorBox::reordered));
        processor_display.DropFromAnotherBox.connect (sigc::mem_fun (*this, &ProcessorBox::object_drop));
-       processor_display.SelectionChanged.connect (sigc::mem_fun (*this, &ProcessorBox::selection_changed));
 
        processor_scroller.show ();
        processor_display.show ();
@@ -656,12 +655,16 @@ ProcessorBox::show_processor_menu (int arg)
                processor_menu->signal_unmap().connect (sigc::mem_fun (*this, &ProcessorBox::processor_menu_unmapped));
        }
 
+       /* Sort out the plugin submenu */
+
        Gtk::MenuItem* plugin_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/ProcessorMenu/newplugin"));
 
        if (plugin_menu_item) {
                plugin_menu_item->set_submenu (*_get_plugin_selector()->plugin_menu());
        }
 
+       /* And the aux submenu */
+
        Gtk::MenuItem* aux_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/ProcessorMenu/newaux"));
 
        if (aux_menu_item) {
@@ -676,9 +679,31 @@ ProcessorBox::show_processor_menu (int arg)
                }
        }
 
+       /* Sensitise actions as approprioate */
+
         cut_action->set_sensitive (can_cut());
        paste_action->set_sensitive (!_rr_selection.processors.empty());
 
+       const bool sensitive = !processor_display.selection().empty();
+       ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive);
+       edit_action->set_sensitive (one_processor_can_be_edited ());
+
+       boost::shared_ptr<Processor> single_selection;
+       if (processor_display.selection().size() == 1) {
+               single_selection = processor_display.selection().front()->processor ();
+       }
+
+       boost::shared_ptr<PluginInsert> pi;
+       if (single_selection) {
+               pi = boost::dynamic_pointer_cast<PluginInsert> (single_selection);
+       }
+
+       /* enable gui for plugin inserts with editors */
+       controls_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<Amp> (single_selection));
+
        processor_menu->popup (1, arg);
 
        /* Add a placeholder gap to the processor list to indicate where a processor would be
@@ -705,8 +730,6 @@ ProcessorBox::leave_notify (GdkEventCrossing* ev)
 void
 ProcessorBox::processor_operation (ProcessorOperation op) 
 {
-
-       bool ret = false;
        ProcSelection targets;
 
        get_selected_processors (targets);
@@ -756,7 +779,6 @@ ProcessorBox::processor_operation (ProcessorOperation op)
                                (*i)->activate ();
                        }
                }
-               ret = true;
                break;
 
        case ProcessorsAB:
@@ -845,29 +867,6 @@ ProcessorBox::build_processor_menu ()
        return processor_menu;
 }
 
-void
-ProcessorBox::selection_changed ()
-{
-       const bool sensitive = !processor_display.selection().empty();
-       ActionManager::set_sensitive(ActionManager::plugin_selection_sensitive_actions,
-                                    sensitive);
-       edit_action->set_sensitive(one_processor_can_be_edited());
-
-       const bool single_selection = (processor_display.selection().size() == 1);
-
-       boost::shared_ptr<PluginInsert> pi;
-       if (single_selection) {
-               pi = boost::dynamic_pointer_cast<PluginInsert>(
-                       processor_display.selection().front()->processor());
-       }
-
-       /* enable gui for plugin inserts with editors */
-       controls_action->set_sensitive(pi && pi->plugin()->has_editor());
-
-       /* disallow rename for multiple selections and for plugin inserts */
-       rename_action->set_sensitive(single_selection && pi);
-}
-
 void
 ProcessorBox::select_all_processors ()
 {
@@ -1667,10 +1666,9 @@ ProcessorBox::for_selected_processors (void (ProcessorBox::*method)(boost::share
 }
 
 void
-ProcessorBox::all_processors_active (bool state)
+ProcessorBox::all_visible_processors_active (bool state)
 {
-       _route->all_processors_active (PreFader, state);
-       _route->all_processors_active (PostFader, state);
+       _route->all_visible_processors_active (state);
 }
 
 void
@@ -1786,8 +1784,10 @@ ProcessorBox::toggle_edit_processor (boost::shared_ptr<Processor> processor)
                        return;
                }
 
-               SendUIWindow* w = new SendUIWindow (send, _session);
-               w->show ();
+               if (boost::dynamic_pointer_cast<InternalSend> (processor) == 0) {
+                       SendUIWindow* w = new SendUIWindow (send, _session);
+                       w->show ();
+               }
 
        } else if ((retrn = boost::dynamic_pointer_cast<Return> (processor)) != 0) {
 
@@ -1945,9 +1945,9 @@ ProcessorBox::register_actions ()
 
        /* activation etc. */
 
-       ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"),
+       ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate All"),
                        sigc::ptr_fun (ProcessorBox::rb_activate_all));
-       ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"),
+       ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate All"),
                        sigc::ptr_fun (ProcessorBox::rb_deactivate_all));
        ActionManager::register_action (popup_act_grp, X_("ab_plugins"), _("A/B Plugins"),
                        sigc::ptr_fun (ProcessorBox::rb_ab_plugins));
@@ -2119,7 +2119,7 @@ ProcessorBox::rb_activate_all ()
                return;
        }
 
-       _current_processor_box->all_processors_active (true);
+       _current_processor_box->all_visible_processors_active (true);
 }
 
 void
@@ -2128,7 +2128,7 @@ ProcessorBox::rb_deactivate_all ()
        if (_current_processor_box == 0) {
                return;
        }
-       _current_processor_box->all_processors_active (false);
+       _current_processor_box->all_visible_processors_active (false);
 }
 
 void