summaryrefslogtreecommitdiff
path: root/gtk2_ardour/io_selector.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-07-27 02:09:51 +0000
committerCarl Hetherington <carl@carlh.net>2010-07-27 02:09:51 +0000
commit4e8d402fd2f92454c0ce1460e0030020b72c3888 (patch)
tree8bebc1154fa4eeefe74db6e38383a93ce2e59607 /gtk2_ardour/io_selector.cc
parentf2df65db6a09e777ed1fc8d6b7b790c2468c5597 (diff)
Fix route port matrix to only display the relevant port types.
git-svn-id: svn://localhost/ardour2/branches/3.0@7505 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/io_selector.cc')
-rw-r--r--gtk2_ardour/io_selector.cc45
1 files changed, 44 insertions, 1 deletions
diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc
index eff2583c42..f90ce88545 100644
--- a/gtk2_ardour/io_selector.cc
+++ b/gtk2_ardour/io_selector.cc
@@ -46,6 +46,8 @@ IOSelector::IOSelector (Gtk::Window* p, ARDOUR::Session* session, boost::shared_
: PortMatrix (p, session, DataType::NIL)
, _io (io)
{
+ setup_type ();
+
/* signal flow from 0 to 1 */
_find_inputs_for_io_outputs = (_io->direction() == IO::Output);
@@ -61,17 +63,58 @@ IOSelector::IOSelector (Gtk::Window* p, ARDOUR::Session* session, boost::shared_
_port_group.reset (new PortGroup (io->name()));
_ports[_ours].add_group (_port_group);
+ io->changed.connect (_io_connection, invalidator (*this), boost::bind (&IOSelector::io_changed_proxy, this), gui_context ());
+
setup_all_ports ();
init ();
}
void
+IOSelector::setup_type ()
+{
+ /* set type according to what's in the IO */
+
+ int N = 0;
+ DataType type_with_ports = DataType::NIL;
+ for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
+ if (_io->ports().num_ports (*i)) {
+ type_with_ports = *i;
+ ++N;
+ }
+ }
+
+ if (N <= 1) {
+ set_type (type_with_ports);
+ } else {
+ set_type (DataType::NIL);
+ }
+}
+
+void
+IOSelector::io_changed_proxy ()
+{
+ /* The IO's changed signal is emitted from code that holds its route's processor lock,
+ so we can't call setup_all_ports (which results in a call to Route::foreach_processor)
+ without a deadlock unless we break things up with this idle handler.
+ */
+
+ Glib::signal_idle().connect_once (sigc::mem_fun (*this, &IOSelector::io_changed));
+}
+
+void
+IOSelector::io_changed ()
+{
+ setup_type ();
+ setup_all_ports ();
+}
+
+void
IOSelector::setup_ports (int dim)
{
if (!_session) {
return;
}
-
+
_ports[dim].suspend_signals ();
if (dim == _other) {