comparison layer/SpectrogramLayer.cpp @ 608:0dba6a391760

Adjust crosshair left end position based on detail level of vertical scale
author Chris Cannam
date Mon, 30 Jan 2012 16:06:32 +0000
parents 5b72899d692b
children d632a1e87018
comparison
equal deleted inserted replaced
607:5b72899d692b 608:0dba6a391760
74 m_binDisplay(AllBins), 74 m_binDisplay(AllBins),
75 m_normalizeColumns(false), 75 m_normalizeColumns(false),
76 m_normalizeVisibleArea(false), 76 m_normalizeVisibleArea(false),
77 m_lastEmittedZoomStep(-1), 77 m_lastEmittedZoomStep(-1),
78 m_synchronous(false), 78 m_synchronous(false),
79 m_haveDetailedScale(false),
79 m_lastPaintBlockWidth(0), 80 m_lastPaintBlockWidth(0),
80 m_updateTimer(0), 81 m_updateTimer(0),
81 m_candidateFillStartFrame(0), 82 m_candidateFillStartFrame(0),
82 m_exiting(false), 83 m_exiting(false),
83 m_sliceableModel(0) 84 m_sliceableModel(0)
3029 extents.push_back(vertical); 3030 extents.push_back(vertical);
3030 3031
3031 QRect horizontal(0, cursorPos.y(), cursorPos.x(), 1); 3032 QRect horizontal(0, cursorPos.y(), cursorPos.x(), 1);
3032 extents.push_back(horizontal); 3033 extents.push_back(horizontal);
3033 3034
3034 int sw = getVerticalScaleWidth(v, false, paint);//!!! 3035 int sw = getVerticalScaleWidth(v, m_haveDetailedScale, paint);
3035 3036
3036 QRect freq(sw, cursorPos.y() - paint.fontMetrics().ascent() - 2, 3037 QRect freq(sw, cursorPos.y() - paint.fontMetrics().ascent() - 2,
3037 paint.fontMetrics().width("123456 Hz") + 2, 3038 paint.fontMetrics().width("123456 Hz") + 2,
3038 paint.fontMetrics().height()); 3039 paint.fontMetrics().height());
3039 extents.push_back(freq); 3040 extents.push_back(freq);
3063 SpectrogramLayer::paintCrosshairs(View *v, QPainter &paint, 3064 SpectrogramLayer::paintCrosshairs(View *v, QPainter &paint,
3064 QPoint cursorPos) const 3065 QPoint cursorPos) const
3065 { 3066 {
3066 paint.save(); 3067 paint.save();
3067 3068
3068 int sw = getVerticalScaleWidth(v, false, paint); //!!! 3069 int sw = getVerticalScaleWidth(v, m_haveDetailedScale, paint);
3069 3070
3070 QFont fn = paint.font(); 3071 QFont fn = paint.font();
3071 if (fn.pointSize() > 8) { 3072 if (fn.pointSize() > 8) {
3072 fn.setPointSize(fn.pointSize() - 1); 3073 fn.setPointSize(fn.pointSize() - 1);
3073 paint.setFont(fn); 3074 paint.setFont(fn);
3485 3486
3486 ppy = py; 3487 ppy = py;
3487 py = y; 3488 py = y;
3488 } 3489 }
3489 } 3490 }
3491
3492 m_haveDetailedScale = detailed;
3490 } 3493 }
3491 3494
3492 class SpectrogramRangeMapper : public RangeMapper 3495 class SpectrogramRangeMapper : public RangeMapper
3493 { 3496 {
3494 public: 3497 public: