From caae5c97112c9abfa9a491c2671a5083d9044eff Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 29 Nov 2024 17:37:02 +0100 Subject: [PATCH] fix: Move visualizer drawer to correct library --- lib/libimhex/CMakeLists.txt | 1 - .../include/content/views/view_data_inspector.hpp | 5 +---- .../source/content/views/view_data_inspector.cpp | 10 ++++------ plugins/ui/CMakeLists.txt | 1 + plugins/ui/include/ui/pattern_drawer.hpp | 2 +- .../ui/include}/ui/visualizer_drawer.hpp | 0 .../ui}/source/ui/visualizer_drawer.cpp | 2 +- 7 files changed, 8 insertions(+), 13 deletions(-) rename {lib/libimhex/include/hex => plugins/ui/include}/ui/visualizer_drawer.hpp (100%) rename {lib/libimhex => plugins/ui}/source/ui/visualizer_drawer.cpp (97%) diff --git a/lib/libimhex/CMakeLists.txt b/lib/libimhex/CMakeLists.txt index ef335ed32..abcd9677f 100644 --- a/lib/libimhex/CMakeLists.txt +++ b/lib/libimhex/CMakeLists.txt @@ -49,7 +49,6 @@ set(LIBIMHEX_SOURCES source/ui/view.cpp source/ui/popup.cpp source/ui/toast.cpp - source/ui/visualizer_drawer.cpp source/subcommands/subcommands.cpp ) diff --git a/plugins/builtin/include/content/views/view_data_inspector.hpp b/plugins/builtin/include/content/views/view_data_inspector.hpp index ea925f1d4..3c308ab0f 100644 --- a/plugins/builtin/include/content/views/view_data_inspector.hpp +++ b/plugins/builtin/include/content/views/view_data_inspector.hpp @@ -1,15 +1,12 @@ #pragma once #include -#include +#include #include #include -#include - #include -#include #include namespace hex::plugin::builtin { diff --git a/plugins/builtin/source/content/views/view_data_inspector.cpp b/plugins/builtin/source/content/views/view_data_inspector.cpp index 1cd64eb90..8791f4ef2 100644 --- a/plugins/builtin/source/content/views/view_data_inspector.cpp +++ b/plugins/builtin/source/content/views/view_data_inspector.cpp @@ -1,5 +1,4 @@ #include "content/views/view_data_inspector.hpp" -#include "ui/pattern_drawer.hpp" #include #include @@ -8,8 +7,8 @@ #include #include -#include - +#include +#include #include #include @@ -183,10 +182,9 @@ namespace hex::plugin::builtin { continue; // Set up the editing function if a write formatter is available - auto formatWriteFunction = pattern->getWriteFormatterFunction(); std::optional editingFunction; - if (!formatWriteFunction.empty()) { - editingFunction = [formatWriteFunction, &pattern](const std::string &value, + if (!pattern->getWriteFormatterFunction().empty()) { + editingFunction = [&pattern](const std::string &value, std::endian) -> std::vector { try { pattern->setValue(value); diff --git a/plugins/ui/CMakeLists.txt b/plugins/ui/CMakeLists.txt index cad681bc6..276e04409 100644 --- a/plugins/ui/CMakeLists.txt +++ b/plugins/ui/CMakeLists.txt @@ -10,6 +10,7 @@ add_imhex_plugin( source/ui/hex_editor.cpp source/ui/pattern_drawer.cpp + source/ui/visualizer_drawer.cpp INCLUDES include LIBRARIES diff --git a/plugins/ui/include/ui/pattern_drawer.hpp b/plugins/ui/include/ui/pattern_drawer.hpp index 87df29dc9..5a78cb01f 100644 --- a/plugins/ui/include/ui/pattern_drawer.hpp +++ b/plugins/ui/include/ui/pattern_drawer.hpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include diff --git a/lib/libimhex/include/hex/ui/visualizer_drawer.hpp b/plugins/ui/include/ui/visualizer_drawer.hpp similarity index 100% rename from lib/libimhex/include/hex/ui/visualizer_drawer.hpp rename to plugins/ui/include/ui/visualizer_drawer.hpp diff --git a/lib/libimhex/source/ui/visualizer_drawer.cpp b/plugins/ui/source/ui/visualizer_drawer.cpp similarity index 97% rename from lib/libimhex/source/ui/visualizer_drawer.cpp rename to plugins/ui/source/ui/visualizer_drawer.cpp index f0f3fb63c..590b62c8b 100644 --- a/lib/libimhex/source/ui/visualizer_drawer.cpp +++ b/plugins/ui/source/ui/visualizer_drawer.cpp @@ -1,5 +1,5 @@ +#include -#include "hex/ui/visualizer_drawer.hpp" #include "imgui.h" namespace hex::ui {