New Route dialog: add fallback default selection
[ardour.git] / gtk2_ardour / processor_box.cc
index 9103db059758dca4c1ca9503d32a7ac9a7eedabd..2ef301b96dc4b625d9c542154d8ae9f376c5697a 100644 (file)
@@ -223,6 +223,10 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
 
                        std::string label = _processor->describe_parameter (*i);
 
+                       if (label == X_("hidden")) {
+                               continue;
+                       }
+
                        if (boost::dynamic_pointer_cast<Send> (_processor)) {
                                label = _("Send");
                        } else if (boost::dynamic_pointer_cast<Return> (_processor)) {
@@ -707,6 +711,11 @@ Menu *
 ProcessorEntry::build_controls_menu ()
 {
        using namespace Menu_Helpers;
+
+       if (!_plugin_display && _controls.empty ()) {
+               return NULL;
+       }
+
        Menu* menu = manage (new Menu);
        MenuList& items = menu->items ();
 
@@ -715,6 +724,11 @@ ProcessorEntry::build_controls_menu ()
                Gtk::CheckMenuItem* c = dynamic_cast<Gtk::CheckMenuItem*> (&items.back ());
                c->set_active (_plugin_display->is_visible ());
                c->signal_toggled().connect (sigc::mem_fun (*this, &ProcessorEntry::toggle_inline_display_visibility));
+       }
+
+       if (_controls.empty ()) {
+               return menu;
+       } else {
                items.push_back (SeparatorElem ());
        }
 
@@ -726,9 +740,7 @@ ProcessorEntry::build_controls_menu ()
                MenuElem (_("Hide All Controls"), sigc::mem_fun (*this, &ProcessorEntry::hide_all_controls))
                );
 
-       if (!_controls.empty ()) {
-               items.push_back (SeparatorElem ());
-       }
+       items.push_back (SeparatorElem ());
 
        for (list<Control*>::iterator i = _controls.begin(); i != _controls.end(); ++i) {
                items.push_back (CheckMenuElemNoMnemonic ((*i)->name ()));
@@ -1568,6 +1580,7 @@ ProcessorEntry::PluginInlineDisplay::PluginInlineDisplay (ProcessorEntry& e, boo
        : PluginDisplay (p, max_height)
        , _entry (e)
        , _scroll (false)
+       , _given_max_height (max_height)
 {
        std::string postfix = string_compose(_("\n%1+double-click to toggle inline-display"), Keyboard::tertiary_modifier_name ());
 
@@ -1639,11 +1652,15 @@ ProcessorEntry::PluginInlineDisplay::update_height_alloc (uint32_t inline_height
        }
 
        if (shm != _cur_height) {
-               if (_scroll == sc || _cur_height < shm) {
-                       queue_resize ();
+               queue_resize ();
+               if (!_scroll && sc) {
+                       _max_height = shm;
+               } else {
+                       _max_height = _given_max_height;
                }
                _cur_height = shm;
        }
+
        _scroll = sc;
 }
 
@@ -2020,9 +2037,15 @@ ProcessorBox::build_possible_aux_menu ()
        MenuList& items = menu->items();
 
        for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
-               if (!_route->internal_send_for (*r) && *r != _route) {
-                       items.push_back (MenuElemNoMnemonic ((*r)->name(), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_choose_aux), boost::weak_ptr<Route>(*r))));
+               if ((*r)->is_master() || (*r)->is_monitor () || *r == _route) {
+                       /* don't allow sending to master or monitor or to self */
+                       continue;
                }
+               if (_route->internal_send_for (*r)) {
+                       /* aux-send to target already exists */
+                       continue;
+               }
+               items.push_back (MenuElemNoMnemonic ((*r)->name(), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_choose_aux), boost::weak_ptr<Route>(*r))));
        }
 
        return menu;
@@ -2396,9 +2419,13 @@ ProcessorBox::use_plugins (const SelectedPlugins& plugins)
                        return true;
                        // XXX SHAREDPTR delete plugin here .. do we even need to care?
                } else if (plugins.size() == 1 && UIConfiguration::instance().get_open_gui_after_adding_plugin()) {
-                       if (boost::dynamic_pointer_cast<PluginInsert>(processor)->plugin()->has_inline_display() && UIConfiguration::instance().get_prefer_inline_over_gui()) {
-                               ;
-                       } else if (_session->engine().connected () && processor_can_be_edited (processor)) {
+                       if (processor->what_can_be_automated ().size () == 0) {
+                               ; /* plugin without controls, don't show ui */
+                       }
+                       else if (boost::dynamic_pointer_cast<PluginInsert>(processor)->plugin()->has_inline_display() && UIConfiguration::instance().get_prefer_inline_over_gui()) {
+                               ; /* only show inline display */
+                       }
+                       else if (_session->engine().connected () && processor_can_be_edited (processor)) {
                                if ((*p)->has_editor ()) {
                                        edit_processor (processor);
                                } else if (boost::dynamic_pointer_cast<PluginInsert>(processor)->plugin()->parameter_count() > 0) {