From c5d3387962972663f3add4597b8726c7cf121b9d Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 23 Dec 2024 21:30:31 +0100 Subject: [PATCH] impr: Replaced centered text notes with overlays --- plugins/builtin/source/content/views/view_bookmarks.cpp | 2 +- .../builtin/source/content/views/view_data_inspector.cpp | 8 +------- plugins/ui/source/ui/hex_editor.cpp | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/plugins/builtin/source/content/views/view_bookmarks.cpp b/plugins/builtin/source/content/views/view_bookmarks.cpp index 568460689..9250f27d4 100644 --- a/plugins/builtin/source/content/views/view_bookmarks.cpp +++ b/plugins/builtin/source/content/views/view_bookmarks.cpp @@ -290,7 +290,7 @@ namespace hex::plugin::builtin { if (ImGui::BeginChild("##bookmarks")) { if (m_bookmarks->empty()) { - ImGuiExt::TextFormattedCentered("hex.builtin.view.bookmarks.no_bookmarks"_lang); + ImGuiExt::TextOverlay("hex.builtin.view.bookmarks.no_bookmarks"_lang, ImGui::GetWindowPos() + ImGui::GetWindowSize() / 2, ImGui::GetWindowWidth() * 0.7); } auto bookmarkToRemove = m_bookmarks->end(); diff --git a/plugins/builtin/source/content/views/view_data_inspector.cpp b/plugins/builtin/source/content/views/view_data_inspector.cpp index 29e8dd590..d864a7b0e 100644 --- a/plugins/builtin/source/content/views/view_data_inspector.cpp +++ b/plugins/builtin/source/content/views/view_data_inspector.cpp @@ -248,13 +248,7 @@ namespace hex::plugin::builtin { } if (m_selectedProvider == nullptr || !m_selectedProvider->isReadable() || m_validBytes <= 0) { - // Draw a message when no bytes are selected - std::string text = "hex.builtin.view.data_inspector.no_data"_lang; - auto textSize = ImGui::CalcTextSize(text.c_str()); - auto availableSpace = ImGui::GetContentRegionAvail(); - - ImGui::SetCursorPos((availableSpace - textSize) / 2.0F); - ImGui::TextUnformatted(text.c_str()); + ImGuiExt::TextOverlay("hex.builtin.view.data_inspector.no_data"_lang, ImGui::GetWindowPos() + ImGui::GetWindowSize() / 2, ImGui::GetWindowWidth() * 0.7); return; } diff --git a/plugins/ui/source/ui/hex_editor.cpp b/plugins/ui/source/ui/hex_editor.cpp index f69938de5..85592e3fd 100644 --- a/plugins/ui/source/ui/hex_editor.cpp +++ b/plugins/ui/source/ui/hex_editor.cpp @@ -505,7 +505,7 @@ namespace hex::ui { m_frameStartSelectionRegion = selection; if (m_provider == nullptr || m_provider->getActualSize() == 0) { - ImGuiExt::TextFormattedCentered("{}", "hex.ui.hex_editor.no_bytes"_lang); + ImGuiExt::TextOverlay("hex.ui.hex_editor.no_bytes"_lang, ImGui::GetWindowPos() + ImGui::GetWindowSize() / 2, ImGui::GetWindowWidth() * 0.7); } if (!m_editingAddress.has_value() && ImGui::IsKeyPressed(ImGuiKey_Escape))