comparison view/Pane.cpp @ 1397:9ea551137329

Fix some incorrect pixel scaling
author Chris Cannam
date Wed, 14 Nov 2018 15:04:04 +0000
parents c39f2d439d59
children 28075cc658c9
comparison
equal deleted inserted replaced
1396:2e316a724336 1397:9ea551137329
25 #include "widgets/IconLoader.h" 25 #include "widgets/IconLoader.h"
26 #include "base/Preferences.h" 26 #include "base/Preferences.h"
27 #include "layer/WaveformLayer.h" 27 #include "layer/WaveformLayer.h"
28 #include "layer/TimeRulerLayer.h" 28 #include "layer/TimeRulerLayer.h"
29 #include "layer/PaintAssistant.h" 29 #include "layer/PaintAssistant.h"
30 #include "ViewProxy.h"
31 30
32 // GF: added so we can propagate the mouse move event to the note layer for context handling. 31 // GF: added so we can propagate the mouse move event to the note layer for context handling.
33 #include "layer/LayerFactory.h" 32 #include "layer/LayerFactory.h"
34 #include "layer/FlexiNoteLayer.h" 33 #include "layer/FlexiNoteLayer.h"
35 34
879 } 878 }
880 879
881 void 880 void
882 Pane::drawLayerNames(QRect r, QPainter &paint) 881 Pane::drawLayerNames(QRect r, QPainter &paint)
883 { 882 {
884 ViewProxy proxy(this, effectiveDevicePixelRatio());
885
886 int fontHeight = paint.fontMetrics().height(); 883 int fontHeight = paint.fontMetrics().height();
887 int fontAscent = paint.fontMetrics().ascent(); 884 int fontAscent = paint.fontMetrics().ascent();
888 885
889 int lly = height() - 6; 886 int lly = height() - 6;
887
888 int zoomWheelSkip = 0, horizontalScaleSkip = 0;
889
890 if (m_manager->getZoomWheelsEnabled()) { 890 if (m_manager->getZoomWheelsEnabled()) {
891 lly -= m_manager->scalePixelSize(20); 891 zoomWheelSkip = m_manager->scalePixelSize(20);
892 } 892 }
893 893
894 for (LayerList::iterator i = m_layerStack.end(); i != m_layerStack.begin();) { 894 for (LayerList::iterator i = m_layerStack.end(); i != m_layerStack.begin();) {
895 --i; 895 --i;
896 int hsh = (*i)->getHorizontalScaleHeight(&proxy, paint); 896 horizontalScaleSkip = (*i)->getHorizontalScaleHeight(this, paint);
897 if (hsh > 0) { 897 if (horizontalScaleSkip > 0) {
898 lly -= hsh;
899 break; 898 break;
900 } 899 }
901 if ((*i)->isLayerOpaque()) { 900 if ((*i)->isLayerOpaque()) {
902 break; 901 break;
903 } 902 }
904 } 903 }
904
905 lly -= std::max(zoomWheelSkip, horizontalScaleSkip);
905 906
906 if (r.y() + r.height() < lly - int(m_layerStack.size()) * fontHeight) { 907 if (r.y() + r.height() < lly - int(m_layerStack.size()) * fontHeight) {
907 return; 908 return;
908 } 909 }
909 910
1842 << endl; 1843 << endl;
1843 1844
1844 Layer *interactionLayer = getInteractionLayer(); 1845 Layer *interactionLayer = getInteractionLayer();
1845 if (interactionLayer && !(interactionLayer->hasTimeXAxis())) { 1846 if (interactionLayer && !(interactionLayer->hasTimeXAxis())) {
1846 SVDEBUG << "Interaction layer does not have time X axis - delegating to it to decide what to do" << endl; 1847 SVDEBUG << "Interaction layer does not have time X axis - delegating to it to decide what to do" << endl;
1847 ViewProxy proxy(this, effectiveDevicePixelRatio()); 1848 interactionLayer->zoomToRegion(this, r);
1848 interactionLayer->zoomToRegion(&proxy, r);
1849 return; 1849 return;
1850 } 1850 }
1851 1851
1852 sv_frame_t newStartFrame = getFrameForX(x0); 1852 sv_frame_t newStartFrame = getFrameForX(x0);
1853 sv_frame_t newEndFrame = getFrameForX(x1); 1853 sv_frame_t newEndFrame = getFrameForX(x1);