mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
impr: Refactor and modularize data information view
This commit is contained in:
@@ -302,7 +302,7 @@ namespace hex {
|
||||
void draw(ImVec2 size, ImPlotFlags flags, bool updateHandle = false) {
|
||||
|
||||
if (!m_processing && ImPlot::BeginPlot("##ChunkBasedAnalysis", size, flags)) {
|
||||
ImPlot::SetupAxes("hex.ui.common.address"_lang, "hex.builtin.view.information.entropy"_lang,
|
||||
ImPlot::SetupAxes("hex.ui.common.address"_lang, "hex.builtin.information_section.info_analysis.entropy"_lang,
|
||||
ImPlotAxisFlags_Lock | ImPlotAxisFlags_NoHighlight | ImPlotAxisFlags_NoSideSwitch,
|
||||
ImPlotAxisFlags_Lock | ImPlotAxisFlags_NoHighlight | ImPlotAxisFlags_NoSideSwitch);
|
||||
ImPlot::SetupAxisFormat(ImAxis_X1, impl::IntegerAxisFormatter, (void*)("0x%04llX"));
|
||||
@@ -682,7 +682,7 @@ namespace hex {
|
||||
u64 m_endAddress = 0;
|
||||
|
||||
// Hold the result of the byte distribution analysis
|
||||
std::array<ImU64, 256> m_valueCounts;
|
||||
std::array<ImU64, 256> m_valueCounts = { };
|
||||
std::atomic<bool> m_processing = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,64 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex/ui/view.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
|
||||
#include "content/helpers/diagrams.hpp"
|
||||
#include <hex/ui/view.hpp>
|
||||
#include <ui/widgets.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
class ViewInformation : public View::Window {
|
||||
public:
|
||||
explicit ViewInformation();
|
||||
~ViewInformation() override;
|
||||
~ViewInformation() override = default;
|
||||
|
||||
void drawContent() override;
|
||||
|
||||
private:
|
||||
struct AnalysisData {
|
||||
AnalysisData() = default;
|
||||
AnalysisData(const AnalysisData&) = default;
|
||||
|
||||
TaskHolder analyzerTask;
|
||||
|
||||
bool dataValid = false;
|
||||
u32 blockSize = 0;
|
||||
double averageEntropy = -1.0;
|
||||
|
||||
double highestBlockEntropy = -1.0;
|
||||
u64 highestBlockEntropyAddress = 0x00;
|
||||
double lowestBlockEntropy = -1.0;
|
||||
u64 lowestBlockEntropyAddress = 0x00;
|
||||
|
||||
double plainTextCharacterPercentage = -1.0;
|
||||
|
||||
Region analysisRegion = { 0, 0 };
|
||||
Region analyzedRegion = { 0, 0 };
|
||||
prv::Provider *analyzedProvider = nullptr;
|
||||
|
||||
std::string dataDescription;
|
||||
std::string dataMimeType;
|
||||
std::string dataAppleCreatorType;
|
||||
std::string dataExtensions;
|
||||
|
||||
std::shared_ptr<DiagramDigram> digram;
|
||||
std::shared_ptr<DiagramLayeredDistribution> layeredDistribution;
|
||||
std::shared_ptr<DiagramByteDistribution> byteDistribution;
|
||||
std::shared_ptr<DiagramByteTypesDistribution> byteTypesDistribution;
|
||||
std::shared_ptr<DiagramChunkBasedEntropyAnalysis> chunkBasedEntropy;
|
||||
|
||||
u32 inputChunkSize = 0;
|
||||
ui::RegionType selectionType = ui::RegionType::EntireData;
|
||||
};
|
||||
|
||||
PerProvider<AnalysisData> m_analysis;
|
||||
|
||||
|
||||
void analyze();
|
||||
|
||||
struct AnalysisData {
|
||||
bool valid = false;
|
||||
|
||||
TaskHolder task;
|
||||
prv::Provider *analyzedProvider = nullptr;
|
||||
Region analysisRegion = { 0, 0 };
|
||||
|
||||
ui::RegionType selectionType = ui::RegionType::EntireData;
|
||||
|
||||
std::list<std::unique_ptr<ContentRegistry::DataInformation::InformationSection>> informationSections;
|
||||
};
|
||||
|
||||
PerProvider<AnalysisData> m_analysisData;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user