# HG changeset patch # User Chris Cannam # Date 1425375239 0 # Node ID 1fc4f29feb2e530c4d76430050181f5aea4157ad # Parent 2be9753651c8df0fd499a294811a30278a6e5ea2# Parent 78e041e45ff0ff3c103e0d794c6f66f391020aff Merge from default branch diff -r 2be9753651c8 -r 1fc4f29feb2e view/Pane.cpp --- a/view/Pane.cpp Mon Feb 09 10:31:07 2015 +0000 +++ b/view/Pane.cpp Tue Mar 03 09:33:59 2015 +0000 @@ -2024,6 +2024,11 @@ int smallThreshold = 10, bigThreshold = 80; + if (m_manager) { + smallThreshold = m_manager->scalePixelSize(smallThreshold); + bigThreshold = m_manager->scalePixelSize(bigThreshold); + } + // SVDEBUG << "Pane::updateDragMode: xdiff = " << xdiff << ", ydiff = " // << ydiff << ", canMoveVertical = " << canMoveVertical << ", drag mode = " << m_dragMode << endl; diff -r 2be9753651c8 -r 1fc4f29feb2e view/ViewManager.cpp --- a/view/ViewManager.cpp Mon Feb 09 10:31:07 2015 +0000 +++ b/view/ViewManager.cpp Tue Mar 03 09:33:59 2015 +0000 @@ -720,3 +720,23 @@ return dark; } +int +ViewManager::scalePixelSize(int pixels) +{ + static float ratio = 0.f; + if (ratio == 0.f) { + float baseEm; +#ifdef Q_OS_MAC + baseEm = 17.f; +#else + baseEm = 15.f; +#endif + float em = QFontMetrics(QFont()).height(); + ratio = em / baseEm; + } + + int scaled = int(pixels * ratio + 0.5); + cerr << "scaledSize: " << pixels << " -> " << scaled << " at ratio " << ratio << endl; + if (pixels != 0 && scaled == 0) scaled = 1; + return scaled; +} diff -r 2be9753651c8 -r 1fc4f29feb2e view/ViewManager.h --- a/view/ViewManager.h Mon Feb 09 10:31:07 2015 +0000 +++ b/view/ViewManager.h Tue Mar 03 09:33:59 2015 +0000 @@ -184,6 +184,13 @@ void setMainModelSampleRate(int sr) { m_mainModelSampleRate = sr; } + /** + * Take a "design pixel" size and scale it for the actual + * display. This is relevant to hi-dpi systems that do not do + * pixel doubling (i.e. Windows and Linux rather than OS/X). + */ + int scalePixelSize(int pixels); + enum OverlayMode { NoOverlays, GlobalOverlays,