Implement localization all throughout ImHex

English only for now, additional languages will come in the future
This commit is contained in:
WerWolv
2021-02-11 23:09:45 +01:00
parent 9227fba474
commit 36a4930b35
26 changed files with 897 additions and 403 deletions

View File

@@ -17,7 +17,7 @@
namespace hex {
ViewHexEditor::ViewHexEditor(std::vector<lang::PatternData*> &patternData)
: View("Hex Editor"), m_patternData(patternData) {
: View("hex.view.hexeditor.title"_lang), m_patternData(patternData) {
this->m_memoryEditor.ReadFn = [](const ImU8 *data, size_t off) -> ImU8 {
auto provider = SharedData::currentProvider;
@@ -130,7 +130,7 @@ namespace hex {
if (ProjectFile::hasUnsavedChanges()) {
glfwSetWindowShouldClose(window, GLFW_FALSE);
View::doLater([] { ImGui::OpenPopup("Save Changes"); });
View::doLater([] { ImGui::OpenPopup("hex.view.hexeditor.save_changes"_lang); });
}
});
@@ -143,12 +143,12 @@ namespace hex {
View::subscribeEvent(Events::OpenWindow, [this](auto name) {
if (std::any_cast<const char*>(name) == std::string("Open File")) {
View::openFileBrowser("Open File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
View::openFileBrowser("hex.view.hexeditor.open_file"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
this->openFile(path);
this->getWindowOpenState() = true;
});
} else if (std::any_cast<const char*>(name) == std::string("Open Project")) {
View::openFileBrowser("Open Project", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ".hexproj", [this](auto path) {
View::openFileBrowser("hex.view.hexeditor.open_project"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ".hexproj", [this](auto path) {
ProjectFile::load(path);
View::postEvent(Events::ProjectFileLoad);
this->getWindowOpenState() = true;
@@ -166,15 +166,15 @@ namespace hex {
size_t dataSize = (provider == nullptr || !provider->isReadable()) ? 0x00 : provider->getSize();
this->m_memoryEditor.DrawWindow("Hex Editor", &this->getWindowOpenState(), this, dataSize, dataSize == 0 ? 0x00 : provider->getBaseAddress());
this->m_memoryEditor.DrawWindow("hex.view.hexeditor.title"_lang, &this->getWindowOpenState(), this, dataSize, dataSize == 0 ? 0x00 : provider->getBaseAddress());
if (dataSize != 0x00) {
if (ImGui::Begin("Hex Editor")) {
if (ImGui::Begin("hex.view.hexeditor.title"_lang)) {
if (ImGui::IsMouseReleased(ImGuiMouseButton_Right) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows))
ImGui::OpenPopup("Edit");
ImGui::OpenPopup("hex.menu.edit"_lang);
if (ImGui::BeginPopup("Edit")) {
if (ImGui::BeginPopup("hex.menu.edit"_lang)) {
this->drawEditPopup();
ImGui::EndPopup();
}
@@ -182,7 +182,7 @@ namespace hex {
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
ImGui::Text("Page %d / %d", provider->getCurrentPage() + 1, provider->getPageCount());
ImGui::Text("hex.view.hexeditor.page"_lang, provider->getCurrentPage() + 1, provider->getPageCount());
ImGui::SameLine();
if (ImGui::ArrowButton("prevPage", ImGuiDir_Left)) {
@@ -215,7 +215,7 @@ namespace hex {
}
static void saveAs() {
View::openFileBrowser("Save As", imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, "*.*", [](auto path) {
View::openFileBrowser("hex.view.hexeditor.save_as"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, "*.*", [](auto path) {
FILE *file = fopen(path.c_str(), "wb");
if (file != nullptr) {
@@ -241,10 +241,9 @@ namespace hex {
void ViewHexEditor::drawAlwaysVisible() {
auto provider = SharedData::currentProvider;
if (ImGui::BeginPopupModal("Save Changes", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
constexpr auto Message = "You have unsaved changes made to your Project.\nAre you sure you want to exit?";
if (ImGui::BeginPopupModal("hex.view.hexeditor.save_changes.title"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::NewLine();
ImGui::TextUnformatted(Message);
ImGui::TextUnformatted("hex.view.hexeditor.save_changes.desc"_lang);
ImGui::NewLine();
confirmButtons("Yes", "No", [] { View::postEvent(Events::CloseImHex); }, [] { ImGui::CloseCurrentPopup(); });
@@ -255,23 +254,22 @@ namespace hex {
ImGui::EndPopup();
}
if (ImGui::BeginPopupModal("Load File with Loader Script", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
constexpr auto Message = "Load a file using a Python loader script.";
if (ImGui::BeginPopupModal("hex.view.hexeditor.script.title"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::SetCursorPosX(10);
ImGui::TextWrapped(Message);
ImGui::TextWrapped("hex.view.hexeditor.script.desc"_lang);
ImGui::NewLine();
ImGui::InputText("##nolabel", this->m_loaderScriptScriptPath.data(), this->m_loaderScriptScriptPath.length(), ImGuiInputTextFlags_ReadOnly);
ImGui::SameLine();
if (ImGui::Button("Script")) {
View::openFileBrowser("Loader Script: Open Script", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ".py", [this](auto path) {
if (ImGui::Button("hex.view.hexeditor.script.script"_lang)) {
View::openFileBrowser("hex.view.hexeditor.script.script.title"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ".py", [this](auto path) {
this->m_loaderScriptScriptPath = path;
});
}
ImGui::InputText("##nolabel", this->m_loaderScriptFilePath.data(), this->m_loaderScriptFilePath.length(), ImGuiInputTextFlags_ReadOnly);
ImGui::SameLine();
if (ImGui::Button("File")) {
View::openFileBrowser("Loader Script: Open File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
if (ImGui::Button("hex.view.hexeditor.script.file"_lang)) {
View::openFileBrowser("hex.view.hexeditor.script.file.title"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
this->m_loaderScriptFilePath = path;
});
}
@@ -280,7 +278,7 @@ namespace hex {
ImGui::NewLine();
confirmButtons("Load", "Cancel",
confirmButtons("hex.common.load"_lang, "hex.common.cancel"_lang,
[this, &provider] {
if (!this->m_loaderScriptScriptPath.empty() && !this->m_loaderScriptFilePath.empty()) {
this->openFile(this->m_loaderScriptFilePath);
@@ -299,11 +297,11 @@ namespace hex {
}
if (ImGui::BeginPopupModal("Set base address", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::InputText("Address", this->m_baseAddressBuffer, 16, ImGuiInputTextFlags_CharsHexadecimal);
if (ImGui::BeginPopupModal("hex.view.hexeditor.menu.edit.set_base"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::InputText("hex.common.address"_lang, this->m_baseAddressBuffer, 16, ImGuiInputTextFlags_CharsHexadecimal);
ImGui::NewLine();
confirmButtons("Set", "Cancel",
confirmButtons("hex.common.set"_lang, "hex.common.cancel"_lang,
[this, &provider]{
provider->setBaseAddress(strtoull(this->m_baseAddressBuffer, nullptr, 16));
ImGui::CloseCurrentPopup();
@@ -321,38 +319,38 @@ namespace hex {
void ViewHexEditor::drawMenu() {
auto provider = SharedData::currentProvider;
if (ImGui::BeginMenu("File")) {
if (ImGui::MenuItem("Open File...", "CTRL + O")) {
if (ImGui::BeginMenu("hex.menu.file"_lang)) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.open_file"_lang, "CTRL + O")) {
View::openFileBrowser("Open File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
View::openFileBrowser("hex.view.hexeditor.open_file"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
this->openFile(path);
this->getWindowOpenState() = true;
});
}
if (ImGui::MenuItem("Save", "CTRL + S", false, provider != nullptr && provider->isWritable())) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.save"_lang, "CTRL + S", false, provider != nullptr && provider->isWritable())) {
save();
}
if (ImGui::MenuItem("Save As...", "CTRL + SHIFT + S", false, provider != nullptr && provider->isWritable())) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.save_as"_lang, "CTRL + SHIFT + S", false, provider != nullptr && provider->isWritable())) {
saveAs();
}
ImGui::Separator();
if (ImGui::MenuItem("Open Project", "")) {
View::openFileBrowser("Open Project", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ".hexproj", [this](auto path) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.open_project"_lang, "")) {
View::openFileBrowser("hex.view.hexeditor.menu.file.open_project"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ".hexproj", [this](auto path) {
ProjectFile::load(path);
View::postEvent(Events::ProjectFileLoad);
this->getWindowOpenState() = true;
});
}
if (ImGui::MenuItem("Save Project", "", false, provider != nullptr && provider->isWritable())) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.save_project"_lang, "", false, provider != nullptr && provider->isWritable())) {
View::postEvent(Events::ProjectFileStore);
if (ProjectFile::getProjectFilePath() == "") {
View::openFileBrowser("Save Project", imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, ".hexproj", [](auto path) {
View::openFileBrowser("hex.view.hexeditor.save_project"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, ".hexproj", [](auto path) {
ProjectFile::store(path);
});
}
@@ -362,10 +360,10 @@ namespace hex {
ImGui::Separator();
if (ImGui::BeginMenu("Import...")) {
if (ImGui::MenuItem("Base64 File")) {
if (ImGui::BeginMenu("hex.view.hexeditor.menu.file.import"_lang)) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.import.base64"_lang)) {
View::openFileBrowser("Open Base64 File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
View::openFileBrowser("hex.view.hexeditor.menu.file.import.base64"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
std::vector<u8> base64;
this->loadFromFile(path, base64);
@@ -373,19 +371,19 @@ namespace hex {
this->m_dataToSave = crypt::decode64(base64);
if (this->m_dataToSave.empty())
View::showErrorPopup("File is not in a valid Base64 format!");
View::showErrorPopup("hex.view.hexeditor.base64.import_error"_lang);
else
ImGui::OpenPopup("Save Data");
ImGui::OpenPopup("hex.view.hexeditor.save_data"_lang);
this->getWindowOpenState() = true;
} else View::showErrorPopup("Failed to open file!");
} else View::showErrorPopup("hex.view.hexeditor.file_open_error"_lang);
});
}
ImGui::Separator();
if (ImGui::MenuItem("IPS Patch")) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.import.ips"_lang)) {
View::openFileBrowser("Apply IPS Patch", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
View::openFileBrowser("hex.view.hexeditor.open_file"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
auto patchData = hex::readFile(path);
auto patch = hex::loadIPSPatch(patchData);
@@ -398,8 +396,8 @@ namespace hex {
}
if (ImGui::MenuItem("IPS32 Patch")) {
View::openFileBrowser("Apply IPS32 Patch", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.import.ips32"_lang)) {
View::openFileBrowser("hex.view.hexeditor.open_file"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, "*.*", [this](auto path) {
auto patchData = hex::readFile(path);
auto patch = hex::loadIPS32Patch(patchData);
@@ -410,17 +408,17 @@ namespace hex {
});
}
if (ImGui::MenuItem("File with Loader Script")) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.import.script"_lang)) {
this->m_loaderScriptFilePath.clear();
this->m_loaderScriptScriptPath.clear();
View::doLater([]{ ImGui::OpenPopup("Load File with Loader Script"); });
View::doLater([]{ ImGui::OpenPopup("hex.view.hexeditor.script.title"_lang); });
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Export...", provider != nullptr && provider->isWritable())) {
if (ImGui::MenuItem("IPS Patch")) {
if (ImGui::BeginMenu("hex.view.hexeditor.menu.file.export"_lang, provider != nullptr && provider->isWritable())) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.export.ips"_lang)) {
Patches patches = provider->getPatches();
if (!patches.contains(0x00454F45) && patches.contains(0x00454F46)) {
u8 value = 0;
@@ -429,11 +427,11 @@ namespace hex {
}
this->m_dataToSave = generateIPSPatch(patches);
View::openFileBrowser("Export File", imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, "*.*", [this](auto path) {
View::openFileBrowser("hex.view.hexeditor.menu.file.export.title"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, "*.*", [this](auto path) {
this->saveToFile(path, this->m_dataToSave);
});
}
if (ImGui::MenuItem("IPS32 Patch")) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.export.ips32"_lang)) {
Patches patches = provider->getPatches();
if (!patches.contains(0x00454F45) && patches.contains(0x45454F46)) {
u8 value = 0;
@@ -442,7 +440,7 @@ namespace hex {
}
this->m_dataToSave = generateIPS32Patch(patches);
View::openFileBrowser("Export File", imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, "*.*", [this](auto path) {
View::openFileBrowser("hex.view.hexeditor.menu.file.export.title"_lang, imgui_addons::ImGuiFileBrowser::DialogMode::SAVE, "*.*", [this](auto path) {
this->saveToFile(path, this->m_dataToSave);
});
}
@@ -454,20 +452,20 @@ namespace hex {
ImGui::Separator();
if (ImGui::MenuItem("Search", "CTRL + F")) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.search"_lang, "CTRL + F")) {
this->getWindowOpenState() = true;
View::doLater([]{ ImGui::OpenPopup("Search"); });
View::doLater([]{ ImGui::OpenPopup("hex.view.hexeditor.menu.file.search"_lang); });
}
if (ImGui::MenuItem("Goto", "CTRL + G")) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.file.goto"_lang, "CTRL + G")) {
this->getWindowOpenState() = true;
View::doLater([]{ ImGui::OpenPopup("Goto"); });
View::doLater([]{ ImGui::OpenPopup("hex.view.hexeditor.menu.file.goto"_lang); });
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Edit")) {
if (ImGui::BeginMenu("hex.menu.edit"_lang)) {
this->drawEditPopup();
ImGui::EndMenu();
}
@@ -481,13 +479,13 @@ namespace hex {
saveAs();
return true;
} else if (mods == GLFW_MOD_CONTROL && key == GLFW_KEY_F) {
View::doLater([]{ ImGui::OpenPopup("Search"); });
View::doLater([]{ ImGui::OpenPopup("hex.view.hexeditor.menu.file.search"_lang); });
return true;
} else if (mods == GLFW_MOD_CONTROL && key == GLFW_KEY_G) {
View::doLater([]{ ImGui::OpenPopup("Goto"); });
View::doLater([]{ ImGui::OpenPopup("hex.view.hexeditor.menu.file.goto"_lang); });
return true;
} else if (mods == GLFW_MOD_CONTROL && key == GLFW_KEY_O) {
View::doLater([]{ ImGui::OpenPopup("Open File"); });
View::doLater([]{ ImGui::OpenPopup("hex.view.hexeditor.open_file"_lang); });
return true;
} else if (mods == (GLFW_MOD_CONTROL | GLFW_MOD_ALT) && key == GLFW_KEY_C) {
this->copyBytes();
@@ -510,13 +508,13 @@ namespace hex {
provider = new prv::FileProvider(path);
if (!provider->isWritable()) {
this->m_memoryEditor.ReadOnly = true;
View::showErrorPopup("Couldn't get write access. File opened in read-only mode.");
View::showErrorPopup("hex.view.hexeditor.error.read_only"_lang);
} else {
this->m_memoryEditor.ReadOnly = false;
}
if (!provider->isAvailable()) {
View::showErrorPopup("Failed to open file!");
View::showErrorPopup("hex.view.hexeditor.error.open"_lang);
return;
}
@@ -918,11 +916,11 @@ R"(
}
};
if (ImGui::BeginPopupContextVoid("Search")) {
ImGui::TextUnformatted("Search");
if (ImGui::BeginPopupContextVoid("hex.view.hexeditor.menu.file.search"_lang)) {
ImGui::TextUnformatted("hex.view.hexeditor.menu.file.search"_lang);
if (ImGui::BeginTabBar("searchTabs")) {
char *currBuffer;
if (ImGui::BeginTabItem("String")) {
if (ImGui::BeginTabItem("hex.view.hexeditor.search.string"_lang)) {
this->m_searchFunction = findString;
this->m_lastSearchBuffer = &this->m_lastStringSearch;
currBuffer = this->m_searchStringBuffer;
@@ -932,7 +930,7 @@ R"(
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Hex")) {
if (ImGui::BeginTabItem("hex.view.hexeditor.search.hex"_lang)) {
this->m_searchFunction = findHex;
this->m_lastSearchBuffer = &this->m_lastHexSearch;
currBuffer = this->m_searchHexBuffer;
@@ -943,16 +941,16 @@ R"(
ImGui::EndTabItem();
}
if (ImGui::Button("Find"))
if (ImGui::Button("hex.view.hexeditor.search.find"_lang))
Find(currBuffer);
if (this->m_lastSearchBuffer->size() > 0) {
if ((ImGui::Button("Find Next")))
if ((ImGui::Button("hex.view.hexeditor.search.find_next"_lang)))
FindNext();
ImGui::SameLine();
if ((ImGui::Button("Find Prev")))
if ((ImGui::Button("hex.view.hexeditor.search.find_prev"_lang)))
FindPrevious();
}
@@ -967,11 +965,11 @@ R"(
void ViewHexEditor::drawGotoPopup() {
auto provider = SharedData::currentProvider;
if (ImGui::BeginPopup("Goto")) {
ImGui::TextUnformatted("Goto");
if (ImGui::BeginPopup("hex.view.hexeditor.menu.file.goto"_lang)) {
ImGui::TextUnformatted("hex.view.hexeditor.menu.file.goto"_lang);
if (ImGui::BeginTabBar("gotoTabs")) {
s64 newOffset = 0;
if (ImGui::BeginTabItem("Begin")) {
if (ImGui::BeginTabItem("hex.view.hexeditor.goto.offset.begin"_lang)) {
ImGui::InputScalar("##nolabel", ImGuiDataType_U64, &this->m_gotoAddress, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal);
if (this->m_gotoAddress >= provider->getActualSize())
@@ -981,7 +979,7 @@ R"(
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Current")) {
if (ImGui::BeginTabItem("hex.view.hexeditor.goto.offset.current"_lang)) {
ImGui::InputScalar("##nolabel", ImGuiDataType_S64, &this->m_gotoAddress, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal);
if (this->m_memoryEditor.DataPreviewAddr == -1 || this->m_memoryEditor.DataPreviewAddrEnd == -1) {
@@ -1002,7 +1000,7 @@ R"(
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("End")) {
if (ImGui::BeginTabItem("hex.view.hexeditor.goto.offset.end"_lang)) {
ImGui::InputScalar("##nolabel", ImGuiDataType_U64, &this->m_gotoAddress, nullptr, nullptr, "%llx", ImGuiInputTextFlags_CharsHexadecimal);
if (this->m_gotoAddress >= provider->getActualSize())
@@ -1013,7 +1011,7 @@ R"(
ImGui::EndTabItem();
}
if (ImGui::Button("Goto")) {
if (ImGui::Button("hex.view.hexeditor.menu.file.goto"_lang)) {
provider->setCurrentPage(std::floor(newOffset / double(prv::Provider::PageSize)));
this->m_memoryEditor.GotoAddr = newOffset;
this->m_memoryEditor.DataPreviewAddr = newOffset;
@@ -1028,40 +1026,40 @@ R"(
}
void ViewHexEditor::drawEditPopup() {
if (ImGui::BeginMenu("Copy as...", this->m_memoryEditor.DataPreviewAddr != -1 && this->m_memoryEditor.DataPreviewAddrEnd != -1)) {
if (ImGui::MenuItem("Bytes", "CTRL + ALT + C"))
if (ImGui::BeginMenu("hex.view.hexeditor.menu.edit.copy"_lang, this->m_memoryEditor.DataPreviewAddr != -1 && this->m_memoryEditor.DataPreviewAddrEnd != -1)) {
if (ImGui::MenuItem("hex.view.hexeditor.copy.bytes"_lang, "CTRL + ALT + C"))
this->copyBytes();
if (ImGui::MenuItem("Hex String", "CTRL + SHIFT + C"))
if (ImGui::MenuItem("hex.view.hexeditor.copy.hex"_lang, "CTRL + SHIFT + C"))
this->copyString();
ImGui::Separator();
if (ImGui::MenuItem("C Array"))
if (ImGui::MenuItem("hex.view.hexeditor.copy.c"_lang))
this->copyLanguageArray(Language::C);
if (ImGui::MenuItem("C++ Array"))
if (ImGui::MenuItem("hex.view.hexeditor.copy.cpp"_lang))
this->copyLanguageArray(Language::Cpp);
if (ImGui::MenuItem("C# Array"))
if (ImGui::MenuItem("hex.view.hexeditor.copy.csharp"_lang))
this->copyLanguageArray(Language::CSharp);
if (ImGui::MenuItem("Rust Array"))
if (ImGui::MenuItem("hex.view.hexeditor.copy.rust"_lang))
this->copyLanguageArray(Language::Rust);
if (ImGui::MenuItem("Python Array"))
if (ImGui::MenuItem("hex.view.hexeditor.copy.python"_lang))
this->copyLanguageArray(Language::Python);
if (ImGui::MenuItem("Java Array"))
if (ImGui::MenuItem("hex.view.hexeditor.copy.java"_lang))
this->copyLanguageArray(Language::Java);
if (ImGui::MenuItem("JavaScript Array"))
if (ImGui::MenuItem("hex.view.hexeditor.copy.js"_lang))
this->copyLanguageArray(Language::JavaScript);
ImGui::Separator();
if (ImGui::MenuItem("Editor View"))
if (ImGui::MenuItem("hex.view.hexeditor.copy.ascii"_lang))
this->copyHexView();
if (ImGui::MenuItem("HTML"))
if (ImGui::MenuItem("hex.view.hexeditor.copy.html"_lang))
this->copyHexViewHTML();
ImGui::EndMenu();
}
if (ImGui::MenuItem("Create bookmark", nullptr, false, this->m_memoryEditor.DataPreviewAddr != -1 && this->m_memoryEditor.DataPreviewAddrEnd != -1)) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.bookmark"_lang, nullptr, false, this->m_memoryEditor.DataPreviewAddr != -1 && this->m_memoryEditor.DataPreviewAddrEnd != -1)) {
size_t start = std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd);
size_t end = std::max(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd);
@@ -1069,9 +1067,9 @@ R"(
}
auto provider = SharedData::currentProvider;
if (ImGui::MenuItem("Set base address", nullptr, false, provider != nullptr && provider->isReadable())) {
if (ImGui::MenuItem("hex.view.hexeditor.menu.edit.set_base"_lang, nullptr, false, provider != nullptr && provider->isReadable())) {
std::memset(this->m_baseAddressBuffer, 0x00, sizeof(this->m_baseAddressBuffer));
View::doLater([]{ ImGui::OpenPopup("Set base address"); });
View::doLater([]{ ImGui::OpenPopup("hex.view.hexeditor.menu.edit.set_base"_lang); });
}
}