From 2f1a707fd335ed75289e1ffc153d9045cf9f0802 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 11 Jan 2022 23:05:02 +0100 Subject: [PATCH] ui: Improve layout of hex editor footer --- external/ImGui/include/imgui_memory_editor.h | 4 ++-- .../builtin/source/content/views/view_hexeditor.cpp | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/external/ImGui/include/imgui_memory_editor.h b/external/ImGui/include/imgui_memory_editor.h index e3cc4d6c6..3505a1d3f 100644 --- a/external/ImGui/include/imgui_memory_editor.h +++ b/external/ImGui/include/imgui_memory_editor.h @@ -268,7 +268,7 @@ struct MemoryEditor const float height_separator = style.ItemSpacing.y; float footer_height = 0; if (OptShowOptions) - footer_height += height_separator + ImGui::GetFrameHeightWithSpacing() * 1; + footer_height += height_separator + ImGui::GetFrameHeightWithSpacing() * 2; ImGui::BeginChild("offset", ImVec2(0, s.LineHeight), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav); ImGui::Text("%*c ", s.AddrDigitsCount, ' '); @@ -731,7 +731,7 @@ struct MemoryEditor if (GotoAddr < mem_size) { ImGui::BeginChild("##scrolling"); - ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (GotoAddr / Cols) * ImGui::GetTextLineHeight()); + ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (GotoAddr / Cols) * ImGui::GetTextLineHeight() * 2); ImGui::EndChild(); } GotoAddr = (size_t)-1; diff --git a/plugins/builtin/source/content/views/view_hexeditor.cpp b/plugins/builtin/source/content/views/view_hexeditor.cpp index 8efa75396..5aab59198 100644 --- a/plugins/builtin/source/content/views/view_hexeditor.cpp +++ b/plugins/builtin/source/content/views/view_hexeditor.cpp @@ -175,11 +175,11 @@ namespace hex::plugin::builtin { } if (provider->getPageCount() > 1) { - ImGui::SameLine(); + ImGui::NewLine(); - ImGui::TextFormatted("hex.builtin.view.hexeditor.page"_lang, provider->getCurrentPage() + 1, provider->getPageCount()); + auto linePos = ImGui::GetCursorPosY() - 15 * SharedData::globalScale; - ImGui::SameLine(); + ImGui::SetCursorPosY(linePos); if (ImGui::ArrowButton("prevPage", ImGuiDir_Left)) { provider->setCurrentPage(provider->getCurrentPage() - 1); @@ -194,6 +194,13 @@ namespace hex::plugin::builtin { EventManager::post(Region { std::min(this->m_memoryEditor.DataPreviewAddr, this->m_memoryEditor.DataPreviewAddrEnd), 1 }); } + + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + ImGui::SameLine(); + ImGui::SetCursorPosY(linePos); + + ImGui::TextFormatted("hex.builtin.view.hexeditor.page"_lang, provider->getCurrentPage() + 1, provider->getPageCount()); } this->drawSearchPopup();