summaryrefslogtreecommitdiff
path: root/gtk2_ardour/port_matrix_row_labels.cc
diff options
context:
space:
mode:
authorJohannes Mueller <github@johannes-mueller.org>2018-10-28 17:22:32 +0100
committerJohannes Mueller <github@johannes-mueller.org>2018-11-01 18:53:27 +0100
commitcc83e1a9bfd7339c4ebfcde4a57d511eec51923e (patch)
tree5317c52f1256f4f8c12ab3fc59f490ead9cd6168 /gtk2_ardour/port_matrix_row_labels.cc
parent732fd75f9ba8ddf369088fb5b9e4a91d17160e00 (diff)
Consider size of port matrix column labels for size of row labels
The column labels are drawn in an angle towards the edge where the row labels are. Therefore, if the column labels are much longer than the row labels it can happen that they go beyond the left edge. In that case we have to add an extra width to the row labels.
Diffstat (limited to 'gtk2_ardour/port_matrix_row_labels.cc')
-rw-r--r--gtk2_ardour/port_matrix_row_labels.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/gtk2_ardour/port_matrix_row_labels.cc b/gtk2_ardour/port_matrix_row_labels.cc
index ff7ac6a48a..893313c607 100644
--- a/gtk2_ardour/port_matrix_row_labels.cc
+++ b/gtk2_ardour/port_matrix_row_labels.cc
@@ -25,14 +25,16 @@
#include "gtkmm2ext/colors.h"
#include "utils.h"
#include "port_matrix_row_labels.h"
+#include "port_matrix_column_labels.h"
#include "port_matrix.h"
#include "port_matrix_body.h"
#include "pbd/i18n.h"
using namespace std;
-PortMatrixRowLabels::PortMatrixRowLabels (PortMatrix* m, PortMatrixBody* b)
+PortMatrixRowLabels::PortMatrixRowLabels (PortMatrix* m, PortMatrixBody* b, PortMatrixColumnLabels& cols)
: PortMatrixLabels (m, b)
+ , _column_labels (cols)
{
}
@@ -93,6 +95,13 @@ PortMatrixRowLabels::compute_dimensions ()
_width += _longest_port_name;
_width += name_pad() * 2;
}
+
+ uint32_t needed_by_columns = _column_labels.dimensions().second * tan (angle());
+
+ if (_width < needed_by_columns) {
+ _longest_bundle_name += (needed_by_columns - _width);
+ _width = needed_by_columns;
+ }
}