Scale the port matrix with the GUI/font-scaling setting.
authorCarl Hetherington <cth@carlh.net>
Sat, 11 Jan 2020 00:15:17 +0000 (01:15 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 11 Jan 2020 00:17:42 +0000 (01:17 +0100)
gtk2_ardour/port_matrix.cc
gtk2_ardour/port_matrix.h
gtk2_ardour/port_matrix_body.cc
gtk2_ardour/port_matrix_column_labels.cc
gtk2_ardour/port_matrix_component.cc
gtk2_ardour/port_matrix_component.h
gtk2_ardour/port_matrix_row_labels.cc

index 50aa4801278e218d530d2ae47ab37544858ee602..08000d9122dafe22137fc4282ca29489e878bf26 100644 (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 ();
+       }
+}
index 8f0f8fd56a9120b10f3f617d56431ef6bf74355a..8667c8c8e6939dcb9c4cc5e25bd902dec9b7e9cb 100644 (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;
 
index 39aea414df413f5e7dd0f9f63d1aa37e27a59f47..89ad10b81bf81e6d8df0b77f102019b058c1f2b2 100644 (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);
index ffa6ffd930d48f0ef88b846f0300d052be83393a..ed81933b9e9d8ffa5984ccd08f7f236ba2d099a1 100644 (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;
index fe58289825a40808ac0d433786d49c4fdf27c27b..c3a430875d0ca162b1a4caa69105c530a70f9f2b 100644 (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;
+}
index ba1d2ae52655b49a8d64fe1bd64beaf69722243c..4286c1bf54debc533244f52331dbb5d0132ee7d0 100644 (file)
@@ -76,9 +76,7 @@ public:
        }
 
        /** @return grid spacing */
-       static uint32_t grid_spacing () {
-               return 24;
-       }
+       static uint32_t grid_spacing ();
 
 protected:
 
index 9081ea50fc170f6bc3264d924239e35aa9da1bcd..a4d3336e8e9b0e306c3f14b6cf36a5588ce1a23a 100644 (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;