mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 21:47:40 -05:00
build: Refactor ContentRegistry into multiple separate files
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/api/content_registry/communication_interface.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/background_services.hpp>
|
||||
#include <hex/api/events/events_provider.hpp>
|
||||
#include <hex/api/events/events_lifecycle.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include <content/command_line_interface.hpp>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
#include <hex/api/imhex_api/hex_editor.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
#include <hex/api/events/requests_interaction.hpp>
|
||||
#include <hex/api/events/requests_gui.hpp>
|
||||
#include <hex/api/plugin_manager.hpp>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/imhex_api/hex_editor.hpp>
|
||||
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/api/content_registry/command_palette.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
|
||||
#include <hex/ui/view.hpp>
|
||||
|
||||
@@ -250,8 +252,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void registerCommandPaletteCommands() {
|
||||
|
||||
ContentRegistry::CommandPaletteCommands::add(
|
||||
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
ContentRegistry::CommandPalette::add(
|
||||
ContentRegistry::CommandPalette::Type::SymbolCommand,
|
||||
"=",
|
||||
"hex.builtin.command.calc.desc",
|
||||
[](auto input) {
|
||||
@@ -279,8 +281,8 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
});
|
||||
|
||||
ContentRegistry::CommandPaletteCommands::add(
|
||||
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
ContentRegistry::CommandPalette::add(
|
||||
ContentRegistry::CommandPalette::Type::SymbolCommand,
|
||||
"@",
|
||||
"hex.builtin.command.goto.desc",
|
||||
[](auto input) {
|
||||
@@ -307,8 +309,8 @@ namespace hex::plugin::builtin {
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
ContentRegistry::CommandPaletteCommands::add(
|
||||
ContentRegistry::CommandPaletteCommands::Type::KeywordCommand,
|
||||
ContentRegistry::CommandPalette::add(
|
||||
ContentRegistry::CommandPalette::Type::KeywordCommand,
|
||||
"/web",
|
||||
"hex.builtin.command.web.desc",
|
||||
[](auto input) {
|
||||
@@ -319,8 +321,8 @@ namespace hex::plugin::builtin {
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
ContentRegistry::CommandPaletteCommands::add(
|
||||
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
ContentRegistry::CommandPalette::add(
|
||||
ContentRegistry::CommandPalette::Type::SymbolCommand,
|
||||
"$",
|
||||
"hex.builtin.command.cmd.desc",
|
||||
[](auto input) {
|
||||
@@ -349,13 +351,13 @@ namespace hex::plugin::builtin {
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
ContentRegistry::CommandPaletteCommands::addHandler(
|
||||
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
ContentRegistry::CommandPalette::addHandler(
|
||||
ContentRegistry::CommandPalette::Type::SymbolCommand,
|
||||
">",
|
||||
[](const auto &input) {
|
||||
std::vector<ContentRegistry::CommandPaletteCommands::impl::QueryResult> result;
|
||||
std::vector<ContentRegistry::CommandPalette::impl::QueryResult> result;
|
||||
|
||||
for (const auto &[priority, entry] : ContentRegistry::Interface::impl::getMenuItems()) {
|
||||
for (const auto &[priority, entry] : ContentRegistry::UserInterface::impl::getMenuItems()) {
|
||||
if (!entry.enabledCallback())
|
||||
continue;
|
||||
|
||||
@@ -367,8 +369,8 @@ namespace hex::plugin::builtin {
|
||||
std::vector<std::string> names;
|
||||
std::transform(entry.unlocalizedNames.begin(), entry.unlocalizedNames.end(), std::back_inserter(names), [](auto &name) { return Lang(name); });
|
||||
|
||||
if (auto combined = wolv::util::combineStrings(names, " -> "); hex::containsIgnoreCase(combined, input) && !combined.contains(ContentRegistry::Interface::impl::SeparatorValue) && !combined.contains(ContentRegistry::Interface::impl::SubMenuValue)) {
|
||||
result.emplace_back(ContentRegistry::CommandPaletteCommands::impl::QueryResult {
|
||||
if (auto combined = wolv::util::combineStrings(names, " -> "); hex::containsIgnoreCase(combined, input) && !combined.contains(ContentRegistry::UserInterface::impl::SeparatorValue) && !combined.contains(ContentRegistry::UserInterface::impl::SubMenuValue)) {
|
||||
result.emplace_back(ContentRegistry::CommandPalette::impl::QueryResult {
|
||||
std::move(combined),
|
||||
[&entry](const auto&) { entry.callback(); }
|
||||
});
|
||||
@@ -381,11 +383,11 @@ namespace hex::plugin::builtin {
|
||||
return fmt::format("Menu Item: {}", input.data());
|
||||
});
|
||||
|
||||
ContentRegistry::CommandPaletteCommands::addHandler(
|
||||
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
ContentRegistry::CommandPalette::addHandler(
|
||||
ContentRegistry::CommandPalette::Type::SymbolCommand,
|
||||
".",
|
||||
[](const auto &input) {
|
||||
std::vector<ContentRegistry::CommandPaletteCommands::impl::QueryResult> result;
|
||||
std::vector<ContentRegistry::CommandPalette::impl::QueryResult> result;
|
||||
|
||||
u32 index = 0;
|
||||
for (const auto &provider : ImHexApi::Provider::getProviders()) {
|
||||
@@ -395,7 +397,7 @@ namespace hex::plugin::builtin {
|
||||
if (!hex::containsIgnoreCase(name, input))
|
||||
continue;
|
||||
|
||||
result.emplace_back(ContentRegistry::CommandPaletteCommands::impl::QueryResult {
|
||||
result.emplace_back(ContentRegistry::CommandPalette::impl::QueryResult {
|
||||
provider->getName(),
|
||||
[index](const auto&) { ImHexApi::Provider::setCurrentProvider(index); }
|
||||
});
|
||||
@@ -407,17 +409,17 @@ namespace hex::plugin::builtin {
|
||||
return fmt::format("Data Source: {}", input.data());
|
||||
});
|
||||
|
||||
ContentRegistry::CommandPaletteCommands::add(
|
||||
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
ContentRegistry::CommandPalette::add(
|
||||
ContentRegistry::CommandPalette::Type::SymbolCommand,
|
||||
"%",
|
||||
"hex.builtin.command.convert.desc",
|
||||
handleConversionCommand);
|
||||
|
||||
ContentRegistry::CommandPaletteCommands::addHandler(
|
||||
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
|
||||
ContentRegistry::CommandPalette::addHandler(
|
||||
ContentRegistry::CommandPalette::Type::SymbolCommand,
|
||||
"+",
|
||||
[](const auto &input) {
|
||||
std::vector<ContentRegistry::CommandPaletteCommands::impl::QueryResult> result;
|
||||
std::vector<ContentRegistry::CommandPalette::impl::QueryResult> result;
|
||||
|
||||
for (const auto &[unlocalizedName, view] : ContentRegistry::Views::impl::getEntries()) {
|
||||
if (!view->shouldProcess())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/communication_interface.hpp>
|
||||
#include <hex/api/events/requests_interaction.hpp>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_formatter.hpp>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
|
||||
#include <hex/providers/provider.hpp>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_information.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/helpers/magic.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/imhex_api/hex_editor.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_inspector.hpp>
|
||||
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/helpers/crypto.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <algorithm>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/helpers/scaling.hpp>
|
||||
@@ -263,13 +263,13 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
void registerBasicDataProcessorNodes() {
|
||||
ContentRegistry::DataProcessorNode::add<NodeInteger>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.int");
|
||||
ContentRegistry::DataProcessorNode::add<NodeFloat>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.float");
|
||||
ContentRegistry::DataProcessorNode::add<NodeNullptr>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.nullptr");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBuffer>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.buffer");
|
||||
ContentRegistry::DataProcessorNode::add<NodeString>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.string");
|
||||
ContentRegistry::DataProcessorNode::add<NodeRGBA8>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.rgba8");
|
||||
ContentRegistry::DataProcessorNode::add<NodeComment>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.comment");
|
||||
ContentRegistry::DataProcessor::add<NodeInteger>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.int");
|
||||
ContentRegistry::DataProcessor::add<NodeFloat>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.float");
|
||||
ContentRegistry::DataProcessor::add<NodeNullptr>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.nullptr");
|
||||
ContentRegistry::DataProcessor::add<NodeBuffer>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.buffer");
|
||||
ContentRegistry::DataProcessor::add<NodeString>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.string");
|
||||
ContentRegistry::DataProcessor::add<NodeRGBA8>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.rgba8");
|
||||
ContentRegistry::DataProcessor::add<NodeComment>("hex.builtin.nodes.constants", "hex.builtin.nodes.constants.comment");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
#include <hex/data_processor/node.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
@@ -148,14 +148,14 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
void registerControlDataProcessorNodes() {
|
||||
ContentRegistry::DataProcessorNode::add<NodeIf>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.if");
|
||||
ContentRegistry::DataProcessorNode::add<NodeEquals>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.equals");
|
||||
ContentRegistry::DataProcessorNode::add<NodeNot>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.not");
|
||||
ContentRegistry::DataProcessorNode::add<NodeGreaterThan>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.gt");
|
||||
ContentRegistry::DataProcessorNode::add<NodeLessThan>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.lt");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBoolAND>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.and");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBoolOR>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.or");
|
||||
ContentRegistry::DataProcessorNode::add<NodeLoop>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.loop");
|
||||
ContentRegistry::DataProcessor::add<NodeIf>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.if");
|
||||
ContentRegistry::DataProcessor::add<NodeEquals>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.equals");
|
||||
ContentRegistry::DataProcessor::add<NodeNot>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.not");
|
||||
ContentRegistry::DataProcessor::add<NodeGreaterThan>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.gt");
|
||||
ContentRegistry::DataProcessor::add<NodeLessThan>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.lt");
|
||||
ContentRegistry::DataProcessor::add<NodeBoolAND>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.and");
|
||||
ContentRegistry::DataProcessor::add<NodeBoolOR>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.or");
|
||||
ContentRegistry::DataProcessor::add<NodeLoop>("hex.builtin.nodes.control_flow", "hex.builtin.nodes.control_flow.loop");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <algorithm>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/helpers/scaling.hpp>
|
||||
#include <hex/helpers/crypto.hpp>
|
||||
@@ -145,9 +145,9 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
void registerDecodeDataProcessorNodes() {
|
||||
ContentRegistry::DataProcessorNode::add<NodeDecodingBase64>("hex.builtin.nodes.decoding", "hex.builtin.nodes.decoding.base64");
|
||||
ContentRegistry::DataProcessorNode::add<NodeDecodingHex>("hex.builtin.nodes.decoding", "hex.builtin.nodes.decoding.hex");
|
||||
ContentRegistry::DataProcessorNode::add<NodeCryptoAESDecrypt>("hex.builtin.nodes.crypto", "hex.builtin.nodes.crypto.aes");
|
||||
ContentRegistry::DataProcessor::add<NodeDecodingBase64>("hex.builtin.nodes.decoding", "hex.builtin.nodes.decoding.base64");
|
||||
ContentRegistry::DataProcessor::add<NodeDecodingHex>("hex.builtin.nodes.decoding", "hex.builtin.nodes.decoding.hex");
|
||||
ContentRegistry::DataProcessor::add<NodeCryptoAESDecrypt>("hex.builtin.nodes.crypto", "hex.builtin.nodes.crypto.aes");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
#include <hex/data_processor/node.hpp>
|
||||
|
||||
#include <ranges>
|
||||
@@ -166,14 +166,14 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
void registerLogicDataProcessorNodes() {
|
||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseADD>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.add");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseAND>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.and");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseOR>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.or");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseXOR>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.xor");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseNOT>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.not");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseShiftLeft>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.shift_left");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseShiftRight>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.shift_right");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBitwiseSwap>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.swap");
|
||||
ContentRegistry::DataProcessor::add<NodeBitwiseADD>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.add");
|
||||
ContentRegistry::DataProcessor::add<NodeBitwiseAND>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.and");
|
||||
ContentRegistry::DataProcessor::add<NodeBitwiseOR>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.or");
|
||||
ContentRegistry::DataProcessor::add<NodeBitwiseXOR>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.xor");
|
||||
ContentRegistry::DataProcessor::add<NodeBitwiseNOT>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.not");
|
||||
ContentRegistry::DataProcessor::add<NodeBitwiseShiftLeft>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.shift_left");
|
||||
ContentRegistry::DataProcessor::add<NodeBitwiseShiftRight>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.shift_right");
|
||||
ContentRegistry::DataProcessor::add<NodeBitwiseSwap>("hex.builtin.nodes.bitwise", "hex.builtin.nodes.bitwise.swap");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
#include <hex/data_processor/node.hpp>
|
||||
|
||||
#include <numeric>
|
||||
@@ -152,16 +152,16 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
void registerMathDataProcessorNodes() {
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticAdd>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.add");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticSubtract>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.sub");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticMultiply>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.mul");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticDivide>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.div");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticModulus>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.mod");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticAverage>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.average");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticMedian>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.median");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticCeil>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.ceil");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticFloor>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.floor");
|
||||
ContentRegistry::DataProcessorNode::add<NodeArithmeticRound>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.round");
|
||||
ContentRegistry::DataProcessor::add<NodeArithmeticAdd>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.add");
|
||||
ContentRegistry::DataProcessor::add<NodeArithmeticSubtract>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.sub");
|
||||
ContentRegistry::DataProcessor::add<NodeArithmeticMultiply>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.mul");
|
||||
ContentRegistry::DataProcessor::add<NodeArithmeticDivide>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.div");
|
||||
ContentRegistry::DataProcessor::add<NodeArithmeticModulus>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.mod");
|
||||
ContentRegistry::DataProcessor::add<NodeArithmeticAverage>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.average");
|
||||
ContentRegistry::DataProcessor::add<NodeArithmeticMedian>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.median");
|
||||
ContentRegistry::DataProcessor::add<NodeArithmeticCeil>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.ceil");
|
||||
ContentRegistry::DataProcessor::add<NodeArithmeticFloor>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.floor");
|
||||
ContentRegistry::DataProcessor::add<NodeArithmeticRound>("hex.builtin.nodes.arithmetic", "hex.builtin.nodes.arithmetic.round");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/pattern_language.hpp>
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
#include <hex/api/events/events_interaction.hpp>
|
||||
|
||||
@@ -12,6 +13,8 @@
|
||||
#include <content/helpers/diagrams.hpp>
|
||||
#include <pl/patterns/pattern.hpp>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
class NodeReadData : public dp::Node {
|
||||
@@ -461,30 +464,30 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
void registerOtherDataProcessorNodes() {
|
||||
ContentRegistry::DataProcessorNode::add<NodeReadData>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.read");
|
||||
ContentRegistry::DataProcessorNode::add<NodeWriteData>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.write");
|
||||
ContentRegistry::DataProcessorNode::add<NodeDataSize>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.size");
|
||||
ContentRegistry::DataProcessorNode::add<NodeDataSelection>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.selection");
|
||||
ContentRegistry::DataProcessor::add<NodeReadData>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.read");
|
||||
ContentRegistry::DataProcessor::add<NodeWriteData>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.write");
|
||||
ContentRegistry::DataProcessor::add<NodeDataSize>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.size");
|
||||
ContentRegistry::DataProcessor::add<NodeDataSelection>("hex.builtin.nodes.data_access", "hex.builtin.nodes.data_access.selection");
|
||||
|
||||
ContentRegistry::DataProcessorNode::add<NodeCastIntegerToBuffer>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.int_to_buffer");
|
||||
ContentRegistry::DataProcessorNode::add<NodeCastBufferToInteger>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.buffer_to_int");
|
||||
ContentRegistry::DataProcessorNode::add<NodeCastFloatToBuffer>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.float_to_buffer");
|
||||
ContentRegistry::DataProcessorNode::add<NodeCastBufferToFloat>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.buffer_to_float");
|
||||
ContentRegistry::DataProcessor::add<NodeCastIntegerToBuffer>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.int_to_buffer");
|
||||
ContentRegistry::DataProcessor::add<NodeCastBufferToInteger>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.buffer_to_int");
|
||||
ContentRegistry::DataProcessor::add<NodeCastFloatToBuffer>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.float_to_buffer");
|
||||
ContentRegistry::DataProcessor::add<NodeCastBufferToFloat>("hex.builtin.nodes.casting", "hex.builtin.nodes.casting.buffer_to_float");
|
||||
|
||||
ContentRegistry::DataProcessorNode::add<NodeBufferCombine>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.combine");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBufferSlice>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.slice");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBufferRepeat>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.repeat");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBufferPatch>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.patch");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBufferSize>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.size");
|
||||
ContentRegistry::DataProcessorNode::add<NodeBufferByteSwap>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.byte_swap");
|
||||
ContentRegistry::DataProcessor::add<NodeBufferCombine>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.combine");
|
||||
ContentRegistry::DataProcessor::add<NodeBufferSlice>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.slice");
|
||||
ContentRegistry::DataProcessor::add<NodeBufferRepeat>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.repeat");
|
||||
ContentRegistry::DataProcessor::add<NodeBufferPatch>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.patch");
|
||||
ContentRegistry::DataProcessor::add<NodeBufferSize>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.size");
|
||||
ContentRegistry::DataProcessor::add<NodeBufferByteSwap>("hex.builtin.nodes.buffer", "hex.builtin.nodes.buffer.byte_swap");
|
||||
|
||||
ContentRegistry::DataProcessorNode::add<NodeVisualizerDigram>("hex.builtin.nodes.visualizer", "hex.builtin.nodes.visualizer.digram");
|
||||
ContentRegistry::DataProcessorNode::add<NodeVisualizerLayeredDistribution>("hex.builtin.nodes.visualizer", "hex.builtin.nodes.visualizer.layered_dist");
|
||||
ContentRegistry::DataProcessorNode::add<NodeVisualizerImage>("hex.builtin.nodes.visualizer", "hex.builtin.nodes.visualizer.image");
|
||||
ContentRegistry::DataProcessorNode::add<NodeVisualizerImageRGBA>("hex.builtin.nodes.visualizer", "hex.builtin.nodes.visualizer.image_rgba");
|
||||
ContentRegistry::DataProcessorNode::add<NodeVisualizerByteDistribution>("hex.builtin.nodes.visualizer", "hex.builtin.nodes.visualizer.byte_distribution");
|
||||
ContentRegistry::DataProcessor::add<NodeVisualizerDigram>("hex.builtin.nodes.visualizer", "hex.builtin.nodes.visualizer.digram");
|
||||
ContentRegistry::DataProcessor::add<NodeVisualizerLayeredDistribution>("hex.builtin.nodes.visualizer", "hex.builtin.nodes.visualizer.layered_dist");
|
||||
ContentRegistry::DataProcessor::add<NodeVisualizerImage>("hex.builtin.nodes.visualizer", "hex.builtin.nodes.visualizer.image");
|
||||
ContentRegistry::DataProcessor::add<NodeVisualizerImageRGBA>("hex.builtin.nodes.visualizer", "hex.builtin.nodes.visualizer.image_rgba");
|
||||
ContentRegistry::DataProcessor::add<NodeVisualizerByteDistribution>("hex.builtin.nodes.visualizer", "hex.builtin.nodes.visualizer.byte_distribution");
|
||||
|
||||
ContentRegistry::DataProcessorNode::add<NodePatternLanguageOutVariable>("hex.builtin.nodes.pattern_language", "hex.builtin.nodes.pattern_language.out_var");
|
||||
ContentRegistry::DataProcessor::add<NodePatternLanguageOutVariable>("hex.builtin.nodes.pattern_language", "hex.builtin.nodes.pattern_language.out_var");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <hex/data_processor/node.hpp>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
|
||||
#include <hex/ui/imgui_imhex_extensions.h>
|
||||
|
||||
@@ -184,11 +184,11 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
void registerVisualDataProcessorNodes() {
|
||||
ContentRegistry::DataProcessorNode::add<NodeDisplayInteger>("hex.builtin.nodes.display", "hex.builtin.nodes.display.int");
|
||||
ContentRegistry::DataProcessorNode::add<NodeDisplayFloat>("hex.builtin.nodes.display", "hex.builtin.nodes.display.float");
|
||||
ContentRegistry::DataProcessorNode::add<NodeDisplayBuffer>("hex.builtin.nodes.display", "hex.builtin.nodes.display.buffer");
|
||||
ContentRegistry::DataProcessorNode::add<NodeDisplayString>("hex.builtin.nodes.display", "hex.builtin.nodes.display.string");
|
||||
ContentRegistry::DataProcessorNode::add<NodeDisplayBits>("hex.builtin.nodes.display", "hex.builtin.nodes.display.bits");
|
||||
ContentRegistry::DataProcessor::add<NodeDisplayInteger>("hex.builtin.nodes.display", "hex.builtin.nodes.display.int");
|
||||
ContentRegistry::DataProcessor::add<NodeDisplayFloat>("hex.builtin.nodes.display", "hex.builtin.nodes.display.float");
|
||||
ContentRegistry::DataProcessor::add<NodeDisplayBuffer>("hex.builtin.nodes.display", "hex.builtin.nodes.display.buffer");
|
||||
ContentRegistry::DataProcessor::add<NodeDisplayString>("hex.builtin.nodes.display", "hex.builtin.nodes.display.string");
|
||||
ContentRegistry::DataProcessor::add<NodeDisplayBits>("hex.builtin.nodes.display", "hex.builtin.nodes.display.bits");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/hex_editor.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <hex/ui/imgui_imhex_extensions.h>
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
#include <hex/api/events/requests_gui.hpp>
|
||||
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/file_type_handler.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
#include <hex/api/workspace_manager.hpp>
|
||||
@@ -262,7 +263,7 @@ namespace hex::plugin::builtin {
|
||||
EventFileDropped::subscribe([](const std::fs::path &path) {
|
||||
// Check if a custom file handler can handle the file
|
||||
bool handled = false;
|
||||
for (const auto &[extensions, handler] : ContentRegistry::FileHandler::impl::getEntries()) {
|
||||
for (const auto &[extensions, handler] : ContentRegistry::FileTypeHandler::impl::getEntries()) {
|
||||
for (const auto &extension : extensions) {
|
||||
if (path.extension() == extension) {
|
||||
// Pass the file to the handler and check if it was successful
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/file_type_handler.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
|
||||
#include <hex/helpers/default_paths.hpp>
|
||||
@@ -9,11 +9,11 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void registerFileHandlers() {
|
||||
|
||||
ContentRegistry::FileHandler::add({ ".hexproj" }, [](const std::fs::path &path) {
|
||||
ContentRegistry::FileTypeHandler::add({ ".hexproj" }, [](const std::fs::path &path) {
|
||||
return ProjectFile::load(path);
|
||||
});
|
||||
|
||||
ContentRegistry::FileHandler::add({ ".hexlyt" }, [](const std::fs::path &path) {
|
||||
ContentRegistry::FileTypeHandler::add({ ".hexlyt" }, [](const std::fs::path &path) {
|
||||
for (const auto &folder : paths::Layouts.write()) {
|
||||
if (wolv::io::fs::copyFile(path, folder / path.filename()))
|
||||
return true;
|
||||
@@ -22,7 +22,7 @@ namespace hex::plugin::builtin {
|
||||
return false;
|
||||
});
|
||||
|
||||
ContentRegistry::FileHandler::add({ ".mgc" }, [](const auto &path) {
|
||||
ContentRegistry::FileTypeHandler::add({ ".mgc" }, [](const auto &path) {
|
||||
for (const auto &destPath : paths::Magic.write()) {
|
||||
if (wolv::io::fs::copyFile(path, destPath / path.filename(), std::fs::copy_options::overwrite_existing)) {
|
||||
ui::ToastInfo::open("hex.builtin.view.information.magic_db_added"_lang);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/events/events_gui.hpp>
|
||||
#include <hex/api_urls.hpp>
|
||||
|
||||
@@ -37,7 +38,7 @@ namespace hex::plugin::builtin {
|
||||
return;
|
||||
|
||||
TaskManager::doLater([updateString] {
|
||||
ContentRegistry::Interface::addTitleBarButton(ICON_VS_ARROW_DOWN, ImGuiCustomCol_ToolbarGreen, "hex.builtin.welcome.update.title", [] {
|
||||
ContentRegistry::UserInterface::addTitleBarButton(ICON_VS_ARROW_DOWN, ImGuiCustomCol_ToolbarGreen, "hex.builtin.welcome.update.title", [] {
|
||||
ImHexApi::System::updateImHex(ImHexApi::System::isNightlyBuild() ? ImHexApi::System::UpdateType::Nightly : ImHexApi::System::UpdateType::Stable);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/data_formatter.hpp>
|
||||
#include <hex/api/content_registry/reports.hpp>
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
#include <hex/api/content_registry/provider.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <implot.h>
|
||||
@@ -367,10 +372,10 @@ namespace hex::plugin::builtin {
|
||||
|
||||
static void createFileMenu() {
|
||||
|
||||
ContentRegistry::Interface::registerMainMenuItem("hex.builtin.menu.file", 1000);
|
||||
ContentRegistry::UserInterface::registerMainMenuItem("hex.builtin.menu.file", 1000);
|
||||
|
||||
/* Create File */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.create_file" }, ICON_VS_FILE, 1050, CTRLCMD + Keys::N + AllowWhileTyping, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.create_file" }, ICON_VS_FILE, 1050, CTRLCMD + Keys::N + AllowWhileTyping, [] {
|
||||
auto newProvider = hex::ImHexApi::Provider::createProvider("hex.builtin.provider.mem_file", true);
|
||||
if (newProvider != nullptr && !newProvider->open())
|
||||
hex::ImHexApi::Provider::remove(newProvider);
|
||||
@@ -379,12 +384,12 @@ namespace hex::plugin::builtin {
|
||||
}, noRunningTasks);
|
||||
|
||||
/* Open File */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.open_file" }, ICON_VS_FOLDER_OPENED, 1100, CTRLCMD + Keys::O + AllowWhileTyping, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.open_file" }, ICON_VS_FOLDER_OPENED, 1100, CTRLCMD + Keys::O + AllowWhileTyping, [] {
|
||||
RequestOpenWindow::post("Open File");
|
||||
}, noRunningTasks, ContentRegistry::Views::getViewByName("hex.builtin.view.hex_editor.name"));
|
||||
|
||||
/* Open Other */
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.open_other"}, ICON_VS_TELESCOPE, 1150, [] {
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.open_other"}, ICON_VS_TELESCOPE, 1150, [] {
|
||||
for (const auto &[unlocalizedProviderName, icon] : ContentRegistry::Provider::impl::getEntries()) {
|
||||
if (menu::menuItemEx(Lang(unlocalizedProviderName), icon))
|
||||
ImHexApi::Provider::createProvider(unlocalizedProviderName);
|
||||
@@ -392,7 +397,7 @@ namespace hex::plugin::builtin {
|
||||
}, noRunningTasks);
|
||||
|
||||
/* Reload Provider */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.reload_provider"}, ICON_VS_REFRESH, 1250, CTRLCMD + Keys::R + AllowWhileTyping, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.reload_provider"}, ICON_VS_REFRESH, 1250, CTRLCMD + Keys::R + AllowWhileTyping, [] {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
|
||||
provider->close();
|
||||
@@ -404,41 +409,41 @@ namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
/* Project open / save */
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.project" }, ICON_VS_NOTEBOOK, 1400, []{}, noRunningTasks);
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.project" }, ICON_VS_NOTEBOOK, 1400, []{}, noRunningTasks);
|
||||
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.project", "hex.builtin.menu.file.project.open" }, ICON_VS_ROOT_FOLDER_OPENED, 1410,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.project", "hex.builtin.menu.file.project.open" }, ICON_VS_ROOT_FOLDER_OPENED, 1410,
|
||||
CTRL + ALT + Keys::O + AllowWhileTyping,
|
||||
openProject, noRunningTasks);
|
||||
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.project", "hex.builtin.menu.file.project.save" }, ICON_VS_SAVE, 1450,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.project", "hex.builtin.menu.file.project.save" }, ICON_VS_SAVE, 1450,
|
||||
CTRL + ALT + Keys::S + AllowWhileTyping,
|
||||
saveProject, [&] { return noRunningTaskAndValidProvider() && ProjectFile::hasPath(); });
|
||||
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.project", "hex.builtin.menu.file.project.save_as" }, ICON_VS_SAVE_AS, 1500,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.project", "hex.builtin.menu.file.project.save_as" }, ICON_VS_SAVE_AS, 1500,
|
||||
ALT + SHIFT + Keys::S + AllowWhileTyping,
|
||||
saveProjectAs, noRunningTaskAndValidProvider);
|
||||
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 2000);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 2000);
|
||||
|
||||
/* Import */
|
||||
{
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.import" }, ICON_VS_SIGN_IN, 5140, []{}, noRunningTaskAndValidProvider);
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.import" }, ICON_VS_SIGN_IN, 5140, []{}, noRunningTaskAndValidProvider);
|
||||
|
||||
/* IPS */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.ips"}, ICON_VS_GIT_PULL_REQUEST_NEW_CHANGES, 5150,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.ips"}, ICON_VS_GIT_PULL_REQUEST_NEW_CHANGES, 5150,
|
||||
Shortcut::None,
|
||||
importIPSPatch,
|
||||
noRunningTaskAndWritableProvider);
|
||||
|
||||
/* IPS32 */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.ips32"}, ICON_VS_GIT_PULL_REQUEST_NEW_CHANGES, 5200,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.ips32"}, ICON_VS_GIT_PULL_REQUEST_NEW_CHANGES, 5200,
|
||||
Shortcut::None,
|
||||
importIPS32Patch,
|
||||
noRunningTaskAndWritableProvider);
|
||||
|
||||
/* Modified File */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.modified_file" }, ICON_VS_FILES, 5300,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.modified_file" }, ICON_VS_FILES, 5300,
|
||||
Shortcut::None,
|
||||
importModifiedFile,
|
||||
noRunningTaskAndWritableProvider);
|
||||
@@ -447,68 +452,68 @@ namespace hex::plugin::builtin {
|
||||
/* Export */
|
||||
/* Only make them accessible if the current provider is dumpable */
|
||||
{
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.export" }, ICON_VS_SIGN_OUT, 6000, []{}, isProviderDumpable);
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.export" }, ICON_VS_SIGN_OUT, 6000, []{}, isProviderDumpable);
|
||||
|
||||
/* Selection to File */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.selection_to_file" }, ICON_VS_FILE_BINARY, 6010,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.selection_to_file" }, ICON_VS_FILE_BINARY, 6010,
|
||||
Shortcut::None,
|
||||
exportSelectionToFile,
|
||||
ImHexApi::HexEditor::isSelectionValid);
|
||||
|
||||
/* Base 64 */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.base64" }, ICON_VS_NOTE, 6020,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.base64" }, ICON_VS_NOTE, 6020,
|
||||
Shortcut::None,
|
||||
exportBase64,
|
||||
isProviderDumpable);
|
||||
|
||||
/* Language */
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.as_language" }, ICON_VS_CODE, 6030,
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.as_language" }, ICON_VS_CODE, 6030,
|
||||
drawExportLanguageMenu,
|
||||
isProviderDumpable);
|
||||
|
||||
/* Report */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.report" }, ICON_VS_MARKDOWN, 6040,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.report" }, ICON_VS_MARKDOWN, 6040,
|
||||
Shortcut::None,
|
||||
exportReport,
|
||||
ImHexApi::Provider::isValid);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.file", "hex.builtin.menu.file.export" }, 6050);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.file", "hex.builtin.menu.file.export" }, 6050);
|
||||
|
||||
/* IPS */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.ips" }, ICON_VS_GIT_PULL_REQUEST_NEW_CHANGES, 6100,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.ips" }, ICON_VS_GIT_PULL_REQUEST_NEW_CHANGES, 6100,
|
||||
Shortcut::None,
|
||||
exportIPSPatch,
|
||||
isProviderDumpable);
|
||||
|
||||
/* IPS32 */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.ips32" }, ICON_VS_GIT_PULL_REQUEST_NEW_CHANGES, 6150,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.ips32" }, ICON_VS_GIT_PULL_REQUEST_NEW_CHANGES, 6150,
|
||||
Shortcut::None,
|
||||
exportIPS32Patch,
|
||||
isProviderDumpable);
|
||||
}
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 10000);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 10000);
|
||||
|
||||
/* Close Provider */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.close"}, ICON_VS_CHROME_CLOSE, 10050, CTRLCMD + Keys::W + AllowWhileTyping, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.close"}, ICON_VS_CHROME_CLOSE, 10050, CTRLCMD + Keys::W + AllowWhileTyping, [] {
|
||||
ImHexApi::Provider::remove(ImHexApi::Provider::get());
|
||||
}, noRunningTaskAndValidProvider);
|
||||
|
||||
/* Quit ImHex */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.quit"}, ICON_VS_CLOSE_ALL, 10100, ALT + Keys::F4 + AllowWhileTyping, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.quit"}, ICON_VS_CLOSE_ALL, 10100, ALT + Keys::F4 + AllowWhileTyping, [] {
|
||||
ImHexApi::System::closeImHex();
|
||||
});
|
||||
}
|
||||
|
||||
static void createEditMenu() {
|
||||
ContentRegistry::Interface::registerMainMenuItem("hex.builtin.menu.edit", 2000);
|
||||
ContentRegistry::UserInterface::registerMainMenuItem("hex.builtin.menu.edit", 2000);
|
||||
}
|
||||
|
||||
static void createViewMenu() {
|
||||
ContentRegistry::Interface::registerMainMenuItem("hex.builtin.menu.view", 3000);
|
||||
ContentRegistry::UserInterface::registerMainMenuItem("hex.builtin.menu.view", 3000);
|
||||
|
||||
#if !defined(OS_WEB)
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.view", "hex.builtin.menu.view.always_on_top" }, ICON_VS_PINNED, 1000, Keys::F10 + AllowWhileTyping, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.view", "hex.builtin.menu.view.always_on_top" }, ICON_VS_PINNED, 1000, Keys::F10 + AllowWhileTyping, [] {
|
||||
static bool state = false;
|
||||
|
||||
state = !state;
|
||||
@@ -517,7 +522,7 @@ namespace hex::plugin::builtin {
|
||||
#endif
|
||||
|
||||
#if !defined(OS_MACOS) && !defined(OS_WEB)
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.view", "hex.builtin.menu.view.fullscreen" }, ICON_VS_SCREEN_FULL, 2000, Keys::F11 + AllowWhileTyping, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.view", "hex.builtin.menu.view.fullscreen" }, ICON_VS_SCREEN_FULL, 2000, Keys::F11 + AllowWhileTyping, [] {
|
||||
static bool state = false;
|
||||
static ImVec2 position, size;
|
||||
|
||||
@@ -542,10 +547,10 @@ namespace hex::plugin::builtin {
|
||||
#endif
|
||||
|
||||
#if !defined(OS_WEB)
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.view" }, 3000);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.view" }, 3000);
|
||||
#endif
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.view" }, 4000, [] {
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.view" }, 4000, [] {
|
||||
for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) {
|
||||
if (view->hasViewMenuItemEntry()) {
|
||||
auto &state = view->getWindowOpenState();
|
||||
@@ -561,15 +566,15 @@ namespace hex::plugin::builtin {
|
||||
static void createLayoutMenu() {
|
||||
LayoutManager::reload();
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.layout" }, ICON_VS_LAYOUT, 1050, []{}, ImHexApi::Provider::isValid);
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.layout" }, ICON_VS_LAYOUT, 1050, []{}, ImHexApi::Provider::isValid);
|
||||
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.layout", "hex.builtin.menu.workspace.layout.save" }, 1100, Shortcut::None, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.layout", "hex.builtin.menu.workspace.layout.save" }, 1100, Shortcut::None, [] {
|
||||
ui::PopupTextInput::open("hex.builtin.popup.save_layout.title", "hex.builtin.popup.save_layout.desc", [](const std::string &name) {
|
||||
LayoutManager::save(name);
|
||||
});
|
||||
}, ImHexApi::Provider::isValid);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.layout" }, ICON_VS_LAYOUT, 1150, [] {
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.layout" }, ICON_VS_LAYOUT, 1150, [] {
|
||||
bool locked = LayoutManager::isLayoutLocked();
|
||||
if (menu::menuItemEx("hex.builtin.menu.workspace.layout.lock"_lang, ICON_VS_LOCK, Shortcut::None, locked, ImHexApi::Provider::isValid())) {
|
||||
LayoutManager::lockLayout(!locked);
|
||||
@@ -577,9 +582,9 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
});
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.layout" }, 1200);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.layout" }, 1200);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.layout" }, 2000, [] {
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.layout" }, 2000, [] {
|
||||
for (const auto &path : romfs::list("layouts")) {
|
||||
if (menu::menuItem(wolv::util::capitalizeString(path.stem().string()).c_str(), Shortcut::None, false, ImHexApi::Provider::isValid())) {
|
||||
LayoutManager::loadFromString(std::string(romfs::get(path).string()));
|
||||
@@ -601,19 +606,19 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
static void createWorkspaceMenu() {
|
||||
ContentRegistry::Interface::registerMainMenuItem("hex.builtin.menu.workspace", 4000);
|
||||
ContentRegistry::UserInterface::registerMainMenuItem("hex.builtin.menu.workspace", 4000);
|
||||
|
||||
createLayoutMenu();
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.workspace" }, 3000);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.workspace" }, 3000);
|
||||
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.create" }, ICON_VS_ADD, 3100, Shortcut::None, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.workspace", "hex.builtin.menu.workspace.create" }, ICON_VS_ADD, 3100, Shortcut::None, [] {
|
||||
ui::PopupTextInput::open("hex.builtin.popup.create_workspace.title", "hex.builtin.popup.create_workspace.desc", [](const std::string &name) {
|
||||
WorkspaceManager::createWorkspace(name);
|
||||
});
|
||||
}, ImHexApi::Provider::isValid);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.workspace" }, 3200, [] {
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.workspace" }, 3200, [] {
|
||||
const auto &workspaces = WorkspaceManager::getWorkspaces();
|
||||
|
||||
bool shiftPressed = ImGui::GetIO().KeyShift;
|
||||
@@ -634,11 +639,11 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
static void createExtrasMenu() {
|
||||
ContentRegistry::Interface::registerMainMenuItem("hex.builtin.menu.extras", 5000);
|
||||
ContentRegistry::UserInterface::registerMainMenuItem("hex.builtin.menu.extras", 5000);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.extras" }, 2600);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.extras" }, 2600);
|
||||
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.menu.extras.check_for_update" }, ICON_VS_SYNC, 2700, Shortcut::None, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.menu.extras.check_for_update" }, ICON_VS_SYNC, 2700, Shortcut::None, [] {
|
||||
TaskManager::createBackgroundTask("Checking for updates", [] {
|
||||
auto versionString = ImHexApi::System::checkForUpdate();
|
||||
if (!versionString.has_value()) {
|
||||
@@ -653,18 +658,18 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
if (ImHexApi::System::isNightlyBuild()) {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.menu.extras.switch_to_stable" }, ICON_VS_ROCKET, 2750, Shortcut::None, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.menu.extras.switch_to_stable" }, ICON_VS_ROCKET, 2750, Shortcut::None, [] {
|
||||
ImHexApi::System::updateImHex(ImHexApi::System::UpdateType::Stable);
|
||||
});
|
||||
} else {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.menu.extras.switch_to_nightly" }, ICON_VS_ROCKET, 2750, Shortcut::None, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.menu.extras.switch_to_nightly" }, ICON_VS_ROCKET, 2750, Shortcut::None, [] {
|
||||
ImHexApi::System::updateImHex(ImHexApi::System::UpdateType::Nightly);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static void createHelpMenu() {
|
||||
ContentRegistry::Interface::registerMainMenuItem("hex.builtin.menu.help", 6000);
|
||||
ContentRegistry::UserInterface::registerMainMenuItem("hex.builtin.menu.help", 6000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/hex_editor.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
@@ -9,9 +9,6 @@
|
||||
#include <pl/patterns/pattern.hpp>
|
||||
#include <wolv/utils/lock.hpp>
|
||||
|
||||
#include <wolv/utils/string.hpp>
|
||||
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/events/events_lifecycle.hpp>
|
||||
#include <hex/api/events/events_gui.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <hex/api/imhex_api/hex_editor.hpp>
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/pattern_language.hpp>
|
||||
|
||||
#include <hex/providers/provider.hpp>
|
||||
#include <hex/helpers/http_requests.hpp>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/pattern_language.hpp>
|
||||
#include <hex/helpers/encoding_file.hpp>
|
||||
|
||||
#include <hex/providers/provider.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/pattern_language.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
#include <hex/helpers/magic.hpp>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/pattern_language.hpp>
|
||||
|
||||
#include <pl/core/evaluator.hpp>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "content/views/view_hex_editor.hpp"
|
||||
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
#include <hex/helpers/crypto.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/providers/buffered_reader.hpp>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/events/events_lifecycle.hpp>
|
||||
#include <hex/api/events/requests_gui.hpp>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/provider.hpp>
|
||||
|
||||
#include "content/providers/gdb_provider.hpp"
|
||||
#include "content/providers/file_provider.hpp"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "content/providers/file_provider.hpp"
|
||||
#include "content/providers/memory_file_provider.hpp"
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
#include <hex/api/events/events_provider.hpp>
|
||||
#include <hex/api/events/events_lifecycle.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
@@ -359,7 +360,7 @@ namespace hex::plugin::builtin::recent {
|
||||
return;
|
||||
#endif
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.file" }, 1200, [] {
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.file" }, 1200, [] {
|
||||
if (menu::beginMenuEx("hex.builtin.menu.file.open_recent"_lang, ICON_VS_ARCHIVE, !recent::s_recentEntriesUpdating && !s_recentEntries.empty())) {
|
||||
// Copy to avoid changing list while iteration
|
||||
auto recentEntries = s_recentEntries;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/reports.hpp>
|
||||
#include <hex/helpers/fmt.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/experiments.hpp>
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/api/theme_manager.hpp>
|
||||
#include <hex/api/shortcut_manager.hpp>
|
||||
@@ -412,7 +415,7 @@ namespace hex::plugin::builtin {
|
||||
bool draw(const std::string &) override {
|
||||
bool changed = false;
|
||||
|
||||
const auto currIndex = std::ranges::count_if(ContentRegistry::Interface::impl::getMenuItems(), [](const auto &entry) {
|
||||
const auto currIndex = std::ranges::count_if(ContentRegistry::UserInterface::impl::getMenuItems(), [](const auto &entry) {
|
||||
return entry.second.toolbarIndex != -1;
|
||||
});
|
||||
|
||||
@@ -429,7 +432,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
// Loop over all available menu items
|
||||
for (auto &[priority, menuItem] : ContentRegistry::Interface::impl::getMenuItems()) {
|
||||
for (auto &[priority, menuItem] : ContentRegistry::UserInterface::impl::getMenuItems()) {
|
||||
ImGui::PushID(&menuItem);
|
||||
ON_SCOPE_EXIT { ImGui::PopID(); };
|
||||
|
||||
@@ -441,9 +444,9 @@ namespace hex::plugin::builtin {
|
||||
const auto &unlocalizedName = menuItem.unlocalizedNames.back();
|
||||
if (menuItem.unlocalizedNames.size() > 2)
|
||||
continue;
|
||||
if (unlocalizedName.get() == ContentRegistry::Interface::impl::SeparatorValue)
|
||||
if (unlocalizedName.get() == ContentRegistry::UserInterface::impl::SeparatorValue)
|
||||
continue;
|
||||
if (unlocalizedName.get() == ContentRegistry::Interface::impl::SubMenuValue)
|
||||
if (unlocalizedName.get() == ContentRegistry::UserInterface::impl::SubMenuValue)
|
||||
continue;
|
||||
if (menuItem.toolbarIndex != -1)
|
||||
continue;
|
||||
@@ -478,7 +481,7 @@ namespace hex::plugin::builtin {
|
||||
// Handle dropping menu items from the toolbar box
|
||||
if (ImGui::BeginDragDropTarget()) {
|
||||
if (auto payload = ImGui::AcceptDragDropPayload("TOOLBAR_ITEM_PAYLOAD"); payload != nullptr) {
|
||||
auto &menuItem = *static_cast<ContentRegistry::Interface::impl::MenuItem **>(payload->Data);
|
||||
auto &menuItem = *static_cast<ContentRegistry::UserInterface::impl::MenuItem **>(payload->Data);
|
||||
|
||||
menuItem->toolbarIndex = -1;
|
||||
changed = true;
|
||||
@@ -497,8 +500,8 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextRow();
|
||||
|
||||
// Find all menu items that are in the toolbar and sort them by their toolbar index
|
||||
std::vector<ContentRegistry::Interface::impl::MenuItem*> toolbarItems;
|
||||
for (auto &[priority, menuItem] : ContentRegistry::Interface::impl::getMenuItemsMutable()) {
|
||||
std::vector<ContentRegistry::UserInterface::impl::MenuItem*> toolbarItems;
|
||||
for (auto &[priority, menuItem] : ContentRegistry::UserInterface::impl::getMenuItemsMutable()) {
|
||||
if (menuItem.toolbarIndex == -1)
|
||||
continue;
|
||||
|
||||
@@ -520,7 +523,7 @@ namespace hex::plugin::builtin {
|
||||
const auto &unlocalizedName = menuItem->unlocalizedNames.back();
|
||||
if (menuItem->unlocalizedNames.size() > 2)
|
||||
continue;
|
||||
if (unlocalizedName.get() == ContentRegistry::Interface::impl::SubMenuValue)
|
||||
if (unlocalizedName.get() == ContentRegistry::UserInterface::impl::SubMenuValue)
|
||||
continue;
|
||||
if (menuItem->toolbarIndex == -1)
|
||||
continue;
|
||||
@@ -542,10 +545,10 @@ namespace hex::plugin::builtin {
|
||||
// Handle dropping toolbar items onto each other to reorder them
|
||||
if (ImGui::BeginDragDropTarget()) {
|
||||
if (auto payload = ImGui::AcceptDragDropPayload("TOOLBAR_ITEM_PAYLOAD"); payload != nullptr) {
|
||||
auto &otherMenuItem = *static_cast<ContentRegistry::Interface::impl::MenuItem **>(payload->Data);
|
||||
auto &otherMenuItem = *static_cast<ContentRegistry::UserInterface::impl::MenuItem **>(payload->Data);
|
||||
|
||||
// Get all toolbar items sorted by toolbarIndex
|
||||
std::vector<ContentRegistry::Interface::impl::MenuItem*> newToolbarItems = toolbarItems;
|
||||
std::vector<ContentRegistry::UserInterface::impl::MenuItem*> newToolbarItems = toolbarItems;
|
||||
|
||||
// Remove otherMenuItem from its current position
|
||||
auto it = std::ranges::find(newToolbarItems, otherMenuItem);
|
||||
@@ -636,7 +639,7 @@ namespace hex::plugin::builtin {
|
||||
// Handle dropping menu items onto the toolbar box
|
||||
if (ImGui::BeginDragDropTarget()) {
|
||||
if (auto payload = ImGui::AcceptDragDropPayload("MENU_ITEM_PAYLOAD"); payload != nullptr) {
|
||||
auto &menuItem = *static_cast<ContentRegistry::Interface::impl::MenuItem **>(payload->Data);
|
||||
auto &menuItem = *static_cast<ContentRegistry::UserInterface::impl::MenuItem **>(payload->Data);
|
||||
|
||||
menuItem->toolbarIndex = currIndex;
|
||||
changed = true;
|
||||
@@ -649,7 +652,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
ContentRegistry::Interface::updateToolbarItems();
|
||||
ContentRegistry::UserInterface::updateToolbarItems();
|
||||
}
|
||||
|
||||
return changed;
|
||||
@@ -658,7 +661,7 @@ namespace hex::plugin::builtin {
|
||||
nlohmann::json store() override {
|
||||
std::map<i32, std::pair<std::string, u32>> items;
|
||||
|
||||
for (const auto &[priority, menuItem] : ContentRegistry::Interface::impl::getMenuItems()) {
|
||||
for (const auto &[priority, menuItem] : ContentRegistry::UserInterface::impl::getMenuItems()) {
|
||||
if (menuItem.toolbarIndex != -1)
|
||||
items.emplace(menuItem.toolbarIndex, std::make_pair(menuItem.unlocalizedNames.back().get(), menuItem.icon.color));
|
||||
}
|
||||
@@ -673,14 +676,14 @@ namespace hex::plugin::builtin {
|
||||
if (data.is_array() && data.empty())
|
||||
return;
|
||||
|
||||
for (auto &[priority, menuItem] : ContentRegistry::Interface::impl::getMenuItemsMutable())
|
||||
for (auto &[priority, menuItem] : ContentRegistry::UserInterface::impl::getMenuItemsMutable())
|
||||
menuItem.toolbarIndex = -1;
|
||||
|
||||
auto toolbarItems = data.get<std::map<i32, std::pair<std::string, u32>>>();
|
||||
if (toolbarItems.empty())
|
||||
return;
|
||||
|
||||
for (auto &[priority, menuItem] : ContentRegistry::Interface::impl::getMenuItemsMutable()) {
|
||||
for (auto &[priority, menuItem] : ContentRegistry::UserInterface::impl::getMenuItemsMutable()) {
|
||||
for (const auto &[index, value] : toolbarItems) {
|
||||
const auto &[name, color] = value;
|
||||
if (menuItem.unlocalizedNames.back().get() == name) {
|
||||
@@ -691,7 +694,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
ContentRegistry::Interface::updateToolbarItems();
|
||||
ContentRegistry::UserInterface::updateToolbarItems();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/helpers/scaling.hpp>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
|
||||
#include <hex/helpers/http_requests.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/tools.hpp>
|
||||
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
@@ -29,7 +30,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void addTitleBarButtons() {
|
||||
if (dbg::debugModeEnabled()) {
|
||||
ContentRegistry::Interface::addTitleBarButton(ICON_VS_DEBUG, ImGuiCustomCol_ToolbarGray, "hex.builtin.title_bar_button.debug_build", []{
|
||||
ContentRegistry::UserInterface::addTitleBarButton(ICON_VS_DEBUG, ImGuiCustomCol_ToolbarGray, "hex.builtin.title_bar_button.debug_build", []{
|
||||
if (ImGui::GetIO().KeyShift) {
|
||||
RequestOpenPopup::post("DebugMenu");
|
||||
} else {
|
||||
@@ -38,7 +39,7 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
}
|
||||
|
||||
ContentRegistry::Interface::addTitleBarButton(ICON_VS_SMILEY, ImGuiCustomCol_ToolbarGray, "hex.builtin.title_bar_button.feedback", []{
|
||||
ContentRegistry::UserInterface::addTitleBarButton(ICON_VS_SMILEY, ImGuiCustomCol_ToolbarGray, "hex.builtin.title_bar_button.feedback", []{
|
||||
hex::openWebpage("https://github.com/WerWolv/ImHex/discussions/categories/feedback");
|
||||
});
|
||||
|
||||
@@ -223,7 +224,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void addFooterItems() {
|
||||
if (hex::isProcessElevated()) {
|
||||
ContentRegistry::Interface::addFooterItem([] {
|
||||
ContentRegistry::UserInterface::addFooterItem([] {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiExt::GetCustomColorU32(ImGuiCustomCol_Highlight));
|
||||
ImGui::TextUnformatted(ICON_VS_SHIELD);
|
||||
ImGui::PopStyleColor();
|
||||
@@ -231,7 +232,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
if (dbg::debugModeEnabled()) {
|
||||
ContentRegistry::Interface::addFooterItem([] {
|
||||
ContentRegistry::UserInterface::addFooterItem([] {
|
||||
static float framerate = 0;
|
||||
if (ImGuiExt::HasSecondPassed()) {
|
||||
framerate = 1.0F / ImGui::GetIO().DeltaTime;
|
||||
@@ -273,7 +274,7 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
}
|
||||
|
||||
ContentRegistry::Interface::addFooterItem([] {
|
||||
ContentRegistry::UserInterface::addFooterItem([] {
|
||||
static bool shouldResetProgress = false;
|
||||
|
||||
auto taskCount = TaskManager::getRunningTaskCount();
|
||||
@@ -452,11 +453,11 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
// Toolbar items
|
||||
ContentRegistry::Interface::addToolbarItem([] {
|
||||
ContentRegistry::UserInterface::addToolbarItem([] {
|
||||
|
||||
for (const auto &menuItem : ContentRegistry::Interface::impl::getToolbarMenuItems()) {
|
||||
for (const auto &menuItem : ContentRegistry::UserInterface::impl::getToolbarMenuItems()) {
|
||||
const auto &unlocalizedItemName = menuItem->unlocalizedNames.back();
|
||||
if (unlocalizedItemName.get() == ContentRegistry::Interface::impl::SeparatorValue) {
|
||||
if (unlocalizedItemName.get() == ContentRegistry::UserInterface::impl::SeparatorValue) {
|
||||
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
||||
continue;
|
||||
}
|
||||
@@ -472,7 +473,7 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
// Provider switcher
|
||||
ContentRegistry::Interface::addToolbarItem([] {
|
||||
ContentRegistry::UserInterface::addToolbarItem([] {
|
||||
const bool providerValid = ImHexApi::Provider::get() != nullptr;
|
||||
const bool tasksRunning = TaskManager::getRunningTaskCount() > 0;
|
||||
|
||||
@@ -549,13 +550,13 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
EventImHexStartupFinished::subscribe([] {
|
||||
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.edit.undo", ImGuiCustomCol_ToolbarBlue);
|
||||
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.edit.redo", ImGuiCustomCol_ToolbarBlue);
|
||||
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.menu.file.create_file", ImGuiCustomCol_ToolbarGray);
|
||||
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.menu.file.open_file", ImGuiCustomCol_ToolbarBrown);
|
||||
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.file.save", ImGuiCustomCol_ToolbarBlue);
|
||||
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.file.save_as", ImGuiCustomCol_ToolbarBlue);
|
||||
ContentRegistry::Interface::addMenuItemToToolbar("hex.builtin.menu.edit.bookmark.create", ImGuiCustomCol_ToolbarGreen);
|
||||
ContentRegistry::UserInterface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.edit.undo", ImGuiCustomCol_ToolbarBlue);
|
||||
ContentRegistry::UserInterface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.edit.redo", ImGuiCustomCol_ToolbarBlue);
|
||||
ContentRegistry::UserInterface::addMenuItemToToolbar("hex.builtin.menu.file.create_file", ImGuiCustomCol_ToolbarGray);
|
||||
ContentRegistry::UserInterface::addMenuItemToToolbar("hex.builtin.menu.file.open_file", ImGuiCustomCol_ToolbarBrown);
|
||||
ContentRegistry::UserInterface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.file.save", ImGuiCustomCol_ToolbarBlue);
|
||||
ContentRegistry::UserInterface::addMenuItemToToolbar("hex.builtin.view.hex_editor.menu.file.save_as", ImGuiCustomCol_ToolbarBlue);
|
||||
ContentRegistry::UserInterface::addMenuItemToToolbar("hex.builtin.menu.edit.bookmark.create", ImGuiCustomCol_ToolbarGreen);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <content/views/fullscreen/view_fullscreen_save_editor.hpp>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/pattern_language.hpp>
|
||||
|
||||
#include <fonts/vscode_icons.hpp>
|
||||
#include <toasts/toast_notification.hpp>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "hex/ui/popup.hpp"
|
||||
|
||||
#include <hex/api_urls.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
#include <hex/api/plugin_manager.hpp>
|
||||
|
||||
@@ -11,16 +11,15 @@
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <hex/helpers/http_requests.hpp>
|
||||
#include <hex/helpers/default_paths.hpp>
|
||||
|
||||
#include <content/popups/popup_docs_question.hpp>
|
||||
#include <hex/helpers/menu_items.hpp>
|
||||
|
||||
#include <fonts/vscode_icons.hpp>
|
||||
|
||||
#include <romfs/romfs.hpp>
|
||||
#include <wolv/utils/string.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <hex/helpers/menu_items.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
@@ -80,13 +79,13 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ViewAbout::ViewAbout() : View::Modal("hex.builtin.view.help.about.name", ICON_VS_HEART) {
|
||||
// Add "About" menu item to the help menu
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.help.about.name" }, ICON_VS_INFO, 1000, Shortcut::None, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.help.about.name" }, ICON_VS_INFO, 1000, Shortcut::None, [this] {
|
||||
this->getWindowOpenState() = true;
|
||||
});
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.help" }, 2000);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.help" }, 2000);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.help" }, 3000, [] {
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.help" }, 3000, [] {
|
||||
if (menu::isNativeMenuBarUsed())
|
||||
return;
|
||||
|
||||
@@ -100,11 +99,11 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PopStyleVar();
|
||||
});
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.help" }, 4000);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.help" }, 4000);
|
||||
|
||||
|
||||
// Add documentation link to the help menu
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.help.documentation" }, ICON_VS_BOOK, 5000, Shortcut::None, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.help.documentation" }, ICON_VS_BOOK, 5000, Shortcut::None, [] {
|
||||
hex::openWebpage("https://docs.werwolv.net/imhex");
|
||||
AchievementManager::unlockAchievement("hex.builtin.achievement.starting_out", "hex.builtin.achievement.starting_out.docs.name");
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "content/views/view_achievements.hpp"
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
#include <hex/api/events/requests_gui.hpp>
|
||||
#include <hex/api/events/events_interaction.hpp>
|
||||
@@ -14,7 +15,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ViewAchievements::ViewAchievements() : View::Floating("hex.builtin.view.achievements.name", ICON_VS_SPARKLE) {
|
||||
// Add achievements menu item to Extas menu
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.achievements.name" }, ICON_VS_SPARKLE, 2600, Shortcut::None, [&, this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.achievements.name" }, ICON_VS_SPARKLE, 2600, Shortcut::None, [&, this] {
|
||||
this->getWindowOpenState() = true;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "content/views/view_bookmarks.hpp"
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/reports.hpp>
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
@@ -600,7 +602,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void ViewBookmarks::registerMenuItems() {
|
||||
/* Create bookmark */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.menu.edit.bookmark.create" }, ICON_VS_BOOKMARK, 1900, CTRLCMD + Keys::B, [&] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.menu.edit.bookmark.create" }, ICON_VS_BOOKMARK, 1900, CTRLCMD + Keys::B, [&] {
|
||||
if (!ImHexApi::HexEditor::isSelectionValid())
|
||||
return;
|
||||
|
||||
@@ -610,10 +612,10 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::Views::getViewByName("hex.builtin.view.hex_editor.name"));
|
||||
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.file", "hex.builtin.menu.file.import" }, 5400);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.file", "hex.builtin.menu.file.import" }, 5400);
|
||||
|
||||
/* Import bookmarks */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.bookmark" }, ICON_VS_BOOKMARK, 5500, Shortcut::None, [this]{
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.bookmark" }, ICON_VS_BOOKMARK, 5500, Shortcut::None, [this]{
|
||||
fs::openFileBrowser(fs::DialogMode::Open, { { "Bookmarks File", "hexbm"} }, [&, this](const std::fs::path &path) {
|
||||
try {
|
||||
this->importBookmarks(ImHexApi::Provider::get(), nlohmann::json::parse(wolv::io::File(path, wolv::io::File::Mode::Read).readString()));
|
||||
@@ -621,11 +623,11 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
}, ImHexApi::Provider::isValid);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.file", "hex.builtin.menu.file.export" }, 6200);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.file", "hex.builtin.menu.file.export" }, 6200);
|
||||
|
||||
|
||||
/* Export bookmarks */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.bookmark" }, ICON_VS_BOOKMARK, 6250, Shortcut::None, [this]{
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.bookmark" }, ICON_VS_BOOKMARK, 6250, Shortcut::None, [this]{
|
||||
fs::openFileBrowser(fs::DialogMode::Save, { { "Bookmarks File", "hexbm"} }, [&, this](const std::fs::path &path) {
|
||||
nlohmann::json json;
|
||||
this->exportBookmarks(ImHexApi::Provider::get(), json);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "content/views/view_command_palette.hpp"
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/command_palette.hpp>
|
||||
#include <wolv/utils/guards.hpp>
|
||||
#include <hex/api/events/requests_gui.hpp>
|
||||
#include <hex/api/events/events_interaction.hpp>
|
||||
@@ -177,7 +177,7 @@ namespace hex::plugin::builtin {
|
||||
std::vector<CommandResult> results;
|
||||
|
||||
// Loop over every registered command and check if the input matches it
|
||||
for (const auto &[type, command, unlocalizedDescription, displayCallback, executeCallback] : ContentRegistry::CommandPaletteCommands::impl::getEntries()) {
|
||||
for (const auto &[type, command, unlocalizedDescription, displayCallback, executeCallback] : ContentRegistry::CommandPalette::impl::getEntries()) {
|
||||
|
||||
auto AutoComplete = [this, currCommand = command](auto) {
|
||||
this->focusInputTextBox();
|
||||
@@ -187,7 +187,7 @@ namespace hex::plugin::builtin {
|
||||
return std::nullopt;
|
||||
};
|
||||
|
||||
if (type == ContentRegistry::CommandPaletteCommands::Type::SymbolCommand) {
|
||||
if (type == ContentRegistry::CommandPalette::Type::SymbolCommand) {
|
||||
// Handle symbol commands
|
||||
// These commands are used by entering a single symbol and then any input
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace hex::plugin::builtin {
|
||||
results.push_back({ displayCallback(matchedCommand), matchedCommand, executeCallback });
|
||||
}
|
||||
}
|
||||
} else if (type == ContentRegistry::CommandPaletteCommands::Type::KeywordCommand) {
|
||||
} else if (type == ContentRegistry::CommandPalette::Type::KeywordCommand) {
|
||||
// Handle keyword commands
|
||||
// These commands are used by entering a keyword followed by a space and then any input
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
// WHen a command has been identified, show the query results for that command
|
||||
for (const auto &handler : ContentRegistry::CommandPaletteCommands::impl::getHandlers()) {
|
||||
for (const auto &handler : ContentRegistry::CommandPalette::impl::getHandlers()) {
|
||||
const auto &[type, command, queryCallback, displayCallback] = handler;
|
||||
|
||||
auto processedInput = input;
|
||||
@@ -223,11 +223,11 @@ namespace hex::plugin::builtin {
|
||||
processedInput = wolv::util::trim(processedInput.substr(command.length()));
|
||||
|
||||
for (const auto &[description, callback] : queryCallback(processedInput)) {
|
||||
if (type == ContentRegistry::CommandPaletteCommands::Type::SymbolCommand) {
|
||||
if (type == ContentRegistry::CommandPalette::Type::SymbolCommand) {
|
||||
if (auto [match, value] = MatchCommand(input, command); match != MatchType::NoMatch) {
|
||||
results.push_back({ fmt::format("{} ({})", command, description), "", [callback](auto ... args){ callback(args...); return std::nullopt; } });
|
||||
}
|
||||
} else if (type == ContentRegistry::CommandPaletteCommands::Type::KeywordCommand) {
|
||||
} else if (type == ContentRegistry::CommandPalette::Type::KeywordCommand) {
|
||||
if (auto [match, value] = MatchCommand(input, command + " "); match != MatchType::NoMatch) {
|
||||
results.push_back({ fmt::format("{} ({})", command, description), "", [callback](auto ... args){ callback(args...); return std::nullopt; } });
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "content/views/view_data_inspector.hpp"
|
||||
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/default_paths.hpp>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "content/views/view_data_processor.hpp"
|
||||
#include <toasts/toast_notification.hpp>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/file_type_handler.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
|
||||
@@ -355,9 +357,9 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
ViewDataProcessor::ViewDataProcessor() : View::Window("hex.builtin.view.data_processor.name", ICON_VS_CHIP) {
|
||||
ContentRegistry::DataProcessorNode::add<NodeCustom>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.custom", this);
|
||||
ContentRegistry::DataProcessorNode::add<NodeCustomInput>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.input");
|
||||
ContentRegistry::DataProcessorNode::add<NodeCustomOutput>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.output");
|
||||
ContentRegistry::DataProcessor::add<NodeCustom>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.custom", this);
|
||||
ContentRegistry::DataProcessor::add<NodeCustomInput>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.input");
|
||||
ContentRegistry::DataProcessor::add<NodeCustomOutput>("hex.builtin.nodes.custom", "hex.builtin.nodes.custom.output");
|
||||
|
||||
ProjectFile::registerPerProviderHandler({
|
||||
.basePath = "data_processor.json",
|
||||
@@ -398,7 +400,7 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
/* Import Nodes */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.data_processor" }, ICON_VS_CHIP, 5600, Shortcut::None, [this]{
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.data_processor" }, ICON_VS_CHIP, 5600, Shortcut::None, [this]{
|
||||
fs::openFileBrowser(fs::DialogMode::Open, { {"hex.builtin.view.data_processor.name"_lang, "hexnode" } },
|
||||
[&](const std::fs::path &path) {
|
||||
wolv::io::File file(path, wolv::io::File::Mode::Read);
|
||||
@@ -410,7 +412,7 @@ namespace hex::plugin::builtin {
|
||||
}, ImHexApi::Provider::isValid);
|
||||
|
||||
/* Export Nodes */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.data_processor" }, ICON_VS_CHIP, 8050, Shortcut::None, [this]{
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.data_processor" }, ICON_VS_CHIP, 8050, Shortcut::None, [this]{
|
||||
fs::openFileBrowser(fs::DialogMode::Save, { {"hex.builtin.view.data_processor.name"_lang, "hexnode" } },
|
||||
[&, this](const std::fs::path &path) {
|
||||
wolv::io::File file(path, wolv::io::File::Mode::Create);
|
||||
@@ -421,7 +423,7 @@ namespace hex::plugin::builtin {
|
||||
return ImHexApi::Provider::isValid() && !m_workspaceStack->empty() && !m_workspaceStack->back()->nodes.empty();
|
||||
});
|
||||
|
||||
ContentRegistry::FileHandler::add({ ".hexnode" }, [this](const auto &path) {
|
||||
ContentRegistry::FileTypeHandler::add({ ".hexnode" }, [this](const auto &path) {
|
||||
wolv::io::File file(path, wolv::io::File::Mode::Read);
|
||||
if (!file.isValid()) return false;
|
||||
|
||||
@@ -685,7 +687,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
// Draw all nodes that are registered in the content registry
|
||||
for (const auto &[unlocalizedCategory, unlocalizedName, function] : ContentRegistry::DataProcessorNode::impl::getEntries()) {
|
||||
for (const auto &[unlocalizedCategory, unlocalizedName, function] : ContentRegistry::DataProcessor::impl::getEntries()) {
|
||||
if (unlocalizedCategory.empty() && unlocalizedName.empty()) {
|
||||
// Draw a separator if the node has no category and no name
|
||||
ImGui::Separator();
|
||||
@@ -1147,7 +1149,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
std::unique_ptr<dp::Node> ViewDataProcessor::loadNode(nlohmann::json data) {
|
||||
try {
|
||||
auto &nodeEntries = ContentRegistry::DataProcessorNode::impl::getEntries();
|
||||
auto &nodeEntries = ContentRegistry::DataProcessor::impl::getEntries();
|
||||
|
||||
std::unique_ptr<dp::Node> newNode;
|
||||
for (auto &entry : nodeEntries) {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "content/views/view_hex_editor.hpp"
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/data_formatter.hpp>
|
||||
#include <hex/api/content_registry/pattern_language.hpp>
|
||||
#include <hex/api/shortcut_manager.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
@@ -1195,7 +1198,7 @@ namespace hex::plugin::builtin {
|
||||
showSelectionInWindowFooter = !show;
|
||||
});
|
||||
|
||||
ContentRegistry::Interface::addFooterItem([] {
|
||||
ContentRegistry::UserInterface::addFooterItem([] {
|
||||
if (!showSelectionInWindowFooter) return;
|
||||
|
||||
if (auto selection = ImHexApi::HexEditor::getSelection(); selection.has_value()) {
|
||||
@@ -1210,23 +1213,23 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void ViewHexEditor::registerMenuItems() {
|
||||
/* Undo */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.undo" }, ICON_VS_DISCARD, 1000, CTRLCMD + Keys::Z, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.undo" }, ICON_VS_DISCARD, 1000, CTRLCMD + Keys::Z, [] {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
provider->undo();
|
||||
}, [&] { return ImHexApi::Provider::isValid() && ImHexApi::Provider::get()->canUndo(); },
|
||||
this);
|
||||
|
||||
/* Redo */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.redo" }, ICON_VS_REDO, 1050, CTRLCMD + Keys::Y, [] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.redo" }, ICON_VS_REDO, 1050, CTRLCMD + Keys::Y, [] {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
provider->redo();
|
||||
}, [&] { return ImHexApi::Provider::isValid() && ImHexApi::Provider::get()->canRedo(); },
|
||||
this);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 1300);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 1300);
|
||||
|
||||
/* Save */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.save" }, ICON_VS_SAVE, 1350,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.save" }, ICON_VS_SAVE, 1350,
|
||||
CTRLCMD + Keys::S,
|
||||
save,
|
||||
[] {
|
||||
@@ -1238,7 +1241,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Save As */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.save_as" }, ICON_VS_SAVE_AS, 1375,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.save_as" }, ICON_VS_SAVE_AS, 1375,
|
||||
CTRLCMD + SHIFT + Keys::S,
|
||||
saveAs,
|
||||
[] {
|
||||
@@ -1250,7 +1253,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Load Encoding File */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.custom_encoding" }, "あ", 5700, Shortcut::None,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.custom_encoding" }, "あ", 5700, Shortcut::None,
|
||||
[this]{
|
||||
const auto basePaths = paths::Encodings.read();
|
||||
std::vector<std::fs::path> paths;
|
||||
@@ -1278,10 +1281,10 @@ namespace hex::plugin::builtin {
|
||||
ImHexApi::Provider::isValid,
|
||||
this);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 1500, this);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 1500, this);
|
||||
|
||||
/* Search */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.search" }, ICON_VS_SEARCH, 1550,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.search" }, ICON_VS_SEARCH, 1550,
|
||||
CTRLCMD + Keys::F,
|
||||
[this] {
|
||||
this->openPopup<PopupFind>(this);
|
||||
@@ -1290,7 +1293,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Goto */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.goto" }, ICON_VS_DEBUG_STEP_INTO, 1600,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.goto" }, ICON_VS_DEBUG_STEP_INTO, 1600,
|
||||
CTRLCMD + Keys::G,
|
||||
[this] {
|
||||
this->openPopup<PopupGoto>();
|
||||
@@ -1299,12 +1302,12 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Skip until */
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.skip_until" }, ICON_VS_DEBUG_STEP_OVER, 1610,
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.file", "hex.builtin.view.hex_editor.menu.file.skip_until" }, ICON_VS_DEBUG_STEP_OVER, 1610,
|
||||
[]{},
|
||||
canSearchForDifferingByte);
|
||||
|
||||
/* Skip until previous differing byte */
|
||||
ContentRegistry::Interface::addMenuItem({
|
||||
ContentRegistry::UserInterface::addMenuItem({
|
||||
"hex.builtin.menu.file",
|
||||
"hex.builtin.view.hex_editor.menu.file.skip_until",
|
||||
"hex.builtin.view.hex_editor.menu.file.skip_until.previous_differing_byte"
|
||||
@@ -1343,7 +1346,7 @@ namespace hex::plugin::builtin {
|
||||
canSearchForDifferingByte);
|
||||
|
||||
/* Skip until next differing byte */
|
||||
ContentRegistry::Interface::addMenuItem({
|
||||
ContentRegistry::UserInterface::addMenuItem({
|
||||
"hex.builtin.menu.file",
|
||||
"hex.builtin.view.hex_editor.menu.file.skip_until",
|
||||
"hex.builtin.view.hex_editor.menu.file.skip_until.next_differing_byte"
|
||||
@@ -1382,10 +1385,10 @@ namespace hex::plugin::builtin {
|
||||
canSearchForDifferingByte);
|
||||
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.edit" }, 1100, this);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.edit" }, 1100, this);
|
||||
|
||||
/* Copy */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy" }, ICON_VS_COPY, 1150,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy" }, ICON_VS_COPY, 1150,
|
||||
CurrentView + CTRLCMD + Keys::C,
|
||||
[] {
|
||||
auto selection = ImHexApi::HexEditor::getSelection();
|
||||
@@ -1395,10 +1398,10 @@ namespace hex::plugin::builtin {
|
||||
ImHexApi::HexEditor::isSelectionValid,
|
||||
this);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as" }, ICON_VS_PREVIEW, 1190, []{}, ImHexApi::HexEditor::isSelectionValid, this);
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as" }, ICON_VS_PREVIEW, 1190, []{}, ImHexApi::HexEditor::isSelectionValid, this);
|
||||
|
||||
/* Copy As */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as", "hex.builtin.view.hex_editor.copy.ascii" }, ICON_VS_SYMBOL_KEY, 1200,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as", "hex.builtin.view.hex_editor.copy.ascii" }, ICON_VS_SYMBOL_KEY, 1200,
|
||||
CurrentView + CTRLCMD + ALT + Keys::C,
|
||||
[] {
|
||||
auto selection = ImHexApi::HexEditor::getSelection();
|
||||
@@ -1409,7 +1412,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Copy address */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as", "hex.builtin.view.hex_editor.copy.address" }, ICON_VS_LOCATION, 1250,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as", "hex.builtin.view.hex_editor.copy.address" }, ICON_VS_LOCATION, 1250,
|
||||
Shortcut::None,
|
||||
[] {
|
||||
auto selection = ImHexApi::HexEditor::getSelection();
|
||||
@@ -1420,7 +1423,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Copy custom encoding */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as", "hex.builtin.view.hex_editor.copy.custom_encoding" }, "あ", 1300,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as", "hex.builtin.view.hex_editor.copy.custom_encoding" }, "あ", 1300,
|
||||
SHIFT + ALT + Keys::C,
|
||||
[this] {
|
||||
auto selection = ImHexApi::HexEditor::getSelection();
|
||||
@@ -1433,10 +1436,10 @@ namespace hex::plugin::builtin {
|
||||
},
|
||||
this);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as" }, 1350, this);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as" }, 1350, this);
|
||||
|
||||
/* Copy as... */
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as" }, ICON_VS_FILE_CODE, 1400, []{
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.copy_as" }, ICON_VS_FILE_CODE, 1400, []{
|
||||
auto selection = ImHexApi::HexEditor::getSelection();
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
|
||||
@@ -1476,7 +1479,7 @@ namespace hex::plugin::builtin {
|
||||
}, this);
|
||||
|
||||
/* Paste */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste" }, ICON_VS_OUTPUT, 1450, CurrentView + CTRLCMD + Keys::V,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste" }, ICON_VS_OUTPUT, 1450, CurrentView + CTRLCMD + Keys::V,
|
||||
[this] {
|
||||
processPasteBehaviour(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { 0, 0 }, ImHexApi::Provider::get())));
|
||||
},
|
||||
@@ -1484,10 +1487,10 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Paste... */
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste_as" }, ICON_VS_CLIPPY, 1490, []{}, ImHexApi::HexEditor::isSelectionValid, this);
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste_as" }, ICON_VS_CLIPPY, 1490, []{}, ImHexApi::HexEditor::isSelectionValid, this);
|
||||
|
||||
/* Paste... > Paste all */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste_as", "hex.builtin.view.hex_editor.menu.edit.paste_all" }, ICON_VS_CLIPPY, 1500, CurrentView + CTRLCMD + SHIFT + Keys::V,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste_as", "hex.builtin.view.hex_editor.menu.edit.paste_all" }, ICON_VS_CLIPPY, 1500, CurrentView + CTRLCMD + SHIFT + Keys::V,
|
||||
[] {
|
||||
pasteBytes(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { 0, 0 }, ImHexApi::Provider::get())), false, false);
|
||||
},
|
||||
@@ -1495,7 +1498,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Paste... > Paste all as string */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste_as", "hex.builtin.view.hex_editor.menu.edit.paste_all_string" }, ICON_VS_SYMBOL_KEY, 1510,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.paste_as", "hex.builtin.view.hex_editor.menu.edit.paste_all_string" }, ICON_VS_SYMBOL_KEY, 1510,
|
||||
Shortcut::None,
|
||||
[] {
|
||||
pasteBytes(ImHexApi::HexEditor::getSelection().value_or( ImHexApi::HexEditor::ProviderRegion(Region { 0, 0 }, ImHexApi::Provider::get())), false, true);
|
||||
@@ -1504,7 +1507,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Select */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.select" }, ICON_VS_LIST_SELECTION, 1525,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.select" }, ICON_VS_LIST_SELECTION, 1525,
|
||||
CTRLCMD + SHIFT + Keys::A,
|
||||
[this] {
|
||||
auto selection = ImHexApi::HexEditor::getSelection().value_or(ImHexApi::HexEditor::ProviderRegion{ { 0, 1 }, nullptr });
|
||||
@@ -1514,7 +1517,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Select All */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.select_all" }, ICON_VS_LIST_FLAT, 1550, CurrentView + CTRLCMD + Keys::A,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.select_all" }, ICON_VS_LIST_FLAT, 1550, CurrentView + CTRLCMD + Keys::A,
|
||||
[] {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
ImHexApi::HexEditor::setSelection(provider->getBaseAddress(), provider->getActualSize());
|
||||
@@ -1523,10 +1526,10 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.edit" }, 1600, this);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.edit" }, 1600, this);
|
||||
|
||||
/* Set Base Address */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.set_base" }, ICON_VS_LOCATION, 1650, Shortcut::None,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.set_base" }, ICON_VS_LOCATION, 1650, Shortcut::None,
|
||||
[this] {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
this->openPopup<PopupBaseAddress>(provider->getBaseAddress());
|
||||
@@ -1535,7 +1538,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Resize */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.resize" }, ICON_VS_ARROW_BOTH, 1700, Shortcut::None,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.resize" }, ICON_VS_ARROW_BOTH, 1700, Shortcut::None,
|
||||
[this] {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
this->openPopup<PopupResize>(provider->getActualSize());
|
||||
@@ -1544,7 +1547,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Insert */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.insert" }, ICON_VS_INSERT, 1750, Shortcut::None,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.insert" }, ICON_VS_INSERT, 1750, Shortcut::None,
|
||||
[this] {
|
||||
auto selection = ImHexApi::HexEditor::getSelection();
|
||||
|
||||
@@ -1554,7 +1557,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Remove */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.remove" }, ICON_VS_CLEAR_ALL, 1800, Shortcut::None,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.remove" }, ICON_VS_CLEAR_ALL, 1800, Shortcut::None,
|
||||
[this] {
|
||||
auto selection = ImHexApi::HexEditor::getSelection();
|
||||
|
||||
@@ -1564,7 +1567,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Fill */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.fill" }, ICON_VS_PAINTCAN, 1810, Shortcut::None,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.fill" }, ICON_VS_PAINTCAN, 1810, Shortcut::None,
|
||||
[this] {
|
||||
auto selection = ImHexApi::HexEditor::getSelection();
|
||||
|
||||
@@ -1574,7 +1577,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Toggle Overwrite/Insert mode */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.insert_mode" }, ICON_VS_EDIT, 1820, Shortcut::None,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.insert_mode" }, ICON_VS_EDIT, 1820, Shortcut::None,
|
||||
[this] {
|
||||
if (m_hexEditor.getMode() == ui::HexEditor::Mode::Insert)
|
||||
m_hexEditor.setMode(ui::HexEditor::Mode::Overwrite);
|
||||
@@ -1593,7 +1596,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Jump to */
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.jump_to" }, ICON_VS_DEBUG_STEP_OUT, 1850,
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.jump_to" }, ICON_VS_DEBUG_STEP_OUT, 1850,
|
||||
[] {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
if (provider == nullptr)
|
||||
@@ -1639,7 +1642,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Set Page Size */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.set_page_size" }, ICON_VS_BROWSER, 1860, Shortcut::None,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.set_page_size" }, ICON_VS_BROWSER, 1860, Shortcut::None,
|
||||
[this] {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
this->openPopup<PopupPageSize>(provider->getPageSize());
|
||||
@@ -1647,10 +1650,10 @@ namespace hex::plugin::builtin {
|
||||
[] { return ImHexApi::Provider::isValid() && ImHexApi::Provider::get()->isReadable(); },
|
||||
this);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.edit" }, 1900, this);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.edit" }, 1900, this);
|
||||
|
||||
/* Open in new provider */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.open_in_new_provider" }, ICON_VS_GO_TO_FILE, 1950, Shortcut::None,
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.hex_editor.menu.edit.open_in_new_provider" }, ICON_VS_GO_TO_FILE, 1950, Shortcut::None,
|
||||
[] {
|
||||
auto selection = ImHexApi::HexEditor::getSelection();
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
#include "content/views/view_highlight_rules.hpp"
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
#include <hex/api/events/events_provider.hpp>
|
||||
#include <hex/api/events/events_interaction.hpp>
|
||||
|
||||
#include <imgui_internal.h>
|
||||
|
||||
#include <wolv/utils/guards.hpp>
|
||||
|
||||
#include <fonts/vscode_icons.hpp>
|
||||
#include <imgui_internal.h>
|
||||
#include <wolv/utils/guards.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
@@ -115,7 +116,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
ViewHighlightRules::ViewHighlightRules() : View::Floating("hex.builtin.view.highlight_rules.name", ICON_VS_TAG) {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.highlight_rules.menu.edit.rules" }, ICON_VS_TAG, 1950, Shortcut::None, [&, this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.highlight_rules.menu.edit.rules" }, ICON_VS_TAG, 1950, Shortcut::None, [&, this] {
|
||||
this->getWindowOpenState() = true;
|
||||
}, ImHexApi::Provider::isValid,
|
||||
ContentRegistry::Views::getViewByName("hex.builtin.view.hex_editor.name"));
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
#include "content/views/view_information.hpp"
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/data_information.hpp>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
|
||||
#include <hex/providers/provider.hpp>
|
||||
|
||||
#include <hex/helpers/magic.hpp>
|
||||
|
||||
#include <toasts/toast_notification.hpp>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
using namespace hex::literals;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "content/views/view_logs.hpp"
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
|
||||
#include <fonts/vscode_icons.hpp>
|
||||
@@ -8,7 +8,7 @@
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
ViewLogs::ViewLogs() : View::Floating("hex.builtin.view.logs.name", ICON_VS_DEBUG_LINE_BY_LINE) {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.logs.name" }, ICON_VS_BRACKET_ERROR, 2500, Shortcut::None, [&, this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.logs.name" }, ICON_VS_BRACKET_ERROR, 2500, Shortcut::None, [&, this] {
|
||||
this->getWindowOpenState() = true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <content/views/view_pattern_data.hpp>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/providers/memory_provider.hpp>
|
||||
#include <hex/api/events/requests_interaction.hpp>
|
||||
#include <hex/api/events/events_interaction.hpp>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#include "content/views/view_pattern_editor.hpp"
|
||||
#include <fonts/blender_icons.hpp>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/file_type_handler.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
#include <hex/api/content_registry/reports.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
|
||||
#include <hex/api/events/events_provider.hpp>
|
||||
@@ -1994,13 +1998,13 @@ namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
/* Open File */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.file.open_pattern" }, ICON_VS_FOLDER_OPENED, 1100, AllowWhileTyping + CTRLCMD + Keys::O, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.file.open_pattern" }, ICON_VS_FOLDER_OPENED, 1100, AllowWhileTyping + CTRLCMD + Keys::O, [this] {
|
||||
m_openPatternFile(true);
|
||||
}, [] { return ImHexApi::Provider::isValid(); },
|
||||
this);
|
||||
|
||||
/* Save */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.file.save_pattern" }, ICON_VS_SAVE, 1350, AllowWhileTyping + CTRLCMD + Keys::S, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.file.save_pattern" }, ICON_VS_SAVE, 1350, AllowWhileTyping + CTRLCMD + Keys::S, [this] {
|
||||
m_savePatternFile(true);
|
||||
},[this] {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
@@ -2011,24 +2015,24 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Save As */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.file.save_pattern_as" }, ICON_VS_SAVE_AS, 1375, AllowWhileTyping + CTRLCMD + SHIFT + Keys::S, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.file.save_pattern_as" }, ICON_VS_SAVE_AS, 1375, AllowWhileTyping + CTRLCMD + SHIFT + Keys::S, [this] {
|
||||
m_savePatternAsFile(true);
|
||||
},[] {
|
||||
return ImHexApi::Provider::isValid();
|
||||
},
|
||||
this);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 1500, this);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.file" }, 1500, this);
|
||||
|
||||
/* Find */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.find" }, ICON_VS_SEARCH, 1510, AllowWhileTyping + CTRLCMD + Keys::F, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.find" }, ICON_VS_SEARCH, 1510, AllowWhileTyping + CTRLCMD + Keys::F, [this] {
|
||||
m_replaceMode = false;
|
||||
m_openFindReplacePopUp = true;
|
||||
}, [] { return true; },
|
||||
this);
|
||||
|
||||
/* Find Next */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.find_next" }, 1520, AllowWhileTyping + Keys::F3, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.find_next" }, 1520, AllowWhileTyping + Keys::F3, [this] {
|
||||
if (auto editor = getEditorFromFocusedWindow(); editor != nullptr) {
|
||||
ui::TextEditor::FindReplaceHandler *findReplaceHandler = editor->getFindReplaceHandler();
|
||||
findReplaceHandler->findMatch(editor, true);
|
||||
@@ -2046,7 +2050,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Find Previous */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.find_previous" }, 1530, AllowWhileTyping + SHIFT + Keys::F3, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.find_previous" }, 1530, AllowWhileTyping + SHIFT + Keys::F3, [this] {
|
||||
if (auto editor = getEditorFromFocusedWindow(); editor != nullptr) {
|
||||
ui::TextEditor::FindReplaceHandler *findReplaceHandler = editor->getFindReplaceHandler();
|
||||
findReplaceHandler->findMatch(editor, false);
|
||||
@@ -2064,74 +2068,74 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Replace */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.replace" }, ICON_VS_REPLACE, 1540, AllowWhileTyping + CTRLCMD + Keys::H, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.replace" }, ICON_VS_REPLACE, 1540, AllowWhileTyping + CTRLCMD + Keys::H, [this] {
|
||||
m_replaceMode = true;
|
||||
m_openFindReplacePopUp = true;
|
||||
}, [this] { return m_focusedSubWindowName.contains(textEditorView); },
|
||||
this);
|
||||
|
||||
/* Replace Next */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.replace_next" }, 1550, Shortcut::None, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.replace_next" }, 1550, Shortcut::None, [this] {
|
||||
m_textEditor->getFindReplaceHandler()->replace(&*m_textEditor, true);
|
||||
}, [this] { return ImHexApi::Provider::isValid() && !m_textEditor->getFindReplaceHandler()->getReplaceWord().empty() && m_focusedSubWindowName.contains(textEditorView); },
|
||||
[]{ return false; },
|
||||
this);
|
||||
|
||||
/* Replace Previous */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.replace_previous" }, 1560, Shortcut::None, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.replace_previous" }, 1560, Shortcut::None, [this] {
|
||||
m_textEditor->getFindReplaceHandler()->replace(&*m_textEditor, false);
|
||||
}, [this] { return ImHexApi::Provider::isValid() && !m_textEditor->getFindReplaceHandler()->getReplaceWord().empty() && m_focusedSubWindowName.contains(textEditorView); },
|
||||
[]{ return false; },
|
||||
this);
|
||||
|
||||
/* Replace All */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.replace_all" }, ICON_VS_REPLACE_ALL, 1570, Shortcut::None, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.replace_all" }, ICON_VS_REPLACE_ALL, 1570, Shortcut::None, [this] {
|
||||
m_textEditor->getFindReplaceHandler()->replaceAll(&*m_textEditor);
|
||||
}, [this] { return ImHexApi::Provider::isValid() && !m_textEditor->getFindReplaceHandler()->getReplaceWord().empty() && m_focusedSubWindowName.contains(textEditorView); },
|
||||
this);
|
||||
|
||||
|
||||
/* Goto Line */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.goto_line" }, ICON_VS_DEBUG_STEP_INTO, 1600, AllowWhileTyping + CTRLCMD + Keys::G, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.view.pattern_editor.menu.goto_line" }, ICON_VS_DEBUG_STEP_INTO, 1600, AllowWhileTyping + CTRLCMD + Keys::G, [this] {
|
||||
m_openGotoLinePopUp = true;
|
||||
}, [] { return true; },
|
||||
this);
|
||||
|
||||
/* Import Pattern */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.pattern" }, ICON_VS_FILE_CODE, 5600, Shortcut::None, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.pattern" }, ICON_VS_FILE_CODE, 5600, Shortcut::None, [this] {
|
||||
m_openPatternFile(false);
|
||||
}, ImHexApi::Provider::isValid);
|
||||
|
||||
/* Export Pattern */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.pattern" }, ICON_VS_FILE_CODE, 7050, Shortcut::None, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.export", "hex.builtin.menu.file.export.pattern" }, ICON_VS_FILE_CODE, 7050, Shortcut::None, [this] {
|
||||
m_savePatternFile(false);
|
||||
}, [this] {
|
||||
return ImHexApi::Provider::isValid() && !wolv::util::trim(m_textEditor->getText()).empty();
|
||||
});
|
||||
|
||||
/* Undo */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.undo" }, ICON_VS_DISCARD, 1250, AllowWhileTyping + CTRLCMD + Keys::Z, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.undo" }, ICON_VS_DISCARD, 1250, AllowWhileTyping + CTRLCMD + Keys::Z, [this] {
|
||||
m_textEditor->undo();
|
||||
}, [this] { return ImHexApi::Provider::isValid() && m_textEditor->canUndo() && m_focusedSubWindowName.contains(textEditorView); },
|
||||
this);
|
||||
|
||||
/* Redo */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.redo" }, ICON_VS_REDO, 1275, AllowWhileTyping + CTRLCMD + Keys::Y, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.redo" }, ICON_VS_REDO, 1275, AllowWhileTyping + CTRLCMD + Keys::Y, [this] {
|
||||
m_textEditor->redo();
|
||||
}, [this] { return ImHexApi::Provider::isValid() && m_textEditor->canRedo() && m_focusedSubWindowName.contains(textEditorView); },
|
||||
this);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.edit" }, 1280, this);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.edit" }, 1280, this);
|
||||
|
||||
|
||||
/* Cut */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.cut" }, ICON_VS_COMBINE, 1300, AllowWhileTyping + CTRLCMD + Keys::X, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.cut" }, ICON_VS_COMBINE, 1300, AllowWhileTyping + CTRLCMD + Keys::X, [this] {
|
||||
m_textEditor->cut();
|
||||
}, [this] { return ImHexApi::Provider::isValid() && m_textEditor->hasSelection() && m_focusedSubWindowName.contains(textEditorView); },
|
||||
this);
|
||||
|
||||
/* Copy */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.copy" }, ICON_VS_COPY, 1400, AllowWhileTyping + CTRLCMD + Keys::C, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.copy" }, ICON_VS_COPY, 1400, AllowWhileTyping + CTRLCMD + Keys::C, [this] {
|
||||
if (auto editor = getEditorFromFocusedWindow(); editor != nullptr) {
|
||||
editor->copy();
|
||||
} else {
|
||||
@@ -2146,23 +2150,23 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Paste */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.paste" }, ICON_VS_OUTPUT, 1500, AllowWhileTyping + CTRLCMD + Keys::V, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.paste" }, ICON_VS_OUTPUT, 1500, AllowWhileTyping + CTRLCMD + Keys::V, [this] {
|
||||
m_textEditor->paste();
|
||||
}, [this] { return m_focusedSubWindowName.contains(textEditorView); },
|
||||
this);
|
||||
|
||||
|
||||
/* Select All */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.select_all" }, ICON_VS_LIST_FLAT, 1650, AllowWhileTyping + CTRLCMD + Keys::A, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.select_all" }, ICON_VS_LIST_FLAT, 1650, AllowWhileTyping + CTRLCMD + Keys::A, [this] {
|
||||
if (auto editor = getEditorFromFocusedWindow(); editor != nullptr)
|
||||
editor->selectAll();
|
||||
}, [] { return ImHexApi::Provider::isValid(); },
|
||||
this);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.edit" }, 1700, this);
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.edit" }, 1700, this);
|
||||
|
||||
/* Add Breakpoint */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.add_breakpoint"}, ICON_VS_DEBUG_BREAKPOINT_DATA, 1750, Keys::F8 + AllowWhileTyping, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.add_breakpoint"}, ICON_VS_DEBUG_BREAKPOINT_DATA, 1750, Keys::F8 + AllowWhileTyping, [this] {
|
||||
const auto line = m_textEditor.get(ImHexApi::Provider::get()).getCursorPosition().m_line + 1;
|
||||
const auto &runtime = ContentRegistry::PatternLanguage::getRuntime();
|
||||
|
||||
@@ -2181,7 +2185,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Trigger Evaluation */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit","hex.builtin.view.pattern_editor.menu.edit.run_pattern" }, ICON_VS_PLAY, 1800, Keys::F5 + AllowWhileTyping, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit","hex.builtin.view.pattern_editor.menu.edit.run_pattern" }, ICON_VS_PLAY, 1800, Keys::F5 + AllowWhileTyping, [this] {
|
||||
auto &runtime = ContentRegistry::PatternLanguage::getRuntime();
|
||||
if (runtime.isRunning()) {
|
||||
m_breakpointHit = false;
|
||||
@@ -2192,7 +2196,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Continue debugger */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit","hex.builtin.view.pattern_editor.menu.edit.continue_debugger"}, ICON_VS_DEBUG_CONTINUE, 1850, SHIFT + Keys::F9 + AllowWhileTyping, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit","hex.builtin.view.pattern_editor.menu.edit.continue_debugger"}, ICON_VS_DEBUG_CONTINUE, 1850, SHIFT + Keys::F9 + AllowWhileTyping, [this] {
|
||||
const auto &runtime = ContentRegistry::PatternLanguage::getRuntime();
|
||||
if (runtime.isRunning())
|
||||
m_breakpointHit = false;
|
||||
@@ -2200,7 +2204,7 @@ namespace hex::plugin::builtin {
|
||||
this);
|
||||
|
||||
/* Step debugger */
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.edit","hex.builtin.view.pattern_editor.menu.edit.step_debugger" },ICON_VS_DEBUG_STEP_INTO, 1900, SHIFT + Keys::F7 + AllowWhileTyping, [this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.edit","hex.builtin.view.pattern_editor.menu.edit.step_debugger" },ICON_VS_DEBUG_STEP_INTO, 1900, SHIFT + Keys::F7 + AllowWhileTyping, [this] {
|
||||
const auto &runtime = ContentRegistry::PatternLanguage::getRuntime();
|
||||
if (runtime.isRunning()) {
|
||||
runtime.getInternals().evaluator->pauseNextLine();
|
||||
@@ -2217,7 +2221,7 @@ namespace hex::plugin::builtin {
|
||||
}};
|
||||
|
||||
/* Place pattern... */
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.place_pattern" }, ICON_VS_LIBRARY, 3000,
|
||||
ContentRegistry::UserInterface::addMenuItemSubMenu({ "hex.builtin.menu.edit", "hex.builtin.view.pattern_editor.menu.edit.place_pattern" }, ICON_VS_LIBRARY, 3000,
|
||||
[&, this] {
|
||||
if (menu::beginMenu("hex.builtin.view.pattern_editor.menu.edit.place_pattern.builtin"_lang)) {
|
||||
if (menu::beginMenu("hex.builtin.view.pattern_editor.menu.edit.place_pattern.builtin.single"_lang)) {
|
||||
@@ -2267,7 +2271,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void ViewPatternEditor::registerHandlers() {
|
||||
ContentRegistry::FileHandler::add({ ".hexpat", ".pat" }, [](const std::fs::path &path) -> bool {
|
||||
ContentRegistry::FileTypeHandler::add({ ".hexpat", ".pat" }, [](const std::fs::path &path) -> bool {
|
||||
wolv::io::File file(path, wolv::io::File::Mode::Read);
|
||||
|
||||
if (file.isValid()) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "content/views/view_provider_settings.hpp"
|
||||
|
||||
#include <hex/api/imhex_api/hex_editor.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
#include <hex/api/events/events_provider.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
@@ -16,7 +16,7 @@ namespace hex::plugin::builtin {
|
||||
this->getWindowOpenState() = true;
|
||||
});
|
||||
|
||||
ContentRegistry::Interface::addSidebarItem(ICON_VS_SERVER_PROCESS, [] {
|
||||
ContentRegistry::UserInterface::addSidebarItem(ICON_VS_SERVER_PROCESS, [] {
|
||||
auto provider = hex::ImHexApi::Provider::get();
|
||||
|
||||
if (auto *sidebarInterfaceProvider = dynamic_cast<prv::IProviderSidebarInterface*>(provider); sidebarInterfaceProvider != nullptr)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "content/views/view_settings.hpp"
|
||||
|
||||
#include <fonts/fonts.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/events/requests_gui.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
// Add the settings menu item to the Extras menu
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.extras" }, 3000);
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.settings.name" }, ICON_VS_SETTINGS_GEAR, 4000, CTRLCMD + Keys::Comma, [&, this] {
|
||||
ContentRegistry::UserInterface::addMenuItemSeparator({ "hex.builtin.menu.extras" }, 3000);
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.settings.name" }, ICON_VS_SETTINGS_GEAR, 4000, CTRLCMD + Keys::Comma, [&, this] {
|
||||
this->getWindowOpenState() = true;
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
#include <hex/api_urls.hpp>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/events/events_interaction.hpp>
|
||||
|
||||
#include <popups/popup_notification.hpp>
|
||||
@@ -30,7 +31,7 @@ namespace hex::plugin::builtin {
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
ViewStore::ViewStore() : View::Floating("hex.builtin.view.store.name", ICON_VS_EXTENSIONS) {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.store.name" }, ICON_VS_EXTENSIONS, 1000, Shortcut::None, [&, this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.store.name" }, ICON_VS_EXTENSIONS, 1000, Shortcut::None, [&, this] {
|
||||
if (m_requestStatus == RequestStatus::NotAttempted)
|
||||
this->refresh();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "content/views/view_theme_manager.hpp"
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/theme_manager.hpp>
|
||||
#include <hex/api/events/events_interaction.hpp>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
ViewThemeManager::ViewThemeManager() : View::Floating("hex.builtin.view.theme_manager.name", ICON_VS_SYMBOL_COLOR) {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.theme_manager.name" }, ICON_VS_SYMBOL_COLOR, 2000, Shortcut::None, [&, this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.theme_manager.name" }, ICON_VS_SYMBOL_COLOR, 2000, Shortcut::None, [&, this] {
|
||||
this->getWindowOpenState() = true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "content/views/view_tools.hpp"
|
||||
#include <imgui_internal.h>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/tools.hpp>
|
||||
#include <hex/api/layout_manager.hpp>
|
||||
|
||||
#include <fonts/vscode_icons.hpp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "content/views/view_tutorials.hpp"
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/tutorial_manager.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
#include <hex/api/events/requests_gui.hpp>
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
ViewTutorials::ViewTutorials() : View::Floating("hex.builtin.view.tutorials.name", ICON_VS_BOOK) {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.tutorials.name" }, ICON_VS_COMPASS, 4000, Shortcut::None, [&, this] {
|
||||
ContentRegistry::UserInterface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.view.tutorials.name" }, ICON_VS_COMPASS, 4000, Shortcut::None, [&, this] {
|
||||
this->getWindowOpenState() = true;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <hex/api/workspace_manager.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
#include <hex/api/content_registry/provider.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
#include <hex/api/theme_manager.hpp>
|
||||
#include <hex/api/layout_manager.hpp>
|
||||
@@ -430,7 +433,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
auto extraWelcomeScreenEntries = ContentRegistry::Interface::impl::getWelcomeScreenEntries();
|
||||
auto extraWelcomeScreenEntries = ContentRegistry::UserInterface::impl::getWelcomeScreenEntries();
|
||||
if (!extraWelcomeScreenEntries.empty()) {
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
|
||||
ImGui::TableNextColumn();
|
||||
@@ -514,7 +517,7 @@ namespace hex::plugin::builtin {
|
||||
static bool hovered = false;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, hovered ? 1.0F : 0.3F);
|
||||
{
|
||||
const auto &quickSettings = ContentRegistry::Interface::impl::getWelcomeScreenQuickSettingsToggles();
|
||||
const auto &quickSettings = ContentRegistry::UserInterface::impl::getWelcomeScreenQuickSettingsToggles();
|
||||
if (!quickSettings.empty()) {
|
||||
const auto padding = ImGui::GetStyle().FramePadding.y;
|
||||
const ImVec2 windowSize = { 150_scaled, 2 * ImGui::GetTextLineHeightWithSpacing() + padding + std::ceil(quickSettings.size() / 5.0F) * (ImGui::GetTextLineHeightWithSpacing() + padding) };
|
||||
@@ -646,16 +649,16 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
|
||||
ContentRegistry::Interface::addWelcomeScreenQuickSettingsToggle(ICON_VS_COMPASS_ACTIVE, ICON_VS_COMPASS, "hex.builtin.welcome.quick_settings.simplified", false, [](bool state) {
|
||||
ContentRegistry::UserInterface::addWelcomeScreenQuickSettingsToggle(ICON_VS_COMPASS_ACTIVE, ICON_VS_COMPASS, "hex.builtin.welcome.quick_settings.simplified", false, [](bool state) {
|
||||
s_simplifiedWelcomeScreen = state;
|
||||
WorkspaceManager::switchWorkspace(s_simplifiedWelcomeScreen ? "Minimal" : "Default");
|
||||
});
|
||||
|
||||
EventImHexStartupFinished::subscribe([]() {
|
||||
for (const auto &quickSetting : ContentRegistry::Interface::impl::getWelcomeScreenQuickSettingsToggles()) {
|
||||
for (const auto &quickSetting : ContentRegistry::UserInterface::impl::getWelcomeScreenQuickSettingsToggles()) {
|
||||
auto &setting = quickSetting.unlocalizedTooltip;
|
||||
ContentRegistry::Settings::onChange("hex.builtin.settings.quick_settings", setting, [setting](const ContentRegistry::Settings::SettingsValue &value) {
|
||||
for (auto &[onIcon, offIcon, unlocalizedTooltip, toggleCallback, state] : ContentRegistry::Interface::impl::getWelcomeScreenQuickSettingsToggles()) {
|
||||
for (auto &[onIcon, offIcon, unlocalizedTooltip, toggleCallback, state] : ContentRegistry::UserInterface::impl::getWelcomeScreenQuickSettingsToggles()) {
|
||||
if (unlocalizedTooltip == setting) {
|
||||
state = value.get<bool>(state);
|
||||
toggleCallback(state);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/shortcut_manager.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
#include <hex/api/project_file_manager.hpp>
|
||||
@@ -49,15 +51,15 @@ namespace hex::plugin::builtin {
|
||||
ImGui::GetWindowDrawList()->AddShadowCircle(pos, diameter / 2, ImGui::GetColorU32(ImGuiCol_ButtonActive, 0.8F), diameter / 4, ImVec2());
|
||||
}
|
||||
|
||||
void createNestedMenu(std::span<const UnlocalizedString> menuItems, const char *icon, const Shortcut &shortcut, View *view, const ContentRegistry::Interface::impl::MenuCallback &callback, const ContentRegistry::Interface::impl::EnabledCallback &enabledCallback, const ContentRegistry::Interface::impl::SelectedCallback &selectedCallback) {
|
||||
void createNestedMenu(std::span<const UnlocalizedString> menuItems, const char *icon, const Shortcut &shortcut, View *view, const ContentRegistry::UserInterface::impl::MenuCallback &callback, const ContentRegistry::UserInterface::impl::EnabledCallback &enabledCallback, const ContentRegistry::UserInterface::impl::SelectedCallback &selectedCallback) {
|
||||
const auto &name = menuItems.front();
|
||||
|
||||
if (name.get() == ContentRegistry::Interface::impl::SeparatorValue) {
|
||||
if (name.get() == ContentRegistry::UserInterface::impl::SeparatorValue) {
|
||||
menu::menuSeparator();
|
||||
return;
|
||||
}
|
||||
|
||||
if (name.get() == ContentRegistry::Interface::impl::SubMenuValue) {
|
||||
if (name.get() == ContentRegistry::UserInterface::impl::SubMenuValue) {
|
||||
if (enabledCallback()) {
|
||||
callback();
|
||||
}
|
||||
@@ -74,9 +76,9 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bool isSubmenu = (menuItems.begin() + 1)->get() == ContentRegistry::Interface::impl::SubMenuValue;
|
||||
bool isSubmenu = (menuItems.begin() + 1)->get() == ContentRegistry::UserInterface::impl::SubMenuValue;
|
||||
|
||||
if (menu::beginMenuEx(Lang(name), std::next(menuItems.begin())->get() == ContentRegistry::Interface::impl::SubMenuValue ? icon : nullptr, isSubmenu ? enabledCallback() : true)) {
|
||||
if (menu::beginMenuEx(Lang(name), std::next(menuItems.begin())->get() == ContentRegistry::UserInterface::impl::SubMenuValue ? icon : nullptr, isSubmenu ? enabledCallback() : true)) {
|
||||
createNestedMenu({ std::next(menuItems.begin()), menuItems.end() }, icon, shortcut, view, callback, enabledCallback, selectedCallback);
|
||||
menu::endMenu();
|
||||
}
|
||||
@@ -89,7 +91,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::SetCursorPosX(8);
|
||||
for (const auto &callback : ContentRegistry::Interface::impl::getFooterItems()) {
|
||||
for (const auto &callback : ContentRegistry::UserInterface::impl::getFooterItems()) {
|
||||
const auto y = ImGui::GetCursorPosY();
|
||||
const auto prevIdx = drawList->_VtxCurrentIdx;
|
||||
callback();
|
||||
@@ -110,7 +112,7 @@ namespace hex::plugin::builtin {
|
||||
u32 index = 0;
|
||||
u32 drawIndex = 1;
|
||||
ImGui::PushID("SideBarWindows");
|
||||
for (const auto &[icon, callback, enabledCallback] : ContentRegistry::Interface::impl::getSidebarItems()) {
|
||||
for (const auto &[icon, callback, enabledCallback] : ContentRegistry::UserInterface::impl::getSidebarItems()) {
|
||||
ImGui::SetCursorPosY(sidebarPos.y + sidebarWidth * drawIndex);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetColorU32(ImGuiCol_MenuBarBg));
|
||||
@@ -234,7 +236,7 @@ namespace hex::plugin::builtin {
|
||||
#endif
|
||||
}
|
||||
|
||||
const auto &titleBarButtons = ContentRegistry::Interface::impl::getTitlebarButtons();
|
||||
const auto &titleBarButtons = ContentRegistry::UserInterface::impl::getTitlebarButtons();
|
||||
|
||||
// Draw custom title bar buttons
|
||||
if (!titleBarButtons.empty()) {
|
||||
@@ -308,7 +310,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
bool isMenuItemVisible(const ContentRegistry::Interface::impl::MenuItem &menuItem) {
|
||||
bool isMenuItemVisible(const ContentRegistry::UserInterface::impl::MenuItem &menuItem) {
|
||||
const auto lastFocusedView = View::getLastFocusedView();
|
||||
if (lastFocusedView == nullptr && menuItem.view != nullptr) {
|
||||
return false;
|
||||
@@ -325,7 +327,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
std::set<UnlocalizedString> getVisibleMainMenus() {
|
||||
std::set<UnlocalizedString> result;
|
||||
for (auto &[priority, menuItem] : ContentRegistry::Interface::impl::getMenuItems()) {
|
||||
for (auto &[priority, menuItem] : ContentRegistry::UserInterface::impl::getMenuItems()) {
|
||||
if (isMenuItemVisible(menuItem)) {
|
||||
result.emplace(menuItem.unlocalizedNames.front());
|
||||
}
|
||||
@@ -335,7 +337,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void populateMenu(const UnlocalizedString &menuName) {
|
||||
for (auto &[priority, menuItem] : ContentRegistry::Interface::impl::getMenuItems()) {
|
||||
for (auto &[priority, menuItem] : ContentRegistry::UserInterface::impl::getMenuItems()) {
|
||||
if (!menuName.empty()) {
|
||||
if (menuItem.unlocalizedNames[0] != menuName)
|
||||
continue;
|
||||
@@ -383,7 +385,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void drawMenu() {
|
||||
const auto &menuItems = ContentRegistry::Interface::impl::getMainMenuItems();
|
||||
const auto &menuItems = ContentRegistry::UserInterface::impl::getMainMenuItems();
|
||||
const auto visibleMainMenus = getVisibleMainMenus();
|
||||
|
||||
if (menu::isNativeMenuBarUsed()) {
|
||||
@@ -561,7 +563,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::BeginDisabled(ContentRegistry::Views::impl::getFullScreenView() != nullptr);
|
||||
{
|
||||
for (const auto &callback : ContentRegistry::Interface::impl::getToolbarItems()) {
|
||||
for (const auto &callback : ContentRegistry::UserInterface::impl::getToolbarItems()) {
|
||||
callback();
|
||||
ImGui::SameLine();
|
||||
}
|
||||
@@ -582,7 +584,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
bool anySidebarItemsAvailable() {
|
||||
if (const auto &items = ContentRegistry::Interface::impl::getSidebarItems(); items.empty()) {
|
||||
if (const auto &items = ContentRegistry::UserInterface::impl::getSidebarItems(); items.empty()) {
|
||||
return false;
|
||||
} else {
|
||||
return std::any_of(items.begin(), items.end(), [](const auto &item) {
|
||||
@@ -670,7 +672,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PopStyleVar(2);
|
||||
|
||||
// Draw main menu popups
|
||||
for (auto &[priority, menuItem] : ContentRegistry::Interface::impl::getMainMenuItems()) {
|
||||
for (auto &[priority, menuItem] : ContentRegistry::UserInterface::impl::getMainMenuItems()) {
|
||||
const auto &unlocalizedNames = menuItem.unlocalizedName;
|
||||
if (ImGui::BeginPopup(unlocalizedNames.get().c_str())) {
|
||||
populateMenu(unlocalizedNames);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
#include <hex/api/workspace_manager.hpp>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include <hex/plugin.hpp>
|
||||
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/debugging.hpp>
|
||||
|
||||
Reference in New Issue
Block a user