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 ();
//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);
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;
//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) {
sigc::signal<void, framepos_t, bool, framepos_t> ARDOUR_UI::Clock;
sigc::signal<void> 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)
{
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; }
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 ()
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;
? 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);
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);
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<PBD::Controllable>(), fader_length, fader_girth));
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)
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
{
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:
*
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);
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);
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);
PBD::Signal0<void> MeterStrip::MetricChanged;
PBD::Signal0<void> 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)
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;
}
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();
}
_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: "));
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:
Glib::RefPtr<ActionGroup> 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)
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;
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 ();
/* 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 ();
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")
{
ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> 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<PBD::Controllable>(), 0, max(13.f, rintf(13.f * ARDOUR_UI::ui_scale)))
+ , _slider (&_adjustment, boost::shared_ptr<PBD::Controllable>(), 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)
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 {
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
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()) {
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();
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;
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;
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*/)
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<void (std::string)>& functor)
{
void reset_dpi ();
void set_pango_fontsize ();
+
+ float get_ui_scale ();
static sigc::signal<void> DPIReset;
- sigc::signal<void,std::string> ParameterChanged;
+ sigc::signal<void,std::string> ParameterChanged;
void map_parameters (boost::function<void (std::string)>&);
void parameter_changed (std::string);