From 50c60c031dd2f4c303becddd889a0e5dd7374d62 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 24 Dec 2021 21:54:27 +0100 Subject: [PATCH] Allow to use UI scaling to libardour This will replace LV2Plugin::_ui_scale_factor, and be useful for export-analysis. --- libs/ardour/ardour/ardour.h | 3 +++ libs/ardour/globals.cc | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 182435a5ef..1f999c092e 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -57,6 +57,7 @@ namespace ARDOUR { extern LIBARDOUR_API PBD::Signal0 GUIIdle; extern LIBARDOUR_API PBD::Signal3 CopyConfigurationFiles; extern LIBARDOUR_API std::map reserved_io_names; + extern LIBARDOUR_API float ui_scale_factor; /** * @param try_optimization true to enable hardware optimized routines @@ -85,6 +86,8 @@ namespace ARDOUR { LIBARDOUR_API void setup_fpu (); LIBARDOUR_API std::vector get_available_sync_options(); + LIBARDOUR_API void set_global_ui_scale_factor (float s); + /* the @param ui_handler will be called if there are old configuration * files to be copied. It should (probably) ask the user about the * action, and return true or false depending on whether or not the diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 54252c2b39..a81d6760f7 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -162,10 +162,13 @@ PBD::Signal3 ARDOUR::CopyConfigurationFile std::map ARDOUR::reserved_io_names; +float ARDOUR::ui_scale_factor = 1.0; + static bool have_old_configuration_files = false; static bool running_from_gui = false; static int cpu_dma_latency_fd = -1; + namespace ARDOUR { extern void setup_enum_writer (); } @@ -763,6 +766,10 @@ ARDOUR::no_auto_connect () return getenv ("ARDOUR_NO_AUTOCONNECT") != 0; } +void ARDOUR::set_global_ui_scale_factor (float s) { + ui_scale_factor = s; +} + void ARDOUR::setup_fpu () {