#include <gtkmm/checkbutton.h>
#include <boost/shared_ptr.hpp>
#include <ardour/data_type.h>
+#include <ardour/types.h>
namespace ARDOUR {
class Session;
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<ARDOUR::Bundle>);
- void add_port (std::string const &);
+ void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
+ boost::shared_ptr<ARDOUR::Bundle> only_bundle ();
void clear ();
+ uint32_t total_channels () const;
std::string name; ///< name for the group
- std::vector<boost::shared_ptr<ARDOUR::Bundle> > bundles;
- std::vector<std::string> ports;
+
+ ARDOUR::BundleList const & bundles () const {
+ return _bundles;
+ }
+
bool visible () const {
return _visible;
}
void set_visible (bool v) {
_visible = v;
- VisibilityChanged ();
+ Modified ();
}
- sigc::signal<void> VisibilityChanged;
+ bool has_port (std::string const &) const;
+
+ sigc::signal<void> Modified;
+ sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
-private:
+private:
+ void bundle_changed (ARDOUR::Bundle::Change);
+
+ ARDOUR::BundleList _bundles;
+
+ typedef std::map<boost::shared_ptr<ARDOUR::Bundle>, 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<boost::shared_ptr<PortGroup> > List;
- private:
- void visibility_checkbutton_toggled ();
- void setup_visibility_checkbutton ();
+ void add_group (boost::shared_ptr<PortGroup>);
+ void set_type (ARDOUR::DataType);
+ void gather (ARDOUR::Session &, bool);
+ ARDOUR::BundleList const & bundles () const;
+ void clear ();
+ void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
+ 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<PortGroup*>, 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<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
- void take_visibility_from (PortGroupList const &);
+ sigc::signal<void> Changed;
- sigc::signal<void> VisibilityChanged;
-
private:
- void maybe_add_session_bundle (boost::shared_ptr<ARDOUR::Bundle>);
+ bool port_has_prefix (std::string const &, std::string const &) const;
std::string common_prefix (std::vector<std::string> const &) const;
- void visibility_changed ();
+ std::string common_prefix_before (std::vector<std::string> const &, std::string const &) const;
+ void emit_changed ();
+ boost::shared_ptr<ARDOUR::Bundle> make_bundle_from_ports (std::vector<std::string> const &, bool) const;
- ARDOUR::Session& _session;
ARDOUR::DataType _type;
- bool _offer_inputs;
+ mutable ARDOUR::BundleList _bundles;
+ List _groups;
+ std::vector<sigc::connection> _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<ARDOUR::Bundle>);
+
+ void add_processor_bundle (boost::shared_ptr<ARDOUR::Bundle>);
+
+private:
+ void reread_component_bundles ();
+
+ boost::shared_ptr<ARDOUR::Bundle> _route;
+ std::vector<boost::shared_ptr<ARDOUR::Bundle> > _processor;
};
#endif /* __gtk_ardour_port_group_h__ */