- int g = 0;
- for (PortGroupList::List::const_iterator i = _matrix->rows()->begin(); i != _matrix->rows()->end(); ++i) {
-
- 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;
- }
-
- /* BUNDLE NAMES */
+ int N = 0;
+ int M = 0;
+
+ PortGroup::BundleList const & bundles = _matrix->visible_rows()->bundles ();
+ for (PortGroup::BundleList::const_iterator i = bundles.begin(); i != bundles.end(); ++i) {
+ render_bundle_name (cr, background_colour (), (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (N), 0, y, (*i)->bundle);
+
+ if (!_matrix->show_only_bundles()) {
+ uint32_t const N = _matrix->count_of_our_type ((*i)->bundle->nchannels());
+ for (uint32_t j = 0; j < N; ++j) {
+ Gdk::Color c = (*i)->has_colour ? (*i)->colour : get_a_bundle_colour (M);
+ ARDOUR::BundleChannel bc (
+ (*i)->bundle,
+ (*i)->bundle->type_channel_to_overall (_matrix->type (), j)
+ );
+
+ render_channel_name (cr, background_colour (), c, 0, y, bc);
+ y += grid_spacing();
+ ++M;
+ }