2020-09-25 14:25:36 +02:00
|
|
|
#include <gui/menus/source.h>
|
2020-10-01 01:21:15 +02:00
|
|
|
#include <imgui.h>
|
|
|
|
#include <gui/gui.h>
|
|
|
|
#include <core.h>
|
|
|
|
#include <signal_path/signal_path.h>
|
2020-09-25 14:25:36 +02:00
|
|
|
|
|
|
|
namespace sourecmenu {
|
2020-10-01 01:21:15 +02:00
|
|
|
int sourceId = 0;
|
2020-09-25 14:25:36 +02:00
|
|
|
|
2020-10-01 01:21:15 +02:00
|
|
|
void init() {
|
|
|
|
// Select default
|
|
|
|
// TODO: Replace by setting
|
|
|
|
if (sigpath::sourceManager.sourceNames.size() > 0) {
|
|
|
|
sigpath::sourceManager.selectSource(sigpath::sourceManager.sourceNames[0]);
|
|
|
|
}
|
2020-09-25 14:25:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void draw(void* ctx) {
|
2020-10-01 01:21:15 +02:00
|
|
|
std::string items = "";
|
|
|
|
for (std::string name : sigpath::sourceManager.sourceNames) {
|
|
|
|
items += name;
|
|
|
|
items += '\0';
|
|
|
|
}
|
|
|
|
float itemWidth = ImGui::GetContentRegionAvailWidth();
|
2020-09-25 14:25:36 +02:00
|
|
|
|
2020-10-01 01:21:15 +02:00
|
|
|
ImGui::SetNextItemWidth(itemWidth);
|
|
|
|
if (ImGui::Combo("##source", &sourceId, items.c_str())) {
|
|
|
|
sigpath::sourceManager.selectSource(sigpath::sourceManager.sourceNames[sourceId]);
|
|
|
|
}
|
|
|
|
|
|
|
|
sigpath::sourceManager.showSelectedMenu();
|
2020-09-25 14:25:36 +02:00
|
|
|
}
|
|
|
|
}
|