rntviewer/src/render.h

84 lines
1.6 KiB
C

struct Viewer {
#ifndef RNT_NO_GFX
MemoryEditor mem_edit;
#endif
// Imgui colors
f32 col_section[Sec_COUNT][3];
f32 col_key[3];
f32 col_checksum[3];
f32 col_highlight[3];
f32 col_page_start[3];
b8 highlight_cluster;
u64 highlighted_cluster;
b8 highlight_zstd_headers;
u64 last_seen_zstd_header_start;
u64 latest_page_gone_to;
u64 latest_key_gone_to;
u64 latest_checksum_gone_to;
u64 latest_page_list_gone_to;
Byte_Range hovered_range;
};
struct Edit_Bg_Color_Data {
RNTuple_Data *rndata;
Viewer viewer;
};
// ----------------------------------------------------
// TERMINAL VIEW
// ----------------------------------------------------
enum Ansi_Color {
ACol_None,
ACol_Red,
ACol_Green,
ACol_Yellow,
ACol_Blue,
ACol_Magenta,
ACol_Cyan,
ACol_White,
ACol_Grey,
ACol_Bright_Red,
ACol_Bright_Green,
ACol_Bright_Yellow,
ACol_Bright_Blue,
ACol_Bright_Magenta,
ACol_Bright_Cyan,
ACol_Bright_White,
ACol_COUNT
};
const u64 ACOL_MAX_LEN = 6;
internal String8 ansi_color_table[ACol_COUNT] = {
str8("\033[0m"),
str8("\033[31m"),
str8("\033[32m"),
str8("\033[33m"),
str8("\033[34m"),
str8("\033[35m"),
str8("\033[36m"),
str8("\033[37m"),
str8("\033[90m"),
str8("\033[91m"),
str8("\033[92m"),
str8("\033[93m"),
str8("\033[94m"),
str8("\033[95m"),
str8("\033[96m"),
str8("\033[97m")
};
struct Term_Viewer {
Ansi_Color col_section[Sec_COUNT];
Ansi_Color col_key;
Ansi_Color col_checksum;
Ansi_Color col_highlight;
Ansi_Color col_page_start;
// How many bytes to render per line
u16 max_cols;
};