mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-28 21:37:50 +02:00
new scripting system
This commit is contained in:
@ -59,6 +59,7 @@ void windowInit() {
|
||||
|
||||
gui::menu.registerEntry("Source", sourecmenu::draw, NULL);
|
||||
gui::menu.registerEntry("Audio", audiomenu::draw, NULL);
|
||||
gui::menu.registerEntry("Scripting", scriptingmenu::draw, NULL);
|
||||
gui::menu.registerEntry("Band Plan", bandplanmenu::draw, NULL);
|
||||
gui::menu.registerEntry("Display", displaymenu::draw, NULL);
|
||||
|
||||
@ -76,6 +77,7 @@ void windowInit() {
|
||||
|
||||
sourecmenu::init();
|
||||
audiomenu::init();
|
||||
scriptingmenu::init();
|
||||
bandplanmenu::init();
|
||||
displaymenu::init();
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <gui/menus/display.h>
|
||||
#include <gui/menus/bandplan.h>
|
||||
#include <gui/menus/audio.h>
|
||||
#include <gui/menus/scripting.h>
|
||||
#include <gui/dialogs/credits.h>
|
||||
#include <signal_path/source.h>
|
||||
|
||||
|
21
core/src/gui/menus/scripting.cpp
Normal file
21
core/src/gui/menus/scripting.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include <gui/menus/scripting.h>
|
||||
#include <core.h>
|
||||
#include <gui/style.h>
|
||||
|
||||
namespace scriptingmenu {
|
||||
void init() {
|
||||
|
||||
}
|
||||
|
||||
void draw(void* ctx) {
|
||||
float menuWidth = ImGui::GetContentRegionAvailWidth();
|
||||
for (const auto& [name, script] : core::scriptManager.scripts) {
|
||||
bool running = script->running;
|
||||
if (running) { style::beginDisabled(); }
|
||||
if (ImGui::Button(name.c_str(), ImVec2(menuWidth, 0))) {
|
||||
script->run();
|
||||
}
|
||||
if (running) { style::endDisabled(); }
|
||||
}
|
||||
}
|
||||
}
|
6
core/src/gui/menus/scripting.h
Normal file
6
core/src/gui/menus/scripting.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace scriptingmenu {
|
||||
void init();
|
||||
void draw(void* ctx);
|
||||
}
|
Reference in New Issue
Block a user