- /* 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 */
-
- x = 0;
- if (_matrix->arrangement() == PortMatrix::LEFT_TO_BOTTOM) {
- x = _highest_group_name + 2 * name_pad();
- } else {
- x = _longest_port_name + name_pad() * 2;
- }
-
- y = 0;
- ARDOUR::BundleList const r = _matrix->rows()->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);
- cairo_rectangle (cr, x, y, _longest_bundle_name + name_pad() * 2, row_height() * (*i)->nchannels());
- cairo_fill_preserve (cr);
- set_source_rgb (cr, background_colour());
- cairo_set_line_width (cr, label_border_width ());
- cairo_stroke (cr);
-
- double off = 0;
- if ((*i)->nchannels () > 0) {
- /* 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 (cr, (*i)->channel_name(0).c_str(), &ext);
- off = (row_height() - ext.height) / 2;