1
0
mirror of synced 2025-01-18 09:04:52 +01:00

feat: Remember bytes per row in Hex Editor (#1276)

This commit is contained in:
Lennard Fonteijn 2023-09-02 17:52:05 +02:00 committed by GitHub
parent c2fe9f0966
commit f725d763d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,6 +71,7 @@ namespace hex::plugin::builtin::ui {
HexEditor::HexEditor(prv::Provider *provider) : m_provider(provider) {
this->m_currDataVisualizer = ContentRegistry::HexEditor::getVisualizerByName("hex.builtin.visualizer.hexadecimal.8bit");
this->m_bytesPerRow = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.bytes_per_row", this->m_bytesPerRow);
EventManager::subscribe<EventSettingsChanged>(this, [this] {
this->m_selectionColor = ContentRegistry::Settings::read("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.highlight_color", 0x60C08080);
@ -827,6 +828,8 @@ namespace hex::plugin::builtin::ui {
if (ImGui::SliderInt("##row_size", &bytesPerRow, 1, 32 / this->getBytesPerCell(), hex::format("{}", bytesPerRow * this->getBytesPerCell()).c_str())) {
this->m_bytesPerRow = bytesPerRow * this->getBytesPerCell();
this->m_encodingLineStartAddresses.clear();
ContentRegistry::Settings::write("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.bytes_per_row", this->m_bytesPerRow);
}
ImGui::PopItemWidth();
}