From f4046fb8fc65bc66e053cb7e0377ee56f0c7a01b Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 29 Jul 2021 21:09:18 +0200 Subject: [PATCH] fix: Keyboard shortcuts didn't work. Added Select all menu item --- plugins/builtin/source/lang/de_DE.cpp | 1 + plugins/builtin/source/lang/en_US.cpp | 1 + plugins/builtin/source/lang/it_IT.cpp | 1 + source/views/view_hexeditor.cpp | 5 ++++- source/window.cpp | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/builtin/source/lang/de_DE.cpp b/plugins/builtin/source/lang/de_DE.cpp index 63675d60e..ba008b315 100644 --- a/plugins/builtin/source/lang/de_DE.cpp +++ b/plugins/builtin/source/lang/de_DE.cpp @@ -207,6 +207,7 @@ namespace hex::plugin::builtin { { "hex.view.hexeditor.copy.ascii", "ASCII Art" }, { "hex.view.hexeditor.copy.html", "HTML" }, { "hex.view.hexeditor.menu.edit.paste", "Einfügen" }, + { "hex.view.hexeditor.menu.edit.select_all", "Alles auswählen" }, { "hex.view.hexeditor.menu.edit.bookmark", "Lesezeichen erstellen" }, { "hex.view.hexeditor.menu.edit.set_base", "Basisadresse setzen" }, { "hex.view.hexeditor.menu.edit.resize", "Grösse ändern" }, diff --git a/plugins/builtin/source/lang/en_US.cpp b/plugins/builtin/source/lang/en_US.cpp index 726b4fd47..4551c23fb 100644 --- a/plugins/builtin/source/lang/en_US.cpp +++ b/plugins/builtin/source/lang/en_US.cpp @@ -207,6 +207,7 @@ namespace hex::plugin::builtin { { "hex.view.hexeditor.copy.ascii", "ASCII Art" }, { "hex.view.hexeditor.copy.html", "HTML" }, { "hex.view.hexeditor.menu.edit.paste", "Paste" }, + { "hex.view.hexeditor.menu.edit.select_all", "Select all" }, { "hex.view.hexeditor.menu.edit.bookmark", "Create bookmark" }, { "hex.view.hexeditor.menu.edit.set_base", "Set base address" }, { "hex.view.hexeditor.menu.edit.resize", "Resize" }, diff --git a/plugins/builtin/source/lang/it_IT.cpp b/plugins/builtin/source/lang/it_IT.cpp index cd9d6e258..f5a70eda1 100644 --- a/plugins/builtin/source/lang/it_IT.cpp +++ b/plugins/builtin/source/lang/it_IT.cpp @@ -207,6 +207,7 @@ namespace hex::plugin::builtin { { "hex.view.hexeditor.copy.ascii", "ASCII Art" }, { "hex.view.hexeditor.copy.html", "HTML" }, { "hex.view.hexeditor.menu.edit.paste", "Incolla" }, + //{ "hex.view.hexeditor.menu.edit.select_all", "Select all" }, { "hex.view.hexeditor.menu.edit.bookmark", "Crea segnalibro" }, { "hex.view.hexeditor.menu.edit.set_base", "Imposta indirizzo di base" }, // { "hex.view.hexeditor.menu.edit.resize", "Resize" }, diff --git a/source/views/view_hexeditor.cpp b/source/views/view_hexeditor.cpp index 34b1487f9..a3e9b57de 100644 --- a/source/views/view_hexeditor.cpp +++ b/source/views/view_hexeditor.cpp @@ -611,7 +611,7 @@ namespace hex { this->pasteBytes(); return true; } else if (ctrl && keys['A']) { - EventManager::post(Region { SharedData::currentProvider->getBaseAddress(), SharedData::currentProvider->getSize() }); + EventManager::post(Region { SharedData::currentProvider->getBaseAddress(), SharedData::currentProvider->getActualSize() }); return true; } } @@ -1276,6 +1276,9 @@ R"( if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.paste"_lang, "CTRL + V", false, bytesSelected)) this->pasteBytes(); + if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.select_all"_lang, "CTRL + A", false, SharedData::currentProvider != nullptr)) + EventManager::post(Region { SharedData::currentProvider->getBaseAddress(), SharedData::currentProvider->getActualSize() }); + ImGui::Separator(); if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.bookmark"_lang, nullptr, false, this->m_memoryEditor.DataPreviewAddr != -1 && this->m_memoryEditor.DataPreviewAddrEnd != -1)) { diff --git a/source/window.cpp b/source/window.cpp index 1eef8a37e..b06284c5b 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -380,9 +380,9 @@ namespace hex { void Window::frame() { bool pressedKeys[512] = { false }; - std::copy_n(ImGui::GetIO().KeysDown, 512, this->m_prevKeysDown); for (u16 i = 0; i < 512; i++) pressedKeys[i] = ImGui::GetIO().KeysDown[i] && !this->m_prevKeysDown[i]; + std::copy_n(ImGui::GetIO().KeysDown, 512, this->m_prevKeysDown); for (const auto &call : View::getDeferedCalls()) call();