Remove Cruft -- AutomationStyle never did anything.
[ardour.git] / gtk2_ardour / processor_box.cc
index b5fe9abbe26600e5427ecd717f56839ac3bdf631..36b646806039aba383b0611bbd8b8be9c57ff58a 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <sigc++/bind.h>
 
-#include "pbd/convert.h"
 #include "canvas/utils.h"
 
 #include <glibmm/miscutils.h>
@@ -77,9 +76,9 @@
 #include "plugin_ui.h"
 #include "port_insert_ui.h"
 #include "processor_box.h"
+#include "processor_selection.h"
 #include "public_editor.h"
 #include "return_ui.h"
-#include "route_processor_selection.h"
 #include "script_selector.h"
 #include "send_ui.h"
 #include "timers.h"
@@ -657,8 +656,8 @@ ProcessorEntry::add_control_state (XMLNode* node) const
 
        if (_plugin_display) {
                XMLNode* c = new XMLNode (X_("Object"));
-               c->add_property (X_("id"), X_("InlineDisplay"));
-               c->add_property (X_("visible"), _plugin_display->is_visible ());
+               c->set_property (X_("id"), X_("InlineDisplay"));
+               c->set_property (X_("visible"), _plugin_display->is_visible ());
                node->add_child_nocopy (*c);
        }
 }
@@ -672,12 +671,14 @@ ProcessorEntry::set_control_state (XMLNode const * node)
 
        if (_plugin_display) {
                XMLNode* n = GUIObjectState::get_node (node, X_("InlineDisplay"));
-               XMLProperty const * p = n ? n->property (X_("visible")) : NULL;
-               if (p) {
-                       if (string_is_affirmative (p->value ())) {
-                               _plugin_display->show();
+               if (!n) return;
+
+               bool visible;
+               if (n->get_property (X_("visible"), visible)) {
+                       if (visible) {
+                               _plugin_display->show ();
                        } else {
-                               _plugin_display->hide();
+                               _plugin_display->hide ();
                        }
                }
        }
@@ -969,8 +970,8 @@ void
 ProcessorEntry::Control::add_state (XMLNode* node) const
 {
        XMLNode* c = new XMLNode (X_("Object"));
-       c->add_property (X_("id"), state_id ());
-       c->add_property (X_("visible"), _visible);
+       c->set_property (X_("id"), state_id ());
+       c->set_property (X_("visible"), _visible);
        node->add_child_nocopy (*c);
 }
 
@@ -979,8 +980,10 @@ ProcessorEntry::Control::set_state (XMLNode const * node)
 {
        XMLNode* n = GUIObjectState::get_node (node, state_id ());
        if (n) {
-               XMLProperty const * p = n->property (X_("visible"));
-               set_visible (p && string_is_affirmative (p->value ()));
+               bool visible;
+               if (n->get_property (X_("visible"), visible)) {
+                       set_visible (visible);
+               }
        } else {
                set_visible (false);
        }
@@ -1804,14 +1807,14 @@ static std::list<Gtk::TargetEntry> drag_targets_noplugin()
 }
 
 ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelector*()> get_plugin_selector,
-                           RouteProcessorSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
+                           ProcessorSelection& psel, MixerStrip* parent, bool owner_is_mixer)
        : _parent_strip (parent)
        , _owner_is_mixer (owner_is_mixer)
        , ab_direction (true)
        , _get_plugin_selector (get_plugin_selector)
        , _placement (-1)
        , _visible_prefader_processors (0)
-       , _rr_selection(rsel)
+       , _p_selection(psel)
        , processor_display (drop_targets())
        , _redisplay_pending (false)
 {
@@ -2197,7 +2200,7 @@ ProcessorBox::show_processor_menu (int arg)
 
        const bool sensitive = !processor_display.selection().empty() && ! stub_processor_selected ();
 
-       paste_action->set_sensitive (!_rr_selection.processors.empty());
+       paste_action->set_sensitive (!_p_selection.processors.empty());
        cut_action->set_sensitive (sensitive && can_cut ());
        copy_action->set_sensitive (sensitive);
        delete_action->set_sensitive (sensitive || stub_processor_selected ());
@@ -2324,6 +2327,18 @@ ProcessorBox::processor_operation (ProcessorOperation op)
 
        case ProcessorsToggleActive:
                for (ProcSelection::iterator i = targets.begin(); i != targets.end(); ++i) {
+                       if (!(*i)->display_to_user ()) {
+                               assert (0); // these should not be selectable to begin with.
+                               continue;
+                       }
+                       if (!boost::dynamic_pointer_cast<PluginInsert> (*i)) {
+                               continue;
+                       }
+#ifdef MIXBUS
+                       if (boost::dynamic_pointer_cast<PluginInsert> (*i)->is_channelstrip()) {
+                               continue;
+                       }
+#endif
                        (*i)->enable (!(*i)->enabled ());
                }
                break;
@@ -2477,7 +2492,7 @@ ProcessorBox::use_plugins (const SelectedPlugins& plugins)
                        } else if (_session->engine().connected () && processor_can_be_edited (processor)) {
                                if ((*p)->has_editor ()) {
                                        edit_processor (processor);
-                               } else {
+                               } else if (boost::dynamic_pointer_cast<PluginInsert>(processor)->plugin()->parameter_count() > 0) {
                                        generic_edit_processor (processor);
                                }
                        }
@@ -3150,7 +3165,7 @@ ProcessorBox::cut_processors (const ProcSelection& to_be_removed)
                return;
        }
 
-       _rr_selection.set (node);
+       _p_selection.set (node);
 
        no_processor_redisplay = false;
        redisplay_processors ();
@@ -3174,7 +3189,7 @@ ProcessorBox::copy_processors (const ProcSelection& to_be_copied)
                }
        }
 
-       _rr_selection.set (node);
+       _p_selection.set (node);
 }
 
 void
@@ -3289,22 +3304,22 @@ ProcessorBox::rename_processor (boost::shared_ptr<Processor> processor)
 void
 ProcessorBox::paste_processors ()
 {
-       if (_rr_selection.processors.empty()) {
+       if (_p_selection.processors.empty()) {
                return;
        }
 
-       paste_processor_state (_rr_selection.processors.get_node().children(), boost::shared_ptr<Processor>());
+       paste_processor_state (_p_selection.processors.get_node().children(), boost::shared_ptr<Processor>());
 }
 
 void
 ProcessorBox::paste_processors (boost::shared_ptr<Processor> before)
 {
 
-       if (_rr_selection.processors.empty()) {
+       if (_p_selection.processors.empty()) {
                return;
        }
 
-       paste_processor_state (_rr_selection.processors.get_node().children(), before);
+       paste_processor_state (_p_selection.processors.get_node().children(), before);
 }
 
 void
@@ -4249,7 +4264,7 @@ ProcessorWindowProxy::get_state ()
 {
        XMLNode *node;
        node = &ProxyBase::get_state();
-       node->add_property (X_("custom-ui"), is_custom? X_("yes") : X_("no"));
+       node->set_property (X_("custom-ui"), is_custom);
        return *node;
 }
 
@@ -4259,18 +4274,15 @@ ProcessorWindowProxy::set_state (const XMLNode& node, int /*version*/)
        XMLNodeList children = node.children ();
        XMLNodeList::const_iterator i = children.begin ();
        while (i != children.end()) {
-               XMLProperty const * prop = (*i)->property (X_("name"));
-               if ((*i)->name() == X_("Window") && prop && prop->value() == _name) {
+               std::string name;
+               if ((*i)->name() == X_("Window") && (*i)->get_property (X_("name"), name) && name == _name) {
                        break;
                }
                ++i;
        }
 
        if (i != children.end()) {
-               XMLProperty const * prop;
-               if ((prop = (*i)->property (X_("custom-ui"))) != 0) {
-                       want_custom = PBD::string_is_affirmative (prop->value ());
-               }
+               (*i)->get_property (X_("custom-ui"), want_custom);
        }
 
        return ProxyBase::set_state (node, 0);
@@ -4286,6 +4298,7 @@ ProcessorWindowProxy::get (bool create)
        }
        if (_window && (is_custom != want_custom)) {
                /* drop existing window - wrong type */
+               set_state_mask (Gtkmm2ext::WindowProxy::StateMask (state_mask () & ~WindowProxy::Size));
                drop_window ();
        }
 
@@ -4299,8 +4312,8 @@ ProcessorWindowProxy::get (bool create)
 
                if (_window) {
                        setup ();
+                       _window->show_all ();
                }
-               _window->show_all ();
        }
        return _window;
 }
@@ -4310,6 +4323,7 @@ ProcessorWindowProxy::show_the_right_window ()
 {
        if (_window && (is_custom != want_custom)) {
                /* drop existing window - wrong type */
+               set_state_mask (Gtkmm2ext::WindowProxy::StateMask (state_mask () & ~WindowProxy::Size));
                drop_window ();
        }
        toggle ();