mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-08-11 18:41:45 +02:00
Added VFO coloring option
This commit is contained in:
@@ -73,6 +73,14 @@ double VFOManager::VFO::getBandwidth() {
|
||||
return wtfVFO->bandwidth;
|
||||
}
|
||||
|
||||
void VFOManager::VFO::setColor(ImU32 color) {
|
||||
wtfVFO->color = color;
|
||||
}
|
||||
|
||||
std::string VFOManager::VFO::getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
VFOManager::VFOManager() {
|
||||
|
||||
}
|
||||
@@ -83,6 +91,7 @@ VFOManager::VFO* VFOManager::createVFO(std::string name, int reference, double o
|
||||
}
|
||||
VFOManager::VFO* vfo = new VFO(name, reference, offset, bandwidth, sampleRate, minBandwidth, maxBandwidth, bandwidthLocked);
|
||||
vfos[name] = vfo;
|
||||
vfoCreatedEvent.emit(vfo);
|
||||
return vfo;
|
||||
}
|
||||
|
||||
@@ -97,6 +106,7 @@ void VFOManager::deleteVFO(VFOManager::VFO* vfo) {
|
||||
if (name == "") {
|
||||
return;
|
||||
}
|
||||
vfoDeletedEvent.emit(vfo);
|
||||
vfos.erase(name);
|
||||
delete vfo;
|
||||
}
|
||||
@@ -164,6 +174,17 @@ double VFOManager::getBandwidth(std::string name) {
|
||||
return vfos[name]->getBandwidth();
|
||||
}
|
||||
|
||||
void VFOManager::setColor(std::string name, ImU32 color) {
|
||||
if (vfos.find(name) == vfos.end()) {
|
||||
return;
|
||||
}
|
||||
return vfos[name]->setColor(color);
|
||||
}
|
||||
|
||||
bool VFOManager::vfoExists(std::string name) {
|
||||
return (vfos.find(name) != vfos.end());
|
||||
}
|
||||
|
||||
void VFOManager::updateFromWaterfall(ImGui::WaterFall* wtf) {
|
||||
for (auto const& [name, vfo] : vfos) {
|
||||
if (vfo->wtfVFO->centerOffsetChanged) {
|
||||
@@ -171,4 +192,4 @@ void VFOManager::updateFromWaterfall(ImGui::WaterFall* wtf) {
|
||||
vfo->dspVFO->setOffset(vfo->wtfVFO->centerOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,6 +2,7 @@
|
||||
#include <dsp/vfo.h>
|
||||
#include <gui/widgets/waterfall.h>
|
||||
#include <gui/gui.h>
|
||||
#include <utils/event.h>
|
||||
|
||||
class VFOManager {
|
||||
public:
|
||||
@@ -22,6 +23,8 @@ public:
|
||||
void setBandwidthLimits(double minBandwidth, double maxBandwidth, bool bandwidthLocked);
|
||||
bool getBandwidthChanged(bool erase = true);
|
||||
double getBandwidth();
|
||||
void setColor(ImU32 color);
|
||||
std::string getName();
|
||||
|
||||
dsp::stream<dsp::complex_t>* output;
|
||||
|
||||
@@ -46,9 +49,15 @@ public:
|
||||
void setBandwidthLimits(std::string name, double minBandwidth, double maxBandwidth, bool bandwidthLocked);
|
||||
bool getBandwidthChanged(std::string name, bool erase = true);
|
||||
double getBandwidth(std::string name);
|
||||
void setColor(std::string name, ImU32 color);
|
||||
std::string getName();
|
||||
bool vfoExists(std::string name);
|
||||
|
||||
void updateFromWaterfall(ImGui::WaterFall* wtf);
|
||||
|
||||
Event<VFOManager::VFO*> vfoCreatedEvent;
|
||||
Event<VFOManager::VFO*> vfoDeletedEvent;
|
||||
|
||||
private:
|
||||
std::map<std::string, VFO*> vfos;
|
||||
};
|
Reference in New Issue
Block a user