2020-11-20 23:12:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-02-01 17:09:40 +00:00
|
|
|
#include <hex/ui/view.hpp>
|
2020-11-20 23:12:58 +00:00
|
|
|
|
2021-01-13 16:28:27 +00:00
|
|
|
#include <hex/api/content_registry.hpp>
|
2021-01-13 00:24:27 +00:00
|
|
|
|
2020-11-22 14:32:37 +00:00
|
|
|
#include <bit>
|
2020-11-20 23:12:58 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <string>
|
|
|
|
|
2021-12-07 21:47:41 +00:00
|
|
|
namespace hex::plugin::builtin {
|
2020-11-20 23:12:58 +00:00
|
|
|
|
|
|
|
class ViewDataInspector : public View {
|
|
|
|
public:
|
2020-12-27 14:39:06 +00:00
|
|
|
explicit ViewDataInspector();
|
2020-11-20 23:12:58 +00:00
|
|
|
~ViewDataInspector() override;
|
|
|
|
|
2020-12-22 17:10:01 +00:00
|
|
|
void drawContent() override;
|
2020-11-20 23:12:58 +00:00
|
|
|
|
|
|
|
private:
|
2021-03-02 21:09:38 +00:00
|
|
|
struct InspectorCacheEntry {
|
|
|
|
std::string unlocalizedName;
|
2021-12-12 10:52:58 +00:00
|
|
|
ContentRegistry::DataInspector::impl::DisplayFunction displayFunction;
|
2022-02-15 20:50:27 +00:00
|
|
|
std::optional<ContentRegistry::DataInspector::impl::EditingFunction> editingFunction;
|
|
|
|
bool editing;
|
2021-03-02 21:09:38 +00:00
|
|
|
};
|
|
|
|
|
2020-11-20 23:12:58 +00:00
|
|
|
bool m_shouldInvalidate = true;
|
|
|
|
|
2022-02-01 21:09:44 +00:00
|
|
|
std::endian m_endian = std::endian::native;
|
2022-01-24 19:53:17 +00:00
|
|
|
ContentRegistry::DataInspector::NumberDisplayStyle m_numberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle::Decimal;
|
2022-05-27 18:46:16 +00:00
|
|
|
bool m_invert = false;
|
2020-11-22 14:32:37 +00:00
|
|
|
|
2022-02-01 21:09:44 +00:00
|
|
|
u64 m_startAddress = 0;
|
2020-11-20 23:12:58 +00:00
|
|
|
size_t m_validBytes = 0;
|
2021-03-02 21:09:38 +00:00
|
|
|
std::vector<InspectorCacheEntry> m_cachedData;
|
2022-02-15 20:50:27 +00:00
|
|
|
|
|
|
|
std::string m_editingValue;
|
2020-11-20 23:12:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|