X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=gtk2_ardour%2Fport_matrix_body.cc;h=3d564319f841fe8b497966a7d3ac2dce96f21c4f;hb=91e6c1b176d93f43bab6713574c590ea97801bdc;hp=063eaa8d8a0dcc2550b7ae05622b2e287d402daf;hpb=14b0ca31bcb62e5b7e9e77634ef9cd2e8cf65800;p=ardour.git diff --git a/gtk2_ardour/port_matrix_body.cc b/gtk2_ardour/port_matrix_body.cc index 063eaa8d8a..3d564319f8 100644 --- a/gtk2_ardour/port_matrix_body.cc +++ b/gtk2_ardour/port_matrix_body.cc @@ -28,6 +28,8 @@ #include "port_matrix_row_labels.h" #include "port_matrix_grid.h" +#include "i18n.h" + using namespace std; PortMatrixBody::PortMatrixBody (PortMatrix* p) @@ -75,15 +77,19 @@ PortMatrixBody::on_expose_event (GdkEventExpose* event) cairo_rectangle (cr, 0, 0, _alloc_width, _alloc_height); cairo_fill (cr); - stringstream t; - t << _("There are no ") << (_matrix->type() == ARDOUR::DataType::AUDIO ? _("audio") : _("MIDI")) << _(" ports to connect."); + string t; + if (_matrix->type() == ARDOUR::DataType::NIL) { + t = _("There are no ports to connect."); + } else { + t = string_compose (_("There are no %1 ports to connect."), _matrix->type().to_i18n_string()); + } cairo_text_extents_t ext; - cairo_text_extents (cr, t.str().c_str(), &ext); + cairo_text_extents (cr, t.c_str(), &ext); cairo_set_source_rgb (cr, 1, 1, 1); cairo_move_to (cr, (_alloc_width - ext.width) / 2, (_alloc_height + ext.height) / 2); - cairo_show_text (cr, t.str().c_str ()); + cairo_show_text (cr, t.c_str ()); cairo_destroy (cr); @@ -217,21 +223,21 @@ PortMatrixBody::compute_rectangles () } else if (_matrix->arrangement() == PortMatrix::LEFT_TO_BOTTOM) { col_rect.set_height (min (_alloc_height, col.second)); + row_rect.set_height (std::min (_alloc_height - col_rect.get_height(), row.second)); row_rect.set_x (0); - row_rect.set_y (0); + row_rect.set_y (_alloc_height - row_rect.get_height() - col_rect.get_height()); row_rect.set_width (min (_alloc_width, row.first)); - row_rect.set_height (std::min (_alloc_height - col_rect.get_height(), row.second)); grid_rect.set_x (row_rect.get_width()); - grid_rect.set_y (0); + grid_rect.set_y (_alloc_height - row_rect.get_height() - col_rect.get_height()); grid_rect.set_width (std::min (_alloc_width - row_rect.get_width(), grid.first)); grid_rect.set_height (row_rect.get_height ()); col_rect.set_width (grid_rect.get_width () + col_overhang); col_rect.set_x (row_rect.get_width() + grid_rect.get_width() - col_rect.get_width()); _column_labels_border_x = col_rect.get_x () >= 0 ? col_rect.get_x () : 0; - col_rect.set_y (row_rect.get_height()); + col_rect.set_y (_alloc_height - col_rect.get_height()); } _column_labels_height = col_rect.get_height (); @@ -465,9 +471,19 @@ PortMatrixBody::highlight_associated_channels (int dim, ARDOUR::BundleChannel h) PortGroup::BundleList const b = _matrix->visible_ports(1 - dim)->bundles (); for (PortGroup::BundleList::const_iterator i = b.begin(); i != b.end(); ++i) { - for (uint32_t j = 0; j < (*i)->bundle->nchannels(); ++j) { + for (uint32_t j = 0; j < (*i)->bundle->nchannels().n_total(); ++j) { + + if (!_matrix->should_show ((*i)->bundle->channel_type(j))) { + continue; + } + bc[1 - dim] = ARDOUR::BundleChannel ((*i)->bundle, j); - if (_matrix->get_state (bc) == PortMatrixNode::ASSOCIATED) { + + PortMatrixNode n; + n.row = bc[_matrix->row_index()]; + n.column = bc[_matrix->column_index()]; + + if (_matrix->get_association(n) != PortMatrixNode::NOT_ASSOCIATED) { if (dim == _matrix->column_index()) { _row_labels->add_channel_highlight (bc[1 - dim]); } else {