1
0
mirror of synced 2025-02-20 04:01:01 +01:00

ux: Update region setting after ticking "Match Selection" checkbox

This commit is contained in:
WerWolv 2021-05-23 22:46:33 +02:00
parent e688d34587
commit 143cdbd44b
3 changed files with 17 additions and 7 deletions

View File

@ -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<RequestSelectionChange>(Region{ 0, 0 });
}
ImGui::NewLine();
ImGui::TextUnformatted("hex.view.disassembler.settings.header"_lang);

View File

@ -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<RequestSelectionChange>(Region{ 0, 0 });
this->m_shouldInvalidate = true;
}
ImGui::NewLine();
ImGui::TextUnformatted("hex.view.hashes.settings"_lang);

View File

@ -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<EventRegionSelected>(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<EventRegionSelected>(Region { this->m_memoryEditor.DataPreviewAddr, (this->m_memoryEditor.DataPreviewAddrEnd - this->m_memoryEditor.DataPreviewAddr) + 1});
});
EventManager::subscribe<EventProjectFileLoad>(this, []() {