# HG changeset patch # User Chris Cannam # Date 1487675527 0 # Node ID a496986aa61bc96c63338928cf26e29ad773ff61 # Parent 4d0ca1ab4cd0a51538ebe96f391f28163074114a Fix #1792 measure tool crosshairs rendered in wrong colour. Also extend crosshairs over the no-man's-land at the left diff -r 4d0ca1ab4cd0 -r a496986aa61b layer/SpectrogramLayer.cpp --- 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]; diff -r 4d0ca1ab4cd0 -r a496986aa61b layer/SpectrogramLayer.h --- 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 diff -r 4d0ca1ab4cd0 -r a496986aa61b view/Pane.cpp --- 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 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 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)) {