Mercurial > hg > svgui
changeset 1239:a496986aa61b
Fix #1792 measure tool crosshairs rendered in wrong colour. Also extend crosshairs over the no-man's-land at the left
author | Chris Cannam |
---|---|
date | Tue, 21 Feb 2017 11:12:07 +0000 |
parents | 4d0ca1ab4cd0 |
children | c2e923aa4015 |
files | layer/SpectrogramLayer.cpp layer/SpectrogramLayer.h view/Pane.cpp |
diffstat | 3 files changed, 38 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Tue Feb 07 14:55:19 2017 +0000 +++ b/layer/SpectrogramLayer.cpp Tue Feb 21 11:12:07 2017 +0000 @@ -1516,6 +1516,9 @@ smoothing == Preferences::SpectrogramZeroPaddedAndInterpolated); m_renderers[viewId] = new Colour3DPlotRenderer(sources, params); + + m_crosshairColour = + ColourMapper(m_colourMap, 1.f, 255.f).getContrastingColour(); } return m_renderers[viewId];
--- a/layer/SpectrogramLayer.h Tue Feb 07 14:55:19 2017 +0000 +++ b/layer/SpectrogramLayer.h Tue Feb 21 11:12:07 2017 +0000 @@ -258,7 +258,7 @@ ColourScaleType m_colourScale; double m_colourScaleMultiple; int m_colourMap; - QColor m_crosshairColour; + mutable QColor m_crosshairColour; BinScale m_binScale; BinDisplay m_binDisplay; ColumnNormalization m_normalization; // of individual columns
--- a/view/Pane.cpp Tue Feb 07 14:55:19 2017 +0000 +++ b/view/Pane.cpp Tue Feb 21 11:12:07 2017 +0000 @@ -428,25 +428,8 @@ ViewManager::ToolMode toolMode = ViewManager::NavigateMode; if (m_manager) toolMode = m_manager->getToolModeFor(this); - if (m_manager && - m_mouseInWidget && - toolMode == ViewManager::MeasureMode) { - - for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { - --vi; - - std::vector<QRect> crosshairExtents; - - if ((*vi)->getCrosshairExtents(this, paint, m_identifyPoint, - crosshairExtents)) { - (*vi)->paintCrosshairs(this, paint, m_identifyPoint); - break; - } else if ((*vi)->isLayerOpaque()) { - break; - } - } - } - + // Locate some relevant layers and models + Layer *topLayer = getTopLayer(); bool haveSomeTimeXAxis = false; @@ -473,16 +456,43 @@ if (waveformModel && workModel && haveSomeTimeXAxis) break; } - m_scaleWidth = 0; - + // Block off left and right extents so we can see where the main model ends + if (workModel && hasTopLayerTimeXAxis()) { drawModelTimeExtents(r, paint, workModel); } + // Crosshairs for mouse movement in measure mode + + if (m_manager && + m_mouseInWidget && + toolMode == ViewManager::MeasureMode) { + + for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { + --vi; + + std::vector<QRect> crosshairExtents; + + if ((*vi)->getCrosshairExtents(this, paint, m_identifyPoint, + crosshairExtents)) { + (*vi)->paintCrosshairs(this, paint, m_identifyPoint); + break; + } else if ((*vi)->isLayerOpaque()) { + break; + } + } + } + + // Scale width will be set implicitly during drawVerticalScale call + m_scaleWidth = 0; + if (m_manager && m_manager->shouldShowVerticalScale() && topLayer) { drawVerticalScale(r, topLayer, paint); } + // Feature description: the box in top-right showing values from + // the nearest feature to the mouse + if (m_identifyFeatures && m_manager && m_manager->shouldIlluminateLocalFeatures() && topLayer) { @@ -527,6 +537,9 @@ drawLayerNames(r, paint); } + // The blue box that is shown when you ctrl-click in navigate mode + // to define a zoom region + if (m_shiftPressed && m_clickedInRange && (toolMode == ViewManager::NavigateMode || m_navigating)) {