From: Carl Hetherington Date: Sun, 14 Aug 2011 18:12:33 +0000 (+0000) Subject: Fix a few SNAFUs with the port matrix after recent changes. X-Git-Tag: 3.0-alpha10~8 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=d5a55c48f9027583a0355416e5ef73d6851ff67c;p=ardour.git Fix a few SNAFUs with the port matrix after recent changes. git-svn-id: svn://localhost/ardour2/branches/3.0@9992 d708f5d6-7413-0410-9779-e7cbd77b26cf --- diff --git a/gtk2_ardour/port_matrix_column_labels.cc b/gtk2_ardour/port_matrix_column_labels.cc index eba2fffddf..30ff67b9b2 100644 --- a/gtk2_ardour/port_matrix_column_labels.cc +++ b/gtk2_ardour/port_matrix_column_labels.cc @@ -133,18 +133,8 @@ PortMatrixColumnLabels::render (cairo_t* cr) PortGroup::BundleList const & bundles = _matrix->visible_columns()->bundles (); for (PortGroup::BundleList::const_iterator i = bundles.begin (); i != bundles.end(); ++i) { - bool should_show_this_bundle = false; - for (uint32_t j = 0; j < (*i)->bundle->nchannels().n_total(); ++j) { - if (_matrix->should_show ((*i)->bundle->channel_type (j))) { - should_show_this_bundle = true; - break; - } - } - - if (should_show_this_bundle) { - Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N); - render_bundle_name (cr, background_colour (), c, x, 0, (*i)->bundle); - } + Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N); + render_bundle_name (cr, background_colour (), c, x, 0, (*i)->bundle); if (_matrix->show_only_bundles()) { x += grid_spacing(); @@ -163,17 +153,18 @@ PortMatrixColumnLabels::render (cairo_t* cr) for (PortGroup::BundleList::const_iterator i = bundles.begin (); i != bundles.end(); ++i) { - for (uint32_t j = 0; j < (*i)->bundle->nchannels().n_total(); ++j) { - - if (!_matrix->should_show ((*i)->bundle->channel_type(j))) { - continue; - } + uint32_t const C = _matrix->count_of_our_type ((*i)->bundle->nchannels ()); + for (uint32_t j = 0; j < C; ++j) { Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N); render_channel_name (cr, background_colour (), c, x, 0, ARDOUR::BundleChannel ((*i)->bundle, j)); x += grid_spacing(); } + if (C == 0) { + x += grid_spacing (); + } + ++N; } } @@ -497,12 +488,9 @@ PortMatrixColumnLabels::motion (double x, double y) list n; - for (uint32_t i = 0; i < w.bundle->nchannels().n_total(); ++i) { - - if (!_matrix->should_show (w.bundle->channel_type(i))) { - continue; - } + uint32_t const N = _matrix->count_of_our_type (w.bundle->nchannels ()); + for (uint32_t i = 0; i < N; ++i) { ARDOUR::BundleChannel const bc (w.bundle, i); n.push_back (PortMatrixNode (ARDOUR::BundleChannel (), bc)); } diff --git a/gtk2_ardour/port_matrix_grid.cc b/gtk2_ardour/port_matrix_grid.cc index b87f560984..fa394de8ef 100644 --- a/gtk2_ardour/port_matrix_grid.cc +++ b/gtk2_ardour/port_matrix_grid.cc @@ -217,15 +217,25 @@ PortMatrixGrid::render (cairo_t* cr) y += grid_spacing(); } - if ((*j)->bundle->nchannels() == ARDOUR::ChanCount::ZERO) { + if (_matrix->count_of_our_type ((*j)->bundle->nchannels()) == 0) { + /* the *j bundle has no channels of our type, so it will have a dummy + one which needs to be marked non-connectable. + */ draw_non_connectable_indicator (cr, x, y); } x += grid_spacing(); } - if ((*i)->bundle->nchannels() == ARDOUR::ChanCount::ZERO) { - draw_non_connectable_indicator (cr, x, y); + if (_matrix->count_of_our_type ((*i)->bundle->nchannels()) == 0) { + /* draw non-connectable indicators for the case where the *i bundle + has no channels of our type (and hence has 1 dummy channel) + */ + y = by; + for (uint32_t l = 0; l < _matrix->count_of_our_type_min_1 ((*j)->bundle->nchannels()); ++l) { + draw_non_connectable_indicator (cr, x, y); + y += grid_spacing (); + } } by += _matrix->count_of_our_type_min_1 ((*j)->bundle->nchannels()) * grid_spacing();