# HG changeset patch # User Chris Cannam # Date 1394118985 0 # Node ID 56ba2b03508ecc2f5952a8db978360503845e711 # Parent a31c8ee2e17ed0da98d3dcc2a787579f3acb40fe Introduce a GlobalOverlays mode that shows general surrounding information but less local stuff diff -r a31c8ee2e17e -r 56ba2b03508e layer/TimeValueLayer.cpp --- 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; } diff -r a31c8ee2e17e -r 56ba2b03508e view/View.h --- a/view/View.h Thu Mar 06 14:27:59 2014 +0000 +++ b/view/View.h Thu Mar 06 15:16:25 2014 +0000 @@ -200,6 +200,9 @@ virtual void drawMeasurementRect(QPainter &p, const Layer *, QRect rect, bool focus) const; + virtual bool shouldShowFeatureLabels() const { + return m_manager && m_manager->shouldShowFeatureLabels(); + } virtual bool shouldIlluminateLocalFeatures(const Layer *, QPoint &) const { return false; } diff -r a31c8ee2e17e -r 56ba2b03508e view/ViewManager.cpp --- a/view/ViewManager.cpp Thu Mar 06 14:27:59 2014 +0000 +++ b/view/ViewManager.cpp Thu Mar 06 15:16:25 2014 +0000 @@ -43,7 +43,7 @@ m_playSelectionMode(false), m_playSoloMode(false), m_alignMode(false), - m_overlayMode(MinimalOverlays), + m_overlayMode(StandardOverlays), m_zoomWheelsEnabled(true), m_showCentreLine(true), m_illuminateLocalFeatures(true), @@ -57,9 +57,9 @@ (settings.value("overlay-mode", int(m_overlayMode)).toInt()); if (m_overlayMode != NoOverlays && - m_overlayMode != MinimalOverlays && + m_overlayMode != StandardOverlays && m_overlayMode != AllOverlays) { - m_overlayMode = MinimalOverlays; + m_overlayMode = StandardOverlays; } m_zoomWheelsEnabled = diff -r a31c8ee2e17e -r 56ba2b03508e view/ViewManager.h --- a/view/ViewManager.h Thu Mar 06 14:27:59 2014 +0000 +++ b/view/ViewManager.h Thu Mar 06 15:16:25 2014 +0000 @@ -155,7 +155,8 @@ enum OverlayMode { NoOverlays, - MinimalOverlays, + GlobalOverlays, + StandardOverlays, AllOverlays }; void setOverlayMode(OverlayMode mode); @@ -177,7 +178,7 @@ return m_overlayMode == AllOverlays; } bool shouldShowSelectionExtents() const { - return m_overlayMode != NoOverlays; + return m_overlayMode != NoOverlays && m_overlayMode != GlobalOverlays; } bool shouldShowLayerNames() const { return m_overlayMode == AllOverlays; @@ -191,6 +192,9 @@ bool shouldIlluminateLocalFeatures() const { return m_illuminateLocalFeatures; } + bool shouldShowFeatureLabels() const { + return m_overlayMode != NoOverlays && m_overlayMode != GlobalOverlays; + } void setZoomWheelsEnabled(bool enable); bool getZoomWheelsEnabled() const { return m_zoomWheelsEnabled; }