From 143cdbd44b033c0fa28148ee2f6c7dd7c006b2fa Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 23 May 2021 22:46:33 +0200 Subject: [PATCH] ux: Update region setting after ticking "Match Selection" checkbox --- source/views/view_disassembler.cpp | 5 +++++ source/views/view_hashes.cpp | 6 +++++- source/views/view_hexeditor.cpp | 13 +++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/source/views/view_disassembler.cpp b/source/views/view_disassembler.cpp index cec1d6498..21c2e3d50 100644 --- a/source/views/view_disassembler.cpp +++ b/source/views/view_disassembler.cpp @@ -107,7 +107,12 @@ namespace hex { ImGui::InputScalar("hex.view.disassembler.base"_lang, ImGuiDataType_U64, &this->m_baseAddress, nullptr, nullptr, "%08llX", ImGuiInputTextFlags_CharsHexadecimal); ImGui::InputScalarN("hex.view.disassembler.region"_lang, ImGuiDataType_U64, this->m_codeRegion, 2, nullptr, nullptr, "%08llX", ImGuiInputTextFlags_CharsHexadecimal); + ImGui::Checkbox("hex.common.match_selection"_lang, &this->m_shouldMatchSelection); + if (ImGui::IsItemEdited()) { + // Force execution of Region Selection Event + EventManager::post(Region{ 0, 0 }); + } ImGui::NewLine(); ImGui::TextUnformatted("hex.view.disassembler.settings.header"_lang); diff --git a/source/views/view_hashes.cpp b/source/views/view_hashes.cpp index 28d068e31..c90c881bb 100644 --- a/source/views/view_hashes.cpp +++ b/source/views/view_hashes.cpp @@ -49,7 +49,11 @@ namespace hex { if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; ImGui::Checkbox("hex.common.match_selection"_lang, &this->m_shouldMatchSelection); - if (ImGui::IsItemEdited()) this->m_shouldInvalidate = true; + if (ImGui::IsItemEdited()) { + // Force execution of Region Selection Event + EventManager::post(Region{ 0, 0 }); + this->m_shouldInvalidate = true; + } ImGui::NewLine(); ImGui::TextUnformatted("hex.view.hashes.settings"_lang); diff --git a/source/views/view_hexeditor.cpp b/source/views/view_hexeditor.cpp index 79cbaf07f..1017d9ccd 100644 --- a/source/views/view_hexeditor.cpp +++ b/source/views/view_hexeditor.cpp @@ -138,13 +138,14 @@ namespace hex { if (!page.has_value()) return; - if (region.size == 0) - return; - provider->setCurrentPage(page.value()); - u64 start = region.address; - this->m_memoryEditor.GotoAddrAndSelect(start - provider->getBaseAddress(), start + region.size - provider->getBaseAddress() - 1); - EventManager::post(region); + if (region.size != 0) { + provider->setCurrentPage(page.value()); + u64 start = region.address; + this->m_memoryEditor.GotoAddrAndSelect(start - provider->getBaseAddress(), start + region.size - provider->getBaseAddress() - 1); + } + + EventManager::post(Region { this->m_memoryEditor.DataPreviewAddr, (this->m_memoryEditor.DataPreviewAddrEnd - this->m_memoryEditor.DataPreviewAddr) + 1}); }); EventManager::subscribe(this, []() {