- int g = 0;
- for (PortGroupList::List::const_iterator i = _matrix->columns()->begin(); i != _matrix->columns()->end(); ++i) {
-
- /* compute width of this group */
- uint32_t w = 0;
- if (!(*i)->visible()) {
- w = grid_spacing ();
- } else {
- if (_matrix->show_only_bundles()) {
- w = (*i)->bundles().size() * grid_spacing();
- } else {
- w = (*i)->total_channels() * grid_spacing();
- }
- }
-
- if (w == 0) {
- continue;
- }
-
- /* rectangle */
- set_source_rgb (cr, get_a_group_colour (g));
- double const rh = _highest_group_name + 2 * name_pad();
- if (_matrix->arrangement() == PortMatrix::TOP_TO_RIGHT) {
- cairo_rectangle (cr, x, component_to_parent_y (0), w, rh);
- } else {
- cairo_rectangle (cr, x, component_to_parent_y (_height - rh), w, rh);
- }
- cairo_fill (cr);
-
- /* x area available to draw the label in (trying to keep it visible) */
- double const lx = max (x, double (_parent_rectangle.get_x ()));
- double const rx = min (x + w, double (_parent_rectangle.get_width()));
-
- /* hence what abbreviation (or not) we need for the group name */
- string const upper = Glib::ustring ((*i)->name).uppercase ();
- pair<string, double> const display = fit_to_pixels (cr, upper, rx - lx);
-
- /* plot it */
- set_source_rgb (cr, text_colour());
- cairo_move_to (cr, (lx + rx - display.second) / 2, y);
- cairo_show_text (cr, display.first.c_str());
-
- x += w;
- ++g;
-
+ if (Gtkmm2ext::Keyboard::is_delete_event (ev) && w.channel != -1) {
+ _matrix->remove_channel (w);
+ } else if (ev->button == 3) {
+ _matrix->popup_menu (
+ w,
+ ARDOUR::BundleChannel (),
+ ev->time
+ );