semi-functioning vbap panning, still not done
[ardour.git] / gtk2_ardour / port_matrix.h
index cfa4cdbadc7fe730493891bcc6794973a0f0edaf..359b4540e31f0b4bf00ce46653b43ca5fea944ca 100644 (file)
 #include <gtkmm/checkbutton.h>
 #include <gtkmm/notebook.h>
 #include <boost/shared_ptr.hpp>
+
 #include "ardour/bundle.h"
 #include "ardour/types.h"
+#include "ardour/session_handle.h"
+
 #include "port_group.h"
 #include "port_matrix_types.h"
-#include "i18n.h"
 
 /** The `port matrix' UI.  This is a widget which lets the user alter
  *  associations between one set of ports and another.  e.g. to connect
@@ -55,7 +57,7 @@ namespace Gtk {
 
 class PortMatrixBody;
 
-class PortMatrix : public Gtk::Table
+class PortMatrix : public Gtk::Table, public ARDOUR::SessionHandlePtr
 {
 public:
        PortMatrix (Gtk::Window*, ARDOUR::Session *, ARDOUR::DataType);
@@ -122,6 +124,9 @@ public:
 
        std::pair<uint32_t, uint32_t> max_size () const;
 
+       bool should_show (ARDOUR::DataType) const;
+       uint32_t count_of_our_type (ARDOUR::ChanCount) const;
+
        /** @param c Channels; where c[0] is from _ports[0] and c[1] is from _ports[1].
         *  @param s New state.
         */
@@ -134,15 +139,16 @@ public:
        virtual bool list_is_global (int) const = 0;
 
        virtual bool can_add_channel (boost::shared_ptr<ARDOUR::Bundle>) const;
-       virtual void add_channel (boost::shared_ptr<ARDOUR::Bundle>);
+       virtual void add_channel (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::DataType);
        virtual bool can_remove_channels (boost::shared_ptr<ARDOUR::Bundle>) const;
        virtual void remove_channel (ARDOUR::BundleChannel);
+       virtual void remove_all_channels (boost::weak_ptr<ARDOUR::Bundle>);
        virtual bool can_rename_channels (boost::shared_ptr<ARDOUR::Bundle>) const {
                return false;
        }
        virtual void rename_channel (ARDOUR::BundleChannel) {}
        virtual std::string disassociation_verb () const = 0;
-       virtual std::string channel_noun () const { return _("channel"); }
+       virtual std::string channel_noun () const;
 
        enum Result {
                Cancelled,
@@ -160,7 +166,6 @@ protected:
            from left to right as you go from list 0 to list 1.  Hence subclasses which deal with
            inputs and outputs should put outputs in list 0 and inputs in list 1. */
        PortGroupList _ports[2];
-       ARDOUR::Session* _session;
 
 private:
 
@@ -169,11 +174,13 @@ private:
        void routes_changed ();
        void reconnect_to_routes ();
        void select_arrangement ();
-       void add_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>);
+       void add_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>, ARDOUR::DataType);
        void remove_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>, uint32_t);
        void rename_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>, uint32_t);
        void disassociate_all_on_channel (boost::weak_ptr<ARDOUR::Bundle>, uint32_t, int);
+       void disassociate_all_on_bundle (boost::weak_ptr<ARDOUR::Bundle>, int);
        void setup_global_ports ();
+       void setup_global_ports_proxy ();
        void toggle_show_only_bundles ();
        bool on_scroll_event (GdkEventScroll *);
        boost::shared_ptr<ARDOUR::IO> io_from_bundle (boost::shared_ptr<ARDOUR::Bundle>) const;
@@ -185,12 +192,15 @@ private:
        void session_going_away ();
        void add_remove_option (Gtk::Menu_Helpers::MenuList &, boost::weak_ptr<ARDOUR::Bundle>, int);
        void add_disassociate_option (Gtk::Menu_Helpers::MenuList &, boost::weak_ptr<ARDOUR::Bundle>, int, int);
+       void port_connected_or_disconnected ();
 
        Gtk::Window* _parent;
 
-       /// port type that we are working with
+       /// port type that we are working with, or NIL if we are working with all of them
        ARDOUR::DataType _type;
-       std::vector<sigc::connection> _route_connections;
+       PBD::ScopedConnectionList _route_connections;
+       PBD::ScopedConnectionList _changed_connections;
+       PBD::ScopedConnectionList _bundle_changed_connections;
 
        PortMatrixBody* _body;
        Gtk::HScrollbar _hscroll;