1
0
mirror of synced 2024-12-13 16:31:07 +01:00
ImHex/plugins/builtin/include/content/views/view_diff.hpp

53 lines
1.2 KiB
C++
Raw Normal View History

2021-09-21 02:48:41 +02:00
#pragma once
#include <hex.hpp>
#include <hex/ui/view.hpp>
#include <hex/api/task_manager.hpp>
2021-09-21 02:48:41 +02:00
#include <array>
2021-09-21 19:54:13 +02:00
#include <vector>
2021-09-21 02:48:41 +02:00
#include "ui/hex_editor.hpp"
2021-12-07 22:47:41 +01:00
namespace hex::plugin::builtin {
2021-09-21 02:48:41 +02:00
class ViewDiff : public View::Window {
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;
ImGuiWindowFlags getWindowFlags() const override { return ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse; }
2021-09-21 02:48:41 +02:00
2023-02-16 08:53:05 +01:00
public:
struct Column {
ui::HexEditor hexEditor;
int provider = -1;
i32 scrollLock = 0;
};
enum class DifferenceType : u8 {
Added,
Removed,
Modified
};
struct Diff {
Region region;
DifferenceType type;
};
private:
2023-11-10 20:47:08 +01:00
std::function<std::optional<color_t>(u64, const u8*, size_t)> createCompareFunction(size_t otherIndex) const;
void analyze(prv::Provider *providerA, prv::Provider *providerB);
private:
std::array<Column, 2> m_columns;
2021-09-21 19:54:13 +02:00
std::vector<Diff> m_diffs;
TaskHolder m_diffTask;
std::atomic<bool> m_analyzed = false;
2021-09-21 02:48:41 +02:00
};
}