diff --git a/plugins/channelrx/demodam/amdemodgui.cpp b/plugins/channelrx/demodam/amdemodgui.cpp index 654a5cc65..e93317d08 100644 --- a/plugins/channelrx/demodam/amdemodgui.cpp +++ b/plugins/channelrx/demodam/amdemodgui.cpp @@ -240,7 +240,8 @@ void AMDemodGUI::onMenuDialogCalled(const QPoint &p) dialog.exec(); m_settings.m_streamIndex = dialog.getSelectedStreamIndex(); - m_channelMarker.setStreamIndex(m_settings.m_streamIndex); + m_channelMarker.clearStreamIndexes(); + m_channelMarker.addStreamIndex(m_settings.m_streamIndex); displayStreamIndex(); applySettings(); } diff --git a/sdrbase/dsp/channelmarker.cpp b/sdrbase/dsp/channelmarker.cpp index b106471b5..0b95800a0 100644 --- a/sdrbase/dsp/channelmarker.cpp +++ b/sdrbase/dsp/channelmarker.cpp @@ -1,3 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2015-2019 Edouard Griffiths, F4EXB // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// (at your option) any later version. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// + #include "dsp/channelmarker.h" #include "util/simpleserializer.h" @@ -39,7 +56,7 @@ ChannelMarker::ChannelMarker(QObject* parent) : m_movable(true), m_fScaleDisplayType(FScaleDisplay_freq), m_sourceOrSinkStream(true), - m_streamIndex(0) + m_enabledStreamsBits(1) { ++m_nextColor; if(m_colorTable[m_nextColor] == 0) @@ -178,3 +195,17 @@ bool ChannelMarker::deserialize(const QByteArray& data) } } +void ChannelMarker::addStreamIndex(int streamIndex) +{ + m_enabledStreamsBits |= (1<. // +/////////////////////////////////////////////////////////////////////////////////// + #ifndef INCLUDE_CHANNELMARKER_H #define INCLUDE_CHANNELMARKER_H @@ -74,8 +91,13 @@ public: void setSourceOrSinkStream(bool sourceOrSinkStream) { m_sourceOrSinkStream = sourceOrSinkStream; } bool getSourceOrSinkStream() const { return m_sourceOrSinkStream; } - void setStreamIndex(int streamIndex) { m_streamIndex = streamIndex; } - int getStreamIndex() const { return m_streamIndex; } + void addStreamIndex(int streamIndex); + void removeStreamIndex(int streamIndex); + void clearStreamIndexes(); + + bool streamIndexApplies(int streamIndex) const { + return m_enabledStreamsBits & (1<m_channelMarker->getVisible() && (dv->m_channelMarker->getSourceOrSinkStream() == m_displaySourceOrSink) - && (dv->m_channelMarker->getStreamIndex() == m_displayStreamIndex)) + && dv->m_channelMarker->streamIndexApplies(m_displayStreamIndex)) { { GLfloat q3[] { @@ -733,7 +733,7 @@ void GLSpectrum::paintGL() if (dv->m_channelMarker->getVisible() && (dv->m_channelMarker->getSourceOrSinkStream() == m_displaySourceOrSink) - && (dv->m_channelMarker->getStreamIndex() == m_displayStreamIndex)) + && dv->m_channelMarker->streamIndexApplies(m_displayStreamIndex)) { { GLfloat q3[] { @@ -826,7 +826,7 @@ void GLSpectrum::paintGL() // frequency scale channel overlay if (dv->m_channelMarker->getVisible() && (dv->m_channelMarker->getSourceOrSinkStream() == m_displaySourceOrSink) - && (dv->m_channelMarker->getStreamIndex() == m_displayStreamIndex)) + && dv->m_channelMarker->streamIndexApplies(m_displayStreamIndex)) { { GLfloat q3[] { @@ -1550,7 +1550,7 @@ void GLSpectrum::applyChanges() if (dv->m_channelMarker->getHighlighted() && (dv->m_channelMarker->getSourceOrSinkStream() == m_displaySourceOrSink) - && (dv->m_channelMarker->getStreamIndex() == m_displayStreamIndex)) + && dv->m_channelMarker->streamIndexApplies(m_displayStreamIndex)) { qreal xc; int shift; @@ -1698,7 +1698,7 @@ void GLSpectrum::mouseMoveEvent(QMouseEvent* event) if (m_channelMarkerStates[m_cursorChannel]->m_channelMarker->getMovable() && (m_channelMarkerStates[m_cursorChannel]->m_channelMarker->getSourceOrSinkStream() == m_displaySourceOrSink) - && (m_channelMarkerStates[m_cursorChannel]->m_channelMarker->getStreamIndex() == m_displayStreamIndex)) + && m_channelMarkerStates[m_cursorChannel]->m_channelMarker->streamIndexApplies(m_displayStreamIndex)) { m_channelMarkerStates[m_cursorChannel]->m_channelMarker->setCenterFrequencyByCursor(freq); channelMarkerChanged(); @@ -1710,7 +1710,7 @@ void GLSpectrum::mouseMoveEvent(QMouseEvent* event) for (int i = 0; i < m_channelMarkerStates.size(); ++i) { if ((m_channelMarkerStates[i]->m_channelMarker->getSourceOrSinkStream() != m_displaySourceOrSink) - || (m_channelMarkerStates[i]->m_channelMarker->getStreamIndex() != m_displayStreamIndex)) + || !m_channelMarkerStates[i]->m_channelMarker->streamIndexApplies(m_displayStreamIndex)) { continue; } @@ -1776,7 +1776,7 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event) if (m_channelMarkerStates[m_cursorChannel]->m_channelMarker->getMovable() && (m_channelMarkerStates[m_cursorChannel]->m_channelMarker->getSourceOrSinkStream() == m_displaySourceOrSink) - && (m_channelMarkerStates[m_cursorChannel]->m_channelMarker->getStreamIndex() == m_displayStreamIndex)) + && m_channelMarkerStates[m_cursorChannel]->m_channelMarker->streamIndexApplies(m_displayStreamIndex)) { m_channelMarkerStates[m_cursorChannel]->m_channelMarker->setCenterFrequencyByCursor(freq); channelMarkerChanged(); @@ -1812,7 +1812,7 @@ void GLSpectrum::wheelEvent(QWheelEvent *event) for (int i = 0; i < m_channelMarkerStates.size(); ++i) { if ((m_channelMarkerStates[i]->m_channelMarker->getSourceOrSinkStream() != m_displaySourceOrSink) - || (m_channelMarkerStates[i]->m_channelMarker->getStreamIndex() != m_displayStreamIndex)) + || !m_channelMarkerStates[i]->m_channelMarker->streamIndexApplies(m_displayStreamIndex)) { continue; }