feat: Added toggle for human-readable units in hex editor footer (#1251)

Finalization of #1245 by adding a toggle to the hex editor itself, issue
can be closed afterwards.
This commit is contained in:
Lennard Fonteijn
2023-08-13 19:08:09 +02:00
committed by GitHub
parent d2e6d8e4d9
commit 896091b124
11 changed files with 26 additions and 2 deletions

View File

@@ -714,7 +714,9 @@ namespace hex::plugin::builtin::ui {
selection.getStartAddress(),
selection.getEndAddress(),
selection.getSize(),
hex::toByteString(selection.getSize())
this->m_showHumanReadableUnits
? hex::toByteString(selection.getSize())
: hex::format("{}", selection.getSize())
);
}
else
@@ -733,7 +735,9 @@ namespace hex::plugin::builtin::ui {
ImGui::TextFormattedSelectable("0x{0:08X} (0x{1:X} | {2})",
this->m_provider->getActualSize(),
this->m_provider->getActualSize(),
hex::toByteString(this->m_provider->getActualSize())
this->m_showHumanReadableUnits
? hex::toByteString(this->m_provider->getActualSize())
: hex::format("{}", this->m_provider->getActualSize())
);
}
@@ -766,6 +770,12 @@ namespace hex::plugin::builtin::ui {
ImGui::InfoTooltip("hex.builtin.hex_editor.custom_encoding_view"_lang);
ImGui::SameLine();
// Human-readable units
ImGui::DimmedIconToggle(ICON_VS_SYMBOL_NUMERIC, &this->m_showHumanReadableUnits);
ImGui::InfoTooltip("hex.builtin.hex_editor.human_readable_units_footer"_lang);
ImGui::TableNextColumn();
// Visualizer