Allow channel marker to be present in more than one spectrum in MIMO mode

This commit is contained in:
f4exb 2019-09-09 00:58:26 +02:00
parent 836fd6f4e2
commit d1ba318c45
4 changed files with 67 additions and 13 deletions

View File

@ -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();
}

View File

@ -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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#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<<streamIndex);
}
void ChannelMarker::removeStreamIndex(int streamIndex)
{
m_enabledStreamsBits &= ~(1<<streamIndex);
}
void ChannelMarker::clearStreamIndexes()
{
m_enabledStreamsBits = 0;
}

View File

@ -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 <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#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<<streamIndex);
}
virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);
@ -98,7 +120,7 @@ protected:
bool m_movable;
frequencyScaleDisplay_t m_fScaleDisplayType;
bool m_sourceOrSinkStream;
int m_streamIndex;
uint32_t m_enabledStreamsBits;
void resetToDefaults();

View File

@ -642,7 +642,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[] {
@ -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;
}