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.
This commit is contained in:
parent
732fd75f9b
commit
cc83e1a9bf
|
@ -43,7 +43,7 @@ PortMatrixBody::PortMatrixBody (PortMatrix* p)
|
|||
_ignore_component_size_changed (false)
|
||||
{
|
||||
_column_labels = new PortMatrixColumnLabels (p, this);
|
||||
_row_labels = new PortMatrixRowLabels (p, this);
|
||||
_row_labels = new PortMatrixRowLabels (p, this, *_column_labels);
|
||||
_grid = new PortMatrixGrid (p, this);
|
||||
|
||||
_components.push_back (_column_labels);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
class PortMatrix;
|
||||
class PortMatrixBody;
|
||||
class PortMatrixNode;
|
||||
class PortMatrixColumnLabels;
|
||||
|
||||
namespace ARDOUR {
|
||||
class Bundle;
|
||||
|
@ -41,7 +42,7 @@ namespace Gtk {
|
|||
class PortMatrixRowLabels : public PortMatrixLabels
|
||||
{
|
||||
public:
|
||||
PortMatrixRowLabels (PortMatrix *, PortMatrixBody *);
|
||||
PortMatrixRowLabels (PortMatrix *, PortMatrixBody *, PortMatrixColumnLabels&);
|
||||
|
||||
void button_press (double, double, GdkEventButton *);
|
||||
|
||||
|
@ -68,6 +69,8 @@ private:
|
|||
|
||||
double _longest_port_name;
|
||||
double _longest_bundle_name;
|
||||
|
||||
PortMatrixColumnLabels& _column_labels;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue