X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fport_group.h;h=c2daae341a2632a3bd173e53e079d174eff9e334;hb=f93ca1349ce3d56ecd9b90c1b6e88971d46d9952;hp=d2136d6f5ee316594877598832eafa5d1f4c7fd9;hpb=f6652f07ae2bfa9d7984c5b6feffd6479faec034;p=ardour.git diff --git a/gtk2_ardour/port_group.h b/gtk2_ardour/port_group.h index d2136d6f5e..c2daae341a 100644 --- a/gtk2_ardour/port_group.h +++ b/gtk2_ardour/port_group.h @@ -26,6 +26,7 @@ #include #include #include +#include namespace ARDOUR { class Session; @@ -41,88 +42,105 @@ class PortMatrix; class PortGroup : public sigc::trackable { public: - /** PortGroup constructor. - * @param n Name. - * @param v true if group should be visible in the UI, otherwise false. - */ - PortGroup (std::string const & n, bool v) - : name (n), _visible (v) {} + PortGroup (std::string const & n); void add_bundle (boost::shared_ptr); - void add_port (std::string const &); + void remove_bundle (boost::shared_ptr); + boost::shared_ptr only_bundle (); void clear (); + uint32_t total_channels () const; std::string name; ///< name for the group - std::vector > bundles; - std::vector ports; + + ARDOUR::BundleList const & bundles () const { + return _bundles; + } + bool visible () const { return _visible; } void set_visible (bool v) { _visible = v; - VisibilityChanged (); + Modified (); } - sigc::signal VisibilityChanged; + bool has_port (std::string const &) const; + + sigc::signal Modified; + sigc::signal BundleChanged; -private: +private: + void bundle_changed (ARDOUR::Bundle::Change); + + ARDOUR::BundleList _bundles; + + typedef std::map, sigc::connection> ConnectionList; + ConnectionList _bundle_changed_connections; + bool _visible; ///< true if the group is visible in the UI }; -/// The UI for a PortGroup -class PortGroupUI +/// A list of PortGroups +class PortGroupList : public sigc::trackable { public: - PortGroupUI (PortMatrix*, PortGroup*); + PortGroupList (); - Gtk::Widget& visibility_checkbutton () { - return _visibility_checkbutton; - } + typedef std::vector > List; - private: - void visibility_checkbutton_toggled (); - void setup_visibility_checkbutton (); + void add_group (boost::shared_ptr); + void set_type (ARDOUR::DataType); + void gather (ARDOUR::Session &, bool); + ARDOUR::BundleList const & bundles () const; + void clear (); + void remove_bundle (boost::shared_ptr); + uint32_t total_visible_channels () const; + uint32_t size () const { + return _groups.size(); + } - PortMatrix* _port_matrix; ///< the PortMatrix that we are working for - PortGroup* _port_group; ///< the PortGroup that we are representing - Gtk::CheckButton _visibility_checkbutton; -}; + void suspend_signals (); + void resume_signals (); -/// A list of PortGroups -class PortGroupList : public std::list, public sigc::trackable -{ - public: - enum Mask { - BUSS = 0x1, - TRACK = 0x2, - SYSTEM = 0x4, - OTHER = 0x8 - }; + List::const_iterator begin () const { + return _groups.begin(); + } - PortGroupList (ARDOUR::Session &, ARDOUR::DataType, bool, Mask); + List::const_iterator end () const { + return _groups.end(); + } - void refresh (); - void set_type (ARDOUR::DataType); - void set_offer_inputs (bool); - std::vector > bundles (); - void take_visibility_from (PortGroupList const &); + sigc::signal Changed; - sigc::signal VisibilityChanged; - private: - void maybe_add_session_bundle (boost::shared_ptr); + bool port_has_prefix (std::string const &, std::string const &) const; std::string common_prefix (std::vector const &) const; - void visibility_changed (); + std::string common_prefix_before (std::vector const &, std::string const &) const; + void emit_changed (); + boost::shared_ptr make_bundle_from_ports (std::vector const &, bool) const; - ARDOUR::Session& _session; ARDOUR::DataType _type; - bool _offer_inputs; + mutable ARDOUR::BundleList _bundles; + List _groups; + std::vector _bundle_changed_connections; + bool _signals_suspended; + bool _pending_change; +}; + - PortGroup _buss; - PortGroup _track; - PortGroup _system; - PortGroup _other; +class RouteBundle : public ARDOUR::Bundle +{ +public: + RouteBundle (boost::shared_ptr); + + void add_processor_bundle (boost::shared_ptr); + +private: + void reread_component_bundles (); + + boost::shared_ptr _route; + std::vector > _processor; }; #endif /* __gtk_ardour_port_group_h__ */