1
0
mirror of synced 2025-01-18 00:56:49 +01:00

impr: Move selection information to the top of the hex editor footer

This commit is contained in:
WerWolv 2024-03-02 09:52:40 +01:00
parent 8f3f941600
commit f6c59b456f

View File

@ -834,6 +834,9 @@ namespace hex::ui {
const auto pageCount = std::max<u32>(1, m_provider->getPageCount());
constexpr static u32 MinPage = 1;
const auto pageAddress = m_provider->getCurrentPageAddress();
const auto pageSize = m_provider->getSize();
// Page slider
ImGui::TableNextColumn();
{
@ -845,7 +848,11 @@ namespace hex::ui {
ImGui::BeginDisabled(pageCount <= 1);
{
ImGui::PushItemWidth(-1);
if (ImGui::SliderScalar("##page_selection", ImGuiDataType_U32, &page, &MinPage, &pageCount, hex::format("0x%02llX / 0x{:02X}", pageCount).c_str()))
if (ImGui::SliderScalar("##page_selection", ImGuiDataType_U32, &page, &MinPage, &pageCount,
hex::format("0x%02llX / 0x{0:02X} [0x{1:04X} - 0x{2:04X}]",
pageCount,
pageAddress,
pageSize == 0 ? 0 : (pageAddress + pageSize - 1)).c_str()))
m_provider->setCurrentPage(page - 1);
ImGui::PopItemWidth();
}
@ -859,22 +866,6 @@ namespace hex::ui {
m_footerCollapsed = !m_footerCollapsed;
}
// Page Address
ImGui::TableNextColumn();
{
const auto pageAddress = m_provider->getCurrentPageAddress();
const auto pageSize = m_provider->getSize();
ImGuiExt::TextFormatted("{}:", "hex.ui.hex_editor.region"_lang);
ImGui::SameLine();
ImGuiExt::TextFormattedSelectable("0x{0:08X} - 0x{1:08X} ({0} - {1})",
pageAddress,
pageSize == 0 ? 0 : (pageAddress + pageSize - 1)
);
}
if (!m_footerCollapsed) {
ImGui::TableNextRow();
// Selection
ImGui::TableNextColumn();
{
@ -898,6 +889,21 @@ namespace hex::ui {
ImGuiExt::TextFormattedSelectable(value);
}
if (!m_footerCollapsed) {
ImGui::TableNextRow();
// Page Address
ImGui::TableNextColumn();
{
ImGuiExt::TextFormatted("{}:", "hex.ui.hex_editor.region"_lang);
ImGui::SameLine();
ImGuiExt::TextFormattedSelectable("0x{0:08X} - 0x{1:08X} ({0} - {1})",
pageAddress,
pageSize == 0 ? 0 : (pageAddress + pageSize - 1)
);
}
ImGui::TableNextColumn();
// Loaded data size