+void
+PortMatrixColumnLabels::render_channel_name (
+ cairo_t* cr, Gdk::Color fg_colour, Gdk::Color bg_colour, double xoff, double yoff, ARDOUR::BundleChannel const &bc
+ )
+{
+ vector<pair<double, double> > const shape = port_name_shape (xoff, yoff);
+
+ cairo_move_to (cr, shape[0].first, shape[0].second);
+ for (uint32_t i = 1; i < 4; ++i) {
+ cairo_line_to (cr, shape[i].first, shape[i].second);
+ }
+ cairo_line_to (cr, shape[0].first, shape[0].second);
+
+ set_source_rgb (cr, bg_colour);
+ cairo_fill_preserve (cr);
+ set_source_rgb (cr, fg_colour);
+ cairo_set_line_width (cr, label_border_width());
+ cairo_stroke (cr);
+
+ set_source_rgb (cr, text_colour());
+
+ double const q = ((grid_spacing() * sin (angle())) - _text_height) / 2 + _descender_height;
+
+ if (_matrix->arrangement() == PortMatrix::TOP_TO_RIGHT) {
+
+ cairo_move_to (
+ cr,
+ xoff + grid_spacing() - q * sin (angle ()),
+ yoff + _height - q * cos (angle ())
+ );
+
+
+ } else {
+
+ double const rl = 3 * name_pad() + _longest_bundle_name;
+ cairo_move_to (
+ cr,
+ xoff + grid_spacing() - q * sin (angle ()) + rl * cos (angle ()),
+ yoff + _height - q * cos (angle ()) - rl * sin (angle())
+ );
+ }
+
+ if (bc.bundle->nchannels() > 1) {
+
+ /* only plot the name if the bundle has more than one channel;
+ the name of a single channel is assumed to be redundant */
+
+ cairo_save (cr);
+ cairo_rotate (cr, -angle());
+
+ cairo_show_text (
+ cr,
+ bc.bundle->channel_name(bc.channel).c_str()
+ );
+
+ cairo_restore (cr);
+ }
+}
+