2020-09-25 14:25:36 +02:00
|
|
|
#include <gui/menus/display.h>
|
|
|
|
#include <imgui.h>
|
|
|
|
#include <gui/gui.h>
|
|
|
|
#include <core.h>
|
2020-12-31 14:26:12 +01:00
|
|
|
#include <gui/colormaps.h>
|
|
|
|
#include <gui/gui.h>
|
2020-09-25 14:25:36 +02:00
|
|
|
|
|
|
|
namespace displaymenu {
|
|
|
|
bool showWaterfall;
|
2021-04-12 23:02:45 +02:00
|
|
|
bool fastFFT = true;
|
2021-04-13 04:54:47 +02:00
|
|
|
bool fullWaterfallUpdate = true;
|
2020-12-31 14:26:12 +01:00
|
|
|
int colorMapId = 0;
|
|
|
|
std::vector<std::string> colorMapNames;
|
|
|
|
std::string colorMapNamesTxt = "";
|
|
|
|
std::string colorMapAuthor = "";
|
2020-09-25 14:25:36 +02:00
|
|
|
|
|
|
|
void init() {
|
|
|
|
showWaterfall = core::configManager.conf["showWaterfall"];
|
|
|
|
showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall();
|
2020-12-31 14:26:12 +01:00
|
|
|
std::string colormapName = core::configManager.conf["colorMap"];
|
|
|
|
if (colormaps::maps.find(colormapName) != colormaps::maps.end()) {
|
|
|
|
colormaps::Map map = colormaps::maps[colormapName];
|
|
|
|
gui::waterfall.updatePalletteFromArray(map.map, map.entryCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto const& [name, map] : colormaps::maps) {
|
|
|
|
colorMapNames.push_back(name);
|
|
|
|
colorMapNamesTxt += name;
|
|
|
|
colorMapNamesTxt += '\0';
|
|
|
|
if (name == colormapName) {
|
|
|
|
colorMapId = (colorMapNames.size() - 1);
|
|
|
|
colorMapAuthor = map.author;
|
|
|
|
}
|
|
|
|
}
|
2021-04-13 04:54:47 +02:00
|
|
|
|
|
|
|
fastFFT = core::configManager.conf["fastFFT"];
|
|
|
|
gui::waterfall.setFastFFT(fastFFT);
|
|
|
|
|
|
|
|
fullWaterfallUpdate = core::configManager.conf["fullWaterfallUpdate"];
|
|
|
|
gui::waterfall.setFullWaterfallUpdate(fullWaterfallUpdate);
|
2020-09-25 14:25:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void draw(void* ctx) {
|
2020-12-31 14:26:12 +01:00
|
|
|
float menuWidth = ImGui::GetContentRegionAvailWidth();
|
2020-09-25 14:25:36 +02:00
|
|
|
if (ImGui::Checkbox("Show Waterfall", &showWaterfall)) {
|
|
|
|
showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall();
|
|
|
|
core::configManager.aquire();
|
|
|
|
core::configManager.conf["showWaterfall"] = showWaterfall;
|
|
|
|
core::configManager.release(true);
|
|
|
|
}
|
2020-12-31 14:26:12 +01:00
|
|
|
|
|
|
|
if (colorMapNames.size() > 0) {
|
|
|
|
ImGui::Text("Color Map");
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
|
|
|
if (ImGui::Combo("##_sdrpp_color_map_sel", &colorMapId, colorMapNamesTxt.c_str())) {
|
|
|
|
colormaps::Map map = colormaps::maps[colorMapNames[colorMapId]];
|
|
|
|
gui::waterfall.updatePalletteFromArray(map.map, map.entryCount);
|
|
|
|
core::configManager.aquire();
|
|
|
|
core::configManager.conf["colorMap"] = colorMapNames[colorMapId];
|
|
|
|
core::configManager.release(true);
|
|
|
|
colorMapAuthor = map.author;
|
|
|
|
}
|
|
|
|
ImGui::Text("Color map Author: %s", colorMapAuthor.c_str());
|
|
|
|
}
|
2021-04-12 23:02:45 +02:00
|
|
|
|
|
|
|
if (ImGui::Checkbox("Fast FFT", &fastFFT)) {
|
|
|
|
gui::waterfall.setFastFFT(fastFFT);
|
2021-04-13 04:54:47 +02:00
|
|
|
core::configManager.aquire();
|
|
|
|
core::configManager.conf["fastFFT"] = fastFFT;
|
|
|
|
core::configManager.release(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ImGui::Checkbox("Full Waterfall Update", &fullWaterfallUpdate)) {
|
|
|
|
gui::waterfall.setFullWaterfallUpdate(fullWaterfallUpdate);
|
|
|
|
core::configManager.aquire();
|
|
|
|
core::configManager.conf["fullWaterfallUpdate"] = fullWaterfallUpdate;
|
|
|
|
core::configManager.release(true);
|
2021-04-12 23:02:45 +02:00
|
|
|
}
|
2020-09-25 14:25:36 +02:00
|
|
|
}
|
|
|
|
}
|