# HG changeset patch # User Chris Cannam # Date 1183488987 0 # Node ID 47fe0352861e75b3734c6baa29090919cf68a5aa # Parent a078aa2932cc99a76d26931d129e513bf2e15a1d * add pitch label to spectrogram harmonic cursor as well diff -r a078aa2932cc -r 47fe0352861e layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Tue Jul 03 18:47:39 2007 +0000 +++ b/layer/SpectrogramLayer.cpp Tue Jul 03 18:56:27 2007 +0000 @@ -2467,10 +2467,15 @@ int sw = getVerticalScaleWidth(v, paint); QRect label(sw, cursorPos.y() - paint.fontMetrics().ascent() - 2, - paint.fontMetrics().width("123456 Hz") + sw + 2, + paint.fontMetrics().width("123456 Hz") + 2, paint.fontMetrics().height()); extents.push_back(label); + QRect pitch(sw, cursorPos.y() + 2, + paint.fontMetrics().width("C#10+50c") + 2, + paint.fontMetrics().height()); + extents.push_back(pitch); + return true; } @@ -2493,7 +2498,21 @@ QString("%1 Hz").arg(fundamental), View::OutlinedText); - //!!! and pitch label + if (Pitch::isFrequencyInMidiRange(fundamental)) { + QString pitchLabel = Pitch::getPitchLabelForFrequency(fundamental); + v->drawVisibleText(paint, + sw + 2, + cursorPos.y() + paint.fontMetrics().ascent() + 2, + pitchLabel, + View::OutlinedText); + } + + /*!!! + long frame = getFrameForX(cursorPos.x()); + RealTime rt = RealTime::frame2RealTime(frame, m_model->getSampleRate()); + QString timeLabel = rt.toText(true).c_str(); + ... + */ int harmonic = 2; diff -r a078aa2932cc -r 47fe0352861e view/View.cpp --- a/view/View.cpp Tue Jul 03 18:47:39 2007 +0000 +++ b/view/View.cpp Tue Jul 03 18:56:27 2007 +0000 @@ -620,6 +620,19 @@ { if (style == OutlinedText) { + paint.save(); + + QColor penColour, surroundColour; + + if (hasLightBackground()) { + penColour = Qt::black; + surroundColour = Qt::white; + } else { + penColour = Qt::white; + surroundColour = Qt::black; + } + +/* QColor origPenColour = paint.pen().color(); QColor penColour = origPenColour; QColor surroundColour = Qt::white; //palette().background().color(); @@ -630,7 +643,7 @@ penColour = QColor::fromHsv(h, s, 255 - v); surroundColour = Qt::black; } - +*/ paint.setPen(surroundColour); for (int dx = -1; dx <= 1; ++dx) { @@ -643,8 +656,10 @@ paint.setPen(penColour); paint.drawText(x, y, text); - +/* paint.setPen(origPenColour); +*/ + paint.restore(); } else {