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;
|
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;
|
|
|
|
}
|
|
|
|
}
|
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());
|
|
|
|
}
|
2020-09-25 14:25:36 +02:00
|
|
|
}
|
|
|
|
}
|