Mercurial > hg > svgui
diff layer/TimeValueLayer.cpp @ 741:56ba2b03508e tonioni
Introduce a GlobalOverlays mode that shows general surrounding information but less local stuff
author | Chris Cannam |
---|---|
date | Thu, 06 Mar 2014 15:16:25 +0000 |
parents | 1640a7c753cc |
children | b6dc57688c72 |
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp Thu Mar 06 14:27:59 2014 +0000 +++ b/layer/TimeValueLayer.cpp Thu Mar 06 15:16:25 2014 +0000 @@ -1170,34 +1170,37 @@ paint.drawRect(x, -1, nx - x, v->height() + 1); } - QString label = p.label; - bool italic = false; + if (v->shouldShowFeatureLabels()) { - if (label == "" && - (m_plotStyle == PlotPoints || - m_plotStyle == PlotSegmentation || - m_plotStyle == PlotConnectedPoints)) { - char lc[20]; - snprintf(lc, 20, "%.3g", p.value); - label = lc; - italic = true; + QString label = p.label; + bool italic = false; + + if (label == "" && + (m_plotStyle == PlotPoints || + m_plotStyle == PlotSegmentation || + m_plotStyle == PlotConnectedPoints)) { + char lc[20]; + snprintf(lc, 20, "%.3g", p.value); + label = lc; + italic = true; + } + + if (label != "") { + // Quick test for 20px before we do the slower test using metrics + bool haveRoom = (nx > x + 20); + haveRoom = (haveRoom && + (nx > x + 6 + paint.fontMetrics().width(label))); + if (haveRoom || + (!haveNext && + (pointCount == 0 || !italic))) { + v->drawVisibleText(paint, x + 5, textY, label, + italic ? + View::OutlinedItalicText : + View::OutlinedText); + } + } } - if (label != "") { - // Quick test for 20px before we do the slower test using metrics - bool haveRoom = (nx > x + 20); - haveRoom = (haveRoom && - (nx > x + 6 + paint.fontMetrics().width(label))); - if (haveRoom || - (!haveNext && - (pointCount == 0 || !italic))) { - v->drawVisibleText(paint, x + 5, textY, label, - italic ? - View::OutlinedItalicText : - View::OutlinedText); - } - } - prevFrame = p.frame; ++pointCount; }