- /* PORT GROUP NAMES */
-
- double x = 0;
- if (_matrix->arrangement() == PortMatrix::LEFT_TO_BOTTOM) {
- x = 0;
- } else {
- x = _width - _highest_group_name - 2 * name_pad();
- }
-
- double y = 0;
- int g = 0;
- for (PortGroupList::List::const_iterator i = _matrix->rows()->begin(); i != _matrix->rows()->end(); ++i) {
-
- /* compute height of this group */
- double h = 0;
- if (!(*i)->visible()) {
- h = grid_spacing ();
- } else {
- if (_matrix->show_only_bundles()) {
- h = (*i)->bundles().size() * grid_spacing();
- } else {
- h = (*i)->total_channels () * grid_spacing();
- }
- }
-
- if (h == 0) {
- continue;
- }
-
- /* 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 */
- string const upper = Glib::ustring ((*i)->name).uppercase ();
- pair<string, double> display = fit_to_pixels (cr, upper, 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;
- }
-