/*
- Copyright (C) 2002-2009 Paul Davis
+ 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
#include "port_matrix_body.h"
#include "port_matrix_component.h"
#include "i18n.h"
+#include "gui_thread.h"
using namespace std;
using namespace sigc;
for (int i = 0; i < 2; ++i) {
_ports[i].set_type (type);
-
+
/* watch for the content of _ports[] changing */
_ports[i].Changed.connect (mem_fun (*this, &PortMatrix::setup));
+
+ /* and for bundles in _ports[] changing */
+ _ports[i].BundleChanged.connect (mem_fun (*this, &PortMatrix::bundle_changed));
}
_hscroll.signal_value_changed().connect (mem_fun (*this, &PortMatrix::hscroll_changed));
/* and also ports */
_session.engine().PortRegisteredOrUnregistered.connect (mem_fun (*this, &PortMatrix::setup_all_ports));
-
+
reconnect_to_routes ();
attach (*_body, 0, 1, 0, 1);
attach (_vscroll, 1, 2, 0, 1, SHRINK);
attach (_hscroll, 0, 1, 1, 2, FILL | EXPAND, SHRINK);
-
+
show_all ();
}
_type = t;
_ports[0].set_type (_type);
_ports[1].set_type (_type);
-
+
setup_all_ports ();
}
for (uint32_t j = 0; j < i->bundle->nchannels(); ++j) {
for (PortGroup::BundleList::iterator k = b.begin(); k != b.end(); ++k) {
for (uint32_t l = 0; l < k->bundle->nchannels(); ++l) {
-
+
BundleChannel c[2] = {
BundleChannel (i->bundle, j),
BundleChannel (k->bundle, l)
maintain notional `signal flow' vaguely from left to right. Subclasses
should choose where to put ports based on signal flowing from _ports[0]
to _ports[1] */
-
+
if (N[0] > N[1]) {
_row_index = 0;
)
{
using namespace Menu_Helpers;
-
+
delete _menu;
_menu = new Menu;
_menu->set_name ("ArdourContextMenu");
-
+
MenuList& items = _menu->items ();
boost::shared_ptr<PortGroup> pg[2];
snprintf (buf, sizeof (buf), _("Add %s"), channel_noun().c_str());
sub.push_back (MenuElem (buf, bind (mem_fun (*this, &PortMatrix::add_channel_proxy), w)));
}
-
-
+
+
if (can_rename_channels (bc[dim].bundle)) {
snprintf (buf, sizeof (buf), _("Rename '%s'..."), bc[dim].bundle->channel_name (bc[dim].channel).c_str());
sub.push_back (
}
sub.push_back (SeparatorElem ());
-
+
if (can_remove_channels (bc[dim].bundle)) {
snprintf (buf, sizeof (buf), _("Remove '%s'"), bc[dim].bundle->channel_name (bc[dim].channel).c_str());
sub.push_back (
bind (mem_fun (*this, &PortMatrix::remove_channel_proxy), w, bc[dim].channel)
)
);
- }
+ }
if (_show_only_bundles) {
snprintf (buf, sizeof (buf), _("%s all"), disassociation_verb().c_str());
bc[dim].bundle->channel_name (bc[dim].channel).c_str()
);
}
-
+
sub.push_back (
MenuElem (buf, bind (mem_fun (*this, &PortMatrix::disassociate_all_on_channel), w, bc[dim].channel, dim))
);
}
need_separator = false;
-
+
for (int dim = 0; dim < 2; ++dim) {
if (pg[dim]) {
boost::weak_ptr<PortGroup> wp (pg[dim]);
-
+
if (pg[dim]->visible()) {
if (dim == 0) {
if (pg[dim]->name.empty()) {
_inhibit_toggle_show_only_bundles = true;
i->set_active (!_show_only_bundles);
_inhibit_toggle_show_only_bundles = false;
-
+
_menu->popup (1, t);
}
void
PortMatrix::setup_all_ports ()
{
+ ENSURE_GUI_THREAD (mem_fun (*this, &PortMatrix::setup_all_ports));
+
setup_ports (0);
setup_ports (1);
}
if (_inhibit_toggle_show_only_bundles) {
return;
}
-
+
_show_only_bundles = !_show_only_bundles;
_body->setup ();
setup_scrollbars ();
{
double const h = _hscroll.get_value ();
double const v = _vscroll.get_value ();
-
+
switch (ev->direction) {
case GDK_SCROLL_UP:
_vscroll.set_value (v - PortMatrixComponent::grid_spacing ());
add_channel (b);
}
+
+void
+PortMatrix::bundle_changed (ARDOUR::Bundle::Change c)
+{
+ if (c != Bundle::NameChanged) {
+ setup_all_ports ();
+ }
+
+ setup ();
+}