mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 13:05:25 -05:00
refactor: Move tools to correct namespace, move data processor nodes
This commit is contained in:
@@ -1,37 +1,34 @@
|
||||
#include <hex/api/localization_manager.hpp>
|
||||
|
||||
#include <hex/ui/view.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <content/tools_entries.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <hex/ui/imgui_imhex_extensions.h>
|
||||
|
||||
#include <fonts/codicons_font.h>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
namespace impl {
|
||||
void drawByteSwapper() {
|
||||
static std::string input, buffer, output;
|
||||
|
||||
if (ImGuiExt::InputTextIcon("hex.builtin.tools.input"_lang, ICON_VS_SYMBOL_NUMERIC, input, ImGuiInputTextFlags_CharsHexadecimal)) {
|
||||
auto nextAlignedSize = std::max<size_t>(2, std::bit_ceil(input.size()));
|
||||
void drawByteSwapper() {
|
||||
static std::string input, buffer, output;
|
||||
|
||||
buffer.clear();
|
||||
buffer.resize(nextAlignedSize - input.size(), '0');
|
||||
buffer += input;
|
||||
if (ImGuiExt::InputTextIcon("hex.builtin.tools.input"_lang, ICON_VS_SYMBOL_NUMERIC, input, ImGuiInputTextFlags_CharsHexadecimal)) {
|
||||
auto nextAlignedSize = std::max<size_t>(2, std::bit_ceil(input.size()));
|
||||
|
||||
output.clear();
|
||||
for (u32 i = 0; i < buffer.size(); i += 2) {
|
||||
output += buffer[buffer.size() - i - 2];
|
||||
output += buffer[buffer.size() - i - 1];
|
||||
}
|
||||
buffer.clear();
|
||||
buffer.resize(nextAlignedSize - input.size(), '0');
|
||||
buffer += input;
|
||||
|
||||
output.clear();
|
||||
for (u32 i = 0; i < buffer.size(); i += 2) {
|
||||
output += buffer[buffer.size() - i - 2];
|
||||
output += buffer[buffer.size() - i - 1];
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().DisabledAlpha);
|
||||
ImGuiExt::InputTextIcon("hex.builtin.tools.output"_lang, ICON_VS_SYMBOL_NUMERIC, output, ImGuiInputTextFlags_ReadOnly);
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().DisabledAlpha);
|
||||
ImGuiExt::InputTextIcon("hex.builtin.tools.output"_lang, ICON_VS_SYMBOL_NUMERIC, output, ImGuiInputTextFlags_ReadOnly);
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user