Mercurial > hg > svgui
changeset 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 | a31c8ee2e17e |
children | a352fb986e7b d50f91fe374e |
files | layer/TimeValueLayer.cpp view/View.h view/ViewManager.cpp view/ViewManager.h |
diffstat | 4 files changed, 40 insertions(+), 30 deletions(-) [+] |
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; }
--- 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; }
--- 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 =
--- 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; }