2009-01-12 20:15:19 -05:00
|
|
|
/*
|
|
|
|
Copyright (C) 2002-2009 Paul Davis
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
#ifndef __gtk_ardour_port_group_h__
|
|
|
|
#define __gtk_ardour_port_group_h__
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <gtkmm/widget.h>
|
|
|
|
#include <gtkmm/checkbutton.h>
|
2009-01-20 09:46:00 -05:00
|
|
|
#include <boost/shared_ptr.hpp>
|
2008-12-08 11:07:28 -05:00
|
|
|
#include <ardour/data_type.h>
|
2009-01-25 01:47:11 -05:00
|
|
|
#include <ardour/types.h>
|
2008-12-08 11:07:28 -05:00
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
2009-01-20 09:46:00 -05:00
|
|
|
class Bundle;
|
2008-12-08 11:07:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
class PortMatrix;
|
|
|
|
|
2009-01-20 09:46:00 -05:00
|
|
|
/** 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
|
|
|
|
* and 0 or more ports, where the ports are not in the bundles.
|
|
|
|
*/
|
2009-01-23 16:24:11 -05:00
|
|
|
class PortGroup : public sigc::trackable
|
2008-12-08 11:07:28 -05:00
|
|
|
{
|
2009-01-23 16:24:11 -05:00
|
|
|
public:
|
2009-02-08 22:18:10 -05:00
|
|
|
PortGroup (std::string const & n);
|
2008-12-08 11:07:28 -05:00
|
|
|
|
2009-01-20 09:46:00 -05:00
|
|
|
void add_bundle (boost::shared_ptr<ARDOUR::Bundle>);
|
2009-02-08 22:18:10 -05:00
|
|
|
void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
|
2009-01-26 23:21:13 -05:00
|
|
|
boost::shared_ptr<ARDOUR::Bundle> only_bundle ();
|
2009-01-20 09:46:00 -05:00
|
|
|
void clear ();
|
2009-02-08 22:18:10 -05:00
|
|
|
uint32_t total_channels () const;
|
2008-12-08 11:07:28 -05:00
|
|
|
|
|
|
|
std::string name; ///< name for the group
|
2009-01-26 23:21:13 -05:00
|
|
|
|
|
|
|
ARDOUR::BundleList const & bundles () const {
|
|
|
|
return _bundles;
|
|
|
|
}
|
|
|
|
|
2009-01-23 16:24:11 -05:00
|
|
|
bool visible () const {
|
|
|
|
return _visible;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_visible (bool v) {
|
|
|
|
_visible = v;
|
2009-01-30 10:08:09 -05:00
|
|
|
Modified ();
|
2009-01-23 16:24:11 -05:00
|
|
|
}
|
|
|
|
|
2009-01-24 10:21:22 -05:00
|
|
|
bool has_port (std::string const &) const;
|
|
|
|
|
2009-01-30 10:08:09 -05:00
|
|
|
sigc::signal<void> Modified;
|
2009-02-08 22:18:10 -05:00
|
|
|
sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
|
2009-01-23 16:24:11 -05:00
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
private:
|
|
|
|
void bundle_changed (ARDOUR::Bundle::Change);
|
|
|
|
|
2009-01-26 23:21:13 -05:00
|
|
|
ARDOUR::BundleList _bundles;
|
2009-02-08 22:18:10 -05:00
|
|
|
|
|
|
|
typedef std::map<boost::shared_ptr<ARDOUR::Bundle>, sigc::connection> ConnectionList;
|
|
|
|
ConnectionList _bundle_changed_connections;
|
|
|
|
|
2009-01-23 16:24:11 -05:00
|
|
|
bool _visible; ///< true if the group is visible in the UI
|
2008-12-08 11:07:28 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/// A list of PortGroups
|
2009-02-08 22:18:10 -05:00
|
|
|
class PortGroupList : public sigc::trackable
|
2008-12-08 11:07:28 -05:00
|
|
|
{
|
|
|
|
public:
|
2009-01-30 10:08:09 -05:00
|
|
|
PortGroupList ();
|
2008-12-08 11:07:28 -05:00
|
|
|
|
2009-01-30 10:08:09 -05:00
|
|
|
typedef std::vector<boost::shared_ptr<PortGroup> > List;
|
|
|
|
|
|
|
|
void add_group (boost::shared_ptr<PortGroup>);
|
2008-12-08 11:07:28 -05:00
|
|
|
void set_type (ARDOUR::DataType);
|
2009-01-30 10:08:09 -05:00
|
|
|
void gather (ARDOUR::Session &, bool);
|
2009-01-26 23:21:13 -05:00
|
|
|
ARDOUR::BundleList const & bundles () const;
|
2009-01-30 10:08:09 -05:00
|
|
|
void clear ();
|
2009-02-08 22:18:10 -05:00
|
|
|
void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
|
|
|
|
uint32_t total_visible_channels () const;
|
2009-01-30 10:08:09 -05:00
|
|
|
uint32_t size () const {
|
|
|
|
return _groups.size();
|
|
|
|
}
|
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
void suspend_signals ();
|
|
|
|
void resume_signals ();
|
|
|
|
|
2009-01-30 10:08:09 -05:00
|
|
|
List::const_iterator begin () const {
|
|
|
|
return _groups.begin();
|
|
|
|
}
|
2009-01-23 16:24:11 -05:00
|
|
|
|
2009-01-30 10:08:09 -05:00
|
|
|
List::const_iterator end () const {
|
|
|
|
return _groups.end();
|
|
|
|
}
|
2009-02-08 22:18:10 -05:00
|
|
|
|
|
|
|
sigc::signal<void> Changed;
|
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
private:
|
2009-01-24 10:21:22 -05:00
|
|
|
bool port_has_prefix (std::string const &, std::string const &) const;
|
2009-01-23 16:24:11 -05:00
|
|
|
std::string common_prefix (std::vector<std::string> const &) const;
|
2009-02-08 22:18:10 -05:00
|
|
|
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;
|
2009-01-20 09:46:00 -05:00
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
ARDOUR::DataType _type;
|
2009-01-26 23:21:13 -05:00
|
|
|
mutable ARDOUR::BundleList _bundles;
|
2009-01-30 10:08:09 -05:00
|
|
|
List _groups;
|
2009-02-08 22:18:10 -05:00
|
|
|
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>);
|
|
|
|
|
|
|
|
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;
|
2008-12-08 11:07:28 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __gtk_ardour_port_group_h__ */
|