Some refactoring. Add port group headers to the port matrix.
git-svn-id: svn://localhost/ardour2/branches/3.0@4443 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
a9d67a2cc9
commit
49510ba1d7
|
@ -33,12 +33,16 @@
|
||||||
BundleEditorMatrix::BundleEditorMatrix (
|
BundleEditorMatrix::BundleEditorMatrix (
|
||||||
ARDOUR::Session& session, boost::shared_ptr<ARDOUR::Bundle> bundle
|
ARDOUR::Session& session, boost::shared_ptr<ARDOUR::Bundle> bundle
|
||||||
)
|
)
|
||||||
: PortMatrix (
|
: PortMatrix (session, bundle->type(), bundle->ports_are_inputs())
|
||||||
session, bundle->type(), bundle->ports_are_inputs(),
|
|
||||||
PortGroupList::Mask (PortGroupList::SYSTEM | PortGroupList::OTHER)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
_our_bundles.push_back (bundle);
|
_port_group = new PortGroup ("", true);
|
||||||
|
_port_group->bundles.push_back (bundle);
|
||||||
|
_row_ports.push_back (_port_group);
|
||||||
|
}
|
||||||
|
|
||||||
|
BundleEditorMatrix::~BundleEditorMatrix ()
|
||||||
|
{
|
||||||
|
delete _port_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -89,14 +93,14 @@ BundleEditorMatrix::add_channel (boost::shared_ptr<ARDOUR::Bundle> b)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_our_bundles.front()->add_channel (d.get_name());
|
_port_group->bundles.front()->add_channel (d.get_name());
|
||||||
setup ();
|
setup ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BundleEditorMatrix::remove_channel (boost::shared_ptr<ARDOUR::Bundle> b, uint32_t c)
|
BundleEditorMatrix::remove_channel (boost::shared_ptr<ARDOUR::Bundle> b, uint32_t c)
|
||||||
{
|
{
|
||||||
_our_bundles.front()->remove_channel (c);
|
_port_group->bundles.front()->remove_channel (c);
|
||||||
setup ();
|
setup ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +236,10 @@ BundleManager::BundleManager (ARDOUR::Session& session)
|
||||||
_tree_view.append_column (_("Name"), _list_model_columns.name);
|
_tree_view.append_column (_("Name"), _list_model_columns.name);
|
||||||
_tree_view.set_headers_visible (false);
|
_tree_view.set_headers_visible (false);
|
||||||
|
|
||||||
_session.foreach_bundle (sigc::mem_fun (*this, &BundleManager::add_bundle));
|
boost::shared_ptr<ARDOUR::BundleList> bundles = _session.bundles ();
|
||||||
|
for (ARDOUR::BundleList::iterator i = bundles->begin(); i != bundles->end(); ++i) {
|
||||||
|
add_bundle (*i);
|
||||||
|
}
|
||||||
|
|
||||||
/* New / Edit / Delete buttons */
|
/* New / Edit / Delete buttons */
|
||||||
Gtk::VBox* buttons = new Gtk::VBox;
|
Gtk::VBox* buttons = new Gtk::VBox;
|
||||||
|
|
|
@ -35,6 +35,7 @@ class BundleEditorMatrix : public PortMatrix
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BundleEditorMatrix (ARDOUR::Session &, boost::shared_ptr<ARDOUR::Bundle>);
|
BundleEditorMatrix (ARDOUR::Session &, boost::shared_ptr<ARDOUR::Bundle>);
|
||||||
|
~BundleEditorMatrix ();
|
||||||
|
|
||||||
void set_state (
|
void set_state (
|
||||||
boost::shared_ptr<ARDOUR::Bundle> ab,
|
boost::shared_ptr<ARDOUR::Bundle> ab,
|
||||||
|
@ -58,6 +59,9 @@ class BundleEditorMatrix : public PortMatrix
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void rename_channel (boost::shared_ptr<ARDOUR::Bundle>, uint32_t);
|
void rename_channel (boost::shared_ptr<ARDOUR::Bundle>, uint32_t);
|
||||||
|
|
||||||
|
private:
|
||||||
|
PortGroup* _port_group;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BundleEditor : public ArdourDialog
|
class BundleEditor : public ArdourDialog
|
||||||
|
|
|
@ -25,25 +25,19 @@
|
||||||
#include "ardour/port.h"
|
#include "ardour/port.h"
|
||||||
|
|
||||||
GlobalPortMatrix::GlobalPortMatrix (ARDOUR::Session& s, ARDOUR::DataType t)
|
GlobalPortMatrix::GlobalPortMatrix (ARDOUR::Session& s, ARDOUR::DataType t)
|
||||||
: PortMatrix (s, t, true, PortGroupList::Mask (PortGroupList::BUSS |
|
: PortMatrix (s, t, true),
|
||||||
PortGroupList::TRACK |
|
|
||||||
PortGroupList::SYSTEM |
|
|
||||||
PortGroupList::OTHER)),
|
|
||||||
_session (s),
|
_session (s),
|
||||||
_our_port_group_list (s, t, false, PortGroupList::Mask (PortGroupList::BUSS |
|
_our_port_group_list (t, false)
|
||||||
PortGroupList::TRACK |
|
|
||||||
PortGroupList::SYSTEM |
|
|
||||||
PortGroupList::OTHER))
|
|
||||||
{
|
{
|
||||||
setup ();
|
setup ();
|
||||||
|
|
||||||
_port_group_list.VisibilityChanged.connect (sigc::mem_fun (*this, &GlobalPortMatrix::group_visibility_changed));
|
_column_ports.VisibilityChanged.connect (sigc::mem_fun (*this, &GlobalPortMatrix::group_visibility_changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GlobalPortMatrix::group_visibility_changed ()
|
GlobalPortMatrix::group_visibility_changed ()
|
||||||
{
|
{
|
||||||
_our_port_group_list.take_visibility_from (_port_group_list);
|
_row_ports.take_visibility_from (_column_ports);
|
||||||
setup ();
|
setup ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,11 +45,8 @@ GlobalPortMatrix::group_visibility_changed ()
|
||||||
void
|
void
|
||||||
GlobalPortMatrix::setup ()
|
GlobalPortMatrix::setup ()
|
||||||
{
|
{
|
||||||
_our_port_group_list.refresh ();
|
_row_ports.gather (_session);
|
||||||
_our_bundles = _our_port_group_list.bundles ();
|
|
||||||
|
|
||||||
PortMatrix::setup ();
|
PortMatrix::setup ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -42,25 +42,30 @@ using namespace ARDOUR;
|
||||||
using namespace Gtk;
|
using namespace Gtk;
|
||||||
|
|
||||||
IOSelector::IOSelector (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io, bool offer_inputs)
|
IOSelector::IOSelector (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io, bool offer_inputs)
|
||||||
: PortMatrix (session, io->default_type(), offer_inputs,
|
: PortMatrix (session, io->default_type(), offer_inputs)
|
||||||
PortGroupList::Mask (PortGroupList::BUSS |
|
|
||||||
PortGroupList::SYSTEM |
|
|
||||||
PortGroupList::OTHER))
|
|
||||||
, _session (session)
|
, _session (session)
|
||||||
, _io (io)
|
, _io (io)
|
||||||
{
|
{
|
||||||
/* Listen for ports changing on the IO */
|
/* Listen for ports changing on the IO */
|
||||||
_io->PortCountChanged.connect (sigc::hide (mem_fun (*this, &IOSelector::ports_changed)));
|
_io->PortCountChanged.connect (sigc::hide (mem_fun (*this, &IOSelector::ports_changed)));
|
||||||
|
|
||||||
|
_port_group = new PortGroup ("", true);
|
||||||
|
_row_ports.push_back (_port_group);
|
||||||
|
|
||||||
setup ();
|
setup ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IOSelector::~IOSelector ()
|
||||||
|
{
|
||||||
|
delete _port_group;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
IOSelector::setup ()
|
IOSelector::setup ()
|
||||||
{
|
{
|
||||||
_our_bundles.clear ();
|
_port_group->bundles.clear ();
|
||||||
_our_bundles.push_back (boost::shared_ptr<ARDOUR::Bundle> (new ARDOUR::Bundle));
|
_port_group->bundles.push_back (boost::shared_ptr<ARDOUR::Bundle> (new ARDOUR::Bundle));
|
||||||
_our_bundles.front()->set_name (_io->name());
|
_port_group->bundles.front()->set_name (_io->name());
|
||||||
|
|
||||||
if (offering_input ()) {
|
if (offering_input ()) {
|
||||||
const PortSet& ps (_io->outputs());
|
const PortSet& ps (_io->outputs());
|
||||||
|
@ -69,8 +74,8 @@ IOSelector::setup ()
|
||||||
for (PortSet::const_iterator i = ps.begin(); i != ps.end(); ++i) {
|
for (PortSet::const_iterator i = ps.begin(); i != ps.end(); ++i) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
snprintf (buf, sizeof(buf), _("out %d"), j + 1);
|
snprintf (buf, sizeof(buf), _("out %d"), j + 1);
|
||||||
_our_bundles.front()->add_channel (buf);
|
_port_group->bundles.front()->add_channel (buf);
|
||||||
_our_bundles.front()->add_port_to_channel (j, _session.engine().make_port_name_non_relative (i->name()));
|
_port_group->bundles.front()->add_port_to_channel (j, _session.engine().make_port_name_non_relative (i->name()));
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,8 +87,8 @@ IOSelector::setup ()
|
||||||
for (PortSet::const_iterator i = ps.begin(); i != ps.end(); ++i) {
|
for (PortSet::const_iterator i = ps.begin(); i != ps.end(); ++i) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
snprintf (buf, sizeof(buf), _("in %d"), j + 1);
|
snprintf (buf, sizeof(buf), _("in %d"), j + 1);
|
||||||
_our_bundles.front()->add_channel (buf);
|
_port_group->bundles.front()->add_channel (buf);
|
||||||
_our_bundles.front()->add_port_to_channel (j, _session.engine().make_port_name_non_relative (i->name()));
|
_port_group->bundles.front()->add_port_to_channel (j, _session.engine().make_port_name_non_relative (i->name()));
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,11 +308,7 @@ IOSelectorWindow::IOSelectorWindow (ARDOUR::Session& session, boost::shared_ptr<
|
||||||
|
|
||||||
get_vbox()->set_spacing (8);
|
get_vbox()->set_spacing (8);
|
||||||
|
|
||||||
/* XXX: do we still need the ScrolledWindow? */
|
get_vbox()->pack_start (_selector, true, true);
|
||||||
Gtk::ScrolledWindow* sel_scroll = Gtk::manage (new Gtk::ScrolledWindow);
|
|
||||||
sel_scroll->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_NEVER);
|
|
||||||
sel_scroll->add (_selector);
|
|
||||||
get_vbox()->pack_start (*sel_scroll, true, true);
|
|
||||||
|
|
||||||
set_position (Gtk::WIN_POS_MOUSE);
|
set_position (Gtk::WIN_POS_MOUSE);
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace ARDOUR {
|
||||||
class IOSelector : public PortMatrix {
|
class IOSelector : public PortMatrix {
|
||||||
public:
|
public:
|
||||||
IOSelector (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool);
|
IOSelector (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool);
|
||||||
|
~IOSelector ();
|
||||||
|
|
||||||
void set_state (
|
void set_state (
|
||||||
boost::shared_ptr<ARDOUR::Bundle>,
|
boost::shared_ptr<ARDOUR::Bundle>,
|
||||||
|
@ -62,6 +63,7 @@ class IOSelector : public PortMatrix {
|
||||||
private:
|
private:
|
||||||
ARDOUR::Session& _session;
|
ARDOUR::Session& _session;
|
||||||
boost::shared_ptr<ARDOUR::IO> _io;
|
boost::shared_ptr<ARDOUR::IO> _io;
|
||||||
|
PortGroup* _port_group;
|
||||||
|
|
||||||
void ports_changed ();
|
void ports_changed ();
|
||||||
};
|
};
|
||||||
|
|
|
@ -629,11 +629,12 @@ MixerStrip::output_press (GdkEventButton *ev)
|
||||||
citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
|
citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_output)));
|
||||||
citems.push_back (SeparatorElem());
|
citems.push_back (SeparatorElem());
|
||||||
|
|
||||||
std::vector<boost::shared_ptr<Bundle> > current = _route->bundles_connected_to_outputs ();
|
ARDOUR::BundleList current = _route->bundles_connected_to_outputs ();
|
||||||
|
|
||||||
_session.foreach_bundle (
|
boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
|
||||||
bind (mem_fun (*this, &MixerStrip::add_bundle_to_output_menu), current)
|
for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
|
||||||
);
|
add_bundle_to_output_menu (*i, current);
|
||||||
|
}
|
||||||
|
|
||||||
output_menu.popup (1, ev->time);
|
output_menu.popup (1, ev->time);
|
||||||
break;
|
break;
|
||||||
|
@ -697,11 +698,12 @@ MixerStrip::input_press (GdkEventButton *ev)
|
||||||
citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
|
citems.push_back (MenuElem (_("Disconnect"), mem_fun (*(static_cast<RouteUI*>(this)), &RouteUI::disconnect_input)));
|
||||||
citems.push_back (SeparatorElem());
|
citems.push_back (SeparatorElem());
|
||||||
|
|
||||||
std::vector<boost::shared_ptr<Bundle> > current = _route->bundles_connected_to_inputs ();
|
ARDOUR::BundleList current = _route->bundles_connected_to_inputs ();
|
||||||
|
|
||||||
_session.foreach_bundle (
|
boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
|
||||||
bind (mem_fun (*this, &MixerStrip::add_bundle_to_input_menu), current)
|
for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
|
||||||
);
|
add_bundle_to_input_menu (*i, current);
|
||||||
|
}
|
||||||
|
|
||||||
input_menu.popup (1, ev->time);
|
input_menu.popup (1, ev->time);
|
||||||
break;
|
break;
|
||||||
|
@ -745,7 +747,7 @@ MixerStrip::bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MixerStrip::add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> > const & current)
|
MixerStrip::add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
|
||||||
{
|
{
|
||||||
using namespace Menu_Helpers;
|
using namespace Menu_Helpers;
|
||||||
|
|
||||||
|
@ -770,7 +772,7 @@ MixerStrip::add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, std::vector<b
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MixerStrip::add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> > const & current)
|
MixerStrip::add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const & current)
|
||||||
{
|
{
|
||||||
using namespace Menu_Helpers;
|
using namespace Menu_Helpers;
|
||||||
|
|
||||||
|
@ -833,7 +835,7 @@ MixerStrip::connect_to_pan ()
|
||||||
void
|
void
|
||||||
MixerStrip::update_input_display ()
|
MixerStrip::update_input_display ()
|
||||||
{
|
{
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > c = _route->bundles_connected_to_inputs ();
|
ARDOUR::BundleList c = _route->bundles_connected_to_inputs ();
|
||||||
|
|
||||||
/* XXX: how do we represent >1 connected bundle? */
|
/* XXX: how do we represent >1 connected bundle? */
|
||||||
if (c.empty() == false) {
|
if (c.empty() == false) {
|
||||||
|
@ -854,7 +856,7 @@ MixerStrip::update_input_display ()
|
||||||
void
|
void
|
||||||
MixerStrip::update_output_display ()
|
MixerStrip::update_output_display ()
|
||||||
{
|
{
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > c = _route->bundles_connected_to_outputs ();
|
ARDOUR::BundleList c = _route->bundles_connected_to_outputs ();
|
||||||
|
|
||||||
/* XXX: how do we represent >1 connected bundle? */
|
/* XXX: how do we represent >1 connected bundle? */
|
||||||
if (c.empty() == false) {
|
if (c.empty() == false) {
|
||||||
|
|
|
@ -180,10 +180,10 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
|
||||||
gint output_press (GdkEventButton *);
|
gint output_press (GdkEventButton *);
|
||||||
|
|
||||||
Gtk::Menu input_menu;
|
Gtk::Menu input_menu;
|
||||||
void add_bundle_to_input_menu (boost::shared_ptr<ARDOUR::Bundle>, std::vector<boost::shared_ptr<ARDOUR::Bundle> > const &);
|
void add_bundle_to_input_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &);
|
||||||
|
|
||||||
Gtk::Menu output_menu;
|
Gtk::Menu output_menu;
|
||||||
void add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, std::vector<boost::shared_ptr<ARDOUR::Bundle> > const &);
|
void add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &);
|
||||||
|
|
||||||
void bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle>);
|
void bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle>);
|
||||||
void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
|
void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
|
||||||
|
|
|
@ -60,7 +60,7 @@ PortGroup::clear ()
|
||||||
bool
|
bool
|
||||||
PortGroup::has_port (std::string const& p) const
|
PortGroup::has_port (std::string const& p) const
|
||||||
{
|
{
|
||||||
for (vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
|
for (ARDOUR::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
|
||||||
if ((*i)->offers_port_alone (p)) {
|
if ((*i)->offers_port_alone (p)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -111,40 +111,29 @@ PortGroupUI::setup_visibility_checkbutton ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PortGroupList constructor.
|
/** PortGroupList constructor.
|
||||||
* @param session Session to get bundles from.
|
|
||||||
* @param type Type of bundles to offer (audio or MIDI)
|
* @param type Type of bundles to offer (audio or MIDI)
|
||||||
* @param offer_inputs true to offer output bundles, otherwise false.
|
* @param offer_inputs true to offer output bundles, otherwise false.
|
||||||
* @param mask Mask of groups to make visible by default.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PortGroupList::PortGroupList (ARDOUR::Session & session, ARDOUR::DataType type, bool offer_inputs, Mask mask)
|
PortGroupList::PortGroupList (ARDOUR::DataType type, bool offer_inputs)
|
||||||
: _session (session), _type (type), _offer_inputs (offer_inputs),
|
: _type (type), _offer_inputs (offer_inputs),
|
||||||
_buss (_("Bus"), mask & BUSS),
|
_buss (_("Bus"), true),
|
||||||
_track (_("Track"), mask & TRACK),
|
_track (_("Track"), true),
|
||||||
_system (_("System"), mask & SYSTEM),
|
_system (_("System"), true),
|
||||||
_other (_("Other"), mask & OTHER)
|
_other (_("Other"), true)
|
||||||
{
|
{
|
||||||
refresh ();
|
|
||||||
|
|
||||||
for (iterator i = begin(); i != end(); ++i) {
|
|
||||||
(*i)->VisibilityChanged.connect (sigc::mem_fun (*this, &PortGroupList::visibility_changed));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Find or re-find all our bundles and set up our lists */
|
/** Gather bundles from around the system and put them in this PortGroupList */
|
||||||
void
|
void
|
||||||
PortGroupList::refresh ()
|
PortGroupList::gather (ARDOUR::Session& session)
|
||||||
{
|
{
|
||||||
clear ();
|
clear_list ();
|
||||||
|
|
||||||
_buss.clear ();
|
|
||||||
_track.clear ();
|
|
||||||
_system.clear ();
|
|
||||||
_other.clear ();
|
|
||||||
|
|
||||||
/* Find the bundles for routes */
|
/* Find the bundles for routes */
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::Session::RouteList> routes = _session.get_routes ();
|
boost::shared_ptr<ARDOUR::Session::RouteList> routes = session.get_routes ();
|
||||||
|
|
||||||
for (ARDOUR::Session::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
|
for (ARDOUR::Session::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
|
||||||
|
|
||||||
|
@ -174,20 +163,25 @@ PortGroupList::refresh ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bundles created by the session */
|
/* Bundles created by the session */
|
||||||
_session.foreach_bundle (sigc::mem_fun (*this, &PortGroupList::maybe_add_session_bundle));
|
boost::shared_ptr<ARDOUR::BundleList> b = session.bundles ();
|
||||||
|
for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
|
||||||
|
if ((*i)->ports_are_inputs() == _offer_inputs && (*i)->type() == _type) {
|
||||||
|
_system.bundles.push_back (*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* XXX: inserts, sends, plugin inserts? */
|
/* XXX: inserts, sends, plugin inserts? */
|
||||||
|
|
||||||
/* Now find all other ports that we haven't thought of yet */
|
/* Now find all other ports that we haven't thought of yet */
|
||||||
|
|
||||||
const char **ports = _session.engine().get_ports ("", _type.to_jack_type(), _offer_inputs ?
|
const char **ports = session.engine().get_ports ("", _type.to_jack_type(), _offer_inputs ?
|
||||||
JackPortIsInput : JackPortIsOutput);
|
JackPortIsInput : JackPortIsOutput);
|
||||||
if (ports) {
|
if (ports) {
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
string client_matching_string;
|
string client_matching_string;
|
||||||
|
|
||||||
client_matching_string = _session.engine().client_name();
|
client_matching_string = session.engine().client_name();
|
||||||
client_matching_string += ':';
|
client_matching_string += ':';
|
||||||
|
|
||||||
while (ports[n]) {
|
while (ports[n]) {
|
||||||
|
@ -215,6 +209,12 @@ PortGroupList::refresh ()
|
||||||
push_back (&_buss);
|
push_back (&_buss);
|
||||||
push_back (&_track);
|
push_back (&_track);
|
||||||
push_back (&_other);
|
push_back (&_other);
|
||||||
|
|
||||||
|
for (iterator i = begin(); i != end(); ++i) {
|
||||||
|
_visibility_connections.push_back (
|
||||||
|
(*i)->VisibilityChanged.connect (sigc::mem_fun (*this, &PortGroupList::visibility_changed))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -236,20 +236,12 @@ PortGroupList::set_offer_inputs (bool i)
|
||||||
_offer_inputs = i;
|
_offer_inputs = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
ARDOUR::BundleList
|
||||||
PortGroupList::maybe_add_session_bundle (boost::shared_ptr<ARDOUR::Bundle> b)
|
PortGroupList::bundles () const
|
||||||
{
|
{
|
||||||
if (b->ports_are_inputs () == _offer_inputs && b->type () == _type) {
|
ARDOUR::BundleList bundles;
|
||||||
_system.bundles.push_back (b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> >
|
for (const_iterator i = begin (); i != end (); ++i) {
|
||||||
PortGroupList::bundles ()
|
|
||||||
{
|
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > bundles;
|
|
||||||
|
|
||||||
for (iterator i = begin (); i != end (); ++i) {
|
|
||||||
if ((*i)->visible()) {
|
if ((*i)->visible()) {
|
||||||
|
|
||||||
std::copy ((*i)->bundles.begin(), (*i)->bundles.end(), std::back_inserter (bundles));
|
std::copy ((*i)->bundles.begin(), (*i)->bundles.end(), std::back_inserter (bundles));
|
||||||
|
@ -334,3 +326,20 @@ PortGroupList::take_visibility_from (PortGroupList const & o)
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PortGroupList::clear_list ()
|
||||||
|
{
|
||||||
|
clear ();
|
||||||
|
|
||||||
|
_buss.clear ();
|
||||||
|
_track.clear ();
|
||||||
|
_system.clear ();
|
||||||
|
_other.clear ();
|
||||||
|
|
||||||
|
for (std::vector<sigc::connection>::iterator i = _visibility_connections.begin(); i != _visibility_connections.end(); ++i) {
|
||||||
|
i->disconnect ();
|
||||||
|
}
|
||||||
|
|
||||||
|
_visibility_connections.clear ();
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <gtkmm/checkbutton.h>
|
#include <gtkmm/checkbutton.h>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <ardour/data_type.h>
|
#include <ardour/data_type.h>
|
||||||
|
#include <ardour/types.h>
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class Session;
|
class Session;
|
||||||
|
@ -53,7 +54,7 @@ public:
|
||||||
void clear ();
|
void clear ();
|
||||||
|
|
||||||
std::string name; ///< name for the group
|
std::string name; ///< name for the group
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > bundles;
|
ARDOUR::BundleList bundles;
|
||||||
std::vector<std::string> ports;
|
std::vector<std::string> ports;
|
||||||
bool visible () const {
|
bool visible () const {
|
||||||
return _visible;
|
return _visible;
|
||||||
|
@ -95,30 +96,22 @@ class PortGroupUI
|
||||||
class PortGroupList : public std::list<PortGroup*>, public sigc::trackable
|
class PortGroupList : public std::list<PortGroup*>, public sigc::trackable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Mask {
|
PortGroupList (ARDOUR::DataType, bool);
|
||||||
BUSS = 0x1,
|
|
||||||
TRACK = 0x2,
|
|
||||||
SYSTEM = 0x4,
|
|
||||||
OTHER = 0x8
|
|
||||||
};
|
|
||||||
|
|
||||||
PortGroupList (ARDOUR::Session &, ARDOUR::DataType, bool, Mask);
|
void gather (ARDOUR::Session &);
|
||||||
|
|
||||||
void refresh ();
|
|
||||||
void set_type (ARDOUR::DataType);
|
void set_type (ARDOUR::DataType);
|
||||||
void set_offer_inputs (bool);
|
void set_offer_inputs (bool);
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
|
ARDOUR::BundleList bundles () const;
|
||||||
void take_visibility_from (PortGroupList const &);
|
void take_visibility_from (PortGroupList const &);
|
||||||
|
void clear_list ();
|
||||||
|
|
||||||
sigc::signal<void> VisibilityChanged;
|
sigc::signal<void> VisibilityChanged;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void maybe_add_session_bundle (boost::shared_ptr<ARDOUR::Bundle>);
|
|
||||||
bool port_has_prefix (std::string const &, std::string const &) const;
|
bool port_has_prefix (std::string const &, std::string const &) const;
|
||||||
std::string common_prefix (std::vector<std::string> const &) const;
|
std::string common_prefix (std::vector<std::string> const &) const;
|
||||||
void visibility_changed ();
|
void visibility_changed ();
|
||||||
|
|
||||||
ARDOUR::Session& _session;
|
|
||||||
ARDOUR::DataType _type;
|
ARDOUR::DataType _type;
|
||||||
bool _offer_inputs;
|
bool _offer_inputs;
|
||||||
|
|
||||||
|
@ -126,6 +119,8 @@ class PortGroupList : public std::list<PortGroup*>, public sigc::trackable
|
||||||
PortGroup _track;
|
PortGroup _track;
|
||||||
PortGroup _system;
|
PortGroup _system;
|
||||||
PortGroup _other;
|
PortGroup _other;
|
||||||
|
|
||||||
|
std::vector<sigc::connection> _visibility_connections;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __gtk_ardour_port_group_h__ */
|
#endif /* __gtk_ardour_port_group_h__ */
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <gtkmm/adjustment.h>
|
#include <gtkmm/adjustment.h>
|
||||||
#include <gtkmm/label.h>
|
#include <gtkmm/label.h>
|
||||||
#include "ardour/bundle.h"
|
#include "ardour/bundle.h"
|
||||||
|
#include "ardour/types.h"
|
||||||
#include "port_matrix.h"
|
#include "port_matrix.h"
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
|
@ -29,20 +30,23 @@
|
||||||
* @param session Our session.
|
* @param session Our session.
|
||||||
* @param type Port type that we are handling.
|
* @param type Port type that we are handling.
|
||||||
* @param offer_inputs true to offer inputs, otherwise false.
|
* @param offer_inputs true to offer inputs, otherwise false.
|
||||||
* @param mask Mask of port groups to offer.
|
|
||||||
*/
|
*/
|
||||||
PortMatrix::PortMatrix (ARDOUR::Session& session, ARDOUR::DataType type, bool offer_inputs, PortGroupList::Mask mask)
|
PortMatrix::PortMatrix (ARDOUR::Session& session, ARDOUR::DataType type, bool offer_inputs)
|
||||||
: _port_group_list (session, type, offer_inputs, mask),
|
: _row_ports (type, !offer_inputs),
|
||||||
|
_column_ports (type, offer_inputs),
|
||||||
|
_session (session),
|
||||||
_offer_inputs (offer_inputs),
|
_offer_inputs (offer_inputs),
|
||||||
_type (type),
|
_type (type),
|
||||||
_body (this, offer_inputs ? PortMatrixBody::BOTTOM_AND_LEFT : PortMatrixBody::TOP_AND_RIGHT)
|
_body (this, offer_inputs ? PortMatrixBody::BOTTOM_AND_LEFT : PortMatrixBody::TOP_AND_RIGHT)
|
||||||
{
|
{
|
||||||
|
setup ();
|
||||||
|
|
||||||
/* checkbuttons for visibility of groups */
|
/* checkbuttons for visibility of groups */
|
||||||
Gtk::HBox* visibility_buttons = Gtk::manage (new Gtk::HBox);
|
Gtk::HBox* visibility_buttons = Gtk::manage (new Gtk::HBox);
|
||||||
|
|
||||||
visibility_buttons->pack_start (*Gtk::manage (new Gtk::Label (_("Show:"))), Gtk::PACK_SHRINK);
|
visibility_buttons->pack_start (*Gtk::manage (new Gtk::Label (_("Show:"))), Gtk::PACK_SHRINK);
|
||||||
|
|
||||||
for (std::list<PortGroup*>::iterator i = _port_group_list.begin(); i != _port_group_list.end(); ++i) {
|
for (std::list<PortGroup*>::iterator i = _column_ports.begin(); i != _column_ports.end(); ++i) {
|
||||||
_port_group_uis.push_back (new PortGroupUI (this, *i));
|
_port_group_uis.push_back (new PortGroupUI (this, *i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,8 +80,8 @@ PortMatrix::~PortMatrix ()
|
||||||
void
|
void
|
||||||
PortMatrix::setup ()
|
PortMatrix::setup ()
|
||||||
{
|
{
|
||||||
_port_group_list.refresh ();
|
_column_ports.gather (_session);
|
||||||
_body.setup (_our_bundles, _port_group_list.bundles ());
|
_body.setup (_row_ports, _column_ports);
|
||||||
setup_scrollbars ();
|
setup_scrollbars ();
|
||||||
queue_draw ();
|
queue_draw ();
|
||||||
}
|
}
|
||||||
|
@ -86,7 +90,8 @@ void
|
||||||
PortMatrix::set_offer_inputs (bool s)
|
PortMatrix::set_offer_inputs (bool s)
|
||||||
{
|
{
|
||||||
_offer_inputs = s;
|
_offer_inputs = s;
|
||||||
_port_group_list.set_offer_inputs (s);
|
_column_ports.set_offer_inputs (s);
|
||||||
|
_row_ports.set_offer_inputs (!s);
|
||||||
setup ();
|
setup ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +99,8 @@ void
|
||||||
PortMatrix::set_type (ARDOUR::DataType t)
|
PortMatrix::set_type (ARDOUR::DataType t)
|
||||||
{
|
{
|
||||||
_type = t;
|
_type = t;
|
||||||
_port_group_list.set_type (t);
|
_column_ports.set_type (t);
|
||||||
|
_row_ports.set_type (t);
|
||||||
setup ();
|
setup ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,18 +137,17 @@ PortMatrix::setup_scrollbars ()
|
||||||
void
|
void
|
||||||
PortMatrix::disassociate_all ()
|
PortMatrix::disassociate_all ()
|
||||||
{
|
{
|
||||||
for (PortGroupList::iterator i = _port_group_list.begin(); i != _port_group_list.end(); ++i) {
|
ARDOUR::BundleList c = _column_ports.bundles ();
|
||||||
|
ARDOUR::BundleList r = _row_ports.bundles ();
|
||||||
|
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::iterator j = (*i)->bundles.begin(); j != (*i)->bundles.end(); ++j) {
|
for (ARDOUR::BundleList::iterator i = c.begin(); i != c.end(); ++i) {
|
||||||
|
for (uint32_t j = 0; j < (*i)->nchannels(); ++j) {
|
||||||
for (uint32_t k = 0; k < (*j)->nchannels(); ++k) {
|
for (uint32_t k = 0; k < r.front()->nchannels(); ++k) {
|
||||||
|
|
||||||
for (uint32_t l = 0; l < _our_bundles.front()->nchannels(); ++l) {
|
|
||||||
|
|
||||||
set_state (
|
set_state (
|
||||||
_our_bundles.front(), l, *j, k, false, 0
|
r.front(), k, *i, j, false, 0
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,13 +46,21 @@ namespace ARDOUR {
|
||||||
class PortMatrix : public Gtk::VBox
|
class PortMatrix : public Gtk::VBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PortMatrix (ARDOUR::Session&, ARDOUR::DataType, bool, PortGroupList::Mask);
|
PortMatrix (ARDOUR::Session&, ARDOUR::DataType, bool);
|
||||||
~PortMatrix ();
|
~PortMatrix ();
|
||||||
|
|
||||||
virtual void setup ();
|
virtual void setup ();
|
||||||
void set_offer_inputs (bool);
|
void set_offer_inputs (bool);
|
||||||
void set_type (ARDOUR::DataType);
|
void set_type (ARDOUR::DataType);
|
||||||
bool offering_input () const { return _offer_inputs; }
|
|
||||||
|
ARDOUR::DataType type () const {
|
||||||
|
return _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool offering_input () const {
|
||||||
|
return _offer_inputs;
|
||||||
|
}
|
||||||
|
|
||||||
void disassociate_all ();
|
void disassociate_all ();
|
||||||
|
|
||||||
enum Result {
|
enum Result {
|
||||||
|
@ -106,15 +114,15 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > _our_bundles;
|
PortGroupList _row_ports;
|
||||||
/// list of port groups
|
PortGroupList _column_ports;
|
||||||
PortGroupList _port_group_list;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void hscroll_changed ();
|
void hscroll_changed ();
|
||||||
void vscroll_changed ();
|
void vscroll_changed ();
|
||||||
|
|
||||||
|
ARDOUR::Session& _session;
|
||||||
/// true to offer inputs, otherwise false
|
/// true to offer inputs, otherwise false
|
||||||
bool _offer_inputs;
|
bool _offer_inputs;
|
||||||
/// port type that we are working with
|
/// port type that we are working with
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "ardour/bundle.h"
|
#include "ardour/bundle.h"
|
||||||
|
#include "ardour/types.h"
|
||||||
#include "port_matrix_body.h"
|
#include "port_matrix_body.h"
|
||||||
#include "port_matrix.h"
|
#include "port_matrix.h"
|
||||||
|
|
||||||
|
@ -29,7 +30,9 @@ PortMatrixBody::PortMatrixBody (PortMatrix* p, Arrangement a)
|
||||||
_grid (p, this),
|
_grid (p, this),
|
||||||
_arrangement (a),
|
_arrangement (a),
|
||||||
_xoffset (0),
|
_xoffset (0),
|
||||||
_yoffset (0)
|
_yoffset (0),
|
||||||
|
_column_ports (_port_matrix->type(), _port_matrix->offering_input()),
|
||||||
|
_row_ports (_port_matrix->type(), !_port_matrix->offering_input())
|
||||||
{
|
{
|
||||||
modify_bg (Gtk::STATE_NORMAL, Gdk::Color ("#00000"));
|
modify_bg (Gtk::STATE_NORMAL, Gdk::Color ("#00000"));
|
||||||
}
|
}
|
||||||
|
@ -215,10 +218,7 @@ PortMatrixBody::compute_rectangles ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PortMatrixBody::setup (
|
PortMatrixBody::setup (PortGroupList const& row, PortGroupList const& column)
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > const & row,
|
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > const & column
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
for (std::list<sigc::connection>::iterator i = _bundle_connections.begin(); i != _bundle_connections.end(); ++i) {
|
for (std::list<sigc::connection>::iterator i = _bundle_connections.begin(); i != _bundle_connections.end(); ++i) {
|
||||||
i->disconnect ();
|
i->disconnect ();
|
||||||
|
@ -226,10 +226,11 @@ PortMatrixBody::setup (
|
||||||
|
|
||||||
_bundle_connections.clear ();
|
_bundle_connections.clear ();
|
||||||
|
|
||||||
_row_bundles = row;
|
_row_ports = row;
|
||||||
_column_bundles = column;
|
_column_ports = column;
|
||||||
|
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::iterator i = _row_bundles.begin(); i != _row_bundles.end(); ++i) {
|
ARDOUR::BundleList r = _row_ports.bundles ();
|
||||||
|
for (ARDOUR::BundleList::iterator i = r.begin(); i != r.end(); ++i) {
|
||||||
|
|
||||||
_bundle_connections.push_back (
|
_bundle_connections.push_back (
|
||||||
(*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_row_labels))
|
(*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_row_labels))
|
||||||
|
@ -237,7 +238,8 @@ PortMatrixBody::setup (
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::iterator i = _column_bundles.begin(); i != _column_bundles.end(); ++i) {
|
ARDOUR::BundleList c = _column_ports.bundles ();
|
||||||
|
for (ARDOUR::BundleList::iterator i = c.begin(); i != c.end(); ++i) {
|
||||||
_bundle_connections.push_back (
|
_bundle_connections.push_back (
|
||||||
(*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_column_labels))
|
(*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_column_labels))
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "port_matrix_column_labels.h"
|
#include "port_matrix_column_labels.h"
|
||||||
#include "port_matrix_row_labels.h"
|
#include "port_matrix_row_labels.h"
|
||||||
#include "port_matrix_grid.h"
|
#include "port_matrix_grid.h"
|
||||||
|
#include "port_group.h"
|
||||||
|
|
||||||
class PortMatrix;
|
class PortMatrix;
|
||||||
|
|
||||||
|
@ -40,20 +41,17 @@ public:
|
||||||
|
|
||||||
PortMatrixBody (PortMatrix *, Arrangement);
|
PortMatrixBody (PortMatrix *, Arrangement);
|
||||||
|
|
||||||
/** @return bundles to offer for columns */
|
/** @return ports to offer for columns */
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > const & column_bundles () {
|
PortGroupList const & column_ports () {
|
||||||
return _column_bundles;
|
return _column_ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return bundles to offer for rows */
|
/** @return ports to offer for rows */
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > const & row_bundles () {
|
PortGroupList const & row_ports () {
|
||||||
return _row_bundles;
|
return _row_ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup (
|
void setup (PortGroupList const &, PortGroupList const &);
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > const &,
|
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > const &
|
|
||||||
);
|
|
||||||
|
|
||||||
uint32_t full_scroll_width ();
|
uint32_t full_scroll_width ();
|
||||||
uint32_t alloc_scroll_width ();
|
uint32_t alloc_scroll_width ();
|
||||||
|
@ -91,9 +89,9 @@ private:
|
||||||
uint32_t _yoffset;
|
uint32_t _yoffset;
|
||||||
|
|
||||||
/// bundles to offer for columns
|
/// bundles to offer for columns
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > _column_bundles;
|
PortGroupList _column_ports;
|
||||||
/// bundles to offer for rows
|
/// bundles to offer for rows
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > _row_bundles;
|
PortGroupList _row_ports;
|
||||||
|
|
||||||
std::list<sigc::connection> _bundle_connections;
|
std::list<sigc::connection> _bundle_connections;
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "ardour/bundle.h"
|
#include "ardour/bundle.h"
|
||||||
|
#include "ardour/types.h"
|
||||||
#include "port_matrix_column_labels.h"
|
#include "port_matrix_column_labels.h"
|
||||||
#include "port_matrix.h"
|
#include "port_matrix.h"
|
||||||
|
|
||||||
|
@ -39,10 +40,13 @@ PortMatrixColumnLabels::compute_dimensions ()
|
||||||
_longest_bundle_name = 0;
|
_longest_bundle_name = 0;
|
||||||
/* width of the longest channel name */
|
/* width of the longest channel name */
|
||||||
_longest_channel_name = 0;
|
_longest_channel_name = 0;
|
||||||
/* height of highest bit of text */
|
/* height of highest bit of text (apart from group names) */
|
||||||
_highest_text = 0;
|
_highest_text = 0;
|
||||||
|
/* width of the whole thing */
|
||||||
|
_width = 0;
|
||||||
|
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->column_bundles().begin (); i != _body->column_bundles().end(); ++i) {
|
ARDOUR::BundleList const c = _body->column_ports().bundles();
|
||||||
|
for (ARDOUR::BundleList::const_iterator i = c.begin (); i != c.end(); ++i) {
|
||||||
|
|
||||||
cairo_text_extents_t ext;
|
cairo_text_extents_t ext;
|
||||||
cairo_text_extents (cr, (*i)->name().c_str(), &ext);
|
cairo_text_extents (cr, (*i)->name().c_str(), &ext);
|
||||||
|
@ -68,23 +72,33 @@ PortMatrixColumnLabels::compute_dimensions ()
|
||||||
_highest_text = ext.height;
|
_highest_text = ext.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_width += (*i)->nchannels() * column_width();
|
||||||
|
}
|
||||||
|
|
||||||
|
_highest_group_name = 0;
|
||||||
|
for (PortGroupList::const_iterator i = _body->column_ports().begin(); i != _body->column_ports().end(); ++i) {
|
||||||
|
if ((*i)->visible()) {
|
||||||
|
cairo_text_extents_t ext;
|
||||||
|
cairo_text_extents (cr, (*i)->name.c_str(), &ext);
|
||||||
|
if (ext.height > _highest_group_name) {
|
||||||
|
_highest_group_name = ext.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
gdk_pixmap_unref (pm);
|
gdk_pixmap_unref (pm);
|
||||||
|
|
||||||
/* width and height of the whole thing */
|
/* height of the whole thing */
|
||||||
|
|
||||||
_width = 0;
|
double const parallelogram_height =
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->column_bundles().begin (); i != _body->column_bundles().end(); ++i) {
|
|
||||||
_width += (*i)->nchannels() * column_width();
|
|
||||||
}
|
|
||||||
|
|
||||||
_height =
|
|
||||||
(_longest_bundle_name + _longest_channel_name + 4 * name_pad()) * sin (angle())
|
(_longest_bundle_name + _longest_channel_name + 4 * name_pad()) * sin (angle())
|
||||||
+ _highest_text * cos (angle());
|
+ _highest_text * cos (angle());
|
||||||
|
|
||||||
_width += _height / tan (angle ());
|
_height = parallelogram_height + _highest_group_name + 2 * name_pad();
|
||||||
|
|
||||||
|
_width += parallelogram_height / tan (angle ());
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
|
@ -103,28 +117,84 @@ PortMatrixColumnLabels::render (cairo_t* cr)
|
||||||
cairo_rectangle (cr, 0, 0, _width, _height);
|
cairo_rectangle (cr, 0, 0, _width, _height);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* BUNDLE PARALLELOGRAM-TYPE-THING AND NAME */
|
/* PORT GROUP NAME */
|
||||||
|
|
||||||
double x = 0;
|
double x = 0;
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->column_bundles().begin (); i != _body->column_bundles().end(); ++i) {
|
double y = 0;
|
||||||
|
|
||||||
Gdk::Color colour = get_a_bundle_colour (i - _body->column_bundles().begin ());
|
if (_location == TOP) {
|
||||||
|
x = (_height - _highest_group_name - 2 * name_pad()) / tan (angle());
|
||||||
|
y = _highest_group_name + name_pad();
|
||||||
|
} else {
|
||||||
|
x = 0;
|
||||||
|
y = _height - name_pad();
|
||||||
|
}
|
||||||
|
|
||||||
|
int g = 0;
|
||||||
|
for (PortGroupList::const_iterator i = _body->column_ports().begin(); i != _body->column_ports().end(); ++i) {
|
||||||
|
|
||||||
|
if (!(*i)->visible() || ((*i)->bundles.empty() && (*i)->ports.empty()) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* compute width of this group */
|
||||||
|
uint32_t w = 0;
|
||||||
|
for (ARDOUR::BundleList::const_iterator j = (*i)->bundles.begin(); j != (*i)->bundles.end(); ++j) {
|
||||||
|
w += (*j)->nchannels() * column_width();
|
||||||
|
}
|
||||||
|
w += (*i)->ports.size() * column_width();
|
||||||
|
|
||||||
|
/* rectangle */
|
||||||
|
set_source_rgb (cr, get_a_group_colour (g));
|
||||||
|
double const rh = _highest_group_name + 2 * name_pad();
|
||||||
|
if (_location == TOP) {
|
||||||
|
cairo_rectangle (cr, x, 0, w, rh);
|
||||||
|
} else if (_location == BOTTOM) {
|
||||||
|
cairo_rectangle (cr, x, _height - rh, w, rh);
|
||||||
|
}
|
||||||
|
cairo_fill (cr);
|
||||||
|
|
||||||
|
std::pair<std::string, double> const display = display_port_name (cr, (*i)->name, w);
|
||||||
|
|
||||||
|
/* plot it */
|
||||||
|
set_source_rgb (cr, text_colour());
|
||||||
|
cairo_move_to (cr, x + (w - display.second) / 2, y);
|
||||||
|
cairo_show_text (cr, display.first.c_str());
|
||||||
|
|
||||||
|
x += w;
|
||||||
|
++g;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* BUNDLE PARALLELOGRAM-TYPE-THING AND NAME */
|
||||||
|
|
||||||
|
x = 0;
|
||||||
|
ARDOUR::BundleList const c = _body->column_ports().bundles();
|
||||||
|
for (ARDOUR::BundleList::const_iterator i = c.begin (); i != c.end(); ++i) {
|
||||||
|
|
||||||
|
Gdk::Color colour = get_a_bundle_colour (i - c.begin ());
|
||||||
set_source_rgb (cr, colour);
|
set_source_rgb (cr, colour);
|
||||||
|
|
||||||
double const w = (*i)->nchannels() * column_width();
|
double const w = (*i)->nchannels() * column_width();
|
||||||
|
double const ph = _height - _highest_group_name - 2 * name_pad();
|
||||||
|
|
||||||
double x_ = x;
|
double x_ = x;
|
||||||
double y_ = _height;
|
|
||||||
|
|
||||||
|
if (_location == TOP) {
|
||||||
|
y = _height;
|
||||||
|
} else if (_location == BOTTOM) {
|
||||||
|
y = ph;
|
||||||
|
}
|
||||||
|
|
||||||
|
double y_ = y;
|
||||||
cairo_move_to (cr, x_, y_);
|
cairo_move_to (cr, x_, y_);
|
||||||
x_ += w;
|
x_ += w;
|
||||||
cairo_line_to (cr, x_, y_);
|
cairo_line_to (cr, x_, y_);
|
||||||
x_ += _height / tan (angle ());
|
x_ += ph / tan (angle ());
|
||||||
y_ -= _height;
|
y_ -= ph;
|
||||||
cairo_line_to (cr, x_, y_);
|
cairo_line_to (cr, x_, y_);
|
||||||
x_ -= w;
|
x_ -= w;
|
||||||
cairo_line_to (cr, x_, y_);
|
cairo_line_to (cr, x_, y_);
|
||||||
cairo_line_to (cr, x, _height);
|
cairo_line_to (cr, x, y);
|
||||||
cairo_fill_preserve (cr);
|
cairo_fill_preserve (cr);
|
||||||
set_source_rgb (cr, background_colour());
|
set_source_rgb (cr, background_colour());
|
||||||
cairo_set_line_width (cr, label_border_width());
|
cairo_set_line_width (cr, label_border_width());
|
||||||
|
@ -132,7 +202,6 @@ PortMatrixColumnLabels::render (cairo_t* cr)
|
||||||
|
|
||||||
set_source_rgb (cr, text_colour());
|
set_source_rgb (cr, text_colour());
|
||||||
|
|
||||||
|
|
||||||
if (_location == TOP) {
|
if (_location == TOP) {
|
||||||
|
|
||||||
double const rl = 3 * name_pad() + _longest_channel_name;
|
double const rl = 3 * name_pad() + _longest_channel_name;
|
||||||
|
@ -147,7 +216,7 @@ PortMatrixColumnLabels::render (cairo_t* cr)
|
||||||
cairo_move_to (
|
cairo_move_to (
|
||||||
cr,
|
cr,
|
||||||
x + basic_text_x_pos (0),
|
x + basic_text_x_pos (0),
|
||||||
_height - name_pad() * sin (angle())
|
ph - name_pad() * sin (angle())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,16 +232,17 @@ PortMatrixColumnLabels::render (cairo_t* cr)
|
||||||
/* PORT NAMES */
|
/* PORT NAMES */
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->column_bundles().begin(); i != _body->column_bundles().end(); ++i) {
|
for (ARDOUR::BundleList::const_iterator i = c.begin (); i != c.end(); ++i) {
|
||||||
|
|
||||||
for (uint32_t j = 0; j < (*i)->nchannels(); ++j) {
|
for (uint32_t j = 0; j < (*i)->nchannels(); ++j) {
|
||||||
|
|
||||||
double const lc = _longest_channel_name + name_pad();
|
double const lc = _longest_channel_name + name_pad();
|
||||||
double const w = column_width();
|
double const w = column_width();
|
||||||
|
double const ph = _height - _highest_group_name - 2 * name_pad();
|
||||||
|
|
||||||
if (_location == BOTTOM) {
|
if (_location == BOTTOM) {
|
||||||
|
|
||||||
double x_ = x + _height / tan (angle()) + w;
|
double x_ = x + ph / tan (angle()) + w;
|
||||||
double const ix = x_;
|
double const ix = x_;
|
||||||
double y_ = 0;
|
double y_ = 0;
|
||||||
cairo_move_to (cr, x_, y_);
|
cairo_move_to (cr, x_, y_);
|
||||||
|
@ -203,7 +273,7 @@ PortMatrixColumnLabels::render (cairo_t* cr)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Gdk::Color colour = get_a_bundle_colour (i - _body->column_bundles().begin());
|
Gdk::Color colour = get_a_bundle_colour (i - c.begin());
|
||||||
set_source_rgb (cr, colour);
|
set_source_rgb (cr, colour);
|
||||||
cairo_fill_preserve (cr);
|
cairo_fill_preserve (cr);
|
||||||
set_source_rgb (cr, background_colour());
|
set_source_rgb (cr, background_colour());
|
||||||
|
@ -216,7 +286,7 @@ PortMatrixColumnLabels::render (cairo_t* cr)
|
||||||
cairo_move_to (cr, x + basic_text_x_pos(j), _height - name_pad() * sin (angle()));
|
cairo_move_to (cr, x + basic_text_x_pos(j), _height - name_pad() * sin (angle()));
|
||||||
} else if (_location == BOTTOM) {
|
} else if (_location == BOTTOM) {
|
||||||
double const rl = 3 * name_pad() + _longest_bundle_name;
|
double const rl = 3 * name_pad() + _longest_bundle_name;
|
||||||
cairo_move_to (cr, x + basic_text_x_pos(j) + rl * cos (angle ()), _height - rl * sin (angle()));
|
cairo_move_to (cr, x + basic_text_x_pos(j) + rl * cos (angle ()), ph - rl * sin (angle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
|
|
|
@ -50,6 +50,7 @@ private:
|
||||||
double _longest_bundle_name;
|
double _longest_bundle_name;
|
||||||
double _longest_channel_name;
|
double _longest_channel_name;
|
||||||
double _highest_text;
|
double _highest_text;
|
||||||
|
double _highest_group_name;
|
||||||
Location _location;
|
Location _location;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -105,3 +105,35 @@ PortMatrixComponent::dimensions ()
|
||||||
|
|
||||||
return std::make_pair (_width, _height);
|
return std::make_pair (_width, _height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::pair<std::string, double>
|
||||||
|
PortMatrixComponent::display_port_name (cairo_t* cr, std::string const &n, double avail) const
|
||||||
|
{
|
||||||
|
/* XXX hopefully there exists a more efficient way of doing this */
|
||||||
|
|
||||||
|
Glib::ustring name = Glib::ustring (n).uppercase ();
|
||||||
|
bool abbreviated = false;
|
||||||
|
uint32_t width = 0;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if (name.length() <= 2) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_text_extents_t ext;
|
||||||
|
cairo_text_extents (cr, name.c_str(), &ext);
|
||||||
|
if (ext.width < avail) {
|
||||||
|
width = ext.width;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (abbreviated) {
|
||||||
|
name = name.substr (0, name.length() - 2) + ".";
|
||||||
|
} else {
|
||||||
|
name = name.substr (0, name.length() - 1) + ".";
|
||||||
|
abbreviated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::make_pair (name, width);
|
||||||
|
}
|
||||||
|
|
|
@ -124,8 +124,18 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX */
|
||||||
|
static Gdk::Color get_a_group_colour (int x) {
|
||||||
|
if ((x % 2) == 0) {
|
||||||
|
return Gdk::Color ("#222222");
|
||||||
|
} else {
|
||||||
|
return Gdk::Color ("#444444");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void set_source_rgb (cairo_t *, Gdk::Color const &);
|
void set_source_rgb (cairo_t *, Gdk::Color const &);
|
||||||
void set_source_rgba (cairo_t *, Gdk::Color const &, double);
|
void set_source_rgba (cairo_t *, Gdk::Color const &, double);
|
||||||
|
std::pair<std::string, double> display_port_name (cairo_t*, std::string const &, double) const;
|
||||||
|
|
||||||
/** Render the complete component to a cairo context. */
|
/** Render the complete component to a cairo context. */
|
||||||
virtual void render (cairo_t *) = 0;
|
virtual void render (cairo_t *) = 0;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cairo/cairo.h>
|
#include <cairo/cairo.h>
|
||||||
#include "ardour/bundle.h"
|
#include "ardour/bundle.h"
|
||||||
|
#include "ardour/types.h"
|
||||||
#include "port_matrix_grid.h"
|
#include "port_matrix_grid.h"
|
||||||
#include "port_matrix.h"
|
#include "port_matrix.h"
|
||||||
|
|
||||||
|
@ -34,13 +35,15 @@ void
|
||||||
PortMatrixGrid::compute_dimensions ()
|
PortMatrixGrid::compute_dimensions ()
|
||||||
{
|
{
|
||||||
_width = 0;
|
_width = 0;
|
||||||
for (uint32_t i = 0; i < _body->column_bundles().size(); ++i) {
|
ARDOUR::BundleList const c = _body->column_ports().bundles();
|
||||||
_width += _body->column_bundles()[i]->nchannels() * column_width();
|
for (ARDOUR::BundleList::const_iterator i = c.begin(); i != c.end(); ++i) {
|
||||||
|
_width += (*i)->nchannels() * column_width();
|
||||||
}
|
}
|
||||||
|
|
||||||
_height = 0;
|
_height = 0;
|
||||||
for (uint32_t i = 0; i < _body->row_bundles().size(); ++i) {
|
ARDOUR::BundleList const r = _body->row_ports().bundles();
|
||||||
_height += _body->row_bundles()[i]->nchannels() * row_height();
|
for (ARDOUR::BundleList::const_iterator i = r.begin(); i != r.end(); ++i) {
|
||||||
|
_height += (*i)->nchannels() * row_height();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,17 +61,18 @@ PortMatrixGrid::render (cairo_t* cr)
|
||||||
|
|
||||||
set_source_rgb (cr, grid_colour());
|
set_source_rgb (cr, grid_colour());
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::size_type i = 0; i < _body->column_bundles().size(); ++i) {
|
ARDOUR::BundleList const c = _body->column_ports().bundles();
|
||||||
|
for (ARDOUR::BundleList::size_type i = 0; i < c.size(); ++i) {
|
||||||
|
|
||||||
cairo_set_line_width (cr, thin_grid_line_width());
|
cairo_set_line_width (cr, thin_grid_line_width());
|
||||||
for (uint32_t j = 1; j < _body->column_bundles()[i]->nchannels(); ++j) {
|
for (uint32_t j = 1; j < c[i]->nchannels(); ++j) {
|
||||||
x += column_width();
|
x += column_width();
|
||||||
cairo_move_to (cr, x, 0);
|
cairo_move_to (cr, x, 0);
|
||||||
cairo_line_to (cr, x, _height);
|
cairo_line_to (cr, x, _height);
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < (_body->column_bundles().size() - 1)) {
|
if (i < (c.size() - 1)) {
|
||||||
x += column_width();
|
x += column_width();
|
||||||
cairo_set_line_width (cr, thick_grid_line_width());
|
cairo_set_line_width (cr, thick_grid_line_width());
|
||||||
cairo_move_to (cr, x, 0);
|
cairo_move_to (cr, x, 0);
|
||||||
|
@ -82,17 +86,18 @@ PortMatrixGrid::render (cairo_t* cr)
|
||||||
/* HORIZONTAL GRID LINES */
|
/* HORIZONTAL GRID LINES */
|
||||||
|
|
||||||
uint32_t y = 0;
|
uint32_t y = 0;
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::size_type i = 0; i < _body->row_bundles().size(); ++i) {
|
ARDOUR::BundleList const r = _body->row_ports().bundles();
|
||||||
|
for (ARDOUR::BundleList::size_type i = 0; i < r.size(); ++i) {
|
||||||
|
|
||||||
cairo_set_line_width (cr, thin_grid_line_width());
|
cairo_set_line_width (cr, thin_grid_line_width());
|
||||||
for (uint32_t j = 1; j < _body->row_bundles()[i]->nchannels(); ++j) {
|
for (uint32_t j = 1; j < r[i]->nchannels(); ++j) {
|
||||||
y += row_height();
|
y += row_height();
|
||||||
cairo_move_to (cr, 0, y);
|
cairo_move_to (cr, 0, y);
|
||||||
cairo_line_to (cr, grid_width, y);
|
cairo_line_to (cr, grid_width, y);
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < (_body->row_bundles().size() - 1)) {
|
if (i < (r.size() - 1)) {
|
||||||
y += row_height();
|
y += row_height();
|
||||||
cairo_set_line_width (cr, thick_grid_line_width());
|
cairo_set_line_width (cr, thick_grid_line_width());
|
||||||
cairo_move_to (cr, 0, y);
|
cairo_move_to (cr, 0, y);
|
||||||
|
@ -106,10 +111,10 @@ PortMatrixGrid::render (cairo_t* cr)
|
||||||
uint32_t bx = 0;
|
uint32_t bx = 0;
|
||||||
uint32_t by = 0;
|
uint32_t by = 0;
|
||||||
|
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->column_bundles().begin(); i < _body->column_bundles().end(); ++i) {
|
for (ARDOUR::BundleList::const_iterator i = c.begin(); i < c.end(); ++i) {
|
||||||
by = 0;
|
by = 0;
|
||||||
|
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator j = _body->row_bundles().begin(); j < _body->row_bundles().end(); ++j) {
|
for (ARDOUR::BundleList::const_iterator j = r.begin(); j < r.end(); ++j) {
|
||||||
|
|
||||||
x = bx;
|
x = bx;
|
||||||
for (uint32_t k = 0; k < (*i)->nchannels (); k++) {
|
for (uint32_t k = 0; k < (*i)->nchannels (); k++) {
|
||||||
|
@ -174,7 +179,8 @@ PortMatrixGrid::button_press (double x, double y, int b)
|
||||||
boost::shared_ptr<ARDOUR::Bundle> other_bundle;
|
boost::shared_ptr<ARDOUR::Bundle> other_bundle;
|
||||||
uint32_t other_channel = 0;
|
uint32_t other_channel = 0;
|
||||||
|
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->row_bundles().begin(); i != _body->row_bundles().end(); ++i) {
|
ARDOUR::BundleList const r = _body->row_ports().bundles();
|
||||||
|
for (ARDOUR::BundleList::const_iterator i = r.begin(); i != r.end(); ++i) {
|
||||||
if (grid_row < (*i)->nchannels ()) {
|
if (grid_row < (*i)->nchannels ()) {
|
||||||
our_bundle = *i;
|
our_bundle = *i;
|
||||||
our_channel = grid_row;
|
our_channel = grid_row;
|
||||||
|
@ -184,7 +190,8 @@ PortMatrixGrid::button_press (double x, double y, int b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->column_bundles().begin(); i != _body->column_bundles().end(); ++i) {
|
ARDOUR::BundleList const c = _body->column_ports().bundles();
|
||||||
|
for (ARDOUR::BundleList::const_iterator i = c.begin(); i != c.end(); ++i) {
|
||||||
if (grid_column < (*i)->nchannels ()) {
|
if (grid_column < (*i)->nchannels ()) {
|
||||||
other_bundle = *i;
|
other_bundle = *i;
|
||||||
other_channel = grid_column;
|
other_channel = grid_column;
|
||||||
|
|
|
@ -44,9 +44,6 @@ private:
|
||||||
void compute_dimensions ();
|
void compute_dimensions ();
|
||||||
void render (cairo_t *);
|
void render (cairo_t *);
|
||||||
|
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > _column_bundles;
|
|
||||||
std::vector<boost::shared_ptr<ARDOUR::Bundle> > _row_bundles;
|
|
||||||
|
|
||||||
PortMatrix* _port_matrix;
|
PortMatrix* _port_matrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,10 @@ PortMatrixRowLabels::compute_dimensions ()
|
||||||
cairo_t* cr = gdk_cairo_create (pm);
|
cairo_t* cr = gdk_cairo_create (pm);
|
||||||
|
|
||||||
_longest_port_name = 0;
|
_longest_port_name = 0;
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->row_bundles().begin(); i != _body->row_bundles().end(); ++i) {
|
_longest_bundle_name = 0;
|
||||||
|
_height = 0;
|
||||||
|
ARDOUR::BundleList const r = _body->row_ports().bundles();
|
||||||
|
for (ARDOUR::BundleList::const_iterator i = r.begin(); i != r.end(); ++i) {
|
||||||
for (uint32_t j = 0; j < (*i)->nchannels(); ++j) {
|
for (uint32_t j = 0; j < (*i)->nchannels(); ++j) {
|
||||||
cairo_text_extents_t ext;
|
cairo_text_extents_t ext;
|
||||||
cairo_text_extents (cr, (*i)->channel_name(j).c_str(), &ext);
|
cairo_text_extents (cr, (*i)->channel_name(j).c_str(), &ext);
|
||||||
|
@ -55,26 +58,34 @@ PortMatrixRowLabels::compute_dimensions ()
|
||||||
_longest_port_name = ext.width;
|
_longest_port_name = ext.width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_longest_bundle_name = 0;
|
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->row_bundles().begin(); i != _body->row_bundles().end(); ++i) {
|
|
||||||
cairo_text_extents_t ext;
|
cairo_text_extents_t ext;
|
||||||
cairo_text_extents (cr, (*i)->name().c_str(), &ext);
|
cairo_text_extents (cr, (*i)->name().c_str(), &ext);
|
||||||
if (ext.width > _longest_bundle_name) {
|
if (ext.width > _longest_bundle_name) {
|
||||||
_longest_bundle_name = ext.width;
|
_longest_bundle_name = ext.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_height += (*i)->nchannels() * row_height();
|
||||||
|
}
|
||||||
|
|
||||||
|
_highest_group_name = 0;
|
||||||
|
for (PortGroupList::const_iterator i = _body->row_ports().begin(); i != _body->row_ports().end(); ++i) {
|
||||||
|
if ((*i)->visible()) {
|
||||||
|
cairo_text_extents_t ext;
|
||||||
|
cairo_text_extents (cr, (*i)->name.c_str(), &ext);
|
||||||
|
if (ext.height > _highest_group_name) {
|
||||||
|
_highest_group_name = ext.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
gdk_pixmap_unref (pm);
|
gdk_pixmap_unref (pm);
|
||||||
|
|
||||||
_height = 0;
|
_width = _highest_group_name +
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->row_bundles().begin(); i != _body->row_bundles().end(); ++i) {
|
_longest_port_name +
|
||||||
_height += (*i)->nchannels() * row_height();
|
_longest_bundle_name +
|
||||||
}
|
name_pad() * 6;
|
||||||
|
|
||||||
_width = _longest_port_name + name_pad() * 4 + _longest_bundle_name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,27 +98,73 @@ PortMatrixRowLabels::render (cairo_t* cr)
|
||||||
cairo_rectangle (cr, 0, 0, _width, _height);
|
cairo_rectangle (cr, 0, 0, _width, _height);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
/* SIDE BUNDLE NAMES */
|
/* PORT GROUP NAMES */
|
||||||
|
|
||||||
uint32_t x = 0;
|
double x = 0;
|
||||||
if (_location == LEFT) {
|
if (_location == LEFT) {
|
||||||
x = name_pad();
|
x = 0;
|
||||||
} else if (_location == RIGHT) {
|
} else if (_location == RIGHT) {
|
||||||
x = _longest_port_name + name_pad() * 3;
|
x = _width - _highest_group_name - 2 * name_pad();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t y = 0;
|
double y = 0;
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->row_bundles().begin(); i != _body->row_bundles().end(); ++i) {
|
int g = 0;
|
||||||
|
for (PortGroupList::const_iterator i = _body->row_ports().begin(); i != _body->row_ports().end(); ++i) {
|
||||||
|
|
||||||
Gdk::Color const colour = get_a_bundle_colour (i - _body->row_bundles().begin ());
|
if (!(*i)->visible() || ((*i)->bundles.empty() && (*i)->ports.empty()) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* compute height of this group */
|
||||||
|
double h = 0;
|
||||||
|
for (ARDOUR::BundleList::const_iterator j = (*i)->bundles.begin(); j != (*i)->bundles.end(); ++j) {
|
||||||
|
h += (*j)->nchannels() * row_height();
|
||||||
|
}
|
||||||
|
h += (*i)->ports.size() * row_height();
|
||||||
|
|
||||||
|
/* rectangle */
|
||||||
|
set_source_rgb (cr, get_a_group_colour (g));
|
||||||
|
double const rw = _highest_group_name + 2 * name_pad();
|
||||||
|
cairo_rectangle (cr, x, y, rw, h);
|
||||||
|
cairo_fill (cr);
|
||||||
|
|
||||||
|
/* hence what abbreviation (or not) we need for the group name */
|
||||||
|
std::pair<std::string, double> display = display_port_name (cr, (*i)->name, h);
|
||||||
|
|
||||||
|
/* plot it */
|
||||||
|
set_source_rgb (cr, text_colour());
|
||||||
|
cairo_move_to (cr, x + rw - name_pad(), y + (h + display.second) / 2);
|
||||||
|
cairo_save (cr);
|
||||||
|
cairo_rotate (cr, - M_PI / 2);
|
||||||
|
cairo_show_text (cr, display.first.c_str());
|
||||||
|
cairo_restore (cr);
|
||||||
|
|
||||||
|
y += h;
|
||||||
|
++g;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SIDE BUNDLE NAMES */
|
||||||
|
|
||||||
|
x = 0;
|
||||||
|
if (_location == LEFT) {
|
||||||
|
x = _highest_group_name + 2 * name_pad();
|
||||||
|
} else if (_location == RIGHT) {
|
||||||
|
x = _longest_port_name + name_pad() * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
y = 0;
|
||||||
|
ARDOUR::BundleList const r = _body->row_ports().bundles();
|
||||||
|
for (ARDOUR::BundleList::const_iterator i = r.begin(); i != r.end(); ++i) {
|
||||||
|
|
||||||
|
Gdk::Color const colour = get_a_bundle_colour (i - r.begin ());
|
||||||
set_source_rgb (cr, colour);
|
set_source_rgb (cr, colour);
|
||||||
cairo_rectangle (cr, 0, y, _width, row_height() * (*i)->nchannels());
|
cairo_rectangle (cr, x, y, _longest_bundle_name + name_pad() * 2, row_height() * (*i)->nchannels());
|
||||||
cairo_fill_preserve (cr);
|
cairo_fill_preserve (cr);
|
||||||
set_source_rgb (cr, background_colour());
|
set_source_rgb (cr, background_colour());
|
||||||
cairo_set_line_width (cr, label_border_width ());
|
cairo_set_line_width (cr, label_border_width ());
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
|
|
||||||
uint32_t off = 0;
|
double off = 0;
|
||||||
if ((*i)->nchannels () > 0) {
|
if ((*i)->nchannels () > 0) {
|
||||||
/* use the extent of our first channel name so that the bundle name is vertically aligned with it */
|
/* use the extent of our first channel name so that the bundle name is vertically aligned with it */
|
||||||
cairo_text_extents_t ext;
|
cairo_text_extents_t ext;
|
||||||
|
@ -118,7 +175,7 @@ PortMatrixRowLabels::render (cairo_t* cr)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_source_rgb (cr, text_colour());
|
set_source_rgb (cr, text_colour());
|
||||||
cairo_move_to (cr, x, y + name_pad() + off);
|
cairo_move_to (cr, x + name_pad(), y + name_pad() + off);
|
||||||
cairo_show_text (cr, (*i)->name().c_str());
|
cairo_show_text (cr, (*i)->name().c_str());
|
||||||
|
|
||||||
y += row_height() * (*i)->nchannels ();
|
y += row_height() * (*i)->nchannels ();
|
||||||
|
@ -128,17 +185,17 @@ PortMatrixRowLabels::render (cairo_t* cr)
|
||||||
/* SIDE PORT NAMES */
|
/* SIDE PORT NAMES */
|
||||||
|
|
||||||
y = 0;
|
y = 0;
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->row_bundles().begin(); i != _body->row_bundles().end(); ++i) {
|
for (ARDOUR::BundleList::const_iterator i = r.begin(); i != r.end(); ++i) {
|
||||||
for (uint32_t j = 0; j < (*i)->nchannels(); ++j) {
|
for (uint32_t j = 0; j < (*i)->nchannels(); ++j) {
|
||||||
|
|
||||||
uint32_t x = 0;
|
double x = 0;
|
||||||
if (_location == LEFT) {
|
if (_location == LEFT) {
|
||||||
x = _longest_bundle_name + name_pad() * 2;
|
x = _longest_bundle_name + _highest_group_name + name_pad() * 4;
|
||||||
} else if (_location == RIGHT) {
|
} else if (_location == RIGHT) {
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gdk::Color const colour = get_a_bundle_colour (i - _body->row_bundles().begin ());
|
Gdk::Color const colour = get_a_bundle_colour (i - r.begin ());
|
||||||
set_source_rgb (cr, colour);
|
set_source_rgb (cr, colour);
|
||||||
cairo_rectangle (
|
cairo_rectangle (
|
||||||
cr,
|
cr,
|
||||||
|
@ -154,7 +211,7 @@ PortMatrixRowLabels::render (cairo_t* cr)
|
||||||
|
|
||||||
cairo_text_extents_t ext;
|
cairo_text_extents_t ext;
|
||||||
cairo_text_extents (cr, (*i)->channel_name(j).c_str(), &ext);
|
cairo_text_extents (cr, (*i)->channel_name(j).c_str(), &ext);
|
||||||
uint32_t const off = (row_height() - ext.height) / 2;
|
double const off = (row_height() - ext.height) / 2;
|
||||||
|
|
||||||
set_source_rgb (cr, text_colour());
|
set_source_rgb (cr, text_colour());
|
||||||
cairo_move_to (cr, x + name_pad(), y + name_pad() + off);
|
cairo_move_to (cr, x + name_pad(), y + name_pad() + off);
|
||||||
|
@ -188,7 +245,8 @@ PortMatrixRowLabels::button_press (double x, double y, int b, uint32_t t)
|
||||||
boost::shared_ptr<ARDOUR::Bundle> bundle;
|
boost::shared_ptr<ARDOUR::Bundle> bundle;
|
||||||
uint32_t channel = 0;
|
uint32_t channel = 0;
|
||||||
|
|
||||||
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::const_iterator i = _body->row_bundles().begin(); i != _body->row_bundles().end(); ++i) {
|
ARDOUR::BundleList const r = _body->row_ports().bundles();
|
||||||
|
for (ARDOUR::BundleList::const_iterator i = r.begin(); i != r.end(); ++i) {
|
||||||
if (row < (*i)->nchannels ()) {
|
if (row < (*i)->nchannels ()) {
|
||||||
bundle = *i;
|
bundle = *i;
|
||||||
channel = row;
|
channel = row;
|
||||||
|
|
|
@ -54,8 +54,9 @@ private:
|
||||||
void rename_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>, uint32_t);
|
void rename_channel_proxy (boost::weak_ptr<ARDOUR::Bundle>, uint32_t);
|
||||||
|
|
||||||
PortMatrix* _port_matrix;
|
PortMatrix* _port_matrix;
|
||||||
uint32_t _longest_port_name;
|
double _longest_port_name;
|
||||||
uint32_t _longest_bundle_name;
|
double _longest_bundle_name;
|
||||||
|
double _highest_group_name;
|
||||||
Gtk::Menu* _menu;
|
Gtk::Menu* _menu;
|
||||||
Location _location;
|
Location _location;
|
||||||
};
|
};
|
||||||
|
|
|
@ -127,8 +127,8 @@ class IO : public SessionObject, public AutomatableControls, public Latent
|
||||||
int connect_input_ports_to_bundle (boost::shared_ptr<Bundle>, void *src);
|
int connect_input_ports_to_bundle (boost::shared_ptr<Bundle>, void *src);
|
||||||
int connect_output_ports_to_bundle (boost::shared_ptr<Bundle>, void *src);
|
int connect_output_ports_to_bundle (boost::shared_ptr<Bundle>, void *src);
|
||||||
|
|
||||||
std::vector<boost::shared_ptr<Bundle> > bundles_connected_to_inputs ();
|
BundleList bundles_connected_to_inputs ();
|
||||||
std::vector<boost::shared_ptr<Bundle> > bundles_connected_to_outputs ();
|
BundleList bundles_connected_to_outputs ();
|
||||||
|
|
||||||
boost::shared_ptr<Bundle> bundle_for_inputs () { return _bundle_for_inputs; }
|
boost::shared_ptr<Bundle> bundle_for_inputs () { return _bundle_for_inputs; }
|
||||||
boost::shared_ptr<Bundle> bundle_for_outputs () { return _bundle_for_outputs; }
|
boost::shared_ptr<Bundle> bundle_for_outputs () { return _bundle_for_outputs; }
|
||||||
|
@ -380,9 +380,6 @@ class IO : public SessionObject, public AutomatableControls, public Latent
|
||||||
|
|
||||||
void create_bundles_for_inputs_and_outputs ();
|
void create_bundles_for_inputs_and_outputs ();
|
||||||
void setup_bundles_for_inputs_and_outputs ();
|
void setup_bundles_for_inputs_and_outputs ();
|
||||||
|
|
||||||
void maybe_add_input_bundle_to_list (boost::shared_ptr<Bundle>, std::vector<boost::shared_ptr<Bundle> >*);
|
|
||||||
void maybe_add_output_bundle_to_list (boost::shared_ptr<Bundle>, std::vector<boost::shared_ptr<Bundle> >*);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ARDOUR
|
} // namespace ARDOUR
|
||||||
|
|
|
@ -317,6 +317,10 @@ class Session : public PBD::StatefulDestructible
|
||||||
uint32_t ntracks () const;
|
uint32_t ntracks () const;
|
||||||
uint32_t nbusses () const;
|
uint32_t nbusses () const;
|
||||||
|
|
||||||
|
boost::shared_ptr<BundleList> bundles () {
|
||||||
|
return _bundles.reader ();
|
||||||
|
}
|
||||||
|
|
||||||
struct RoutePublicOrderSorter {
|
struct RoutePublicOrderSorter {
|
||||||
bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
|
bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
|
||||||
};
|
};
|
||||||
|
@ -771,7 +775,6 @@ class Session : public PBD::StatefulDestructible
|
||||||
|
|
||||||
/* I/O bundles */
|
/* I/O bundles */
|
||||||
|
|
||||||
void foreach_bundle (sigc::slot<void, boost::shared_ptr<Bundle> >);
|
|
||||||
void add_bundle (boost::shared_ptr<Bundle>);
|
void add_bundle (boost::shared_ptr<Bundle>);
|
||||||
void remove_bundle (boost::shared_ptr<Bundle>);
|
void remove_bundle (boost::shared_ptr<Bundle>);
|
||||||
boost::shared_ptr<Bundle> bundle_by_name (string) const;
|
boost::shared_ptr<Bundle> bundle_by_name (string) const;
|
||||||
|
@ -1616,9 +1619,7 @@ class Session : public PBD::StatefulDestructible
|
||||||
|
|
||||||
/* I/O bundles */
|
/* I/O bundles */
|
||||||
|
|
||||||
typedef list<boost::shared_ptr<Bundle> > BundleList;
|
SerializedRCUManager<BundleList> _bundles;
|
||||||
mutable Glib::Mutex bundle_lock;
|
|
||||||
BundleList _bundles;
|
|
||||||
XMLNode* _bundle_xml_node;
|
XMLNode* _bundle_xml_node;
|
||||||
int load_bundles (XMLNode const &);
|
int load_bundles (XMLNode const &);
|
||||||
|
|
||||||
|
|
|
@ -419,6 +419,9 @@ namespace ARDOUR {
|
||||||
|
|
||||||
typedef std::list<nframes64_t> AnalysisFeatureList;
|
typedef std::list<nframes64_t> AnalysisFeatureList;
|
||||||
|
|
||||||
|
class Bundle;
|
||||||
|
typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
|
||||||
|
|
||||||
} // namespace ARDOUR
|
} // namespace ARDOUR
|
||||||
|
|
||||||
std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
|
std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf);
|
||||||
|
|
|
@ -2629,42 +2629,11 @@ IO::create_bundles_for_inputs_and_outputs ()
|
||||||
setup_bundles_for_inputs_and_outputs ();
|
setup_bundles_for_inputs_and_outputs ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add a bundle to a list if is connected to our inputs.
|
|
||||||
* @param b Bundle to check.
|
|
||||||
* @param bundles List to add to.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
IO::maybe_add_input_bundle_to_list (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> >* bundles)
|
|
||||||
{
|
|
||||||
if (b->ports_are_outputs() == false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b->nchannels() != n_inputs().n_total ()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < n_inputs().n_total (); ++i) {
|
|
||||||
|
|
||||||
Bundle::PortList const & pl = b->channel_ports (i);
|
|
||||||
|
|
||||||
if (pl.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!input(i)->connected_to (pl[0])) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bundles->push_back (b);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return Bundles connected to our inputs */
|
/** @return Bundles connected to our inputs */
|
||||||
std::vector<boost::shared_ptr<Bundle> >
|
BundleList
|
||||||
IO::bundles_connected_to_inputs ()
|
IO::bundles_connected_to_inputs ()
|
||||||
{
|
{
|
||||||
std::vector<boost::shared_ptr<Bundle> > bundles;
|
BundleList bundles;
|
||||||
|
|
||||||
/* User bundles */
|
/* User bundles */
|
||||||
for (std::vector<UserBundleInfo>::iterator i = _bundles_connected_to_inputs.begin(); i != _bundles_connected_to_inputs.end(); ++i) {
|
for (std::vector<UserBundleInfo>::iterator i = _bundles_connected_to_inputs.begin(); i != _bundles_connected_to_inputs.end(); ++i) {
|
||||||
|
@ -2672,51 +2641,31 @@ IO::bundles_connected_to_inputs ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Normal bundles */
|
/* Normal bundles */
|
||||||
_session.foreach_bundle (
|
boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
|
||||||
sigc::bind (sigc::mem_fun (*this, &IO::maybe_add_input_bundle_to_list), &bundles)
|
for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
|
||||||
);
|
if ((*i)->ports_are_outputs() == false || (*i)->nchannels() != n_inputs().n_total()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t j = 0; j < n_inputs().n_total(); ++j) {
|
||||||
|
|
||||||
|
Bundle::PortList const& pl = (*i)->channel_ports (j);
|
||||||
|
if (!pl.empty() && input(j)->connected_to (pl[0])) {
|
||||||
|
bundles.push_back (*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return bundles;
|
return bundles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Add a bundle to a list if is connected to our outputs.
|
|
||||||
* @param b Bundle to check.
|
|
||||||
* @param bundles List to add to.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
IO::maybe_add_output_bundle_to_list (boost::shared_ptr<Bundle> b, std::vector<boost::shared_ptr<Bundle> >* bundles)
|
|
||||||
{
|
|
||||||
if (b->ports_are_inputs() == false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b->nchannels () != n_outputs().n_total ()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < n_outputs().n_total (); ++i) {
|
|
||||||
|
|
||||||
Bundle::PortList const & pl = b->channel_ports (i);
|
|
||||||
|
|
||||||
if (pl.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!output(i)->connected_to (pl[0])) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bundles->push_back (b);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* @return Bundles connected to our outputs */
|
/* @return Bundles connected to our outputs */
|
||||||
std::vector<boost::shared_ptr<Bundle> >
|
BundleList
|
||||||
IO::bundles_connected_to_outputs ()
|
IO::bundles_connected_to_outputs ()
|
||||||
{
|
{
|
||||||
std::vector<boost::shared_ptr<Bundle> > bundles;
|
BundleList bundles;
|
||||||
|
|
||||||
/* User bundles */
|
/* User bundles */
|
||||||
for (std::vector<UserBundleInfo>::iterator i = _bundles_connected_to_outputs.begin(); i != _bundles_connected_to_outputs.end(); ++i) {
|
for (std::vector<UserBundleInfo>::iterator i = _bundles_connected_to_outputs.begin(); i != _bundles_connected_to_outputs.end(); ++i) {
|
||||||
|
@ -2724,9 +2673,21 @@ IO::bundles_connected_to_outputs ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Auto bundles */
|
/* Auto bundles */
|
||||||
_session.foreach_bundle (
|
boost::shared_ptr<ARDOUR::BundleList> b = _session.bundles ();
|
||||||
sigc::bind (sigc::mem_fun (*this, &IO::maybe_add_output_bundle_to_list), &bundles)
|
for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
|
||||||
);
|
if ((*i)->ports_are_inputs() == false || (*i)->nchannels() != n_outputs().n_total()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t j = 0; j < n_outputs().n_total(); ++j) {
|
||||||
|
|
||||||
|
Bundle::PortList const& pl = (*i)->channel_ports (j);
|
||||||
|
|
||||||
|
if (!pl.empty() && output(j)->connected_to (pl[0])) {
|
||||||
|
bundles.push_back (*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return bundles;
|
return bundles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,7 @@ Session::Session (AudioEngine &eng,
|
||||||
routes (new RouteList),
|
routes (new RouteList),
|
||||||
auditioner ((Auditioner*) 0),
|
auditioner ((Auditioner*) 0),
|
||||||
_total_free_4k_blocks (0),
|
_total_free_4k_blocks (0),
|
||||||
|
_bundles (new BundleList),
|
||||||
_bundle_xml_node (0),
|
_bundle_xml_node (0),
|
||||||
_click_io ((IO*) 0),
|
_click_io ((IO*) 0),
|
||||||
click_data (0),
|
click_data (0),
|
||||||
|
@ -219,6 +220,7 @@ Session::Session (AudioEngine &eng,
|
||||||
routes (new RouteList),
|
routes (new RouteList),
|
||||||
auditioner ((Auditioner *) 0),
|
auditioner ((Auditioner *) 0),
|
||||||
_total_free_4k_blocks (0),
|
_total_free_4k_blocks (0),
|
||||||
|
_bundles (new BundleList),
|
||||||
_bundle_xml_node (0),
|
_bundle_xml_node (0),
|
||||||
_click_io ((IO *) 0),
|
_click_io ((IO *) 0),
|
||||||
click_data (0),
|
click_data (0),
|
||||||
|
@ -3761,8 +3763,9 @@ void
|
||||||
Session::add_bundle (shared_ptr<Bundle> bundle)
|
Session::add_bundle (shared_ptr<Bundle> bundle)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock guard (bundle_lock);
|
RCUWriter<BundleList> writer (_bundles);
|
||||||
_bundles.push_back (bundle);
|
boost::shared_ptr<BundleList> b = writer.get_copy ();
|
||||||
|
b->push_back (bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
BundleAdded (bundle); /* EMIT SIGNAL */
|
BundleAdded (bundle); /* EMIT SIGNAL */
|
||||||
|
@ -3776,11 +3779,12 @@ Session::remove_bundle (shared_ptr<Bundle> bundle)
|
||||||
bool removed = false;
|
bool removed = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock guard (bundle_lock);
|
RCUWriter<BundleList> writer (_bundles);
|
||||||
BundleList::iterator i = find (_bundles.begin(), _bundles.end(), bundle);
|
boost::shared_ptr<BundleList> b = writer.get_copy ();
|
||||||
|
BundleList::iterator i = find (b->begin(), b->end(), bundle);
|
||||||
|
|
||||||
if (i != _bundles.end()) {
|
if (i != b->end()) {
|
||||||
_bundles.erase (i);
|
b->erase (i);
|
||||||
removed = true;
|
removed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3795,9 +3799,9 @@ Session::remove_bundle (shared_ptr<Bundle> bundle)
|
||||||
shared_ptr<Bundle>
|
shared_ptr<Bundle>
|
||||||
Session::bundle_by_name (string name) const
|
Session::bundle_by_name (string name) const
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (bundle_lock);
|
boost::shared_ptr<BundleList> b = _bundles.reader ();
|
||||||
|
|
||||||
for (BundleList::const_iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
|
for (BundleList::const_iterator i = b->begin(); i != b->end(); ++i) {
|
||||||
if ((*i)->name() == name) {
|
if ((*i)->name() == name) {
|
||||||
return* i;
|
return* i;
|
||||||
}
|
}
|
||||||
|
@ -4290,12 +4294,4 @@ Session::sync_order_keys (const char* base)
|
||||||
Route::SyncOrderKeys (base); // EMIT SIGNAL
|
Route::SyncOrderKeys (base); // EMIT SIGNAL
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Session::foreach_bundle (sigc::slot<void, boost::shared_ptr<Bundle> > sl)
|
|
||||||
{
|
|
||||||
Glib::Mutex::Lock lm (bundle_lock);
|
|
||||||
for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
|
|
||||||
sl (*i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1061,8 +1061,8 @@ Session::state(bool full_state)
|
||||||
|
|
||||||
child = node->add_child ("Bundles");
|
child = node->add_child ("Bundles");
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (bundle_lock);
|
boost::shared_ptr<BundleList> bundles = _bundles.reader ();
|
||||||
for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
|
for (BundleList::iterator i = bundles->begin(); i != bundles->end(); ++i) {
|
||||||
boost::shared_ptr<UserBundle> b = boost::dynamic_pointer_cast<UserBundle> (*i);
|
boost::shared_ptr<UserBundle> b = boost::dynamic_pointer_cast<UserBundle> (*i);
|
||||||
if (b) {
|
if (b) {
|
||||||
child->add_child_nocopy (b->get_state());
|
child->add_child_nocopy (b->get_state());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user