#include "bit_container.h" #include "cli/cmd.h" #include "common/widgets/menuitem_fileopen.h" #include "core/cli/cli.h" #include "core/plugin.h" #include "explorer/explorer.h" #include "logger.h" #include "bitview.h" #include "explorer/explorer.h" #include #include class BitViewAppPlugin : public satdump::Plugin { public: std::string getID() { return "bitview_app"; } void init() { // TODOREWORK maybe a way to call up/init a handler? satdump::eventBus->register_handler(renderExplorerLoaderButton); satdump::eventBus->register_handler(registerCliCommands); } static void registerCliCommands(const satdump::cli::RegisterSubcommandEvent &evt) { if (evt.is_gui) evt.cmd_handlers.push_back(std::make_shared()); } static satdump::widget::MenuItemFileOpen fopen_menu; static void renderExplorerLoaderButton(const satdump::explorer::RenderLoadMenuElementsEvent &evt) { if (ImGui::BeginMenu("Add")) { if (ImGui::BeginMenu("Tools")) { fopen_menu.render("BitView", "Open binary file", "", {{"All Files", "*"}}); ImGui::EndMenu(); } ImGui::EndMenu(); } if (fopen_menu.update()) evt.master_handler->addSubHandler(std::make_shared(std::make_shared( // std::filesystem::path(fopen_menu.getPath()).stem().string() + std::filesystem::path(fopen_menu.getPath()).extension().string(), // fopen_menu.getPath()))); } }; satdump::widget::MenuItemFileOpen BitViewAppPlugin::fopen_menu; PLUGIN_LOADER(BitViewAppPlugin)