1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

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,
ShowTop,
ShowFull
ShowFull,
ShowText
};
qint64 m_startFrequency;

View File

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

View File

@ -1379,9 +1379,10 @@ void GLSpectrum::paintGL()
}
}
if (m_markersDisplay == SpectrumSettings::MarkersDisplaySpectrum) {
if (m_markersDisplay & SpectrumSettings::MarkersDisplaySpectrum) {
drawSpectrumMarkers();
} else if (m_markersDisplay == SpectrumSettings::MarkersDisplayAnnotations) {
}
if (m_markersDisplay & SpectrumSettings::MarkersDisplayAnnotations) {
drawAnnotationMarkers();
}
@ -1908,28 +1909,27 @@ void GLSpectrum::drawAnnotationMarkers()
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(
marker->m_markerColor.redF(),
marker->m_markerColor.greenF(),
marker->m_markerColor.blueF(), 0.5f
);
GLfloat d1[] {
marker->m_startPos, 0,
marker->m_startPos, 1,
GLfloat d2[] {
marker->m_stopPos, full ? 0 : htop,
marker->m_stopPos, full ? 1 : h,
};
m_glShaderSimple.drawSegments(m_glHistogramBoxMatrix, color, d1, 2);
if (marker->m_bandwidth != 0)
{
GLfloat d2[] {
marker->m_stopPos, 0,
marker->m_stopPos, 1,
};
m_glShaderSimple.drawSegments(m_glHistogramBoxMatrix, color, d2, 2);
}
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 ?
marker->m_startPos :
marker->m_stopPos;
@ -2822,7 +2822,7 @@ void GLSpectrum::updateWaterfallMarkers()
void GLSpectrum::updateAnnotationMarkers()
{
if (m_markersDisplay != SpectrumSettings::MarkersDisplayAnnotations) {
if (!(m_markersDisplay & SpectrumSettings::MarkersDisplayAnnotations)) {
return;
}
@ -2838,7 +2838,7 @@ void GLSpectrum::updateAnnotationMarkers()
void GLSpectrum::updateSortedAnnotationMarkers()
{
if (m_markersDisplay != SpectrumSettings::MarkersDisplayAnnotations) {
if (!(m_markersDisplay & SpectrumSettings::MarkersDisplayAnnotations)) {
return;
}
@ -2862,7 +2862,7 @@ void GLSpectrum::updateSortedAnnotationMarkers()
void GLSpectrum::updateMarkersDisplay()
{
if (m_markersDisplay == SpectrumSettings::MarkersDisplayAnnotations) {
if (m_markersDisplay & SpectrumSettings::MarkersDisplayAnnotations) {
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))
{
QPointF pHis;
@ -3294,8 +3294,18 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
if (((*iMarker)->m_startFrequency < selectedFrequency) && (selectedFrequency <= stopFrequency) && !selected)
{
(*iMarker)->m_show = (*iMarker)->m_show == SpectrumAnnotationMarker::ShowFull ?
SpectrumAnnotationMarker::ShowTop : SpectrumAnnotationMarker::ShowFull;
switch ((*iMarker)->m_show)
{
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;
}
}

View File

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