5c7a529fa1
* Added imnodes * Added basic data processor view. Still needs to be cleaned up * Make sure all attached links get properly removed when a Node is deleted * Cleanup and API exposing * Added data provider overlays and integrate them with the data processor * Optimized data processing * Node UI enhancements * Added support for all themes to the nodes editor * Improved data processor context menus * Fixed data processor context menu showing up everywhere * Make hex editor context menu behave the same as data processor one * Add different node pin types and prevent incompatible ones from being connected * Don't require explicitly marking node as end node * Fixed plugin copying * Added some more nodes
84 lines
2.7 KiB
C++
84 lines
2.7 KiB
C++
#pragma once
|
|
|
|
#include <any>
|
|
#include <functional>
|
|
#include <list>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
#include <hex/api/content_registry.hpp>
|
|
#include <hex/api/imhex_api.hpp>
|
|
#include <hex/api/event.hpp>
|
|
|
|
#include <imgui.h>
|
|
#include <ImGuiFileBrowser.h>
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
namespace hex { class SharedData; }
|
|
|
|
namespace hex::plugin::internal {
|
|
void initializePlugin(SharedData &sharedData);
|
|
}
|
|
|
|
namespace hex {
|
|
|
|
namespace prv { class Provider; }
|
|
namespace dp { class Node; }
|
|
class View;
|
|
|
|
class SharedData {
|
|
SharedData() = default;
|
|
public:
|
|
SharedData(const SharedData&) = delete;
|
|
SharedData(SharedData&&) = delete;
|
|
|
|
friend class Window;
|
|
|
|
template<typename T>
|
|
static T& getVariable(std::string variableName) {
|
|
return std::any_cast<T&>(SharedData::sharedVariables[variableName]);
|
|
}
|
|
|
|
template<typename T>
|
|
static void setVariable(std::string variableName, T value) {
|
|
SharedData::sharedVariables[variableName] = value;
|
|
}
|
|
|
|
public:
|
|
static std::vector<EventHandler> eventHandlers;
|
|
static std::vector<std::function<void()>> deferredCalls;
|
|
static prv::Provider *currentProvider;
|
|
static std::map<std::string, std::vector<ContentRegistry::Settings::Entry>> settingsEntries;
|
|
static nlohmann::json settingsJson;
|
|
static std::map<std::string, Events> customEvents;
|
|
static u32 customEventsLastId;
|
|
static std::vector<ContentRegistry::CommandPaletteCommands::Entry> commandPaletteCommands;
|
|
static std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> patternLanguageFunctions;
|
|
static std::vector<View*> views;
|
|
static std::vector<ContentRegistry::Tools::Entry> toolsEntries;
|
|
static std::vector<ContentRegistry::DataInspector::Entry> dataInspectorEntries;
|
|
static u32 patternPaletteOffset;
|
|
static std::string errorPopupMessage;
|
|
static std::list<ImHexApi::Bookmarks::Entry> bookmarkEntries;
|
|
|
|
static imgui_addons::ImGuiFileBrowser fileBrowser;
|
|
static imgui_addons::ImGuiFileBrowser::DialogMode fileBrowserDialogMode;
|
|
static std::string fileBrowserTitle;
|
|
static std::string fileBrowserValidExtensions;
|
|
static std::function<void(std::string)> fileBrowserCallback;
|
|
|
|
static std::vector<ContentRegistry::DataProcessorNode::Entry> dataProcessorNodes;
|
|
static u32 dataProcessorNodeIdCounter;
|
|
|
|
static int mainArgc;
|
|
static char **mainArgv;
|
|
|
|
static ImVec2 windowPos;
|
|
static ImVec2 windowSize;
|
|
|
|
private:
|
|
static std::map<std::string, std::any> sharedVariables;
|
|
};
|
|
|
|
} |