mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
@@ -4,11 +4,16 @@
|
||||
|
||||
#include <imgui.h>
|
||||
#include <hex/ui/view.hpp>
|
||||
#include <hex/api/task.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ui/hex_editor.hpp"
|
||||
|
||||
#include <IntervalTree.h>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
class ViewDiff : public View {
|
||||
@@ -19,13 +24,33 @@ namespace hex::plugin::builtin {
|
||||
void drawContent() override;
|
||||
|
||||
private:
|
||||
void drawDiffLine(const std::array<int, 2> &providerIds, u64 row) const;
|
||||
struct Column {
|
||||
ui::HexEditor hexEditor;
|
||||
int provider = -1;
|
||||
i32 scrollLock = 0;
|
||||
};
|
||||
|
||||
int m_providerA = -1, m_providerB = -1;
|
||||
enum class DifferenceType : u8 {
|
||||
Added,
|
||||
Removed,
|
||||
Modified
|
||||
};
|
||||
|
||||
bool m_greyedOutZeros = true;
|
||||
bool m_upperCaseHex = true;
|
||||
u32 m_columnCount = 16;
|
||||
struct Diff {
|
||||
Region region;
|
||||
DifferenceType type;
|
||||
};
|
||||
|
||||
bool drawDiffColumn(Column &column, float height) const;
|
||||
void drawProviderSelector(Column &column);
|
||||
std::string getProviderName(Column &column) const;
|
||||
|
||||
private:
|
||||
std::array<Column, 2> m_columns;
|
||||
|
||||
std::vector<Diff> m_diffs;
|
||||
TaskHolder m_diffTask;
|
||||
std::atomic<bool> m_analyzed = false;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@ namespace hex::plugin::builtin::ui {
|
||||
void draw(float height = ImGui::GetContentRegionAvail().y);
|
||||
|
||||
void setProvider(prv::Provider *provider) { this->m_provider = provider; }
|
||||
void setUnknownDataCharacter(char character) { this->m_unknownDataCharacter = character; }
|
||||
private:
|
||||
enum class CellType { None, Hex, ASCII };
|
||||
|
||||
@@ -174,6 +175,7 @@ namespace hex::plugin::builtin::ui {
|
||||
u16 m_bytesPerRow = 16;
|
||||
ContentRegistry::HexEditor::DataVisualizer *m_currDataVisualizer;
|
||||
u32 m_grayZeroHighlighter = 0;
|
||||
char m_unknownDataCharacter = '?';
|
||||
|
||||
bool m_shouldJumpToSelection = false;
|
||||
bool m_centerOnJump = false;
|
||||
|
||||
Reference in New Issue
Block a user