1
0
mirror of synced 2024-11-28 17:40:51 +01:00

refactor: Move tools to correct namespace, move data processor nodes

This commit is contained in:
WerWolv 2023-12-01 13:53:51 +01:00
parent a50bb39978
commit 519d965a36
27 changed files with 2124 additions and 2155 deletions

View File

@ -1,7 +1,6 @@
#include <hex/helpers/literals.hpp>
namespace hex::plugin::builtin {
namespace impl {
void drawDemangler();
void drawASCIITable();
@ -24,5 +23,4 @@ namespace hex::plugin::builtin {
void drawFileToolSplitter();
void drawFileToolCombiner();
}
}

View File

@ -1,14 +1,12 @@
#include <hex/helpers/utils.hpp>
#include <hex/api/localization_manager.hpp>
#include <content/tools_entries.hpp>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
namespace hex::plugin::builtin {
namespace impl {
void drawASCIITable() {
static bool asciiTableShowOctal = false;
@ -55,5 +53,6 @@ namespace hex::plugin::builtin {
ImGui::Checkbox("hex.builtin.tools.ascii_table.octal"_lang, &asciiTableShowOctal);
}
}
}

View File

@ -2,14 +2,12 @@
#include <hex/helpers/fmt.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/ui/view.hpp>
#include <content/tools_entries.hpp>
#include <hex/ui/imgui_imhex_extensions.h>
#include <fonts/codicons_font.h>
namespace hex::plugin::builtin {
namespace impl {
void drawBaseConverter() {
static std::array<std::string, 4> buffers;
@ -51,5 +49,5 @@ namespace hex::plugin::builtin {
if (ImGuiExt::InputTextIcon("hex.builtin.tools.base_converter.bin"_lang, ICON_VS_SYMBOL_NUMERIC, buffers[3]))
ConvertBases(2);
}
}
}

View File

@ -1,17 +1,14 @@
#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;
@ -33,5 +30,5 @@ namespace hex::plugin::builtin {
ImGuiExt::InputTextIcon("hex.builtin.tools.output"_lang, ICON_VS_SYMBOL_NUMERIC, output, ImGuiInputTextFlags_ReadOnly);
ImGui::PopStyleVar();
}
}
}

View File

@ -4,7 +4,6 @@
#include <hex/api/localization_manager.hpp>
#include <content/helpers/math_evaluator.hpp>
#include <content/tools_entries.hpp>
#include <imgui.h>
@ -13,7 +12,7 @@
#include <romfs/romfs.hpp>
namespace hex::plugin::builtin {
namespace impl {
void drawColorPicker() {
static std::array<float, 4> pickedColor = { 0 };
static std::string rgba8;
@ -223,5 +222,5 @@ namespace hex::plugin::builtin {
ImGui::EndTable();
}
}
}
}

View File

@ -4,13 +4,12 @@
#include <llvm/Demangle/Demangle.h>
#include <imgui.h>
#include <TextEditor.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <TextEditor.h>
namespace hex::plugin::builtin {
namespace impl {
void drawDemangler() {
static std::string mangledName, demangledName, wrappedDemangledName;
static TextEditor outputField = []{
@ -60,5 +59,5 @@ namespace hex::plugin::builtin {
}
ImGui::EndChild();
}
}
}

View File

@ -1,7 +1,5 @@
#include <hex/api/localization_manager.hpp>
#include <content/tools_entries.hpp>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <fonts/codicons_font.h>
@ -9,7 +7,7 @@
#include <numeric>
namespace hex::plugin::builtin {
namespace impl {
void drawEuclidianAlgorithm() {
static u64 a, b;
@ -85,5 +83,5 @@ namespace hex::plugin::builtin {
ImGui::NewLine();
}
}
}

View File

@ -14,7 +14,7 @@
#include <wolv/io/file.hpp>
namespace hex::plugin::builtin {
namespace impl {
void drawFileToolCombiner() {
static std::vector<std::fs::path> files;
static std::u8string outputPath;
@ -149,5 +149,5 @@ namespace hex::plugin::builtin {
}
ImGui::EndDisabled();
}
}
}

View File

@ -13,7 +13,7 @@
#include <wolv/utils/guards.hpp>
namespace hex::plugin::builtin {
namespace impl {
void drawFileToolShredder() {
static std::u8string selectedFile;
static bool fastMode = false;
@ -135,5 +135,5 @@ namespace hex::plugin::builtin {
ImGui::EndDisabled();
}
}
}
}

View File

@ -15,7 +15,7 @@
#include <wolv/utils/guards.hpp>
namespace hex::plugin::builtin {
namespace impl {
using namespace hex::literals;
void drawFileToolSplitter() {
@ -142,5 +142,5 @@ namespace hex::plugin::builtin {
}
ImGui::EndDisabled();
}
}
}

View File

@ -1,5 +1,4 @@
namespace hex::plugin::builtin {
namespace impl {
/*void drawFileUploader() {
struct UploadedFile {
@ -92,5 +91,5 @@ namespace hex::plugin::builtin {
currFile.clear();
}
}*/
}
}

View File

@ -1,22 +1,15 @@
#include <hex/helpers/http_requests.hpp>
#include <hex/ui/view.hpp>
#include <regex>
#include <llvm/Demangle/Demangle.h>
#include <content/helpers/math_evaluator.hpp>
#include <content/tools_entries.hpp>
#include <imgui.h>
#include <implot.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <wolv/net/socket_server.hpp>
#include <fonts/codicons_font.h>
namespace hex::plugin::builtin {
namespace impl {
void drawGraphingCalculator() {
static std::array<long double, 1000> x, y;
static std::string mathInput;
@ -73,5 +66,5 @@ namespace hex::plugin::builtin {
}
}
}
}

View File

@ -1,12 +1,12 @@
#include <hex/api/content_registry.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/ui/imgui_imhex_extensions.h>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
namespace hex::plugin::builtin {
namespace impl {
// Tool for converting between different number formats.
// There are three places where input can be changed; the bit checkboxes, the hex input, and the decimal input.
// The bit checkboxes and the hex input are directly related and can be converted between each other easily.
@ -705,5 +705,5 @@ namespace hex::plugin::builtin {
ToolMenu(inputFieldWidth);
}
}
}

View File

@ -1,11 +1,11 @@
#include <hex/api/localization_manager.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/providers/provider.hpp>
#include <hex/ui/imgui_imhex_extensions.h>
#include <hex/helpers/utils.hpp>
#include <content/helpers/math_evaluator.hpp>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <fonts/fontawesome_font.h>
#include <fonts/codicons_font.h>
@ -13,7 +13,7 @@
#include <string>
namespace hex::plugin::builtin {
namespace impl {
void drawMathEvaluator() {
static std::vector<long double> mathHistory;
static std::string lastMathError;
@ -330,5 +330,5 @@ namespace hex::plugin::builtin {
}
}
}
}
}

View File

@ -1,14 +1,11 @@
#include <hex/helpers/utils.hpp>
#include <hex/api/localization_manager.hpp>
#include <content/tools_entries.hpp>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
namespace hex::plugin::builtin {
namespace impl {
void drawInvariantMultiplicationDecoder() {
static u64 divisor = 1;
static u64 multiplier = 1;
@ -62,5 +59,5 @@ namespace hex::plugin::builtin {
}
ImGui::EndChild();
}
}
}

View File

@ -2,11 +2,10 @@
#include <hex/api/localization_manager.hpp>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
namespace hex::plugin::builtin {
namespace impl {
void drawPermissionsCalculator() {
static bool setuid, setgid, sticky;
static bool r[3], w[3], x[3];
@ -61,5 +60,5 @@ namespace hex::plugin::builtin {
if (sticky && !x[2])
ImGuiExt::TextFormattedColored(WarningColor, "{}", "hex.builtin.tools.permissions.sticky_error"_lang);
}
}
}

View File

@ -2,18 +2,15 @@
#include <hex/helpers/utils.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/ui/view.hpp>
#include <regex>
#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 drawRegexReplacer() {
static auto regexInput = [] { std::string s; s.reserve(0xFFF); return s; }();
static auto regexPattern = [] { std::string s; s.reserve(0xFFF); return s; }();
@ -35,5 +32,5 @@ namespace hex::plugin::builtin {
ImGui::PopItemWidth();
}
}
}

View File

@ -1,18 +1,18 @@
#include <hex/api/localization_manager.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/ui/imgui_imhex_extensions.h>
#include <wolv/net/socket_client.hpp>
#include <wolv/net/socket_server.hpp>
#include <fonts/codicons_font.h>
#include <imgui.h>
#include <jthread.hpp>
#include <hex/ui/imgui_imhex_extensions.h>
#include <jthread.hpp>
#include <string>
#include <vector>
namespace hex::plugin::builtin {
namespace impl {
using namespace std::literals::chrono_literals;
void drawTCPClientServer() {
@ -190,5 +190,5 @@ namespace hex::plugin::builtin {
ImGui::EndTabBar();
}
}
}
}

View File

@ -3,17 +3,15 @@
#include <hex/helpers/http_requests.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/ui/view.hpp>
#include <content/tools_entries.hpp>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <fonts/codicons_font.h>
#include <nlohmann/json.hpp>
namespace hex::plugin::builtin {
namespace impl {
using namespace std::literals::string_literals;
using namespace std::literals::chrono_literals;
@ -90,5 +88,5 @@ namespace hex::plugin::builtin {
}
}
}
}
}

View File

@ -8,8 +8,6 @@
namespace hex::plugin::builtin {
namespace impl {
void drawFileTools() {
if (ImGui::BeginTabBar("file_tools_tabs")) {
if (ImGui::BeginTabItem("hex.builtin.tools.file_tools.shredder"_lang)) {
@ -23,32 +21,32 @@ namespace hex::plugin::builtin {
}
if (ImGui::BeginTabItem("hex.builtin.tools.file_tools.combiner"_lang)) {
impl::drawFileToolCombiner();
drawFileToolCombiner();
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
}
}
void registerToolEntries() {
ContentRegistry::Tools::add("hex.builtin.tools.demangler", impl::drawDemangler);
ContentRegistry::Tools::add("hex.builtin.tools.ascii_table", impl::drawASCIITable);
ContentRegistry::Tools::add("hex.builtin.tools.regex_replacer", impl::drawRegexReplacer);
ContentRegistry::Tools::add("hex.builtin.tools.color", impl::drawColorPicker);
ContentRegistry::Tools::add("hex.builtin.tools.calc", impl::drawMathEvaluator);
ContentRegistry::Tools::add("hex.builtin.tools.graphing", impl::drawGraphingCalculator);
ContentRegistry::Tools::add("hex.builtin.tools.base_converter", impl::drawBaseConverter);
ContentRegistry::Tools::add("hex.builtin.tools.byte_swapper", impl::drawByteSwapper);
ContentRegistry::Tools::add("hex.builtin.tools.permissions", impl::drawPermissionsCalculator);
// ContentRegistry::Tools::add("hex.builtin.tools.file_uploader", impl::drawFileUploader);
ContentRegistry::Tools::add("hex.builtin.tools.wiki_explain", impl::drawWikiExplainer);
ContentRegistry::Tools::add("hex.builtin.tools.file_tools", impl::drawFileTools);
ContentRegistry::Tools::add("hex.builtin.tools.ieee754", impl::drawIEEE754Decoder);
ContentRegistry::Tools::add("hex.builtin.tools.invariant_multiplication", impl::drawInvariantMultiplicationDecoder);
ContentRegistry::Tools::add("hex.builtin.tools.tcp_client_server", impl::drawTCPClientServer);
ContentRegistry::Tools::add("hex.builtin.tools.euclidean_algorithm", impl::drawEuclidianAlgorithm);
ContentRegistry::Tools::add("hex.builtin.tools.demangler", drawDemangler);
ContentRegistry::Tools::add("hex.builtin.tools.ascii_table", drawASCIITable);
ContentRegistry::Tools::add("hex.builtin.tools.regex_replacer", drawRegexReplacer);
ContentRegistry::Tools::add("hex.builtin.tools.color", drawColorPicker);
ContentRegistry::Tools::add("hex.builtin.tools.calc", drawMathEvaluator);
ContentRegistry::Tools::add("hex.builtin.tools.graphing", drawGraphingCalculator);
ContentRegistry::Tools::add("hex.builtin.tools.base_converter", drawBaseConverter);
ContentRegistry::Tools::add("hex.builtin.tools.byte_swapper", drawByteSwapper);
ContentRegistry::Tools::add("hex.builtin.tools.permissions", drawPermissionsCalculator);
//ContentRegistry::Tools::add("hex.builtin.tools.file_uploader", drawFileUploader);
ContentRegistry::Tools::add("hex.builtin.tools.wiki_explain", drawWikiExplainer);
ContentRegistry::Tools::add("hex.builtin.tools.file_tools", drawFileTools);
ContentRegistry::Tools::add("hex.builtin.tools.ieee754", drawIEEE754Decoder);
ContentRegistry::Tools::add("hex.builtin.tools.invariant_multiplication", drawInvariantMultiplicationDecoder);
ContentRegistry::Tools::add("hex.builtin.tools.tcp_client_server", drawTCPClientServer);
ContentRegistry::Tools::add("hex.builtin.tools.euclidean_algorithm", drawEuclidianAlgorithm);
}
}