mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
feat: Implement Myers' diffing algorithm (#1508)
This commit is contained in:
44
plugins/diffing/include/content/views/view_diff.hpp
Normal file
44
plugins/diffing/include/content/views/view_diff.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <hex.hpp>
|
||||
|
||||
#include <hex/ui/view.hpp>
|
||||
#include <hex/api/task_manager.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "ui/hex_editor.hpp"
|
||||
|
||||
namespace hex::plugin::diffing {
|
||||
|
||||
class ViewDiff : public View::Window {
|
||||
public:
|
||||
ViewDiff();
|
||||
~ViewDiff() override;
|
||||
|
||||
void drawContent() override;
|
||||
ImGuiWindowFlags getWindowFlags() const override { return ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse; }
|
||||
|
||||
public:
|
||||
struct Column {
|
||||
ui::HexEditor hexEditor;
|
||||
ContentRegistry::Diffing::DiffTree diffTree;
|
||||
|
||||
int provider = -1;
|
||||
i32 scrollLock = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
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;
|
||||
|
||||
TaskHolder m_diffTask;
|
||||
std::atomic<bool> m_analyzed = false;
|
||||
ContentRegistry::Diffing::Algorithm *m_algorithm = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user