From 92fa72eac7679281c5d4fa675fd6c8b0f986dd30 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 28 Aug 2025 22:29:30 +0200 Subject: [PATCH] fix: More hashes view layout issues --- plugins/hashes/romfs/lang/en_US.json | 2 +- plugins/hashes/romfs/lang/fr_FR.json | 1 - plugins/hashes/romfs/lang/pl_PL.json | 1 - plugins/hashes/romfs/lang/zh_CN.json | 1 - .../hashes/source/content/views/view_hashes.cpp | 14 ++++++++------ 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/plugins/hashes/romfs/lang/en_US.json b/plugins/hashes/romfs/lang/en_US.json index a414a27e2..41d83141b 100644 --- a/plugins/hashes/romfs/lang/en_US.json +++ b/plugins/hashes/romfs/lang/en_US.json @@ -6,7 +6,7 @@ "hex.hashes.view.hashes.hover_info": "Hover over the Hex Editor selection and hold down SHIFT to view the hashes of that region.", "hex.hashes.view.hashes.name": "Hashes", "hex.hashes.view.hashes.no_settings": "No settings available", - "hex.hashes.view.hashes.add": "Add hash", + "hex.hashes.view.hashes.add": "(Double click to add new Hash...)", "hex.hashes.view.hashes.remove": "Remove hash", "hex.hashes.view.hashes.hash_name": "Hash Name", "hex.hashes.view.hashes.table.name": "Name", diff --git a/plugins/hashes/romfs/lang/fr_FR.json b/plugins/hashes/romfs/lang/fr_FR.json index 57201c816..5e4d34772 100644 --- a/plugins/hashes/romfs/lang/fr_FR.json +++ b/plugins/hashes/romfs/lang/fr_FR.json @@ -6,7 +6,6 @@ "hex.hashes.view.hashes.hover_info": "Passez la souris sur la sélection de l'éditeur hexadécimal et maintenez la touche MAJ enfoncée pour voir les hachages de cette région.", "hex.hashes.view.hashes.name": "Hachages", "hex.hashes.view.hashes.no_settings": "Aucun paramètre disponible", - "hex.hashes.view.hashes.add": "Ajouter un hachage", "hex.hashes.view.hashes.remove": "Supprimer un hachage", "hex.hashes.view.hashes.hash_name": "Nom du hachage", "hex.hashes.view.hashes.table.name": "Nom", diff --git a/plugins/hashes/romfs/lang/pl_PL.json b/plugins/hashes/romfs/lang/pl_PL.json index 810f1ac39..bcfb71b2b 100644 --- a/plugins/hashes/romfs/lang/pl_PL.json +++ b/plugins/hashes/romfs/lang/pl_PL.json @@ -18,7 +18,6 @@ "hex.hashes.hash.common.xor_out": "XOR wyjścia", "hex.hashes.hash.sum": "Suma", "hex.hashes.hash.sum.fold": "Zwiń wynik", - "hex.hashes.view.hashes.add": "Dodaj hash", "hex.hashes.view.hashes.function": "Funkcja skrótu", "hex.hashes.view.hashes.hash": "Hash", "hex.hashes.view.hashes.hash_name": "Nazwa hash", diff --git a/plugins/hashes/romfs/lang/zh_CN.json b/plugins/hashes/romfs/lang/zh_CN.json index b95ca86ac..47d44e1a7 100644 --- a/plugins/hashes/romfs/lang/zh_CN.json +++ b/plugins/hashes/romfs/lang/zh_CN.json @@ -27,6 +27,5 @@ "hex.hashes.view.hashes.table.name": "名称", "hex.hashes.view.hashes.table.result": "结果", "hex.hashes.view.hashes.table.type": "类型", - "hex.hashes.view.hashes.add": "添加哈希", "hex.hashes.view.hashes.hash_name": "​​哈希名称​" } \ No newline at end of file diff --git a/plugins/hashes/source/content/views/view_hashes.cpp b/plugins/hashes/source/content/views/view_hashes.cpp index a5bdcea1b..9e08770ff 100644 --- a/plugins/hashes/source/content/views/view_hashes.cpp +++ b/plugins/hashes/source/content/views/view_hashes.cpp @@ -182,7 +182,7 @@ namespace hex::plugin::hashes { if (m_newHashName.empty() && m_selectedHash != nullptr) m_newHashName = fmt::format("{} {}", Lang(m_selectedHash->getUnlocalizedName()), static_cast("hex.hashes.view.hashes.hash"_lang)); - if (ImGuiExt::BeginSubWindow("hex.ui.common.settings"_lang, nullptr, scaled({ 0, 250 }))) { + if (ImGuiExt::BeginSubWindow("hex.ui.common.settings"_lang, nullptr, scaled({ 0, 100 }))) { if (m_selectedHash != nullptr) { auto startPos = ImGui::GetCursorPosY(); m_selectedHash->draw(); @@ -215,7 +215,7 @@ namespace hex::plugin::hashes { ImGui::TableSetupColumn("hex.hashes.view.hashes.table.name"_lang); ImGui::TableSetupColumn("hex.hashes.view.hashes.table.type"_lang); ImGui::TableSetupColumn("hex.hashes.view.hashes.table.result"_lang, ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("##buttons", ImGuiTableColumnFlags_WidthFixed, 50_scaled); + ImGui::TableSetupColumn("##buttons", ImGuiTableColumnFlags_WidthFixed, ImGui::GetTextLineHeight() * 2); ImGui::TableHeadersRow(); @@ -226,7 +226,7 @@ namespace hex::plugin::hashes { for (u32 i = 0; i < m_hashFunctions->size(); i++) { auto &function = (*m_hashFunctions)[i]; - ImGui::PushID(i); + ImGui::PushID(i + 1); ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -248,14 +248,15 @@ namespace hex::plugin::hashes { } catch (const std::exception &e) { result = e.what(); } - } - else + } else { result = "???"; + } ImGuiExt::TextFormattedSelectable("{}", result); ImGui::TableNextColumn(); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0)); if (ImGuiExt::DimmedIconButton(ICON_VS_OPEN_PREVIEW, ImGui::GetStyleColorVec4(ImGuiCol_Text))) { PopupTextHash::open(function); } @@ -263,6 +264,7 @@ namespace hex::plugin::hashes { if (ImGuiExt::DimmedIconButton(ICON_VS_CHROME_CLOSE, ImGui::GetStyleColorVec4(ImGuiCol_Text))) { indexToRemove = i; } + ImGui::PopStyleVar(); ImGui::PopID(); } @@ -289,7 +291,7 @@ namespace hex::plugin::hashes { { ImGui::PushClipRect(ImGui::GetWindowPos(), ImGui::GetWindowPos() + ImGui::GetWindowSize(), false); - const auto text = "(Double click to add new Hash...)"; + const auto text = "hex.hashes.view.hashes.add"_lang; const auto textSize = ImGui::CalcTextSize(text); ImGui::SetCursorPosX((ImGui::GetWindowSize().x - textSize.x) / 2); ImGuiExt::TextFormattedDisabled(text);