2009-01-12 20:15:19 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2008-2015 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2009-01-12 20:15:19 -05:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
#ifndef __gtk_ardour_port_group_h__
|
|
|
|
#define __gtk_ardour_port_group_h__
|
2008-12-08 11:07:28 -05:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2009-06-09 19:43:20 -04:00
|
|
|
#include <set>
|
2009-12-17 13:24:23 -05:00
|
|
|
#include <boost/shared_ptr.hpp>
|
2009-12-19 15:26:31 -05:00
|
|
|
#include "pbd/signals.h"
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
#include <gtkmm/widget.h>
|
|
|
|
#include <gtkmm/checkbutton.h>
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/data_type.h"
|
|
|
|
#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;
|
2009-06-09 16:21:19 -04:00
|
|
|
class Processor;
|
2009-06-09 19:43:20 -04:00
|
|
|
class IO;
|
2008-12-08 11:07:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
class PortMatrix;
|
2009-07-17 09:18:58 -04:00
|
|
|
class PublicEditor;
|
2008-12-08 11:07:28 -05:00
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
/** A list of bundles grouped by some aspect of their type e.g. busses, tracks, system.
|
|
|
|
* A group has 0 or more bundles.
|
2009-01-20 09:46:00 -05:00
|
|
|
*/
|
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);
|
2009-12-17 13:24:23 -05:00
|
|
|
~PortGroup ();
|
2008-12-08 11:07:28 -05:00
|
|
|
|
2009-11-14 18:08:17 -05:00
|
|
|
void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, bool allow_dups = false);
|
2009-07-19 20:22:09 -04:00
|
|
|
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);
|
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 ();
|
2010-06-29 22:59:13 -04:00
|
|
|
ARDOUR::ChanCount total_channels () const;
|
2009-07-19 20:22:09 -04:00
|
|
|
boost::shared_ptr<ARDOUR::IO> io_from_bundle (boost::shared_ptr<ARDOUR::Bundle>) const;
|
2009-12-21 20:10:25 -05:00
|
|
|
void remove_duplicates ();
|
2008-12-08 11:07:28 -05:00
|
|
|
|
|
|
|
std::string name; ///< name for the group
|
2009-01-26 23:21:13 -05:00
|
|
|
|
2009-01-24 10:21:22 -05:00
|
|
|
bool has_port (std::string const &) const;
|
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
/** The bundle list has changed in some way; a bundle has been added or removed, or the list cleared etc. */
|
2009-12-19 15:26:31 -05:00
|
|
|
PBD::Signal0<void> Changed;
|
2009-12-04 22:04:54 -05:00
|
|
|
|
|
|
|
/** An individual bundle on our list has changed in some way */
|
2009-12-19 15:26:31 -05:00
|
|
|
PBD::Signal1<void,ARDOUR::Bundle::Change> BundleChanged;
|
2009-01-23 16:24:11 -05:00
|
|
|
|
2009-07-17 09:18:58 -04:00
|
|
|
struct BundleRecord {
|
2009-12-17 13:24:23 -05:00
|
|
|
boost::shared_ptr<ARDOUR::Bundle> bundle;
|
|
|
|
/** IO whose ports are in the bundle, or 0. This is so that we can do things like adding
|
|
|
|
ports to the IO from matrix editor menus. */
|
2011-06-01 13:00:29 -04:00
|
|
|
boost::weak_ptr<ARDOUR::IO> io;
|
2009-12-17 13:24:23 -05:00
|
|
|
Gdk::Color colour;
|
|
|
|
bool has_colour;
|
2009-12-21 13:23:07 -05:00
|
|
|
PBD::ScopedConnection changed_connection;
|
2009-12-17 13:24:23 -05:00
|
|
|
|
|
|
|
BundleRecord (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO>, Gdk::Color, bool has_colour);
|
2009-07-17 09:18:58 -04:00
|
|
|
};
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
typedef std::list<BundleRecord*> BundleList;
|
2009-07-17 09:18:58 -04:00
|
|
|
|
|
|
|
BundleList const & bundles () const {
|
|
|
|
return _bundles;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
private:
|
|
|
|
void bundle_changed (ARDOUR::Bundle::Change);
|
2009-11-14 18:08:17 -05:00
|
|
|
void add_bundle_internal (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO>, bool, Gdk::Color, bool);
|
2009-02-08 22:18:10 -05:00
|
|
|
|
2009-07-17 09:18:58 -04:00
|
|
|
BundleList _bundles;
|
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
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2009-01-30 10:08:09 -05:00
|
|
|
PortGroupList ();
|
2009-12-17 13:24:23 -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>);
|
2009-11-18 08:35:31 -05:00
|
|
|
void add_group_if_not_empty (boost::shared_ptr<PortGroup>);
|
2012-05-20 17:56:28 -04:00
|
|
|
void gather (ARDOUR::Session *, ARDOUR::DataType, bool, bool, bool);
|
2009-07-17 09:18:58 -04:00
|
|
|
PortGroup::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>);
|
2010-06-29 22:59:13 -04:00
|
|
|
ARDOUR::ChanCount total_channels () const;
|
2009-01-30 10:08:09 -05:00
|
|
|
uint32_t size () const {
|
|
|
|
return _groups.size();
|
|
|
|
}
|
2009-07-19 20:22:09 -04:00
|
|
|
boost::shared_ptr<ARDOUR::IO> io_from_bundle (boost::shared_ptr<ARDOUR::Bundle>) const;
|
2009-01-30 10:08:09 -05:00
|
|
|
|
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 {
|
2009-11-14 19:26:28 -05:00
|
|
|
return _groups.begin ();
|
2009-01-30 10:08:09 -05:00
|
|
|
}
|
2009-01-23 16:24:11 -05:00
|
|
|
|
2009-01-30 10:08:09 -05:00
|
|
|
List::const_iterator end () const {
|
2009-11-14 19:26:28 -05:00
|
|
|
return _groups.end ();
|
2009-01-30 10:08:09 -05:00
|
|
|
}
|
2009-02-08 22:18:10 -05:00
|
|
|
|
2009-11-14 19:26:28 -05:00
|
|
|
bool empty () const;
|
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
/** The group list has changed in some way; a group has been added or removed, or the list cleared etc. */
|
2009-12-19 15:26:31 -05:00
|
|
|
PBD::Signal0<void> Changed;
|
2009-12-04 22:04:54 -05:00
|
|
|
|
|
|
|
/** A bundle in one of our groups has changed */
|
2009-12-19 15:26:31 -05:00
|
|
|
PBD::Signal1<void,ARDOUR::Bundle::Change> BundleChanged;
|
2009-02-08 22:18:10 -05:00
|
|
|
|
2017-07-01 15:11:14 -04: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 ();
|
2009-11-07 15:33:41 -05:00
|
|
|
void emit_bundle_changed (ARDOUR::Bundle::Change);
|
2015-12-03 12:43:54 -05:00
|
|
|
boost::shared_ptr<ARDOUR::Bundle> make_bundle_from_ports (std::vector<std::string> const &, ARDOUR::DataType, bool, std::string const& bundle_name = std::string()) const;
|
2017-07-01 15:11:14 -04:00
|
|
|
void maybe_add_processor_to_list (boost::weak_ptr<ARDOUR::Processor>, std::list<boost::shared_ptr<ARDOUR::IO> > *, bool, std::set<boost::shared_ptr<ARDOUR::IO> > &);
|
2009-06-09 16:21:19 -04:00
|
|
|
|
2009-07-17 09:18:58 -04:00
|
|
|
mutable PortGroup::BundleList _bundles;
|
2009-01-30 10:08:09 -05:00
|
|
|
List _groups;
|
2009-12-17 13:24:23 -05:00
|
|
|
PBD::ScopedConnectionList _bundle_changed_connections;
|
2009-12-19 15:26:31 -05:00
|
|
|
PBD::ScopedConnectionList _changed_connections;
|
2009-02-08 22:18:10 -05:00
|
|
|
bool _signals_suspended;
|
|
|
|
bool _pending_change;
|
2009-11-07 15:33:41 -05:00
|
|
|
ARDOUR::Bundle::Change _pending_bundle_change;
|
2009-02-08 22:18:10 -05:00
|
|
|
};
|
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
#endif /* __gtk_ardour_port_group_h__ */
|