mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
feat: Replace useless constants view with a constant search option in the Find view
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex/ui/view.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
enum class ConstantType
|
||||
{
|
||||
Int10,
|
||||
Int16BigEndian,
|
||||
Int16LittleEndian
|
||||
};
|
||||
|
||||
struct Constant {
|
||||
std::string name, description;
|
||||
std::string category;
|
||||
ConstantType type;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
class ViewConstants : public View::Window {
|
||||
public:
|
||||
explicit ViewConstants();
|
||||
~ViewConstants() override = default;
|
||||
|
||||
void drawContent() override;
|
||||
|
||||
private:
|
||||
void reloadConstants();
|
||||
|
||||
std::vector<Constant> m_constants;
|
||||
std::vector<size_t> m_filterIndices;
|
||||
std::string m_filter;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -46,7 +46,8 @@ namespace hex::plugin::builtin {
|
||||
Sequence,
|
||||
Regex,
|
||||
BinaryPattern,
|
||||
Value
|
||||
Value,
|
||||
Constants
|
||||
} mode = Mode::Strings;
|
||||
|
||||
enum class StringType : int { ASCII = 0, UTF8 = 1, UTF16LE = 2, UTF16BE = 3, ASCII_UTF16LE = 4, ASCII_UTF16BE = 5 };
|
||||
@@ -100,6 +101,10 @@ namespace hex::plugin::builtin {
|
||||
} type = Type::U8;
|
||||
} value;
|
||||
|
||||
struct Constants {
|
||||
u32 alignment = 1;
|
||||
} constants;
|
||||
|
||||
} m_searchSettings, m_decodeSettings;
|
||||
|
||||
using OccurrenceTree = wolv::container::IntervalTree<Occurrence>;
|
||||
@@ -120,6 +125,7 @@ namespace hex::plugin::builtin {
|
||||
static std::vector<Occurrence> searchRegex(Task &task, prv::Provider *provider, Region searchRegion, const SearchSettings::Regex &settings);
|
||||
static std::vector<Occurrence> searchBinaryPattern(Task &task, prv::Provider *provider, Region searchRegion, const SearchSettings::BinaryPattern &settings);
|
||||
static std::vector<Occurrence> searchValue(Task &task, prv::Provider *provider, Region searchRegion, const SearchSettings::Value &settings);
|
||||
static std::vector<Occurrence> searchConstants(Task &task, prv::Provider *provider, Region searchRegion, const SearchSettings::Constants &settings);
|
||||
|
||||
void drawContextMenu(Occurrence &target, const std::string &value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user