2021-09-21 02:48:41 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <hex.hpp>
|
|
|
|
|
|
|
|
#include <imgui.h>
|
2022-02-01 18:09:40 +01:00
|
|
|
#include <hex/ui/view.hpp>
|
2023-02-15 17:01:36 +01:00
|
|
|
#include <hex/api/task.hpp>
|
2021-09-21 02:48:41 +02:00
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <string>
|
2021-09-21 19:54:13 +02:00
|
|
|
#include <vector>
|
2021-09-21 02:48:41 +02:00
|
|
|
|
2023-02-15 17:01:36 +01:00
|
|
|
#include "ui/hex_editor.hpp"
|
|
|
|
|
|
|
|
#include <IntervalTree.h>
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
namespace hex::plugin::builtin {
|
2021-09-21 02:48:41 +02:00
|
|
|
|
2021-09-21 19:54:13 +02:00
|
|
|
class ViewDiff : public View {
|
2021-09-21 02:48:41 +02:00
|
|
|
public:
|
2021-09-21 19:54:13 +02:00
|
|
|
ViewDiff();
|
|
|
|
~ViewDiff() override;
|
2021-09-21 02:48:41 +02:00
|
|
|
|
|
|
|
void drawContent() override;
|
|
|
|
|
2021-09-21 19:54:13 +02:00
|
|
|
private:
|
2023-02-15 17:01:36 +01:00
|
|
|
struct Column {
|
|
|
|
ui::HexEditor hexEditor;
|
|
|
|
int provider = -1;
|
|
|
|
i32 scrollLock = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class DifferenceType : u8 {
|
|
|
|
Added,
|
|
|
|
Removed,
|
|
|
|
Modified
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Diff {
|
|
|
|
Region region;
|
|
|
|
DifferenceType type;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool drawDiffColumn(Column &column, float height) const;
|
|
|
|
void drawProviderSelector(Column &column);
|
|
|
|
std::string getProviderName(Column &column) const;
|
2021-09-21 19:54:13 +02:00
|
|
|
|
2023-02-15 17:01:36 +01:00
|
|
|
private:
|
|
|
|
std::array<Column, 2> m_columns;
|
2021-09-21 19:54:13 +02:00
|
|
|
|
2023-02-15 17:01:36 +01:00
|
|
|
std::vector<Diff> m_diffs;
|
|
|
|
TaskHolder m_diffTask;
|
|
|
|
std::atomic<bool> m_analyzed = false;
|
2021-09-21 02:48:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|