diff --git a/plugins/diffing/include/content/views/view_diff.hpp b/plugins/diffing/include/content/views/view_diff.hpp index 3132413e2..5ea6372ac 100644 --- a/plugins/diffing/include/content/views/view_diff.hpp +++ b/plugins/diffing/include/content/views/view_diff.hpp @@ -18,6 +18,7 @@ namespace hex::plugin::diffing { ~ViewDiff() override; void drawContent() override; + void drawAlwaysVisibleContent() override; ImGuiWindowFlags getWindowFlags() const override { return ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse; } public: diff --git a/plugins/diffing/source/content/views/view_diff.cpp b/plugins/diffing/source/content/views/view_diff.cpp index 704d8a035..5ba401cbf 100644 --- a/plugins/diffing/source/content/views/view_diff.cpp +++ b/plugins/diffing/source/content/views/view_diff.cpp @@ -192,14 +192,12 @@ namespace hex::plugin::diffing { ImGui::TableSetupColumn("hex.diffing.view.diff.provider_b"_lang); ImGui::TableHeadersRow(); - ImVec2 buttonPos; ImGui::BeginDisabled(m_diffTask.isRunning()); { // Draw settings button ImGui::TableNextColumn(); if (ImGuiExt::DimmedIconButton(ICON_VS_SETTINGS_GEAR, ImGui::GetStyleColorVec4(ImGuiCol_Text))) - ImGui::OpenPopup("DiffingAlgorithmSettings"); - buttonPos = ImGui::GetCursorScreenPos(); + RequestOpenPopup::post("##DiffingAlgorithmSettings"); ImGui::SameLine(); @@ -212,41 +210,6 @@ namespace hex::plugin::diffing { } ImGui::EndDisabled(); - ImGui::SetNextWindowPos(buttonPos); - if (ImGui::BeginPopup("DiffingAlgorithmSettings")) { - ImGuiExt::Header("hex.diffing.view.diff.algorithm"_lang, true); - ImGui::PushItemWidth(300_scaled); - if (ImGui::BeginCombo("##Algorithm", m_algorithm == nullptr ? "" : Lang(m_algorithm->getUnlocalizedName()))) { - for (const auto &algorithm : ContentRegistry::Diffing::impl::getAlgorithms()) { - ImGui::PushID(algorithm.get()); - if (ImGui::Selectable(Lang(algorithm->getUnlocalizedName()))) { - m_algorithm = algorithm.get(); - m_analyzed = false; - } - ImGui::PopID(); - } - ImGui::EndCombo(); - } - ImGui::PopItemWidth(); - - if (m_algorithm != nullptr) { - ImGuiExt::TextFormattedWrapped("{}", Lang(m_algorithm->getUnlocalizedDescription())); - } - - ImGuiExt::Header("hex.diffing.view.diff.settings"_lang); - if (m_algorithm != nullptr) { - auto drawList = ImGui::GetWindowDrawList(); - auto prevIdx = drawList->_VtxCurrentIdx; - m_algorithm->drawSettings(); - auto currIdx = drawList->_VtxCurrentIdx; - - if (prevIdx == currIdx) - ImGuiExt::TextFormatted("hex.diffing.view.diff.settings.no_settings"_lang); - } - - ImGui::EndPopup(); - } - ImGui::TableNextRow(); // Draw first hex editor column @@ -337,4 +300,42 @@ namespace hex::plugin::diffing { } } + void ViewDiff::drawAlwaysVisibleContent() { + ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(400_scaled, 600_scaled)); + if (ImGui::BeginPopup("##DiffingAlgorithmSettings")) { + ImGuiExt::Header("hex.diffing.view.diff.algorithm"_lang, true); + ImGui::PushItemWidth(300_scaled); + if (ImGui::BeginCombo("##Algorithm", m_algorithm == nullptr ? "" : Lang(m_algorithm->getUnlocalizedName()))) { + for (const auto &algorithm : ContentRegistry::Diffing::impl::getAlgorithms()) { + ImGui::PushID(algorithm.get()); + if (ImGui::Selectable(Lang(algorithm->getUnlocalizedName()))) { + m_algorithm = algorithm.get(); + m_analyzed = false; + } + ImGui::PopID(); + } + ImGui::EndCombo(); + } + ImGui::PopItemWidth(); + + if (m_algorithm != nullptr) { + ImGuiExt::TextFormattedWrapped("{}", Lang(m_algorithm->getUnlocalizedDescription())); + } + + ImGuiExt::Header("hex.diffing.view.diff.settings"_lang); + if (m_algorithm != nullptr) { + auto drawList = ImGui::GetWindowDrawList(); + auto prevIdx = drawList->_VtxCurrentIdx; + m_algorithm->drawSettings(); + auto currIdx = drawList->_VtxCurrentIdx; + + if (prevIdx == currIdx) + ImGuiExt::TextFormatted("hex.diffing.view.diff.settings.no_settings"_lang); + } + + ImGui::EndPopup(); + } + } + + }