mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
chore: apply light lints (#2570)
This commit is contained in:
@@ -12,7 +12,7 @@ namespace hex::plugin::builtin {
|
||||
[[nodiscard]] UnlocalizedString getTitle() const override;
|
||||
|
||||
private:
|
||||
static void resize(size_t newSize);
|
||||
void resize(size_t newSize);
|
||||
u64 m_size;
|
||||
};
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace hex::plugin::builtin {
|
||||
private:
|
||||
void handleFileChange();
|
||||
|
||||
OpenResult open(bool memoryMapped);
|
||||
OpenResult open(bool directAccess);
|
||||
|
||||
protected:
|
||||
std::fs::path m_path;
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace hex::plugin::builtin {
|
||||
void renderErrors();
|
||||
/// A token range is the set of token indices of a definition. The namespace token
|
||||
/// ranges are obtained first because they are needed to obtain unique identifiers.
|
||||
void getAllTokenRanges(IdentifierType idtype);
|
||||
void getAllTokenRanges(IdentifierType identifierTypeToSearch);
|
||||
/// The global scope is the complement of the union of all the function and UDT token ranges
|
||||
void getGlobalTokenRanges();
|
||||
/// If the current token is a function or UDT, creates a map entry from the name to the token range. These are ordered alphabetically by name.
|
||||
@@ -251,10 +251,10 @@ namespace hex::plugin::builtin {
|
||||
void skipDelimiters(i32 maxSkipCount, Token delimiter[2], i8 increment);
|
||||
void skipToken(Token token, i8 step=1);
|
||||
/// from given or current names find the corresponding definition
|
||||
bool findIdentifierDefinition(Definition &result, const std::string &optionalIdentifierName = "", std::string optionalName = "", bool optional = false);
|
||||
bool findIdentifierDefinition(Definition &result, const std::string &optionalIdentifierName = "", std::string optionalName = "", bool setInstances = false);
|
||||
/// To deal with the Parent keyword
|
||||
std::optional<Definition> setChildrenTypes();
|
||||
bool findParentTypes(std::vector<std::string> &parentTypes, const std::string &optionalName="");
|
||||
bool findParentTypes(std::vector<std::string> &parentTypes, const std::string &optionalUDTName="");
|
||||
bool findAllParentTypes(std::vector<std::string> &parentTypes, std::vector<Identifier *> &identifiers, std::string &optionalFullName);
|
||||
bool tryParentType(const std::string &parentType, std::string &variableName, std::optional<Definition> &result, std::vector<Identifier *> &identifiers);
|
||||
/// Convenience function
|
||||
|
||||
46
plugins/builtin/include/plugin_builtin.hpp
Normal file
46
plugins/builtin/include/plugin_builtin.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
void registerEventHandlers();
|
||||
void registerDataVisualizers();
|
||||
void registerMiniMapVisualizers();
|
||||
void registerDataInspectorEntries();
|
||||
void registerToolEntries();
|
||||
void registerPatternLanguageFunctions();
|
||||
void registerPatternLanguageTypes();
|
||||
void registerPatternLanguagePragmas();
|
||||
void registerPatternLanguageVisualizers();
|
||||
void registerCommandPaletteCommands();
|
||||
void registerSettings();
|
||||
void loadSettings();
|
||||
void registerDataProcessorNodes();
|
||||
void registerProviders();
|
||||
void registerDataFormatters();
|
||||
void registerMainMenuEntries();
|
||||
void createWelcomeScreen();
|
||||
void registerViews();
|
||||
void registerThemeHandlers();
|
||||
void registerStyleHandlers();
|
||||
void registerThemes();
|
||||
void registerBackgroundServices();
|
||||
void registerNetworkEndpoints();
|
||||
void registerMCPTools();
|
||||
void registerFileHandlers();
|
||||
void registerProjectHandlers();
|
||||
void registerAchievements();
|
||||
void registerReportGenerators();
|
||||
void registerTutorials();
|
||||
void registerDataInformationSections();
|
||||
void loadWorkspaces();
|
||||
|
||||
void addWindowDecoration();
|
||||
void addFooterItems();
|
||||
void addTitleBarButtons();
|
||||
void addToolbarItems();
|
||||
void addGlobalUIItems();
|
||||
void addInitTasks();
|
||||
|
||||
void handleBorderlessWindowMode();
|
||||
void setupOutOfBoxExperience();
|
||||
|
||||
void extractBundledFiles();
|
||||
}
|
||||
@@ -352,7 +352,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void handleHexdumpCommand(const std::vector<std::string> &args) {
|
||||
if (args.size() < 1 || args.size() > 3) {
|
||||
if (args.empty() || args.size() > 3) {
|
||||
log::println("usage: imhex --hexdump <file> <offset> <size>");
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -399,7 +399,7 @@ namespace hex::plugin::builtin {
|
||||
if (std::fgets(input.data(), input.size() - 1, stdin) == nullptr)
|
||||
std::exit(EXIT_FAILURE);
|
||||
|
||||
input = input.c_str();
|
||||
input = input.c_str(); // Stop at first null byte
|
||||
input = wolv::util::trim(input);
|
||||
|
||||
if (input == ConfirmationString) {
|
||||
@@ -536,7 +536,7 @@ namespace hex::plugin::builtin {
|
||||
mcp::Client client;
|
||||
|
||||
auto result = client.run(std::cin, std::cout);
|
||||
std::fprintf(stderr, "MCP Client disconnected!\n");
|
||||
fmt::print(stderr, "MCP Client disconnected!\n");
|
||||
std::exit(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/imhex_api/hex_editor.hpp>
|
||||
#include <hex/api/content_registry/data_inspector.hpp>
|
||||
@@ -42,7 +43,7 @@ namespace hex::plugin::builtin {
|
||||
std::memcpy(bytes.data(), &result, bytes.size());
|
||||
|
||||
if (endian != std::endian::native)
|
||||
std::reverse(bytes.begin(), bytes.end());
|
||||
std::ranges::reverse(bytes);
|
||||
|
||||
return bytes;
|
||||
});
|
||||
@@ -58,7 +59,7 @@ namespace hex::plugin::builtin {
|
||||
std::memcpy(bytes.data(), &result, bytes.size());
|
||||
|
||||
if (endian != std::endian::native)
|
||||
std::reverse(bytes.begin(), bytes.end());
|
||||
std::ranges::reverse(bytes);
|
||||
|
||||
return bytes;
|
||||
});
|
||||
@@ -73,7 +74,7 @@ namespace hex::plugin::builtin {
|
||||
std::memcpy(bytes.data(), &result, bytes.size());
|
||||
|
||||
if (endian != std::endian::native)
|
||||
std::reverse(bytes.begin(), bytes.end());
|
||||
std::ranges::reverse(bytes);
|
||||
|
||||
return bytes;
|
||||
});
|
||||
@@ -449,7 +450,7 @@ namespace hex::plugin::builtin {
|
||||
std::memcpy(bytes.data(), wideString->data(), bytes.size());
|
||||
|
||||
if (endian != std::endian::native)
|
||||
std::reverse(bytes.begin(), bytes.end());
|
||||
std::ranges::reverse(bytes);
|
||||
|
||||
return bytes;
|
||||
})
|
||||
@@ -477,7 +478,7 @@ namespace hex::plugin::builtin {
|
||||
std::memcpy(bytes.data(), wideString->data(), bytes.size());
|
||||
|
||||
if (endian != std::endian::native)
|
||||
std::reverse(bytes.begin(), bytes.end());
|
||||
std::ranges::reverse(bytes);
|
||||
|
||||
return bytes;
|
||||
})
|
||||
@@ -505,7 +506,7 @@ namespace hex::plugin::builtin {
|
||||
std::memcpy(bytes.data(), wideString->data(), bytes.size());
|
||||
|
||||
if (endian != std::endian::native)
|
||||
std::reverse(bytes.begin(), bytes.end());
|
||||
std::ranges::reverse(bytes);
|
||||
|
||||
return bytes;
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
#include <hex/data_processor/node.hpp>
|
||||
|
||||
@@ -159,7 +160,7 @@ namespace hex::plugin::builtin {
|
||||
for (u8 &b : data)
|
||||
b = BitFlipLookup[b & 0xf] << 4 | BitFlipLookup[b >> 4];
|
||||
|
||||
std::reverse(data.begin(), data.end());
|
||||
std::ranges::reverse(data);
|
||||
this->setBufferOnOutput(1, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <hex/api/imhex_api/provider.hpp>
|
||||
#include <hex/api/content_registry/pattern_language.hpp>
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
@@ -8,6 +9,7 @@
|
||||
#include <hex/data_processor/node.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
|
||||
#include <numeric>
|
||||
#include <wolv/utils/core.hpp>
|
||||
|
||||
#include <content/helpers/diagrams.hpp>
|
||||
@@ -174,7 +176,7 @@ namespace hex::plugin::builtin {
|
||||
const auto &inputB = this->getBufferOnInput(1);
|
||||
|
||||
auto output = inputA;
|
||||
std::copy(inputB.begin(), inputB.end(), std::back_inserter(output));
|
||||
std::ranges::copy(inputB, std::back_inserter(output));
|
||||
|
||||
this->setBufferOnOutput(2, output);
|
||||
}
|
||||
@@ -212,7 +214,7 @@ namespace hex::plugin::builtin {
|
||||
output.resize(buffer.size() * count);
|
||||
|
||||
for (u32 i = 0; i < count; i++)
|
||||
std::copy(buffer.begin(), buffer.end(), output.begin() + buffer.size() * i);
|
||||
std::ranges::copy(buffer, output.begin() + buffer.size() * i);
|
||||
|
||||
this->setBufferOnOutput(2, output);
|
||||
}
|
||||
@@ -233,7 +235,7 @@ namespace hex::plugin::builtin {
|
||||
if (address + patch.size() > buffer.size())
|
||||
buffer.resize(address + patch.size());
|
||||
|
||||
std::copy(patch.begin(), patch.end(), buffer.begin() + address);
|
||||
std::ranges::copy(patch, buffer.begin() + address);
|
||||
|
||||
this->setBufferOnOutput(3, buffer);
|
||||
}
|
||||
@@ -382,7 +384,7 @@ namespace hex::plugin::builtin {
|
||||
if (ImPlot::BeginPlot("##distribution", viewSize, ImPlotFlags_NoLegend | ImPlotFlags_NoMenus | ImPlotFlags_NoBoxSelect)) {
|
||||
ImPlot::SetupAxes("Address", "Count", ImPlotAxisFlags_Lock, ImPlotAxisFlags_Lock);
|
||||
ImPlot::SetupAxisScale(ImAxis_Y1, ImPlotScale_Log10);
|
||||
ImPlot::SetupAxesLimits(0, 256, 1, double(*std::max_element(m_counts.begin(), m_counts.end())) * 1.1F, ImGuiCond_Always);
|
||||
ImPlot::SetupAxesLimits(0, 256, 1, double(*std::ranges::max_element(m_counts)) * 1.1F, ImGuiCond_Always);
|
||||
|
||||
static auto x = [] {
|
||||
std::array<ImU64, 256> result { 0 };
|
||||
@@ -463,7 +465,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void process() override {
|
||||
auto data = this->getBufferOnInput(0);
|
||||
std::reverse(data.begin(), data.end());
|
||||
std::ranges::reverse(data);
|
||||
this->setBufferOnOutput(1, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,8 +90,8 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
private:
|
||||
constexpr static inline auto ByteCount = 1;
|
||||
constexpr static inline auto CharCount = ByteCount * 2;
|
||||
constexpr static auto ByteCount = 1;
|
||||
constexpr static auto CharCount = ByteCount * 2;
|
||||
|
||||
const static inline auto FormattingUpperCase = fmt::format("%0{}{}X", CharCount, ImGuiExt::getFormatLengthSpecifier<u8>());
|
||||
const static inline auto FormattingLowerCase = fmt::format("%0{}{}x", CharCount, ImGuiExt::getFormatLengthSpecifier<u8>());
|
||||
@@ -175,13 +175,13 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
private:
|
||||
constexpr static inline auto ByteCount = sizeof(T);
|
||||
constexpr static inline auto CharCount = 14;
|
||||
constexpr static auto ByteCount = sizeof(T);
|
||||
constexpr static auto CharCount = 14;
|
||||
|
||||
const static inline auto FormatStringUpperCase = fmt::format("%{}G", CharCount);
|
||||
const static inline auto FormatStringLowerCase = fmt::format("%{}g", CharCount);
|
||||
|
||||
const char *getFormatString(bool upperCase) const {
|
||||
[[nodiscard]] const char *getFormatString(bool upperCase) const {
|
||||
if (upperCase)
|
||||
return FormatStringUpperCase.c_str();
|
||||
else
|
||||
|
||||
@@ -258,11 +258,11 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
|
||||
EventImHexStartupFinished::subscribe([] {
|
||||
const auto currVersion = ImHexApi::System::getImHexVersion();
|
||||
const auto& currVersion = ImHexApi::System::getImHexVersion();
|
||||
const auto prevLaunchVersion = ContentRegistry::Settings::read<std::string>("hex.builtin.setting.general", "hex.builtin.setting.general.prev_launch_version", "");
|
||||
|
||||
const auto forceOobe = getEnvironmentVariable("IMHEX_FORCE_OOBE");
|
||||
if (prevLaunchVersion == "" || (forceOobe.has_value() && *forceOobe != "0")) {
|
||||
if (prevLaunchVersion.empty() || (forceOobe.has_value() && *forceOobe != "0")) {
|
||||
EventFirstLaunch::post();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace hex::plugin::builtin {
|
||||
if (restoreWindowPos) {
|
||||
ImHexApi::System::InitialWindowProperties properties = {};
|
||||
|
||||
properties.maximized = ContentRegistry::Settings::read<bool>("hex.builtin.setting.interface", "hex.builtin.setting.interface.window.maximized", 0);
|
||||
properties.maximized = ContentRegistry::Settings::read<bool>("hex.builtin.setting.interface", "hex.builtin.setting.interface.window.maximized", false);
|
||||
properties.x = ContentRegistry::Settings::read<int>("hex.builtin.setting.interface", "hex.builtin.setting.interface.window.x", 0);
|
||||
properties.y = ContentRegistry::Settings::read<int>("hex.builtin.setting.interface", "hex.builtin.setting.interface.window.y", 0);
|
||||
properties.width = ContentRegistry::Settings::read<int>("hex.builtin.setting.interface", "hex.builtin.setting.interface.window.width", 0);
|
||||
|
||||
@@ -51,9 +51,9 @@ namespace hex::plugin::builtin {
|
||||
void zerosMiniMapVisualizer(u64, std::span<const u8> data, std::vector<ImColor> &output) {
|
||||
for (u8 byte : data) {
|
||||
if (byte == 0x00)
|
||||
output.push_back(ImColor(1.0F, 1.0F, 1.0F, 1.0F));
|
||||
output.emplace_back(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
else
|
||||
output.push_back(ImColor(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
output.emplace_back(0.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void rgba8MiniMapVisualizer(u64 address, std::span<const u8> data, std::vector<ImColor> &output) {
|
||||
colorMinimapVisualizer(address, data, output, 4, [](std::span<const u8> subData) -> ImColor {
|
||||
return ImColor(subData[0], subData[1], subData[2], 0xFF);
|
||||
return {subData[0], subData[1], subData[2], 0xFF};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace hex::plugin::builtin {
|
||||
u8 r = (subData[0] & 0xF8);
|
||||
u8 g = ((subData[0] & 0x07) << 5) | ((subData[1] & 0xE0) >> 3);
|
||||
u8 b = (subData[1] & 0x1F) << 3;
|
||||
return ImColor(r, g, b, 0xFF);
|
||||
return {r, g, b, 0xFF};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
class Blend {
|
||||
public:
|
||||
Blend(float start, float end) : m_time(0), m_start(start), m_end(end) {}
|
||||
Blend(float start, float end) : m_start(start), m_end(end) {}
|
||||
|
||||
[[nodiscard]] operator float() {
|
||||
m_time += ImGui::GetIO().DeltaTime;
|
||||
@@ -56,7 +56,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
private:
|
||||
float m_time;
|
||||
float m_time = 0;
|
||||
float m_start, m_end;
|
||||
};
|
||||
|
||||
@@ -472,7 +472,7 @@ namespace hex::plugin::builtin {
|
||||
EventFirstLaunch::subscribe([] {
|
||||
ImHexApi::System::setWindowResizable(false);
|
||||
|
||||
const auto imageTheme = ThemeManager::getImageTheme();
|
||||
auto &imageTheme = ThemeManager::getImageTheme();
|
||||
s_imhexBanner = ImGuiExt::Texture::fromSVG(romfs::get(fmt::format("assets/{}/banner.svg", imageTheme)).span<std::byte>(), 0, 0, ImGuiExt::Texture::Filter::Linear);
|
||||
s_compassTexture = ImGuiExt::Texture::fromImage(romfs::get("assets/common/compass.png").span<std::byte>(), ImGuiExt::Texture::Filter::Linear);
|
||||
s_globeTexture = ImGuiExt::Texture::fromImage(romfs::get("assets/common/globe.png").span<std::byte>(), ImGuiExt::Texture::Filter::Linear);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <hex/api/content_registry/pattern_language.hpp>
|
||||
#include <hex/helpers/encoding_file.hpp>
|
||||
|
||||
@@ -43,7 +44,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
this->getEvaluator()->readData(this->getOffset(), result.data(), result.size(), this->getSection());
|
||||
if (this->getEndian() != std::endian::native)
|
||||
std::reverse(result.begin(), result.end());
|
||||
std::ranges::reverse(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
CommandProvider::CommandProvider() { }
|
||||
CommandProvider::CommandProvider() = default;
|
||||
|
||||
bool CommandProvider::isAvailable() const {
|
||||
return m_open;
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
auto data = gdb::readMemory(m_socket, offset, size);
|
||||
if (!data.empty())
|
||||
std::memcpy(buffer, &data[0], data.size());
|
||||
std::memcpy(buffer, data.data(), data.size());
|
||||
}
|
||||
|
||||
void GDBProvider::writeToSource(u64 offset, const void *buffer, size_t size) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#if defined(OS_WINDOWS) || defined(OS_MACOS) || (defined(OS_LINUX) && !defined(OS_FREEBSD))
|
||||
|
||||
#include <algorithm>
|
||||
#include <content/providers/process_memory_provider.hpp>
|
||||
#include <hex/api/imhex_api/hex_editor.hpp>
|
||||
|
||||
@@ -568,7 +569,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
std::variant<std::string, i128> ProcessMemoryProvider::queryInformation(const std::string &category, const std::string &argument) {
|
||||
auto findRegionByName = [this](const std::string &name) {
|
||||
return std::find_if(m_memoryRegions.begin(), m_memoryRegions.end(),
|
||||
return std::ranges::find_if(m_memoryRegions,
|
||||
[name](const auto ®ion) {
|
||||
return region.name == name;
|
||||
});
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace hex::plugin::builtin::recent {
|
||||
return ImGuiWindowFlags_AlwaysAutoResize;
|
||||
}
|
||||
|
||||
void saveCurrentProjectAsRecent() {
|
||||
static void saveCurrentProjectAsRecent() {
|
||||
if (!ContentRegistry::Settings::read<bool>("hex.builtin.setting.general", "hex.builtin.setting.general.save_recent_providers", true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <hex/api/imhex_api/system.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
@@ -81,11 +82,7 @@ namespace hex::plugin::builtin {
|
||||
return "%d FPS";
|
||||
}();
|
||||
|
||||
if (ImGui::SliderInt(name.data(), &m_value, 14, 201, format.c_str(), ImGuiSliderFlags_AlwaysClamp)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return ImGui::SliderInt(name.data(), &m_value, 14, 201, format.c_str(), ImGuiSliderFlags_AlwaysClamp);
|
||||
}
|
||||
|
||||
void load(const nlohmann::json &data) override {
|
||||
@@ -129,7 +126,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (ImGuiExt::DimmedIconButton(ICON_VS_NEW_FOLDER, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
fs::openFileBrowser(fs::DialogMode::Folder, {}, [&](const std::fs::path &path) {
|
||||
if (std::find(m_paths.begin(), m_paths.end(), path) == m_paths.end()) {
|
||||
if (std::ranges::find(m_paths, path) == m_paths.end()) {
|
||||
m_paths.emplace_back(path);
|
||||
ImHexApi::System::setAdditionalFolderPaths(m_paths);
|
||||
|
||||
@@ -170,7 +167,8 @@ namespace hex::plugin::builtin {
|
||||
nlohmann::json store() override {
|
||||
std::vector<std::string> pathStrings;
|
||||
|
||||
for (const auto &path : m_paths) {
|
||||
pathStrings.reserve(m_paths.size());
|
||||
for (const auto &path : m_paths) {
|
||||
pathStrings.push_back(wolv::io::fs::toNormalizedPathString(path));
|
||||
}
|
||||
|
||||
@@ -211,7 +209,7 @@ namespace hex::plugin::builtin {
|
||||
return m_value;
|
||||
}
|
||||
|
||||
float getValue() const {
|
||||
[[nodiscard]] float getValue() const {
|
||||
return m_value;
|
||||
}
|
||||
|
||||
@@ -232,11 +230,7 @@ namespace hex::plugin::builtin {
|
||||
return fmt::format("hex.builtin.setting.general.backups.auto_backup_time.format.extended"_lang, value / 60, value % 60);
|
||||
}();
|
||||
|
||||
if (ImGui::SliderInt(name.data(), &m_value, 0, (30 * 60) / 30, format.c_str(), ImGuiSliderFlags_AlwaysClamp | ImGuiSliderFlags_NoInput)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return ImGui::SliderInt(name.data(), &m_value, 0, (30 * 60) / 30, format.c_str(), ImGuiSliderFlags_AlwaysClamp | ImGuiSliderFlags_NoInput);
|
||||
}
|
||||
|
||||
void load(const nlohmann::json &data) override {
|
||||
@@ -794,6 +788,7 @@ namespace hex::plugin::builtin {
|
||||
{
|
||||
auto themeNames = ThemeManager::getThemeNames();
|
||||
std::vector<nlohmann::json> themeJsons = { };
|
||||
themeJsons.reserve(themeNames.size());
|
||||
for (const auto &themeName : themeNames)
|
||||
themeJsons.emplace_back(themeName);
|
||||
|
||||
@@ -1059,7 +1054,8 @@ namespace hex::plugin::builtin {
|
||||
auto folderPathStrings = ContentRegistry::Settings::read<std::vector<std::string>>("hex.builtin.setting.folders", "hex.builtin.setting.folders", { });
|
||||
|
||||
std::vector<std::fs::path> paths;
|
||||
for (const auto &pathString : folderPathStrings) {
|
||||
paths.reserve(folderPathStrings.size());
|
||||
for (const auto &pathString : folderPathStrings) {
|
||||
paths.emplace_back(pathString);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <content/text_highlighting/pattern_language.hpp>
|
||||
#include <pl/core/ast/ast_node_type_decl.hpp>
|
||||
#include <pl/core/ast/ast_node_enum.hpp>
|
||||
@@ -59,7 +60,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
bool TextHighlighter::forwardIdentifierName(std::string &identifierName, std::vector<Identifier *> &identifiers, bool preserveCurr ) {
|
||||
auto curr = m_curr;
|
||||
Identifier *identifier = getValue<Identifier>(0);
|
||||
auto *identifier = getValue<Identifier>(0);
|
||||
std::string current;
|
||||
|
||||
if (identifier != nullptr) {
|
||||
@@ -287,7 +288,7 @@ namespace hex::plugin::builtin {
|
||||
if (peek(tkn::Literal::Identifier)) {
|
||||
if (identifier = getValue<Identifier>(0); identifier != nullptr) {
|
||||
identifierType = identifier->getType();
|
||||
std::string name = identifier->get();
|
||||
auto& name = identifier->get();
|
||||
|
||||
if (identifierType == identifierTypeToSearch) {
|
||||
switch (identifierType) {
|
||||
@@ -367,8 +368,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
m_curr = curr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void TextHighlighter::skipTemplate(i32 maxSkipCount, bool forward) {
|
||||
Token delimiters[2];
|
||||
@@ -523,7 +523,7 @@ namespace hex::plugin::builtin {
|
||||
result.idType = IdentifierType::Unknown;
|
||||
std::string identifierName = optionalIdentifierName;
|
||||
|
||||
if (optionalIdentifierName == "") {
|
||||
if (optionalIdentifierName.empty()) {
|
||||
std::vector<Identifier *> identifiers;
|
||||
getFullName(identifierName, identifiers);
|
||||
}
|
||||
@@ -579,7 +579,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
}
|
||||
auto it = std::find_if(definitions.begin(), definitions.end(), [&](const Definition &definition) {
|
||||
auto it = std::ranges::find_if(definitions, [&](const Definition &definition) {
|
||||
return definition.tokenIndex > tokenRange.start && definition.tokenIndex < tokenRange.end;
|
||||
});
|
||||
|
||||
@@ -681,7 +681,7 @@ namespace hex::plugin::builtin {
|
||||
next();
|
||||
} else if (auto udtVars = m_UDTVariables[result.typeStr];udtVars.contains(vectorString[index-1])) {
|
||||
auto saveCurr = m_curr;
|
||||
std::string templateName = "";
|
||||
std::string templateName;
|
||||
auto instances = m_instances[variableParentType];
|
||||
for (auto instance : instances) {
|
||||
if (auto *identifier = std::get_if<Identifier>(&m_tokens[instance].value); identifier != nullptr && identifier->getType() == IdentifierType::TemplateArgument) {
|
||||
@@ -704,7 +704,7 @@ namespace hex::plugin::builtin {
|
||||
next();
|
||||
} else{
|
||||
if (m_typeDefMap.contains(variableParentType)) {
|
||||
std::string typeName = "";
|
||||
std::string typeName;
|
||||
instances = m_instances[variableParentType];
|
||||
for (auto instance: instances) {
|
||||
if (auto *identifier = std::get_if<Identifier>(&m_tokens[instance].value);
|
||||
@@ -771,7 +771,7 @@ namespace hex::plugin::builtin {
|
||||
if (!sequence(tkn::Operator::ScopeResolution) || vectorStringCount != i+2 ||
|
||||
!m_UDTVariables.contains(name))
|
||||
return false;
|
||||
auto variableName = vectorString[i+1];
|
||||
const auto& variableName = vectorString[i+1];
|
||||
if (!m_UDTVariables[name].contains(variableName))
|
||||
return false;
|
||||
auto variableDefinition = m_UDTVariables[name][variableName][0];
|
||||
@@ -858,16 +858,14 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (tokenId > interval.start && tokenId < interval.end) {
|
||||
|
||||
if (nameSpace == "")
|
||||
if (nameSpace.empty())
|
||||
nameSpace = name;
|
||||
else
|
||||
nameSpace = name + "::" + nameSpace;
|
||||
}
|
||||
}
|
||||
|
||||
if (nameSpace != "")
|
||||
return true;
|
||||
return false;
|
||||
return nameSpace != "";
|
||||
}
|
||||
|
||||
//The context is the name of the function or UDT that the variable is in.
|
||||
@@ -1300,7 +1298,7 @@ namespace hex::plugin::builtin {
|
||||
if (identifierType == IdentifierType::Typedef) {
|
||||
auto curr = m_curr;
|
||||
next();
|
||||
std::string typeName = "";
|
||||
std::string typeName;
|
||||
if (sequence(tkn::Operator::Assign, tkn::Literal::Identifier)) {
|
||||
auto identifier2 = getValue<Identifier>(-1);
|
||||
if (identifier2 != nullptr) {
|
||||
@@ -1452,7 +1450,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void TextHighlighter::colorRemainingIdentifierTokens() {
|
||||
std::vector<i32> taggedIdentifiers;
|
||||
for (auto index: m_taggedIdentifiers) {
|
||||
taggedIdentifiers.reserve(m_taggedIdentifiers.size());
|
||||
for (auto index: m_taggedIdentifiers) {
|
||||
taggedIdentifiers.push_back(index);
|
||||
}
|
||||
m_taggedIdentifiers.clear();
|
||||
@@ -1470,7 +1469,7 @@ namespace hex::plugin::builtin {
|
||||
taggedIdentifiers.pop_back();
|
||||
}
|
||||
|
||||
Token *token = const_cast<Token *>(&m_curr[0]);
|
||||
auto *token = const_cast<Token *>(&m_curr[0]);
|
||||
|
||||
if (sequence(tkn::Keyword::Import, tkn::Literal::Identifier)) {
|
||||
next(-1);
|
||||
@@ -1581,7 +1580,7 @@ namespace hex::plugin::builtin {
|
||||
continue;
|
||||
std::string lineOfColors = std::string(m_lines[line].size(), 0);
|
||||
for (auto tokenIndex = m_firstTokenIdOfLine[line]; tokenIndex < m_firstTokenIdOfLine[nextLine(line)]; tokenIndex++) {
|
||||
Token *token = const_cast<Token *>(&m_tokens[tokenIndex]);
|
||||
auto *token = const_cast<Token *>(&m_tokens[tokenIndex]);
|
||||
if (m_tokenColors.contains(token) && token->type == Token::Type::Identifier) {
|
||||
u8 color = (u8) m_tokenColors.at(token);
|
||||
u32 tokenLength = token->location.length;
|
||||
@@ -1935,7 +1934,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
m_lines = wolv::util::splitString(m_text, "\n");
|
||||
m_lines.push_back("");
|
||||
m_lines.emplace_back("");
|
||||
m_firstTokenIdOfLine.clear();
|
||||
m_firstTokenIdOfLine.resize(m_lines.size(), -1);
|
||||
|
||||
@@ -2143,7 +2142,7 @@ namespace hex::plugin::builtin {
|
||||
while (next != ranges.end()) {
|
||||
|
||||
if (next->start - it->end < 2) {
|
||||
Interval &range = const_cast<Interval &>(*it);
|
||||
auto &range = const_cast<Interval &>(*it);
|
||||
range.end = next->end;
|
||||
ranges.erase(next);
|
||||
next = std::next(it);
|
||||
@@ -2345,6 +2344,5 @@ namespace hex::plugin::builtin {
|
||||
m_wasInterrupted = true;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <imgui.h>
|
||||
#include <hex/ui/imgui_imhex_extensions.h>
|
||||
#include <content/tools_entries.hpp>
|
||||
|
||||
#include <fonts/vscode_icons.hpp>
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (response.valid() && response.wait_for(0s) != std::future_status::timeout) {
|
||||
const auto result = response.get();
|
||||
const auto data = result.getData();
|
||||
const auto& data = result.getData();
|
||||
|
||||
if (const auto status = result.getStatusCode(); status != 0)
|
||||
responseText = "Status: " + std::to_string(result.getStatusCode()) + "\n\n" + data;
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace hex::plugin::builtin {
|
||||
|
||||
class IEEE754STATICS {
|
||||
public:
|
||||
IEEE754STATICS() : value(0), exponentBitCount(8), mantissaBitCount(23), resultFloat(0) {}
|
||||
IEEE754STATICS() {}
|
||||
|
||||
u128 value;
|
||||
i32 exponentBitCount;
|
||||
i32 mantissaBitCount;
|
||||
long double resultFloat;
|
||||
u128 value = 0;
|
||||
i32 exponentBitCount = 8;
|
||||
i32 mantissaBitCount =23;
|
||||
long double resultFloat = 0;
|
||||
};
|
||||
|
||||
static IEEE754STATICS ieee754statics;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
void drawFileTools() {
|
||||
static void drawFileTools() {
|
||||
if (ImGui::BeginTabBar("file_tools_tabs")) {
|
||||
if (ImGui::BeginTabItem("hex.builtin.tools.file_tools.shredder"_lang)) {
|
||||
drawFileToolShredder();
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace hex::plugin::builtin {
|
||||
try {
|
||||
const auto attribute = pattern->getAttributeArguments(SimplifiedEditorAttribute);
|
||||
|
||||
const auto name = attribute.size() >= 1 ? attribute[0].toString() : pattern->getDisplayName();
|
||||
const auto name = !attribute.empty() ? attribute[0].toString() : pattern->getDisplayName();
|
||||
const auto description = attribute.size() >= 2 ? attribute[1].toString() : pattern->getComment();
|
||||
|
||||
const auto widgetPos = 200_scaled;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "content/views/view_achievements.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
@@ -321,11 +322,12 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Get all achievement category names
|
||||
std::vector<std::string> categories;
|
||||
for (const auto &[categoryName, achievements] : startNodes) {
|
||||
categories.reserve(startNodes.size());
|
||||
for (const auto &[categoryName, achievements] : startNodes) {
|
||||
categories.push_back(categoryName);
|
||||
}
|
||||
|
||||
std::reverse(categories.begin(), categories.end());
|
||||
std::ranges::reverse(categories);
|
||||
|
||||
// Draw each individual achievement category
|
||||
for (const auto &categoryName : categories) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "content/views/view_data_inspector.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/providers/provider.hpp>
|
||||
@@ -263,7 +264,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
const auto selection = ImHexApi::HexEditor::getSelection();
|
||||
const auto selectedEntryIt = std::find_if(m_cachedData.begin(), m_cachedData.end(), [this](const InspectorCacheEntry &entry) {
|
||||
const auto selectedEntryIt = std::ranges::find_if(m_cachedData, [this](const InspectorCacheEntry &entry) {
|
||||
return entry.unlocalizedName == m_selectedEntryName;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "content/views/view_data_processor.hpp"
|
||||
#include <algorithm>
|
||||
#include <toasts/toast_notification.hpp>
|
||||
|
||||
#include <hex/api/content_registry/data_processor.hpp>
|
||||
@@ -52,9 +53,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void setValue(auto value) { m_value = std::move(value); }
|
||||
|
||||
const std::string &getName() const { return m_name; }
|
||||
[[nodiscard]] const std::string &getName() const { return m_name; }
|
||||
|
||||
dp::Attribute::Type getType() const {
|
||||
[[nodiscard]] dp::Attribute::Type getType() const {
|
||||
switch (m_type) {
|
||||
default:
|
||||
case 0: return dp::Attribute::Type::Integer;
|
||||
@@ -121,8 +122,8 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PopItemWidth();
|
||||
}
|
||||
|
||||
const std::string &getName() const { return m_name; }
|
||||
dp::Attribute::Type getType() const {
|
||||
[[nodiscard]] const std::string &getName() const { return m_name; }
|
||||
[[nodiscard]] dp::Attribute::Type getType() const {
|
||||
switch (m_type) {
|
||||
case 0: return dp::Attribute::Type::Integer;
|
||||
case 1: return dp::Attribute::Type::Float;
|
||||
@@ -139,7 +140,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
const auto& getValue() const { return m_value; }
|
||||
[[nodiscard]] const auto& getValue() const { return m_value; }
|
||||
|
||||
void store(nlohmann::json &j) const override {
|
||||
j = nlohmann::json::object();
|
||||
@@ -314,7 +315,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<dp::Attribute> findAttributes() const {
|
||||
[[nodiscard]] std::vector<dp::Attribute> findAttributes() const {
|
||||
std::vector<dp::Attribute> result;
|
||||
|
||||
// Search through all nodes in the workspace and add all input and output nodes to the result
|
||||
@@ -328,7 +329,7 @@ namespace hex::plugin::builtin {
|
||||
return result;
|
||||
}
|
||||
|
||||
NodeCustomInput* findInput(const std::string &name) const {
|
||||
[[nodiscard]] NodeCustomInput* findInput(const std::string &name) const {
|
||||
for (auto &node : m_workspace.nodes) {
|
||||
if (auto *inputNode = dynamic_cast<NodeCustomInput*>(node.get()); inputNode != nullptr && inputNode->getName() == name)
|
||||
return inputNode;
|
||||
@@ -337,7 +338,7 @@ namespace hex::plugin::builtin {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NodeCustomOutput* findOutput(const std::string &name) const {
|
||||
[[nodiscard]] NodeCustomOutput* findOutput(const std::string &name) const {
|
||||
for (auto &node : m_workspace.nodes) {
|
||||
if (auto *outputNode = dynamic_cast<NodeCustomOutput*>(node.get()); outputNode != nullptr && outputNode->getName() == name)
|
||||
return outputNode;
|
||||
@@ -445,7 +446,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void ViewDataProcessor::eraseLink(Workspace &workspace, int id) {
|
||||
// Find the link with the given ID
|
||||
auto link = std::find_if(workspace.links.begin(), workspace.links.end(),
|
||||
auto link = std::ranges::find_if(workspace.links,
|
||||
[&id](auto link) {
|
||||
return link.getId() == id;
|
||||
});
|
||||
@@ -472,7 +473,7 @@ namespace hex::plugin::builtin {
|
||||
// and remove all links that are connected to the attributes of the node
|
||||
for (int id : ids) {
|
||||
// Find the node with the given ID
|
||||
auto node = std::find_if(workspace.nodes.begin(), workspace.nodes.end(),
|
||||
auto node = std::ranges::find_if(workspace.nodes,
|
||||
[&id](const auto &node) {
|
||||
return node->getId() == id;
|
||||
});
|
||||
@@ -495,7 +496,7 @@ namespace hex::plugin::builtin {
|
||||
// and remove the nodes from the workspace
|
||||
for (int id : ids) {
|
||||
// Find the node with the given ID
|
||||
auto node = std::find_if(workspace.nodes.begin(), workspace.nodes.end(),
|
||||
auto node = std::ranges::find_if(workspace.nodes,
|
||||
[&id](const auto &node) {
|
||||
return node->getId() == id;
|
||||
});
|
||||
@@ -762,7 +763,7 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::BeginPopup("Node Menu")) {
|
||||
if (ImGui::MenuItem("hex.builtin.view.data_processor.menu.save_node"_lang)) {
|
||||
// Find the node that was right-clicked
|
||||
auto it = std::find_if(workspace.nodes.begin(), workspace.nodes.end(),
|
||||
auto it = std::ranges::find_if(workspace.nodes,
|
||||
[this](const auto &node) {
|
||||
return node->getId() == m_rightClickedId;
|
||||
});
|
||||
@@ -856,7 +857,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
auto value = i64(*reinterpret_cast<i128*>(defaultValue.data()));
|
||||
if (ImGui::InputScalar(Lang(attribute.getUnlocalizedName()), ImGuiDataType_S64, &value)) {
|
||||
std::fill(defaultValue.begin(), defaultValue.end(), 0x00);
|
||||
std::ranges::fill(defaultValue, 0x00);
|
||||
|
||||
i128 writeValue = value;
|
||||
std::memcpy(defaultValue.data(), &writeValue, sizeof(writeValue));
|
||||
@@ -866,7 +867,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
auto value = double(*reinterpret_cast<long double*>(defaultValue.data()));
|
||||
if (ImGui::InputScalar(Lang(attribute.getUnlocalizedName()), ImGuiDataType_Double, &value)) {
|
||||
std::fill(defaultValue.begin(), defaultValue.end(), 0x00);
|
||||
std::ranges::fill(defaultValue, 0x00);
|
||||
|
||||
long double writeValue = value;
|
||||
std::memcpy(defaultValue.data(), &writeValue, sizeof(writeValue));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "content/views/view_find.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <hex/api/achievement_manager.hpp>
|
||||
#include <hex/api/imhex_api/hex_editor.hpp>
|
||||
#include <hex/api/events/events_interaction.hpp>
|
||||
@@ -214,16 +215,16 @@ namespace hex::plugin::builtin {
|
||||
|
||||
newSettings.type = ASCII;
|
||||
auto asciiResults = searchStrings(task, provider, searchRegion, newSettings);
|
||||
std::copy(asciiResults.begin(), asciiResults.end(), std::back_inserter(results));
|
||||
std::ranges::copy(asciiResults, std::back_inserter(results));
|
||||
|
||||
if (settings.type == ASCII_UTF16BE) {
|
||||
newSettings.type = UTF16BE;
|
||||
auto utf16Results = searchStrings(task, provider, searchRegion, newSettings);
|
||||
std::copy(utf16Results.begin(), utf16Results.end(), std::back_inserter(results));
|
||||
std::ranges::copy(utf16Results, std::back_inserter(results));
|
||||
} else if (settings.type == ASCII_UTF16LE) {
|
||||
newSettings.type = UTF16LE;
|
||||
auto utf16Results = searchStrings(task, provider, searchRegion, newSettings);
|
||||
std::copy(utf16Results.begin(), utf16Results.end(), std::back_inserter(results));
|
||||
std::ranges::copy(utf16Results, std::back_inserter(results));
|
||||
}
|
||||
|
||||
return results;
|
||||
@@ -921,7 +922,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::Checkbox(fmt::format("{} [0-9]", "hex.builtin.view.find.strings.numbers"_lang.get()).c_str(), &settings.numbers);
|
||||
ImGui::Checkbox(fmt::format("{} [_]", "hex.builtin.view.find.strings.underscores"_lang.get()).c_str(), &settings.underscores);
|
||||
ImGui::Checkbox(fmt::format("{} [!\"#$%...]", "hex.builtin.view.find.strings.symbols"_lang.get()).c_str(), &settings.symbols);
|
||||
ImGui::Checkbox(fmt::format("{} [ \\f\\t\\v]", "hex.builtin.view.find.strings.spaces"_lang.get()).c_str(), &settings.spaces);
|
||||
ImGui::Checkbox(fmt::format(R"({} [ \f\t\v])", "hex.builtin.view.find.strings.spaces"_lang.get()).c_str(), &settings.spaces);
|
||||
ImGui::Checkbox(fmt::format("{} [\\r\\n]", "hex.builtin.view.find.strings.line_feeds"_lang.get()).c_str(), &settings.lineFeeds);
|
||||
|
||||
ImGui::EndPopup();
|
||||
@@ -1158,11 +1159,11 @@ namespace hex::plugin::builtin {
|
||||
m_filterTask.interrupt();
|
||||
|
||||
static std::mutex mutex;
|
||||
std::lock_guard lock(mutex);
|
||||
std::scoped_lock lock(mutex);
|
||||
|
||||
if (!m_currFilter->empty()) {
|
||||
m_filterTask = TaskManager::createTask("hex.builtin.task.filtering_data", currOccurrences.size(), [this, provider, &currOccurrences, filter = m_currFilter.get(provider)](Task &task) {
|
||||
std::lock_guard lock(mutex);
|
||||
std::scoped_lock lock(mutex);
|
||||
|
||||
u64 progress = 0;
|
||||
std::erase_if(currOccurrences, [this, provider, &task, &progress, &filter](const auto ®ion) {
|
||||
|
||||
@@ -304,7 +304,7 @@ namespace hex::plugin::builtin {
|
||||
try {
|
||||
const auto attribute = pattern->getAttributeArguments(SimplifiedEditorAttribute);
|
||||
|
||||
const auto name = attribute.size() >= 1 ? attribute[0].toString() : pattern->getDisplayName();
|
||||
const auto name = !attribute.empty() ? attribute[0].toString() : pattern->getDisplayName();
|
||||
const auto description = attribute.size() >= 2 ? attribute[1].toString() : pattern->getComment();
|
||||
|
||||
const auto widgetPos = 200_scaled;
|
||||
|
||||
@@ -456,8 +456,8 @@ namespace hex::plugin::builtin {
|
||||
)
|
||||
)
|
||||
);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0F, 0.0F));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0F, 0.0F));
|
||||
if (ImGui::BeginChild("##pattern_editor_resizer", defaultEditorSize, ImGuiChildFlags_ResizeY)) {
|
||||
m_textEditor.get(provider).render("##pattern_editor", ImGui::GetContentRegionAvail(), false);
|
||||
m_textEditorHoverBox = ImGui::GetCurrentWindow()->Rect();
|
||||
@@ -1257,7 +1257,7 @@ namespace hex::plugin::builtin {
|
||||
m_hasUnevaluatedChanges.get(provider) = true;
|
||||
variable.value = buffer[0];
|
||||
} else if (variable.type == pl::core::Token::ValueType::String) {
|
||||
std::string buffer = hex::get_or<std::string>(variable.value, "");
|
||||
auto buffer = hex::get_or<std::string>(variable.value, "");
|
||||
if (ImGui::InputText(label.c_str(), buffer))
|
||||
m_hasUnevaluatedChanges.get(provider) = true;
|
||||
variable.value = buffer;
|
||||
@@ -1354,7 +1354,7 @@ namespace hex::plugin::builtin {
|
||||
for (const auto &frame : **m_callStack | std::views::reverse) {
|
||||
auto location = frame.node->getLocation();
|
||||
if (location.source != nullptr && location.source->mainSource) {
|
||||
std::string message = "";
|
||||
std::string message;
|
||||
if (m_lastEvaluationError->has_value())
|
||||
message = processMessage((*m_lastEvaluationError)->message);
|
||||
auto key = ui::TextEditor::Coordinates(location.line, location.column);
|
||||
@@ -1646,7 +1646,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ContentRegistry::PatternLanguage::configureRuntime(*m_editorRuntime, nullptr);
|
||||
const auto &ast = m_editorRuntime->parseString(code, pl::api::Source::DefaultSource);
|
||||
m_textEditor.get(provider).setLongestLineLength(m_editorRuntime->getInternals().preprocessor.get()->getLongestLineLength());
|
||||
m_textEditor.get(provider).setLongestLineLength(m_editorRuntime->getInternals().preprocessor->getLongestLineLength());
|
||||
|
||||
auto &patternVariables = m_patternVariables.get(provider);
|
||||
auto oldPatternVariables = std::move(patternVariables);
|
||||
@@ -2132,7 +2132,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (m_breakpoints->contains(line))
|
||||
evaluator->removeBreakpoint(line);
|
||||
else
|
||||
else
|
||||
evaluator->addBreakpoint(line);
|
||||
|
||||
m_breakpoints = evaluator->getBreakpoints();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <hex/api/workspace_manager.hpp>
|
||||
@@ -162,7 +163,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
bool isAnyViewOpen() {
|
||||
const auto &views = ContentRegistry::Views::impl::getEntries();
|
||||
return std::any_of(views.begin(), views.end(),
|
||||
return std::ranges::any_of(views,
|
||||
[](const auto &entry) {
|
||||
return entry.second->getWindowOpenState();
|
||||
});
|
||||
@@ -819,7 +820,7 @@ namespace hex::plugin::builtin {
|
||||
std::mt19937 random(daysSinceEpoch.count());
|
||||
|
||||
auto chosenCategory = tipsCategories[random()%tipsCategories.size()].at("tips");
|
||||
auto chosenTip = chosenCategory[random()%chosenCategory.size()];
|
||||
const auto& chosenTip = chosenCategory[random()%chosenCategory.size()];
|
||||
s_tipOfTheDay = chosenTip.get<std::string>();
|
||||
|
||||
bool showTipOfTheDay = ContentRegistry::Settings::read<bool>("hex.builtin.setting.general", "hex.builtin.setting.general.show_tips", false);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <hex/api/content_registry/user_interface.hpp>
|
||||
#include <hex/api/content_registry/views.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
@@ -601,7 +602,7 @@ namespace hex::plugin::builtin {
|
||||
if (const auto &items = ContentRegistry::UserInterface::impl::getSidebarItems(); items.empty()) {
|
||||
return false;
|
||||
} else {
|
||||
return std::any_of(items.begin(), items.end(), [](const auto &item) {
|
||||
return std::ranges::any_of(items, [](const auto &item) {
|
||||
return item.enabledCallback();
|
||||
});
|
||||
}
|
||||
@@ -609,7 +610,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
bool isAnyViewOpen() {
|
||||
const auto &views = ContentRegistry::Views::impl::getEntries();
|
||||
return std::any_of(views.begin(), views.end(),
|
||||
return std::ranges::any_of(views,
|
||||
[](const auto &entry) {
|
||||
return entry.second->getWindowOpenState();
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <hex/plugin.hpp>
|
||||
#include <plugin_builtin.hpp>
|
||||
|
||||
#include <hex/plugin.hpp>
|
||||
#include <hex/api/content_registry/settings.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
#include <hex/helpers/logger.hpp>
|
||||
@@ -15,54 +16,6 @@
|
||||
|
||||
using namespace hex;
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
void registerEventHandlers();
|
||||
void registerDataVisualizers();
|
||||
void registerMiniMapVisualizers();
|
||||
void registerDataInspectorEntries();
|
||||
void registerToolEntries();
|
||||
void registerPatternLanguageFunctions();
|
||||
void registerPatternLanguageTypes();
|
||||
void registerPatternLanguagePragmas();
|
||||
void registerPatternLanguageVisualizers();
|
||||
void registerCommandPaletteCommands();
|
||||
void registerSettings();
|
||||
void loadSettings();
|
||||
void registerDataProcessorNodes();
|
||||
void registerProviders();
|
||||
void registerDataFormatters();
|
||||
void registerMainMenuEntries();
|
||||
void createWelcomeScreen();
|
||||
void registerViews();
|
||||
void registerThemeHandlers();
|
||||
void registerStyleHandlers();
|
||||
void registerThemes();
|
||||
void registerBackgroundServices();
|
||||
void registerNetworkEndpoints();
|
||||
void registerMCPTools();
|
||||
void registerFileHandlers();
|
||||
void registerProjectHandlers();
|
||||
void registerAchievements();
|
||||
void registerReportGenerators();
|
||||
void registerTutorials();
|
||||
void registerDataInformationSections();
|
||||
void loadWorkspaces();
|
||||
|
||||
void addWindowDecoration();
|
||||
void addFooterItems();
|
||||
void addTitleBarButtons();
|
||||
void addToolbarItems();
|
||||
void addGlobalUIItems();
|
||||
void addInitTasks();
|
||||
|
||||
void handleBorderlessWindowMode();
|
||||
void setupOutOfBoxExperience();
|
||||
|
||||
void extractBundledFiles();
|
||||
|
||||
}
|
||||
|
||||
IMHEX_PLUGIN_SUBCOMMANDS() {
|
||||
{ "help", "h", "Print help about this command", hex::plugin::builtin::handleHelpCommand },
|
||||
{ "version", "", "Print ImHex version", hex::plugin::builtin::handleVersionCommand },
|
||||
|
||||
Reference in New Issue
Block a user