#include #include #include #include #include #include namespace displaymenu { bool showWaterfall; bool fastFFT = true; int colorMapId = 0; std::vector colorMapNames; std::string colorMapNamesTxt = ""; std::string colorMapAuthor = ""; void init() { showWaterfall = core::configManager.conf["showWaterfall"]; showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall(); 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; } } } void draw(void* ctx) { float menuWidth = ImGui::GetContentRegionAvailWidth(); 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); } 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()); } if (ImGui::Checkbox("Fast FFT", &fastFFT)) { gui::waterfall.setFastFFT(fastFFT); } } }