clean up GUI scaling
This commit is contained in:
parent
8d85afd294
commit
b38ab89d92
@ -199,8 +199,7 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
|
||||
uint32_t text_color;
|
||||
uint32_t led_color;
|
||||
|
||||
const double dpiscale = ARDOUR_UI::config()->get_font_scale () / 102400.;
|
||||
const double corner_radius = std::max(2.0, _corner_radius * dpiscale);
|
||||
const float corner_radius = std::max(2.f, _corner_radius * ARDOUR_UI::ui_scale);
|
||||
|
||||
if (_update_colors) {
|
||||
set_colors ();
|
||||
@ -740,12 +739,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 * dpiscale, 0, 2 * M_PI);
|
||||
cairo_arc (cr, 0, 0, _diameter * .5 - 1 * ARDOUR_UI::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 * dpiscale, 0, 2 * M_PI);
|
||||
cairo_arc (cr, 0, 0, _diameter * .5 - 3 * ARDOUR_UI::ui_scale, 0, 2 * M_PI);
|
||||
cairo_fill(cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
@ -827,7 +826,7 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
|
||||
CairoWidget::on_size_request (req);
|
||||
|
||||
if (_diameter == 0) {
|
||||
const float newdia = rint (11. * ARDOUR_UI::config()->get_font_scale () / 102400.);
|
||||
const float newdia = rintf (11.f * ARDOUR_UI::ui_scale);
|
||||
if (_diameter != newdia) {
|
||||
_pattern_height = 0;
|
||||
_diameter = newdia;
|
||||
|
@ -216,15 +216,13 @@ ARDOUR_UI::tearoff_settings (const char* name) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * btn_scale))
|
||||
#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::ui_scale))
|
||||
|
||||
void
|
||||
ARDOUR_UI::setup_transport ()
|
||||
{
|
||||
RefPtr<Action> act;
|
||||
|
||||
const double btn_scale = config()->get_font_scale () / 102400.;
|
||||
|
||||
transport_tearoff_hbox.set_border_width (PX_SCALE(3,3));
|
||||
transport_tearoff_hbox.set_spacing (PX_SCALE(3,3));
|
||||
|
||||
|
@ -410,7 +410,7 @@ Editor::Editor ()
|
||||
|
||||
samples_per_pixel = 2048; /* too early to use reset_zoom () */
|
||||
|
||||
timebar_height = std::max(12., ceil (15. * ARDOUR_UI::config()->get_font_scale() / 102400.));
|
||||
timebar_height = std::max(12., ceil (15. * ARDOUR_UI::ui_scale));
|
||||
TimeAxisView::setup_sizes ();
|
||||
Marker::setup_sizes (timebar_height);
|
||||
|
||||
|
@ -101,8 +101,8 @@ GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length, int
|
||||
next_release_selects = false;
|
||||
_width = Wide;
|
||||
|
||||
fader_length = rint (fader_length * ARDOUR_UI::config()->get_font_scale() / 102400.);
|
||||
fader_girth = rint (fader_girth * ARDOUR_UI::config()->get_font_scale() / 102400.);
|
||||
fader_length = rint (fader_length * ARDOUR_UI::ui_scale);
|
||||
fader_girth = rint (fader_girth * ARDOUR_UI::ui_scale);
|
||||
|
||||
if (horizontal) {
|
||||
gain_slider = manage (new HSliderController (&gain_adjustment, boost::shared_ptr<PBD::Controllable>(), fader_length, fader_girth));
|
||||
@ -936,7 +936,7 @@ GainMeterBase::redraw_metrics()
|
||||
meter_ticks2_area.queue_draw ();
|
||||
}
|
||||
|
||||
#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * scale))
|
||||
#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::ui_scale))
|
||||
|
||||
GainMeter::GainMeter (Session* s, int fader_length)
|
||||
: GainMeterBase (s, false, fader_length, 24)
|
||||
@ -953,8 +953,6 @@ GainMeter::GainMeter (Session* s, int fader_length)
|
||||
}
|
||||
gain_display_box.pack_start (peak_display, true, true);
|
||||
|
||||
const double scale = ARDOUR_UI::config()->get_font_scale() / 102400.;
|
||||
|
||||
meter_metric_area.set_name ("AudioTrackMetrics");
|
||||
meter_metric_area.set_size_request(PX_SCALE(24, 24), -1);
|
||||
|
||||
|
@ -258,7 +258,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width)
|
||||
width = thin_meter_width;
|
||||
}
|
||||
|
||||
width = rint (width * ARDOUR_UI::config()->get_font_scale() / 102400.);
|
||||
width = rint (width * ARDOUR_UI::ui_scale);
|
||||
|
||||
while (meters.size() < nmeters) {
|
||||
meters.push_back (MeterInfo());
|
||||
|
@ -289,8 +289,7 @@ meter_render_ticks (Gtk::Widget& w, MeterType type, vector<ARDOUR::DataType> typ
|
||||
|
||||
float box_l=0;
|
||||
float box_w=0;
|
||||
const double scale = ARDOUR_UI::config()->get_font_scale() / 102400.;
|
||||
#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * scale))
|
||||
#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::ui_scale))
|
||||
if (tickleft) {
|
||||
if (w.get_name().substr(0, 3) == "Bar") {
|
||||
box_w = PX_SCALE(2, 2);
|
||||
@ -620,7 +619,7 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector<DataType> types)
|
||||
const double fixfontsize = 1.125;
|
||||
#else
|
||||
// counter-act global font-scaling.
|
||||
const double fixfontsize = std::min(1.0, 0.9 / sqrt((double) ARDOUR_UI::config()->get_font_scale() / 102400.));
|
||||
const double fixfontsize = std::min(1.0, 0.9 / sqrtf(ARDOUR_UI::ui_scale));
|
||||
#endif
|
||||
|
||||
font.set_weight (Pango::WEIGHT_NORMAL);
|
||||
|
@ -59,7 +59,7 @@ PBD::Signal1<void,MeterStrip*> MeterStrip::CatchDeletion;
|
||||
PBD::Signal0<void> MeterStrip::MetricChanged;
|
||||
PBD::Signal0<void> MeterStrip::ConfigurationChanged;
|
||||
|
||||
#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * scale))
|
||||
#define PX_SCALE(pxmin, dflt) rint(std::max((double)pxmin, (double)dflt * ARDOUR_UI::ui_scale))
|
||||
|
||||
MeterStrip::MeterStrip (int metricmode, MeterType mt)
|
||||
: AxisView(0)
|
||||
@ -71,8 +71,6 @@ MeterStrip::MeterStrip (int metricmode, MeterType mt)
|
||||
_metricmode = -1;
|
||||
metric_type = MeterPeak;
|
||||
|
||||
const double scale = (double) ARDOUR_UI::config()->get_font_scale() / 102400.;
|
||||
|
||||
mtr_vbox.set_spacing (PX_SCALE(2, 2));
|
||||
nfo_vbox.set_spacing (PX_SCALE(2, 2));
|
||||
peakbx.set_size_request (-1, PX_SCALE(14, 14));
|
||||
@ -124,8 +122,6 @@ MeterStrip::MeterStrip (Session* sess, boost::shared_ptr<ARDOUR::Route> rt)
|
||||
, _route(rt)
|
||||
, peak_display()
|
||||
{
|
||||
const double scale = (double) ARDOUR_UI::config()->get_font_scale() / 102400.;
|
||||
|
||||
mtr_vbox.set_spacing (PX_SCALE(2, 2));
|
||||
nfo_vbox.set_spacing (PX_SCALE(2, 2));
|
||||
SessionHandlePtr::set_session (sess);
|
||||
@ -517,8 +513,6 @@ MeterStrip::on_size_request (Gtk::Requisition* r)
|
||||
void
|
||||
MeterStrip::on_size_allocate (Gtk::Allocation& a)
|
||||
{
|
||||
const double scale = (double) ARDOUR_UI::config()->get_font_scale() / 102400.;
|
||||
|
||||
const int wh = a.get_height();
|
||||
int nh;
|
||||
int mh = 0;
|
||||
@ -551,8 +545,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 *= scale;
|
||||
tnh *= scale;
|
||||
nh *= ARDOUR_UI::ui_scale;
|
||||
tnh *= ARDOUR_UI::ui_scale;
|
||||
|
||||
int prev_height, ignored;
|
||||
bool need_relayout = false;
|
||||
@ -726,8 +720,6 @@ MeterStrip::redraw_metrics ()
|
||||
void
|
||||
MeterStrip::update_button_box ()
|
||||
{
|
||||
const double scale = (double) ARDOUR_UI::config()->get_font_scale() / 102400.;
|
||||
|
||||
if (!_session) return;
|
||||
int height = 0;
|
||||
if (_session->config.get_show_mute_on_meterbridge()) {
|
||||
@ -807,8 +799,6 @@ MeterStrip::name_changed () {
|
||||
if (!_route) {
|
||||
return;
|
||||
}
|
||||
const double scale = (double) ARDOUR_UI::config()->get_font_scale() / 102400.;
|
||||
|
||||
name_label.set_text(_route->name ());
|
||||
if (_session && _session->config.get_track_name_number()) {
|
||||
const int64_t track_number = _route->track_number ();
|
||||
@ -821,7 +811,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 * scale);
|
||||
number_label.set_size_request(PX_SCALE(18, 18), tnh * ARDOUR_UI::ui_scale);
|
||||
} else {
|
||||
number_label.hide();
|
||||
}
|
||||
|
@ -684,7 +684,7 @@ MixerStrip::set_width_enum (Width w, void* owner)
|
||||
|
||||
set_button_names ();
|
||||
|
||||
const double scale = std::max(1.0, ARDOUR_UI::config()->get_font_scale() / 102400.);
|
||||
const float scale = std::max(1.f, ARDOUR_UI::ui_scale);
|
||||
|
||||
switch (w) {
|
||||
case Wide:
|
||||
@ -707,7 +707,7 @@ MixerStrip::set_width_enum (Width w, void* owner)
|
||||
|
||||
{
|
||||
// panners expect an even number of horiz. pixels
|
||||
int width = rint(max (110 * scale, gpm.get_gm_width() + 10 * scale)) + 1;
|
||||
int width = rintf (max (110.f * scale, gpm.get_gm_width() + 10.f * scale)) + 1;
|
||||
width &= ~1;
|
||||
set_size_request (width, -1);
|
||||
}
|
||||
@ -734,7 +734,7 @@ MixerStrip::set_width_enum (Width w, void* owner)
|
||||
|
||||
{
|
||||
// panners expect an even number of horiz. pixels
|
||||
int width = rint(max (60 * scale, gpm.get_gm_width() + 10 * scale)) + 1;
|
||||
int width = rintf (max (60.f * scale, gpm.get_gm_width() + 10.f * scale)) + 1;
|
||||
width &= ~1;
|
||||
set_size_request (width, -1);
|
||||
}
|
||||
|
@ -135,12 +135,11 @@ MonoPanner::on_expose_event (GdkEventExpose*)
|
||||
width = get_width();
|
||||
height = get_height ();
|
||||
|
||||
const double scale = ARDOUR_UI::config()->get_font_scale() / 102400.;
|
||||
const int step_down = rint(height / 3.5);
|
||||
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 * scale;
|
||||
const double corner_radius = 5 * ARDOUR_UI::ui_scale;
|
||||
|
||||
o = colors.outline;
|
||||
f = colors.fill;
|
||||
@ -255,8 +254,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 * scale); /* bottom point */
|
||||
context->rel_line_to (-pos_box_size/2.0, -4.0 * scale); /* lower left */
|
||||
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 (0.0, -pos_box_size); /* upper left */
|
||||
context->close_path ();
|
||||
|
||||
@ -268,7 +267,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 * scale);
|
||||
context->move_to (spos, 1 + top_step + pos_box_size + 4.0 * ARDOUR_UI::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 ();
|
||||
|
@ -240,7 +240,7 @@ PannerUI::setup_pan ()
|
||||
return;
|
||||
}
|
||||
|
||||
const double scale = std::max(1.0, ARDOUR_UI::config()->get_font_scale() / 102400.);
|
||||
const float scale = std::max (1.f, ARDOUR_UI::ui_scale);
|
||||
|
||||
if (_current_uri == "http://ardour.org/plugin/panner_2in2out#ui")
|
||||
{
|
||||
@ -250,7 +250,7 @@ PannerUI::setup_pan ()
|
||||
boost::shared_ptr<Pannable> pannable = _panner->pannable();
|
||||
|
||||
_stereo_panner = new StereoPanner (_panshell);
|
||||
_stereo_panner->set_size_request (-1, 5 * ceil(7. * scale));
|
||||
_stereo_panner->set_size_request (-1, 5 * ceilf(7.f * scale));
|
||||
_stereo_panner->set_send_drawing_mode (_send_mode);
|
||||
pan_vbox.pack_start (*_stereo_panner, false, false);
|
||||
|
||||
@ -286,7 +286,7 @@ PannerUI::setup_pan ()
|
||||
|
||||
_mono_panner->signal_button_release_event().connect (sigc::mem_fun(*this, &PannerUI::pan_button_event));
|
||||
|
||||
_mono_panner->set_size_request (-1, 5 * ceil(7. * scale));
|
||||
_mono_panner->set_size_request (-1, 5 * ceilf(7.f * scale));
|
||||
_mono_panner->set_send_drawing_mode (_send_mode);
|
||||
|
||||
update_pan_sensitive ();
|
||||
@ -295,7 +295,7 @@ PannerUI::setup_pan ()
|
||||
else if (_current_uri == "http://ardour.org/plugin/panner_vbap#ui")
|
||||
{
|
||||
if (!twod_panner) {
|
||||
twod_panner = new Panner2d (_panshell, 61 * scale);
|
||||
twod_panner = new Panner2d (_panshell, rintf(61.f * scale));
|
||||
twod_panner->set_name ("MixerPanZone");
|
||||
twod_panner->show ();
|
||||
twod_panner->signal_button_press_event().connect (sigc::mem_fun(*this, &PannerUI::pan_button_event), false);
|
||||
@ -306,7 +306,7 @@ PannerUI::setup_pan ()
|
||||
if (big_window) {
|
||||
big_window->reset (nins);
|
||||
}
|
||||
twod_panner->set_size_request (-1, 61 * scale);
|
||||
twod_panner->set_size_request (-1, rintf(61.f * scale));
|
||||
twod_panner->set_send_drawing_mode (_send_mode);
|
||||
|
||||
/* and finally, add it to the panner frame */
|
||||
|
@ -493,7 +493,7 @@ ProcessorEntry::toggle_panner_link ()
|
||||
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.0, rint(13. * ARDOUR_UI::config()->get_font_scale () / 102400.)))
|
||||
, _slider (&_adjustment, boost::shared_ptr<PBD::Controllable>(), 0, max(13.f, rintf(13.f * ARDOUR_UI::ui_scale)))
|
||||
, _slider_persistant_tooltip (&_slider)
|
||||
, _button (ArdourButton::led_default_elements)
|
||||
, _ignore_ui_adjustment (false)
|
||||
@ -734,8 +734,7 @@ PluginInsertProcessorEntry::plugin_insert_splitting_changed ()
|
||||
_plugin_insert->input_streams().n_audio() < _plugin_insert->natural_input_streams().n_audio()
|
||||
)
|
||||
{
|
||||
const double scale = max(1.0, ARDOUR_UI::config()->get_font_scale () / 102400.);
|
||||
_routing_icon.set_size_request (-1, rint(7.0 * scale));
|
||||
_routing_icon.set_size_request (-1, std::max (7.f, rintf(7.f * ARDOUR_UI::ui_scale)));
|
||||
_routing_icon.set_visible(true);
|
||||
_input_icon.show();
|
||||
} else {
|
||||
@ -760,8 +759,7 @@ PluginInsertProcessorEntry::hide_things ()
|
||||
ProcessorEntry::PortIcon::PortIcon(bool input) {
|
||||
_input = input;
|
||||
_ports = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1);
|
||||
const double scale = max(1.0, ARDOUR_UI::config()->get_font_scale () / 102400.);
|
||||
set_size_request (-1, rint(2 * scale));
|
||||
set_size_request (-1, std::max (2.f, rintf(2.f * ARDOUR_UI::ui_scale)));
|
||||
}
|
||||
|
||||
bool
|
||||
@ -782,7 +780,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev)
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_fill (cr);
|
||||
|
||||
const double dx = rint(max(2.0, 2. * ARDOUR_UI::config()->get_font_scale () / 102400.));
|
||||
const double dx = rint(max(2., 2. * ARDOUR_UI::ui_scale));
|
||||
if (_ports.n_total() > 1) {
|
||||
for (uint32_t i = 0; i < _ports.n_total(); ++i) {
|
||||
if (i < _ports.n_midi()) {
|
||||
@ -830,8 +828,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);
|
||||
|
||||
const double scale = max(1.0, ARDOUR_UI::config()->get_font_scale () / 102400.);
|
||||
cairo_set_line_width (cr, scale);
|
||||
cairo_set_line_width (cr, max (1.f, ARDOUR_UI::ui_scale));
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
|
||||
|
||||
Gtk::Allocation a = get_allocation();
|
||||
|
@ -151,9 +151,8 @@ StereoPanner::on_expose_event (GdkEventExpose*)
|
||||
width = get_width();
|
||||
height = get_height ();
|
||||
|
||||
const double scale = ARDOUR_UI::config()->get_font_scale() / 102400.;
|
||||
const int step_down = rint(height / 3.5);
|
||||
const double corner_radius = 5.0 * scale;
|
||||
const double corner_radius = 5.0 * ARDOUR_UI::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;
|
||||
|
@ -82,7 +82,7 @@ Glib::RefPtr<Gtk::SizeGroup> TimeAxisView::midi_scroomer_size_group = Glib::RefP
|
||||
void
|
||||
TimeAxisView::setup_sizes()
|
||||
{
|
||||
name_width_px = ceil (100. * ARDOUR_UI::config()->get_font_scale() / 102400.);
|
||||
name_width_px = ceilf (100.f * ARDOUR_UI::ui_scale);
|
||||
}
|
||||
|
||||
TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/)
|
||||
|
Loading…
Reference in New Issue
Block a user