Spectrum markers: Allow all to be displayed

This commit is contained in:
Jon Beniston 2022-06-24 16:44:44 +01:00
parent 82849f80b4
commit 73487e8ef9
4 changed files with 56 additions and 32 deletions

View File

@ -161,7 +161,8 @@ struct SDRBASE_API SpectrumAnnotationMarker
{ {
Hidden, Hidden,
ShowTop, ShowTop,
ShowFull ShowFull,
ShowText
}; };
qint64 m_startFrequency; qint64 m_startFrequency;

View File

@ -39,11 +39,13 @@ public:
AvgModeMax AvgModeMax
}; };
// Bitmask for which selection of markers to display
enum MarkersDisplay enum MarkersDisplay
{ {
MarkersDisplayNone, MarkersDisplayNone = 0,
MarkersDisplaySpectrum, MarkersDisplaySpectrum = 0x1,
MarkersDisplayAnnotations MarkersDisplayAnnotations = 0x2,
MarkersDisplayAll = 0x3
}; };
enum CalibrationInterpolationMode enum CalibrationInterpolationMode

View File

@ -1379,9 +1379,10 @@ void GLSpectrum::paintGL()
} }
} }
if (m_markersDisplay == SpectrumSettings::MarkersDisplaySpectrum) { if (m_markersDisplay & SpectrumSettings::MarkersDisplaySpectrum) {
drawSpectrumMarkers(); drawSpectrumMarkers();
} else if (m_markersDisplay == SpectrumSettings::MarkersDisplayAnnotations) { }
if (m_markersDisplay & SpectrumSettings::MarkersDisplayAnnotations) {
drawAnnotationMarkers(); drawAnnotationMarkers();
} }
@ -1908,28 +1909,27 @@ void GLSpectrum::drawAnnotationMarkers()
m_glShaderSimple.drawSurface(m_glHistogramBoxMatrix, color, q3, 4); m_glShaderSimple.drawSurface(m_glHistogramBoxMatrix, color, q3, 4);
} }
if (marker->m_show == SpectrumAnnotationMarker::ShowFull) // Always draw a line in the top area, so we can see where bands start/stop when contiguous
// When show is ShowFull, we draw at full height of spectrum
bool full = marker->m_show == SpectrumAnnotationMarker::ShowFull;
GLfloat d1[] {
marker->m_startPos, full ? 0 : htop,
marker->m_startPos, full ? 1 : h,
};
m_glShaderSimple.drawSegments(m_glHistogramBoxMatrix, color, d1, 2);
if (marker->m_bandwidth != 0)
{ {
QVector4D color( GLfloat d2[] {
marker->m_markerColor.redF(), marker->m_stopPos, full ? 0 : htop,
marker->m_markerColor.greenF(), marker->m_stopPos, full ? 1 : h,
marker->m_markerColor.blueF(), 0.5f
);
GLfloat d1[] {
marker->m_startPos, 0,
marker->m_startPos, 1,
}; };
m_glShaderSimple.drawSegments(m_glHistogramBoxMatrix, color, d1, 2); m_glShaderSimple.drawSegments(m_glHistogramBoxMatrix, color, d2, 2);
}
if (marker->m_bandwidth != 0)
{
GLfloat d2[] {
marker->m_stopPos, 0,
marker->m_stopPos, 1,
};
m_glShaderSimple.drawSegments(m_glHistogramBoxMatrix, color, d2, 2);
}
if ((marker->m_show == SpectrumAnnotationMarker::ShowFull) || (marker->m_show == SpectrumAnnotationMarker::ShowText))
{
float txtpos = marker->m_startPos < 0.5f ? float txtpos = marker->m_startPos < 0.5f ?
marker->m_startPos : marker->m_startPos :
marker->m_stopPos; marker->m_stopPos;
@ -2822,7 +2822,7 @@ void GLSpectrum::updateWaterfallMarkers()
void GLSpectrum::updateAnnotationMarkers() void GLSpectrum::updateAnnotationMarkers()
{ {
if (m_markersDisplay != SpectrumSettings::MarkersDisplayAnnotations) { if (!(m_markersDisplay & SpectrumSettings::MarkersDisplayAnnotations)) {
return; return;
} }
@ -2838,7 +2838,7 @@ void GLSpectrum::updateAnnotationMarkers()
void GLSpectrum::updateSortedAnnotationMarkers() void GLSpectrum::updateSortedAnnotationMarkers()
{ {
if (m_markersDisplay != SpectrumSettings::MarkersDisplayAnnotations) { if (!(m_markersDisplay & SpectrumSettings::MarkersDisplayAnnotations)) {
return; return;
} }
@ -2862,7 +2862,7 @@ void GLSpectrum::updateSortedAnnotationMarkers()
void GLSpectrum::updateMarkersDisplay() void GLSpectrum::updateMarkersDisplay()
{ {
if (m_markersDisplay == SpectrumSettings::MarkersDisplayAnnotations) { if (m_markersDisplay & SpectrumSettings::MarkersDisplayAnnotations) {
updateAnnotationMarkers(); updateAnnotationMarkers();
} }
} }
@ -3275,7 +3275,7 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
} }
} }
if ((m_markersDisplay == SpectrumSettings::MarkersDisplayAnnotations) && if ((m_markersDisplay & SpectrumSettings::MarkersDisplayAnnotations) &&
(ep.y() <= m_histogramRect.top()*height() + m_annotationMarkerHeight + 2.0f)) (ep.y() <= m_histogramRect.top()*height() + m_annotationMarkerHeight + 2.0f))
{ {
QPointF pHis; QPointF pHis;
@ -3294,8 +3294,18 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
if (((*iMarker)->m_startFrequency < selectedFrequency) && (selectedFrequency <= stopFrequency) && !selected) if (((*iMarker)->m_startFrequency < selectedFrequency) && (selectedFrequency <= stopFrequency) && !selected)
{ {
(*iMarker)->m_show = (*iMarker)->m_show == SpectrumAnnotationMarker::ShowFull ? switch ((*iMarker)->m_show)
SpectrumAnnotationMarker::ShowTop : SpectrumAnnotationMarker::ShowFull; {
case SpectrumAnnotationMarker::ShowTop:
(*iMarker)->m_show = SpectrumAnnotationMarker::ShowText;
break;
case SpectrumAnnotationMarker::ShowText:
(*iMarker)->m_show = SpectrumAnnotationMarker::ShowFull;
break;
case SpectrumAnnotationMarker::ShowFull:
(*iMarker)->m_show = SpectrumAnnotationMarker::ShowTop;
break;
}
selected = true; selected = true;
} }
} }

View File

@ -1673,6 +1673,11 @@ Max - Marker will move according to the maximum power at the marker frequency</s
<string>Full</string> <string>Full</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Text</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item> <item>
@ -1730,7 +1735,8 @@ Max - Marker will move according to the maximum power at the marker frequency</s
None - Hide all markers None - Hide all markers
Spec - Show histogram and waterfall markers Spec - Show histogram and waterfall markers
Anno - Show annotation markers</string> Anno - Show annotation markers
All - Show all markers</string>
</property> </property>
<item> <item>
<property name="text"> <property name="text">
@ -1747,6 +1753,11 @@ Anno - Show annotation markers</string>
<string>Anno</string> <string>Anno</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>All</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item> <item>