build: Refactor ImHexAPI into multiple separate files

This commit is contained in:
WerWolv
2025-08-14 20:16:40 +02:00
parent 4ca429e389
commit d920718b44
144 changed files with 1211 additions and 1067 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <hex/ui/banner.hpp>
#include <hex/helpers/utils.hpp>
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>

View File

@@ -2,8 +2,9 @@
#include <hex/ui/popup.hpp>
#include <hex/api/imhex_api/system.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/helpers/scaling.hpp>
#include <functional>
#include <string>

View File

@@ -3,6 +3,7 @@
#include <hex/ui/popup.hpp>
#include <hex/api/localization_manager.hpp>
#include <hex/api/imhex_api/system.hpp>
#include <functional>
#include <string>

View File

@@ -2,7 +2,7 @@
#include <hex/ui/popup.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/api/imhex_api/system.hpp>
#include <hex/api/localization_manager.hpp>
#include <functional>

View File

@@ -1,7 +1,6 @@
#pragma once
#include <hex.hpp>
#include <hex/api/imhex_api.hpp>
#include <hex/api/content_registry.hpp>
#include <hex/providers/provider.hpp>
#include <hex/helpers/encoding_file.hpp>

View File

@@ -1,7 +1,6 @@
#pragma once
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <hex/providers/provider.hpp>
namespace pl::ptrn { class Pattern; }
namespace hex::prv { class Provider; }
@@ -15,53 +14,6 @@ namespace hex::ui {
Region
};
inline void regionSelectionPicker(Region *region, prv::Provider *provider, RegionType *type, bool showHeader = true, bool firstEntry = false) {
ImGui::BeginGroup();
if (showHeader)
ImGuiExt::Header("hex.ui.common.range"_lang, firstEntry);
if (ImGui::RadioButton("hex.ui.common.range.entire_data"_lang, *type == RegionType::EntireData))
*type = RegionType::EntireData;
if (ImGui::RadioButton("hex.ui.common.range.selection"_lang, *type == RegionType::Selection))
*type = RegionType::Selection;
if (ImGui::RadioButton("hex.ui.common.region"_lang, *type == RegionType::Region))
*type = RegionType::Region;
switch (*type) {
case RegionType::EntireData:
*region = { provider->getBaseAddress(), provider->getActualSize() };
break;
case RegionType::Selection:
*region = ImHexApi::HexEditor::getSelection().value_or(
ImHexApi::HexEditor::ProviderRegion {
{ 0, 1 },
provider }
).getRegion();
break;
case RegionType::Region:
ImGui::SameLine();
const auto width = ImGui::GetContentRegionAvail().x / 2 - ImGui::CalcTextSize(" - ").x / 2;
u64 start = region->getStartAddress(), end = region->getEndAddress();
if (end < start)
end = start;
ImGui::PushItemWidth(width);
ImGuiExt::InputHexadecimal("##start", &start);
ImGui::PopItemWidth();
ImGui::SameLine(0, 0);
ImGui::TextUnformatted(" - ");
ImGui::SameLine(0, 0);
ImGui::PushItemWidth(width);
ImGuiExt::InputHexadecimal("##end", &end);
ImGui::PopItemWidth();
*region = { start, (end - start) + 1 };
break;
}
ImGui::EndGroup();
}
void regionSelectionPicker(Region *region, prv::Provider *provider, RegionType *type, bool showHeader = true, bool firstEntry = false);
}