13
0

Improve GUI HiDPI support

* scale default track heights
* scale region-gain, automation lane control points
* scale max. MIDI note lane height
This commit is contained in:
Robin Gareus 2022-01-29 22:15:15 +01:00
parent 0b055ad66e
commit 97fe05e4de
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 14 additions and 7 deletions

View File

@ -229,12 +229,15 @@ AutomationLine::hide ()
double
AutomationLine::control_point_box_size ()
{
float uiscale = UIConfiguration::instance().get_ui_scale();
uiscale = std::max<float> (1.f, powf (uiscale, 1.71));
if (_height > TimeAxisView::preset_height (HeightLarger)) {
return 8.0;
return rint (8.0 * uiscale);
} else if (_height > (guint32) TimeAxisView::preset_height (HeightNormal)) {
return 6.0;
return rint (6.0 * uiscale);
}
return 4.0;
return rint (4.0 * uiscale);
}
void

View File

@ -393,7 +393,10 @@ MidiStreamView::apply_note_range(uint8_t lowest, uint8_t highest, bool to_region
_highest_note = highest;
_lowest_note = lowest;
int const max_note_height = 20; // This should probably be based on text size...
float uiscale = UIConfiguration::instance().get_ui_scale();
uiscale = expf (uiscale) / expf (1.f);
int const max_note_height = std::max<int> (20, 20 * uiscale);
int const range = _highest_note - _lowest_note;
int const pixels_per_note = floor (child_height () / range);

View File

@ -81,6 +81,7 @@ using namespace ArdourWidgets;
using Gtkmm2ext::Keyboard;
#define TOP_LEVEL_WIDGET controls_ebox
#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
const double trim_handle_size = 6.0; /* pixels */
uint32_t TimeAxisView::button_height = 0;
@ -1325,11 +1326,11 @@ TimeAxisView::preset_height (Height h)
{
switch (h) {
case HeightLargest:
return (button_height * 2) + extra_height + 260;
return (button_height * 2) + extra_height + PX_SCALE (260);
case HeightLarger:
return (button_height * 2) + extra_height + 160;
return (button_height * 2) + extra_height + PX_SCALE (160);
case HeightLarge:
return (button_height * 2) + extra_height + 60;
return (button_height * 2) + extra_height + PX_SCALE (60);
case HeightNormal:
return (button_height * 2) + extra_height + 10;
case HeightSmall: