1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:17:35 +00:00

HexEditor: Add gaps between byte groups

This commit is contained in:
Sam Atkins 2024-03-10 21:14:20 +00:00 committed by Sam Atkins
parent 4a2a40a3c8
commit d4c051ece2
2 changed files with 23 additions and 6 deletions

View file

@ -116,10 +116,23 @@ private:
size_t total_rows() const { return ceil_div(m_content_length, bytes_per_row()); }
size_t line_height() const { return font().pixel_size_rounded_up() + m_line_spacing; }
size_t character_width() const { return font().glyph_fixed_width(); }
size_t cell_width() const { return character_width() * 3; }
size_t cell_gap() const { return character_width() / 2; }
size_t cell_width() const { return character_width() * 2 + cell_gap(); }
size_t group_gap() const { return character_width() * 1.5; }
size_t group_width() const
{
return (character_width() * 2 * bytes_per_group())
+ (cell_gap() * (bytes_per_group() - 1))
+ group_gap();
}
int offset_area_width() const { return m_padding + font().width_rounded_up("0X12345678"sv) + m_padding; }
int hex_area_width() const { return m_padding + bytes_per_row() * cell_width() + m_padding; }
int hex_area_width() const
{
return m_padding
+ groups_per_row() * group_width() - group_gap()
+ m_padding;
}
int text_area_width() const { return m_padding + bytes_per_row() * character_width() + m_padding; }
struct OffsetData {