From 2ac6348fbf1ee1898659d65788f0865aff1ac724 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Wed, 8 Dec 2021 22:18:59 +0100 Subject: [PATCH] ui: Welcome screen, GDB Provider and memory editor ui fixes --- external/ImGui/include/imgui_memory_editor.h | 4 +++- .../source/content/providers/gdb_provider.cpp | 12 +++++++++++- source/window/window.cpp | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/external/ImGui/include/imgui_memory_editor.h b/external/ImGui/include/imgui_memory_editor.h index c9aa55816..e3cc4d6c6 100644 --- a/external/ImGui/include/imgui_memory_editor.h +++ b/external/ImGui/include/imgui_memory_editor.h @@ -239,7 +239,9 @@ struct MemoryEditor DataPreviewAddrOld = DataPreviewAddr; DataPreviewAddrEndOld = DataPreviewAddrEnd; - DrawContents(mem_data, mem_size, base_display_addr); + if (mem_size > 0) + DrawContents(mem_data, mem_size, base_display_addr); + if (ContentsWidthChanged) { CalcSizes(s, mem_size, base_display_addr); diff --git a/plugins/builtin/source/content/providers/gdb_provider.cpp b/plugins/builtin/source/content/providers/gdb_provider.cpp index 4ced48d5f..7b0a80faf 100644 --- a/plugins/builtin/source/content/providers/gdb_provider.cpp +++ b/plugins/builtin/source/content/providers/gdb_provider.cpp @@ -204,7 +204,17 @@ namespace hex::plugin::builtin::prv { } std::string GDBProvider::getName() const { - return hex::format("hex.builtin.provider.gdb.name"_lang, this->m_ipAddress, this->m_port); + std::string address, port; + + if (this->m_ipAddress.empty()) { + address = "-"; + port = "-"; + } else { + address = this->m_ipAddress; + port = std::to_string(this->m_port); + } + + return hex::format("hex.builtin.provider.gdb.name"_lang, address, port); } std::vector> GDBProvider::getDataInformation() const { diff --git a/source/window/window.cpp b/source/window/window.cpp index 0a6eabfd0..6479332dc 100644 --- a/source/window/window.cpp +++ b/source/window/window.cpp @@ -546,7 +546,7 @@ namespace hex { ImGui::TextWrapped("A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM."); - ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5); + ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 6); ImGui::TableNextColumn(); @@ -563,7 +563,9 @@ namespace hex { ImGui::OpenPopup("hex.welcome.start.popup.open_other"_lang); } + ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetCursorPos()); if (ImGui::BeginPopup("hex.welcome.start.popup.open_other"_lang)) { + for (const auto &unlocalizedProviderName : ContentRegistry::Provider::getEntries()) { if (ImGui::Hyperlink(LangEntry(unlocalizedProviderName))) { EventManager::post(unlocalizedProviderName, nullptr);