mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 21:47:40 -05:00
build: Refactor ImHexAPI into multiple separate files
This commit is contained in:
@@ -6,10 +6,13 @@
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/auto_reset.hpp>
|
||||
#include <hex/helpers/default_paths.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
#include <hex/ui/view.hpp>
|
||||
#include <hex/data_processor/node.hpp>
|
||||
|
||||
#include <hex/providers/provider.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <jthread.hpp>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/imhex_api/bookmarks.hpp>
|
||||
#include <hex/api/imhex_api/hex_editor.hpp>
|
||||
#include <hex/api/imhex_api/fonts.hpp>
|
||||
#include <hex/api/imhex_api/messaging.hpp>
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
|
||||
#include <hex/api/events/events_provider.hpp>
|
||||
#include <hex/api/events/events_lifecycle.hpp>
|
||||
@@ -255,7 +260,7 @@ namespace hex {
|
||||
setSelection({ { address, size }, provider == nullptr ? Provider::get() : provider });
|
||||
}
|
||||
|
||||
void addVirtualFile(const std::fs::path &path, std::vector<u8> data, Region region) {
|
||||
void addVirtualFile(const std::string &path, std::vector<u8> data, Region region) {
|
||||
RequestAddVirtualFile::post(path, std::move(data), region);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace hex {
|
||||
|
||||
}
|
||||
|
||||
void addLanguages(const std::string_view &languageList, std::function<std::string_view(const std::filesystem::path &path)> callback) {
|
||||
void addLanguages(const std::string_view &languageList, std::function<std::string_view(const std::string &path)> callback) {
|
||||
const auto json = nlohmann::json::parse(languageList);
|
||||
|
||||
for (const auto &item : json) {
|
||||
@@ -41,7 +41,7 @@ namespace hex {
|
||||
definition.fallbackLanguageId = item["fallback"].get<std::string>();
|
||||
}
|
||||
|
||||
definition.languageFilePaths.emplace_back(PathEntry{ item["path"].get<std::string>(), callback });
|
||||
definition.languageFilePaths.emplace_back(PathEntry{ item["path"].get<std::string>(), std::move(callback) });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <hex/api/plugin_manager.hpp>
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/fmt.hpp>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/helpers/scaling.hpp>
|
||||
#include <hex/helpers/auto_reset.hpp>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <hex/api/tutorial_manager.hpp>
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
#include <hex/api/events/events_gui.hpp>
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <imgui_internal.h>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/helpers/scaling.hpp>
|
||||
#include <wolv/utils/core.hpp>
|
||||
|
||||
#include <map>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <hex/helpers/default_paths.hpp>
|
||||
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include <hex/helpers/fs.hpp>
|
||||
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/fmt.hpp>
|
||||
#include <hex/helpers/utils_linux.hpp>
|
||||
|
||||
23
lib/libimhex/source/helpers/scaling.cpp
Normal file
23
lib/libimhex/source/helpers/scaling.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <hex/helpers/scaling.hpp>
|
||||
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
|
||||
namespace hex {
|
||||
|
||||
float operator""_scaled(long double value) {
|
||||
return value * ImHexApi::System::getGlobalScale();
|
||||
}
|
||||
|
||||
float operator""_scaled(unsigned long long value) {
|
||||
return value * ImHexApi::System::getGlobalScale();
|
||||
}
|
||||
|
||||
ImVec2 scaled(const ImVec2 &vector) {
|
||||
return vector * ImHexApi::System::getGlobalScale();
|
||||
}
|
||||
|
||||
ImVec2 scaled(float x, float y) {
|
||||
return ImVec2(x, y) * ImHexApi::System::getGlobalScale();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
|
||||
#include <hex/helpers/fmt.hpp>
|
||||
#include <hex/helpers/crypto.hpp>
|
||||
@@ -37,21 +37,6 @@
|
||||
#endif
|
||||
|
||||
namespace hex {
|
||||
float operator""_scaled(long double value) {
|
||||
return value * ImHexApi::System::getGlobalScale();
|
||||
}
|
||||
|
||||
float operator""_scaled(unsigned long long value) {
|
||||
return value * ImHexApi::System::getGlobalScale();
|
||||
}
|
||||
|
||||
ImVec2 scaled(const ImVec2 &vector) {
|
||||
return vector * ImHexApi::System::getGlobalScale();
|
||||
}
|
||||
|
||||
ImVec2 scaled(float x, float y) {
|
||||
return ImVec2(x, y) * ImHexApi::System::getGlobalScale();
|
||||
}
|
||||
|
||||
std::string to_string(u128 value) {
|
||||
char data[45] = { 0 };
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <hex/api/events/requests_lifecycle.hpp>
|
||||
#include <hex/api/plugin_manager.hpp>
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/imhex_api/messaging.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/fmt.hpp>
|
||||
|
||||
|
||||
@@ -18,13 +18,11 @@
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
|
||||
#include <hex/api/task_manager.hpp>
|
||||
#include <hex/api/theme_manager.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/utils_macos.hpp>
|
||||
|
||||
|
||||
namespace ImGuiExt {
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
#include <hex/api/task_manager.hpp>
|
||||
#include <hex/helpers/auto_reset.hpp>
|
||||
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
Reference in New Issue
Block a user