Scale the port matrix with the GUI/font-scaling setting.

This commit is contained in:
Carl Hetherington 2020-01-11 01:15:17 +01:00
parent a883afbd64
commit 1f14a9d9a5
7 changed files with 28 additions and 3 deletions

View File

@ -47,6 +47,7 @@
#include "port_matrix_body.h"
#include "port_matrix_component.h"
#include "utils.h"
#include "ui_config.h"
#include "pbd/i18n.h"
@ -113,6 +114,8 @@ PortMatrix::PortMatrix (Window* parent, Session* session, DataType type)
_vspacer.show ();
_vnotebook.show ();
_hnotebook.show ();
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &PortMatrix::parameter_changed));
}
PortMatrix::~PortMatrix ()
@ -1256,3 +1259,11 @@ PortMatrix::key_press (GdkEventKey* k)
return false;
}
void
PortMatrix::parameter_changed (string p)
{
if (p == "font-scale") {
setup ();
}
}

View File

@ -206,6 +206,7 @@ private:
void update_tab_highlighting ();
std::pair<int, int> check_flip () const;
bool can_flip () const;
void parameter_changed (std::string);
Gtk::Window* _parent;

View File

@ -28,6 +28,7 @@
#include "port_matrix_column_labels.h"
#include "port_matrix_row_labels.h"
#include "port_matrix_grid.h"
#include "ui_config.h"
#include "pbd/i18n.h"
@ -73,6 +74,7 @@ PortMatrixBody::on_expose_event (GdkEventExpose* event)
/* nothing to connect */
cairo_t* cr = gdk_cairo_create (get_window()->gobj());
cairo_set_font_size (cr, UIConfiguration::instance().get_ui_scale() * 10);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_rectangle (cr, 0, 0, _alloc_width, _alloc_height);
@ -130,6 +132,7 @@ PortMatrixBody::on_expose_event (GdkEventExpose* event)
}
cairo_t* cr = gdk_cairo_create (get_window()->gobj());
cairo_set_font_size (cr, UIConfiguration::instance().get_ui_scale() * 10);
for (list<PortMatrixComponent*>::iterator i = _components.begin(); i != _components.end(); ++i) {
cairo_save (cr);

View File

@ -27,6 +27,7 @@
#include "port_matrix_column_labels.h"
#include "port_matrix.h"
#include "port_matrix_body.h"
#include "ui_config.h"
#include "pbd/i18n.h"
@ -44,6 +45,7 @@ PortMatrixColumnLabels::compute_dimensions ()
{
cairo_surface_t* surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 200, 200);
cairo_t* cr = cairo_create (surface);
cairo_set_font_size (cr, UIConfiguration::instance().get_ui_scale() * 10);
/* width of the longest bundle name */
_longest_bundle_name = 0;

View File

@ -21,6 +21,7 @@
#include "port_matrix_component.h"
#include "port_matrix.h"
#include "port_matrix_body.h"
#include "ui_config.h"
using namespace std;
@ -81,6 +82,7 @@ PortMatrixComponent::get_pixmap (GdkDrawable *drawable)
/* render */
cairo_t* cr = gdk_cairo_create (_pixmap);
cairo_set_font_size (cr, UIConfiguration::instance().get_ui_scale() * 10);
render (cr);
cairo_destroy (cr);
@ -215,3 +217,9 @@ PortMatrixComponent::position_to_channel (double p, double, boost::shared_ptr<co
return ARDOUR::BundleChannel (boost::shared_ptr<ARDOUR::Bundle> (), -1);
}
uint32_t
PortMatrixComponent::grid_spacing ()
{
return UIConfiguration::instance().get_ui_scale() * 24;
}

View File

@ -76,9 +76,7 @@ public:
}
/** @return grid spacing */
static uint32_t grid_spacing () {
return 24;
}
static uint32_t grid_spacing ();
protected:

View File

@ -30,6 +30,7 @@
#include "port_matrix_column_labels.h"
#include "port_matrix.h"
#include "port_matrix_body.h"
#include "ui_config.h"
#include "pbd/i18n.h"
using namespace std;
@ -46,6 +47,7 @@ PortMatrixRowLabels::compute_dimensions ()
{
cairo_surface_t* surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 200, 200);
cairo_t* cr = cairo_create (surface);
cairo_set_font_size (cr, UIConfiguration::instance().get_ui_scale() * 10);
_longest_port_name = 0;
_longest_bundle_name = 0;