From 45d487f16e8be102bfcdefcd950a69c886495b94 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Wed, 29 Apr 2015 21:30:07 +1000 Subject: [PATCH] Move ARDOUR_UI::ui_scale into UIConfiguration class --- gtk2_ardour/ardour_button.cc | 8 ++++---- gtk2_ardour/ardour_knob.cc | 2 +- gtk2_ardour/ardour_ui.cc | 2 -- gtk2_ardour/ardour_ui.h | 1 - gtk2_ardour/ardour_ui2.cc | 2 +- gtk2_ardour/ardour_ui_dialogs.cc | 2 +- gtk2_ardour/ardour_ui_options.cc | 2 -- gtk2_ardour/editor.cc | 2 +- gtk2_ardour/gain_meter.cc | 6 +++--- gtk2_ardour/level_meter.cc | 2 +- gtk2_ardour/marker.cc | 6 +++--- gtk2_ardour/meter_patterns.cc | 4 ++-- gtk2_ardour/meter_strip.cc | 8 ++++---- gtk2_ardour/mixer_strip.cc | 4 ++-- gtk2_ardour/monitor_section.cc | 2 +- gtk2_ardour/mono_panner.cc | 8 ++++---- gtk2_ardour/panner_ui.cc | 2 +- gtk2_ardour/processor_box.cc | 12 ++++++------ gtk2_ardour/stereo_panner.cc | 2 +- gtk2_ardour/time_axis_view.cc | 2 +- gtk2_ardour/ui_config.cc | 6 ++++++ gtk2_ardour/ui_config.h | 4 +++- 22 files changed, 46 insertions(+), 43 deletions(-) diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index 7dca32e689..69229f6332 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -208,7 +208,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) uint32_t text_color; uint32_t led_color; - const float corner_radius = std::max(2.f, _corner_radius * ARDOUR_UI::ui_scale); + const float corner_radius = std::max(2.f, _corner_radius * ARDOUR_UI::config()->get_ui_scale()); if (_update_colors) { set_colors (); @@ -440,12 +440,12 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *) //black ring cairo_set_source_rgb (cr, 0, 0, 0); - cairo_arc (cr, 0, 0, _diameter * .5 - 1 * ARDOUR_UI::ui_scale, 0, 2 * M_PI); + cairo_arc (cr, 0, 0, _diameter * .5 - 1 * ARDOUR_UI::config()->get_ui_scale(), 0, 2 * M_PI); cairo_fill(cr); //led color ArdourCanvas::set_source_rgba (cr, led_color); - cairo_arc (cr, 0, 0, _diameter * .5 - 3 * ARDOUR_UI::ui_scale, 0, 2 * M_PI); + cairo_arc (cr, 0, 0, _diameter * .5 - 3 * ARDOUR_UI::config()->get_ui_scale(), 0, 2 * M_PI); cairo_fill(cr); cairo_restore (cr); @@ -527,7 +527,7 @@ ArdourButton::on_size_request (Gtk::Requisition* req) CairoWidget::on_size_request (req); if (_diameter == 0) { - const float newdia = rintf (11.f * ARDOUR_UI::ui_scale); + const float newdia = rintf (11.f * ARDOUR_UI::config()->get_ui_scale()); if (_diameter != newdia) { _pattern_height = 0; _diameter = newdia; diff --git a/gtk2_ardour/ardour_knob.cc b/gtk2_ardour/ardour_knob.cc index 5cb671b465..bca5e28661 100644 --- a/gtk2_ardour/ardour_knob.cc +++ b/gtk2_ardour/ardour_knob.cc @@ -330,7 +330,7 @@ ArdourKnob::on_motion_notify_event (GdkEventMotion *ev) //scale the adjustment based on keyboard modifiers & GUI size - const float ui_scale = max (1.f, ARDOUR_UI::ui_scale); + const float ui_scale = max (1.f, ARDOUR_UI::config()->get_ui_scale()); float scale = 0.0025 / ui_scale; if (ev->state & Keyboard::GainFineScaleModifier) { diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 5486daf431..6b0d8a3c2f 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -166,8 +166,6 @@ ARDOUR_UI *ARDOUR_UI::theArdourUI = 0; sigc::signal ARDOUR_UI::Clock; sigc::signal ARDOUR_UI::CloseAllDialogs; -float ARDOUR_UI::ui_scale = 1.0; - static bool ask_about_configuration_copy (string const & old_dir, string const & new_dir, int version) { diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 1ae81f54f1..f2ad1bb0d6 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -186,7 +186,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr static ARDOUR_UI *instance () { return theArdourUI; } static UIConfiguration *config () { return theArdourUI->ui_config; } - static float ui_scale; PublicEditor& the_editor() { return *editor;} Mixer_UI* the_mixer() { return mixer; } diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 172e45d4e7..6a15ec8ea0 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -216,7 +216,7 @@ ARDOUR_UI::tearoff_settings (const char* name) const return 0; } -#define PX_SCALE(px) std::max((float)px, rintf((float)px * ARDOUR_UI::ui_scale)) +#define PX_SCALE(px) std::max((float)px, rintf((float)px * ARDOUR_UI::config()->get_ui_scale())) void ARDOUR_UI::setup_transport () diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 7d7ee7d60b..7de91bc5ae 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -223,7 +223,7 @@ ARDOUR_UI::set_session (Session *s) editor_meter_peak_display.set_name ("meterbridge peakindicator"); editor_meter_peak_display.unset_flags (Gtk::CAN_FOCUS); - editor_meter_peak_display.set_size_request (std::max(9.f, rintf(8.f * ui_scale)), -1); + editor_meter_peak_display.set_size_request (std::max(9.f, rintf(8.f * ARDOUR_UI::config()->get_ui_scale())), -1); editor_meter_peak_display.set_corner_radius (3.0); editor_meter_max_peak = -INFINITY; diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 0c59a66213..a4fcd89b59 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -423,8 +423,6 @@ ARDOUR_UI::parameter_changed (std::string p) ? ArdourCanvas::WaveView::Rectified : ArdourCanvas::WaveView::Normal); } else if (p == "show-waveform-clipping") { ArdourCanvas::WaveView::set_global_show_waveform_clipping (ARDOUR_UI::config()->get_show_waveform_clipping()); - } else if (p == "font-scale") { - ui_scale = config()->get_font_scale () / 102400.; } else if (p == "waveform-cache-size") { /* GUI option has units of megabytes; image cache uses units of bytes */ ArdourCanvas::WaveView::set_image_cache_size (ARDOUR_UI::config()->get_waveform_cache_size() * 1048576); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index e69c28609e..0a51b0ee09 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -414,7 +414,7 @@ Editor::Editor () samples_per_pixel = 2048; /* too early to use reset_zoom () */ - timebar_height = std::max(12., ceil (15. * ARDOUR_UI::ui_scale)); + timebar_height = std::max(12., ceil (15. * ARDOUR_UI::config()->get_ui_scale())); TimeAxisView::setup_sizes (); ArdourMarker::setup_sizes (timebar_height); diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 34bbc95cbc..956b25b6df 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -100,8 +100,8 @@ GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int next_release_selects = false; _width = Wide; - fader_length = rint (fader_length * ARDOUR_UI::ui_scale); - fader_girth = rint (fader_girth * ARDOUR_UI::ui_scale); + fader_length = rint (fader_length * ARDOUR_UI::config()->get_ui_scale()); + fader_girth = rint (fader_girth * ARDOUR_UI::config()->get_ui_scale()); if (horizontal) { gain_slider = manage (new HSliderController (&gain_adjustment, boost::shared_ptr(), fader_length, fader_girth)); @@ -935,7 +935,7 @@ GainMeterBase::redraw_metrics() meter_ticks2_area.queue_draw (); } -#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::ui_scale)) +#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::config()->get_ui_scale())) GainMeter::GainMeter (Session* s, int fader_length) : GainMeterBase (s, false, fader_length, 24) diff --git a/gtk2_ardour/level_meter.cc b/gtk2_ardour/level_meter.cc index ba8113d4c2..4b06675d46 100644 --- a/gtk2_ardour/level_meter.cc +++ b/gtk2_ardour/level_meter.cc @@ -260,7 +260,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width) width = thin_meter_width; } - width = rint (width * ARDOUR_UI::ui_scale); + width = rint (width * ARDOUR_UI::config()->get_ui_scale()); if ( meters.size() > 0 && nmeters == visible_meter_count diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index 0c7376934c..49b4f2c1b0 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -77,8 +77,8 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Container& parent, g { const double MH = marker_height - 1; - const double M3 = std::max(1.f, rintf(3.f * ARDOUR_UI::ui_scale)); - const double M6 = std::max(2.f, rintf(6.f * ARDOUR_UI::ui_scale)); + const double M3 = std::max(1.f, rintf(3.f * ARDOUR_UI::config()->get_ui_scale())); + const double M6 = std::max(2.f, rintf(6.f * ARDOUR_UI::config()->get_ui_scale())); /* Shapes we use: * @@ -403,7 +403,7 @@ ArdourMarker::setup_name_display () limit = _right_label_limit; } - const float padding = std::max(2.f, rintf(2.f * ARDOUR_UI::ui_scale)); + const float padding = std::max(2.f, rintf(2.f * ARDOUR_UI::config()->get_ui_scale())); /* Work out how wide the name can be */ int name_width = min ((double) pixel_width (_name, name_font) + padding, limit); diff --git a/gtk2_ardour/meter_patterns.cc b/gtk2_ardour/meter_patterns.cc index b9653e6ab3..4cf184987a 100644 --- a/gtk2_ardour/meter_patterns.cc +++ b/gtk2_ardour/meter_patterns.cc @@ -304,7 +304,7 @@ meter_render_ticks (Gtk::Widget& w, MeterType type, vector typ float box_l=0; float box_w=0; -#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::ui_scale)) +#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::config()->get_ui_scale())) if (tickleft) { if (w.get_name().substr(0, 3) == "Bar") { box_w = PX_SCALE(2, 2); @@ -641,7 +641,7 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector types) const double fixfontsize = 1.0; #else // counter-act global font-scaling. - const double fixfontsize = std::min(1.0, 0.9 / sqrtf(ARDOUR_UI::ui_scale)); + const double fixfontsize = std::min(1.0, 0.9 / sqrtf(ARDOUR_UI::config()->get_ui_scale())); #endif font.set_weight (Pango::WEIGHT_NORMAL); diff --git a/gtk2_ardour/meter_strip.cc b/gtk2_ardour/meter_strip.cc index cd33ba345b..3279bd64e1 100644 --- a/gtk2_ardour/meter_strip.cc +++ b/gtk2_ardour/meter_strip.cc @@ -58,7 +58,7 @@ PBD::Signal1 MeterStrip::CatchDeletion; PBD::Signal0 MeterStrip::MetricChanged; PBD::Signal0 MeterStrip::ConfigurationChanged; -#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::ui_scale)) +#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::config()->get_ui_scale())) MeterStrip::MeterStrip (int metricmode, MeterType mt) : AxisView(0) @@ -544,8 +544,8 @@ MeterStrip::on_size_allocate (Gtk::Allocation& a) tnh = 4 + std::max(2u, _session->track_number_decimals()) * 8; // TODO 8 = max_with_of_digit_0_to_9() } - nh *= ARDOUR_UI::ui_scale; - tnh *= ARDOUR_UI::ui_scale; + nh *= ARDOUR_UI::config()->get_ui_scale(); + tnh *= ARDOUR_UI::config()->get_ui_scale(); int prev_height, ignored; bool need_relayout = false; @@ -810,7 +810,7 @@ MeterStrip::name_changed () { } const int tnh = 4 + std::max(2u, _session->track_number_decimals()) * 8; // TODO 8 = max_width_of_digit_0_to_9() // NB numbers are rotated 90deg. on the meterbridge -> use height - number_label.set_size_request(PX_SCALE(18, 18), tnh * ARDOUR_UI::ui_scale); + number_label.set_size_request(PX_SCALE(18, 18), tnh * ARDOUR_UI::config()->get_ui_scale()); } else { number_label.hide(); } diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 5054c5e2d4..64f4a64c31 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -257,7 +257,7 @@ MixerStrip::init () _comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor)); // TODO implement ArdourKnob::on_size_request properly -#define PX_SCALE(px) std::max((float)px, rintf((float)px * ARDOUR_UI::ui_scale)) +#define PX_SCALE(px) std::max((float)px, rintf((float)px * ARDOUR_UI::config()->get_ui_scale())) trim_control.set_size_request (PX_SCALE(19), PX_SCALE(19)); #undef PX_SCALE trim_control.set_tooltip_prefix (_("Trim: ")); @@ -703,7 +703,7 @@ MixerStrip::set_width_enum (Width w, void* owner) set_button_names (); - const float scale = std::max(1.f, ARDOUR_UI::ui_scale); + const float scale = std::max(1.f, ARDOUR_UI::config()->get_ui_scale()); switch (w) { case Wide: diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index 5a09311d26..9ee8a87541 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -55,7 +55,7 @@ using namespace std; Glib::RefPtr MonitorSection::monitor_actions; -#define PX_SCALE(px) std::max((float)px, rintf((float)px * ARDOUR_UI::ui_scale)) +#define PX_SCALE(px) std::max((float)px, rintf((float)px * ARDOUR_UI::config()->get_ui_scale())) MonitorSection::MonitorSection (Session* s) : AxisView (s) diff --git a/gtk2_ardour/mono_panner.cc b/gtk2_ardour/mono_panner.cc index 496f67d007..991481a0c6 100644 --- a/gtk2_ardour/mono_panner.cc +++ b/gtk2_ardour/mono_panner.cc @@ -138,7 +138,7 @@ MonoPanner::on_expose_event (GdkEventExpose*) const int lr_box_size = height - 2 * step_down; const int pos_box_size = (int)(rint(step_down * .8)) | 1; const int top_step = step_down - pos_box_size; - const double corner_radius = 5 * ARDOUR_UI::ui_scale; + const double corner_radius = 5 * ARDOUR_UI::config()->get_ui_scale(); o = colors.outline; f = colors.fill; @@ -253,8 +253,8 @@ MonoPanner::on_expose_event (GdkEventExpose*) context->set_line_width (2.0); context->move_to (spos + (pos_box_size/2.0), top_step); /* top right */ context->rel_line_to (0.0, pos_box_size); /* lower right */ - context->rel_line_to (-pos_box_size/2.0, 4.0 * ARDOUR_UI::ui_scale); /* bottom point */ - context->rel_line_to (-pos_box_size/2.0, -4.0 * ARDOUR_UI::ui_scale); /* lower left */ + context->rel_line_to (-pos_box_size/2.0, 4.0 * ARDOUR_UI::config()->get_ui_scale()); /* bottom point */ + context->rel_line_to (-pos_box_size/2.0, -4.0 * ARDOUR_UI::config()->get_ui_scale()); /* lower left */ context->rel_line_to (0.0, -pos_box_size); /* upper left */ context->close_path (); @@ -266,7 +266,7 @@ MonoPanner::on_expose_event (GdkEventExpose*) /* marker line */ context->set_line_width (1.0); - context->move_to (spos, 1 + top_step + pos_box_size + 4.0 * ARDOUR_UI::ui_scale); + context->move_to (spos, 1 + top_step + pos_box_size + 4.0 * ARDOUR_UI::config()->get_ui_scale()); context->line_to (spos, half_lr_box + step_down + lr_box_size - 1); context->set_source_rgba (UINT_RGBA_R_FLT(po), UINT_RGBA_G_FLT(po), UINT_RGBA_B_FLT(po), UINT_RGBA_A_FLT(po)); context->stroke (); diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index 9d40a90a93..4130559204 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -240,7 +240,7 @@ PannerUI::setup_pan () return; } - const float scale = std::max (1.f, ARDOUR_UI::ui_scale); + const float scale = std::max (1.f, ARDOUR_UI::config()->get_ui_scale()); if (_current_uri == "http://ardour.org/plugin/panner_2in2out#ui") { diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 8a913641a3..6ceda3b8d8 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -510,7 +510,7 @@ ProcessorEntry::toggle_panner_link () ProcessorEntry::Control::Control (boost::shared_ptr c, string const & n) : _control (c) , _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1) - , _slider (&_adjustment, boost::shared_ptr(), 0, max(13.f, rintf(13.f * ARDOUR_UI::ui_scale))) + , _slider (&_adjustment, boost::shared_ptr(), 0, max(13.f, rintf(13.f * ARDOUR_UI::config()->get_ui_scale()))) , _slider_persistant_tooltip (&_slider) , _button (ArdourButton::led_default_elements) , _ignore_ui_adjustment (false) @@ -792,7 +792,7 @@ PluginInsertProcessorEntry::plugin_insert_splitting_changed () if (_plugin_insert->splitting () || in != sinks) { - _routing_icon.set_size_request (-1, std::max (7.f, rintf(7.f * ARDOUR_UI::ui_scale))); + _routing_icon.set_size_request (-1, std::max (7.f, rintf(7.f * ARDOUR_UI::config()->get_ui_scale()))); _routing_icon.set_visible(true); _input_icon.show(); } else { @@ -817,7 +817,7 @@ PluginInsertProcessorEntry::hide_things () ProcessorEntry::PortIcon::PortIcon(bool input) { _input = input; _ports = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1); - set_size_request (-1, std::max (2.f, rintf(2.f * ARDOUR_UI::ui_scale))); + set_size_request (-1, std::max (2.f, rintf(2.f * ARDOUR_UI::config()->get_ui_scale()))); } bool @@ -838,7 +838,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); - const double dx = rint(max(2., 2. * ARDOUR_UI::ui_scale)); + const double dx = rint(max(2., 2. * ARDOUR_UI::config()->get_ui_scale())); if (_ports.n_total() > 1) { for (uint32_t i = 0; i < _ports.n_total(); ++i) { if (i < _ports.n_midi()) { @@ -886,7 +886,7 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev) cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height); cairo_clip (cr); - cairo_set_line_width (cr, max (1.f, ARDOUR_UI::ui_scale)); + cairo_set_line_width (cr, max (1.f, ARDOUR_UI::config()->get_ui_scale())); cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); Gtk::Allocation a = get_allocation(); @@ -936,7 +936,7 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev) cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0); cairo_stroke (cr); } else if (midi_sources == 0 && midi_sinks == 1) { - const double dx = 1 + rint(max(2., 2. * ARDOUR_UI::ui_scale)); + const double dx = 1 + rint(max(2., 2. * ARDOUR_UI::config()->get_ui_scale())); // draw "T" // TODO connect back to track-input of last midi-out if any, otherwise draw "X" const float si_x = rintf(width * .2f) + .5f; diff --git a/gtk2_ardour/stereo_panner.cc b/gtk2_ardour/stereo_panner.cc index cdd4d94f18..6fa8241eb1 100644 --- a/gtk2_ardour/stereo_panner.cc +++ b/gtk2_ardour/stereo_panner.cc @@ -151,7 +151,7 @@ StereoPanner::on_expose_event (GdkEventExpose*) height = get_height (); const int step_down = rint(height / 3.5); - const double corner_radius = 5.0 * ARDOUR_UI::ui_scale; + const double corner_radius = 5.0 * ARDOUR_UI::config()->get_ui_scale(); const int lr_box_size = height - 2 * step_down; const int pos_box_size = (int)(rint(step_down * .8)) | 1; const int top_step = step_down - pos_box_size; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index d4c1dbf508..41c41ae4c3 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -82,7 +82,7 @@ Glib::RefPtr TimeAxisView::midi_scroomer_size_group = Glib::RefP void TimeAxisView::setup_sizes() { - name_width_px = ceilf (100.f * ARDOUR_UI::ui_scale); + name_width_px = ceilf (100.f * ARDOUR_UI::config()->get_ui_scale()); } TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/) diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index 8e6c03a980..cc8a737cd9 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -180,6 +180,12 @@ UIConfiguration::set_pango_fontsize () pango_cairo_font_map_set_resolution ((PangoCairoFontMap*) pango_cairo_font_map_get_default(), val/1024); } +float +UIConfiguration::get_ui_scale () +{ + return get_font_scale () / 102400.; +} + void UIConfiguration::map_parameters (boost::function& functor) { diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index bd60173158..0a6e7cda5d 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -80,10 +80,12 @@ class UIConfiguration : public PBD::Stateful void reset_dpi (); void set_pango_fontsize (); + + float get_ui_scale (); static sigc::signal DPIReset; - sigc::signal ParameterChanged; + sigc::signal ParameterChanged; void map_parameters (boost::function&); void parameter_changed (std::string);