#include <vector>
#include <string>
+#include <set>
#include <gtkmm/widget.h>
#include <gtkmm/checkbutton.h>
#include <boost/shared_ptr.hpp>
-#include <ardour/data_type.h>
-#include <ardour/types.h>
+#include "ardour/data_type.h"
+#include "ardour/types.h"
namespace ARDOUR {
class Session;
class Bundle;
+ class Processor;
+ class IO;
}
class PortMatrix;
+class RouteBundle;
+class PublicEditor;
/** A list of bundles and ports, grouped by some aspect of their
* type e.g. busses, tracks, system. Each group has 0 or more bundles
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 add_bundle (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO> io);
+ void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO>, Gdk::Color);
+ void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
+ boost::shared_ptr<ARDOUR::Bundle> only_bundle ();
void clear ();
+ uint32_t total_channels () const;
+ boost::shared_ptr<ARDOUR::IO> io_from_bundle (boost::shared_ptr<ARDOUR::Bundle>) const;
std::string name; ///< name for the group
- ARDOUR::BundleList bundles;
- std::vector<std::string> ports;
+
bool visible () const {
return _visible;
}
void set_visible (bool v) {
_visible = v;
- VisibilityChanged ();
+ Changed ();
}
bool has_port (std::string const &) const;
- sigc::signal<void> VisibilityChanged;
+ sigc::signal<void> Changed;
+ sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
-private:
- bool _visible; ///< true if the group is visible in the UI
-};
+ struct BundleRecord {
+ boost::shared_ptr<ARDOUR::Bundle> bundle;
+ boost::shared_ptr<ARDOUR::IO> io;
+ Gdk::Color colour;
+ bool has_colour;
+ sigc::connection changed_connection;
+ };
-/// The UI for a PortGroup
-class PortGroupUI
-{
- public:
- PortGroupUI (PortMatrix*, PortGroup*);
+ typedef std::list<BundleRecord> BundleList;
- Gtk::Widget& visibility_checkbutton () {
- return _visibility_checkbutton;
+ BundleList const & bundles () const {
+ return _bundles;
}
+
+private:
+ void bundle_changed (ARDOUR::Bundle::Change);
- private:
- void visibility_checkbutton_toggled ();
- void setup_visibility_checkbutton ();
-
- PortMatrix* _port_matrix; ///< the PortMatrix that we are working for
- PortGroup* _port_group; ///< the PortGroup that we are representing
- Gtk::CheckButton _visibility_checkbutton;
+ BundleList _bundles;
+ bool _visible; ///< true if the group is visible in the UI
};
/// A list of PortGroups
-class PortGroupList : public std::list<PortGroup*>, public sigc::trackable
+class PortGroupList : public sigc::trackable
{
public:
- PortGroupList (ARDOUR::DataType, bool);
+ PortGroupList ();
- void gather (ARDOUR::Session &);
+ typedef std::vector<boost::shared_ptr<PortGroup> > List;
+
+ void add_group (boost::shared_ptr<PortGroup>);
void set_type (ARDOUR::DataType);
- void set_offer_inputs (bool);
- ARDOUR::BundleList bundles () const;
- void take_visibility_from (PortGroupList const &);
- void clear_list ();
+ void gather (ARDOUR::Session &, bool);
+ PortGroup::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();
+ }
+ boost::shared_ptr<ARDOUR::IO> io_from_bundle (boost::shared_ptr<ARDOUR::Bundle>) const;
+
+ void suspend_signals ();
+ void resume_signals ();
+
+ List::const_iterator begin () const {
+ return _groups.begin();
+ }
+
+ List::const_iterator end () const {
+ return _groups.end();
+ }
+
+ sigc::signal<void> Changed;
- sigc::signal<void> VisibilityChanged;
-
private:
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;
+ void maybe_add_processor_to_bundle (boost::weak_ptr<ARDOUR::Processor>, boost::shared_ptr<RouteBundle>, bool, std::set<boost::shared_ptr<ARDOUR::IO> > &);
+
ARDOUR::DataType _type;
- bool _offer_inputs;
+ mutable PortGroup::BundleList _bundles;
+ List _groups;
+ std::vector<sigc::connection> _bundle_changed_connections;
+ bool _signals_suspended;
+ bool _pending_change;
+};
+
+
+class RouteBundle : public ARDOUR::Bundle
+{
+public:
+ RouteBundle (boost::shared_ptr<ARDOUR::Bundle>);
- PortGroup _buss;
- PortGroup _track;
- PortGroup _system;
- PortGroup _other;
+ void add_processor_bundle (boost::shared_ptr<ARDOUR::Bundle>);
- std::vector<sigc::connection> _visibility_connections;
+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__ */