summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-01-11 01:15:17 +0100
committerCarl Hetherington <cth@carlh.net>2020-01-11 01:17:42 +0100
commit1f14a9d9a53f86124b657dfe3a1ce6c7786cbaf4 (patch)
treead53cd70b453a9cb44ae24ab63f150550137ea6b /gtk2_ardour
parenta883afbd64c3b6703445fca64aa740ac1ffdde06 (diff)
Scale the port matrix with the GUI/font-scaling setting.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/port_matrix.cc11
-rw-r--r--gtk2_ardour/port_matrix.h1
-rw-r--r--gtk2_ardour/port_matrix_body.cc3
-rw-r--r--gtk2_ardour/port_matrix_column_labels.cc2
-rw-r--r--gtk2_ardour/port_matrix_component.cc8
-rw-r--r--gtk2_ardour/port_matrix_component.h4
-rw-r--r--gtk2_ardour/port_matrix_row_labels.cc2
7 files changed, 28 insertions, 3 deletions
diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc
index 50aa480127..08000d9122 100644
--- a/gtk2_ardour/port_matrix.cc
+++ b/gtk2_ardour/port_matrix.cc
@@ -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 ();
+ }
+}
diff --git a/gtk2_ardour/port_matrix.h b/gtk2_ardour/port_matrix.h
index 8f0f8fd56a..8667c8c8e6 100644
--- a/gtk2_ardour/port_matrix.h
+++ b/gtk2_ardour/port_matrix.h
@@ -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;
diff --git a/gtk2_ardour/port_matrix_body.cc b/gtk2_ardour/port_matrix_body.cc
index 39aea414df..89ad10b81b 100644
--- a/gtk2_ardour/port_matrix_body.cc
+++ b/gtk2_ardour/port_matrix_body.cc
@@ -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);
diff --git a/gtk2_ardour/port_matrix_column_labels.cc b/gtk2_ardour/port_matrix_column_labels.cc
index ffa6ffd930..ed81933b9e 100644
--- a/gtk2_ardour/port_matrix_column_labels.cc
+++ b/gtk2_ardour/port_matrix_column_labels.cc
@@ -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;
diff --git a/gtk2_ardour/port_matrix_component.cc b/gtk2_ardour/port_matrix_component.cc
index fe58289825..c3a430875d 100644
--- a/gtk2_ardour/port_matrix_component.cc
+++ b/gtk2_ardour/port_matrix_component.cc
@@ -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;
+}
diff --git a/gtk2_ardour/port_matrix_component.h b/gtk2_ardour/port_matrix_component.h
index ba1d2ae526..4286c1bf54 100644
--- a/gtk2_ardour/port_matrix_component.h
+++ b/gtk2_ardour/port_matrix_component.h
@@ -76,9 +76,7 @@ public:
}
/** @return grid spacing */
- static uint32_t grid_spacing () {
- return 24;
- }
+ static uint32_t grid_spacing ();
protected:
diff --git a/gtk2_ardour/port_matrix_row_labels.cc b/gtk2_ardour/port_matrix_row_labels.cc
index 9081ea50fc..a4d3336e8e 100644
--- a/gtk2_ardour/port_matrix_row_labels.cc
+++ b/gtk2_ardour/port_matrix_row_labels.cc
@@ -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;