diff --git a/lib/libimhex/include/hex/ui/popup.hpp b/lib/libimhex/include/hex/ui/popup.hpp index c066f07ac..0fed2f1a7 100644 --- a/lib/libimhex/include/hex/ui/popup.hpp +++ b/lib/libimhex/include/hex/ui/popup.hpp @@ -31,7 +31,7 @@ namespace hex { } [[nodiscard]] virtual ImVec2 getMaxSize() const { - return { FLT_MAX, FLT_MAX }; + return { 0, 0 }; } [[nodiscard]] static std::vector> &getOpenPopups() { @@ -50,30 +50,22 @@ namespace hex { return this->m_modal; } - static void close() { - if (s_openPopups.empty()) - return; - - TaskManager::doLater([]{ - std::lock_guard lock(s_mutex); - - ImGui::CloseCurrentPopup(); - s_openPopups.pop_back(); - }); + void close() { + this->m_close = true; } - static std::mutex& getMutex() { - return s_mutex; + [[nodiscard]] bool shouldClose() const { + return this->m_close; } protected: static std::vector> s_openPopups; - static std::mutex s_mutex; private: std::string m_unlocalizedName; bool m_closeButton, m_modal; + std::atomic m_close = false; }; } @@ -87,7 +79,8 @@ namespace hex { public: template static void open(Args && ... args) { - std::lock_guard lock(s_mutex); + static std::mutex mutex; + std::lock_guard lock(mutex); auto popup = std::make_unique(std::forward(args)...); diff --git a/lib/libimhex/source/ui/popup.cpp b/lib/libimhex/source/ui/popup.cpp index a15fab316..688de942f 100644 --- a/lib/libimhex/source/ui/popup.cpp +++ b/lib/libimhex/source/ui/popup.cpp @@ -3,6 +3,5 @@ namespace hex::impl { std::vector> PopupBase::s_openPopups; - std::mutex PopupBase::s_mutex; } \ No newline at end of file diff --git a/main/source/window/window.cpp b/main/source/window/window.cpp index 7ca0961c0..0f7f06229 100644 --- a/main/source/window/window.cpp +++ b/main/source/window/window.cpp @@ -530,59 +530,61 @@ namespace hex { // Draw popup stack { - std::scoped_lock lock(impl::PopupBase::getMutex()); if (auto &popups = impl::PopupBase::getOpenPopups(); !popups.empty()) { static bool popupDisplaying = false; + static bool positionSet = false; static bool sizeSet = false; - static ImVec2 popupSize; auto &currPopup = popups.back(); const auto &name = LangEntry(currPopup->getUnlocalizedName()); - if (!ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId) && !popupDisplaying) + if (!ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId)) ImGui::OpenPopup(name); bool open = true; - ImGui::SetNextWindowSizeConstraints(currPopup->getMinSize(), currPopup->getMaxSize()); - const auto closeButton = currPopup->hasCloseButton() ? &open : nullptr; - const auto flags = currPopup->getFlags(); + const auto &minSize = currPopup->getMinSize(); + const auto &maxSize = currPopup->getMaxSize(); + const bool hasConstraints = minSize.x != 0 && minSize.y != 0 && maxSize.x != 0 && maxSize.y != 0; - auto emptyWindowSize = ImGui::GetStyle().FramePadding * 4; - if (!sizeSet && popupSize.x > emptyWindowSize.x && popupSize.y > emptyWindowSize.y && popupSize.y < ImGui::GetMainViewport()->Size.y) { - ImGui::SetNextWindowSize(popupSize, ImGuiCond_Always); - ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Always, ImVec2(0.5F, 0.5F)); - sizeSet = true; + if (hasConstraints) + ImGui::SetNextWindowSizeConstraints(minSize, maxSize); + else + ImGui::SetNextWindowSize(ImVec2(0, 0), ImGuiCond_Appearing); + + auto* closeButton = currPopup->hasCloseButton() ? &open : nullptr; + + const auto flags = currPopup->getFlags() | (!hasConstraints ? (ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize) : ImGuiWindowFlags_None); + + if (!positionSet) { + ImGui::SetNextWindowPos(ImHexApi::System::getMainWindowPosition() + (ImHexApi::System::getMainWindowSize() / 2.0F), ImGuiCond_Always, ImVec2(0.5F, 0.5F)); + if (sizeSet) + positionSet = true; } - if (currPopup->isModal()) { - if (ImGui::BeginPopupModal(name, closeButton, flags)) { - + const auto createPopup = [&](bool displaying) { + if (displaying) { currPopup->drawContent(); popupDisplaying = true; - popupSize = ImGui::GetWindowSize(); + + if (ImGui::GetWindowSize().x > ImGui::GetStyle().FramePadding.x * 10) + sizeSet = true; ImGui::EndPopup(); } else { popupDisplaying = false; } - } else { - if (ImGui::BeginPopup(name, flags)) { + }; - currPopup->drawContent(); - popupDisplaying = true; - popupSize = ImGui::GetWindowSize(); + if (currPopup->isModal()) + createPopup(ImGui::BeginPopupModal(name, closeButton, flags)); + else + createPopup(ImGui::BeginPopup(name, flags)); - ImGui::EndPopup(); - } else { - popupDisplaying = false; - } - } + if (!popupDisplaying || currPopup->shouldClose()) { + log::debug("Closing popup '{}'", name); + positionSet = sizeSet = false; - if (!open && !popupDisplaying) { - sizeSet = false; - popupDisplaying = false; - popupSize = ImVec2(0, 0); popups.pop_back(); } } diff --git a/plugins/builtin/include/content/popups/popup_notification.hpp b/plugins/builtin/include/content/popups/popup_notification.hpp index 4c9f95868..406ec3ff6 100644 --- a/plugins/builtin/include/content/popups/popup_notification.hpp +++ b/plugins/builtin/include/content/popups/popup_notification.hpp @@ -48,7 +48,7 @@ namespace hex::plugin::builtin { class PopupInfo : public impl::PopupNotification { public: explicit PopupInfo(std::string message) - : PopupNotification("hex.builtin.common.info", std::move(message), []() { + : PopupNotification("hex.builtin.common.info", std::move(message), [this]() { Popup::close(); }) { } }; @@ -56,7 +56,7 @@ namespace hex::plugin::builtin { class PopupError : public impl::PopupNotification { public: explicit PopupError(std::string message) - : PopupNotification("hex.builtin.common.error", std::move(message), []() { + : PopupNotification("hex.builtin.common.error", std::move(message), [this]() { Popup::close(); }) { } }; @@ -64,7 +64,7 @@ namespace hex::plugin::builtin { class PopupFatal : public impl::PopupNotification { public: explicit PopupFatal(std::string message) - : PopupNotification("hex.builtin.common.fatal", std::move(message), []() { + : PopupNotification("hex.builtin.common.fatal", std::move(message), [this]() { ImHexApi::System::closeImHex(); Popup::close(); }) { } diff --git a/plugins/builtin/include/content/popups/popup_question.hpp b/plugins/builtin/include/content/popups/popup_question.hpp index 479d31a1f..7ebb9c6b9 100644 --- a/plugins/builtin/include/content/popups/popup_question.hpp +++ b/plugins/builtin/include/content/popups/popup_question.hpp @@ -21,12 +21,16 @@ namespace hex::plugin::builtin { auto width = ImGui::GetWindowWidth(); ImGui::SetCursorPosX(width / 9); - if (ImGui::Button("hex.builtin.common.yes"_lang, ImVec2(width / 3, 0))) + if (ImGui::Button("hex.builtin.common.yes"_lang, ImVec2(width / 3, 0))) { this->m_yesFunction(); + this->close(); + } ImGui::SameLine(); ImGui::SetCursorPosX(width / 9 * 5); - if (ImGui::Button("hex.builtin.common.no"_lang, ImVec2(width / 3, 0))) + if (ImGui::Button("hex.builtin.common.no"_lang, ImVec2(width / 3, 0))) { this->m_noFunction(); + this->close(); + } ImGui::SetWindowPos((ImHexApi::System::getMainWindowSize() - ImGui::GetWindowSize()) / 2, ImGuiCond_Appearing); } diff --git a/plugins/builtin/include/content/views/view_pattern_editor.hpp b/plugins/builtin/include/content/views/view_pattern_editor.hpp index a53d0d223..928f247d2 100644 --- a/plugins/builtin/include/content/views/view_pattern_editor.hpp +++ b/plugins/builtin/include/content/views/view_pattern_editor.hpp @@ -78,18 +78,18 @@ namespace hex::plugin::builtin { ImGui::NewLine(); ImGui::TextUnformatted("hex.builtin.view.pattern_editor.accept_pattern.question"_lang); - confirmButtons( - "hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang, [this, provider] { + confirmButtons("hex.builtin.common.yes"_lang, "hex.builtin.common.no"_lang, + [this, provider] { this->m_view->loadPatternFile(this->m_view->m_possiblePatternFiles[this->m_view->m_selectedPatternFile], provider); - Popup::close(); + this->close(); }, - [] { - Popup::close(); + [this] { + this->close(); } ); if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape))) - Popup::close(); + this->close(); } [[nodiscard]] ImGuiWindowFlags getFlags() const override { diff --git a/plugins/builtin/romfs/lang/base.json b/plugins/builtin/romfs/lang/base.json index 9d7d1878d..145794154 100644 --- a/plugins/builtin/romfs/lang/base.json +++ b/plugins/builtin/romfs/lang/base.json @@ -829,10 +829,10 @@ "hex.builtin.welcome.plugins.author", "hex.builtin.welcome.plugins.desc", "hex.builtin.welcome.plugins.plugin", - "hex.builtin.welcome.safety_backup.delete", - "hex.builtin.welcome.safety_backup.desc", - "hex.builtin.welcome.safety_backup.restore", - "hex.builtin.welcome.safety_backup.title", + "hex.builtin.popup.safety_backup.delete", + "hex.builtin.popup.safety_backup.desc", + "hex.builtin.popup.safety_backup.restore", + "hex.builtin.popup.safety_backup.title", "hex.builtin.welcome.start.create_file", "hex.builtin.welcome.start.open_file", "hex.builtin.welcome.start.open_other", diff --git a/plugins/builtin/romfs/lang/de_DE.json b/plugins/builtin/romfs/lang/de_DE.json index 0c64adb39..34d0ce75d 100644 --- a/plugins/builtin/romfs/lang/de_DE.json +++ b/plugins/builtin/romfs/lang/de_DE.json @@ -880,10 +880,10 @@ "hex.builtin.welcome.plugins.author": "Autor", "hex.builtin.welcome.plugins.desc": "Beschreibung", "hex.builtin.welcome.plugins.plugin": "Plugin", - "hex.builtin.welcome.safety_backup.delete": "Nein, entfernen", - "hex.builtin.welcome.safety_backup.desc": "Oh nein, ImHex ist letztes Mal abgestürzt.\nWillst du das vorherige Projekt wiederherstellen?", - "hex.builtin.welcome.safety_backup.restore": "Ja, wiederherstellen", - "hex.builtin.welcome.safety_backup.title": "Verlorene Daten wiederherstellen", + "hex.builtin.popup.safety_backup.delete": "Nein, entfernen", + "hex.builtin.popup.safety_backup.desc": "Oh nein, ImHex ist letztes Mal abgestürzt.\nWillst du das vorherige Projekt wiederherstellen?", + "hex.builtin.popup.safety_backup.restore": "Ja, wiederherstellen", + "hex.builtin.popup.safety_backup.title": "Verlorene Daten wiederherstellen", "hex.builtin.welcome.start.create_file": "Neue Datei erstellen", "hex.builtin.welcome.start.open_file": "Datei öffnen", "hex.builtin.welcome.start.open_other": "Andere Provider", diff --git a/plugins/builtin/romfs/lang/en_US.json b/plugins/builtin/romfs/lang/en_US.json index 4bf02f0ec..66a271f51 100644 --- a/plugins/builtin/romfs/lang/en_US.json +++ b/plugins/builtin/romfs/lang/en_US.json @@ -901,10 +901,10 @@ "hex.builtin.welcome.plugins.author": "Author", "hex.builtin.welcome.plugins.desc": "Description", "hex.builtin.welcome.plugins.plugin": "Plugin", - "hex.builtin.welcome.safety_backup.delete": "No, Delete", - "hex.builtin.welcome.safety_backup.desc": "Oh no, ImHex crashed last time.\nDo you want to restore your past work?", - "hex.builtin.welcome.safety_backup.restore": "Yes, Restore", - "hex.builtin.welcome.safety_backup.title": "Restore lost data", + "hex.builtin.popup.safety_backup.delete": "No, Delete", + "hex.builtin.popup.safety_backup.desc": "Oh no, ImHex crashed last time.\nDo you want to restore your past work?", + "hex.builtin.popup.safety_backup.restore": "Yes, Restore", + "hex.builtin.popup.safety_backup.title": "Restore lost data", "hex.builtin.welcome.start.create_file": "Create New File", "hex.builtin.welcome.start.open_file": "Open File", "hex.builtin.welcome.start.open_other": "Other Providers", diff --git a/plugins/builtin/romfs/lang/it_IT.json b/plugins/builtin/romfs/lang/it_IT.json index cd8b28805..8846cf03b 100644 --- a/plugins/builtin/romfs/lang/it_IT.json +++ b/plugins/builtin/romfs/lang/it_IT.json @@ -880,10 +880,10 @@ "hex.builtin.welcome.plugins.author": "Autore", "hex.builtin.welcome.plugins.desc": "Descrizione", "hex.builtin.welcome.plugins.plugin": "Plugin", - "hex.builtin.welcome.safety_backup.delete": "No, Elimina", - "hex.builtin.welcome.safety_backup.desc": "Oh no, l'ultima volta ImHex è crashato.\nVuoi ripristinare il tuo lavoro?", - "hex.builtin.welcome.safety_backup.restore": "Sì, Ripristina", - "hex.builtin.welcome.safety_backup.title": "Ripristina i dati persi", + "hex.builtin.popup.safety_backup.delete": "No, Elimina", + "hex.builtin.popup.safety_backup.desc": "Oh no, l'ultima volta ImHex è crashato.\nVuoi ripristinare il tuo lavoro?", + "hex.builtin.popup.safety_backup.restore": "Sì, Ripristina", + "hex.builtin.popup.safety_backup.title": "Ripristina i dati persi", "hex.builtin.welcome.start.create_file": "Crea un nuovo File", "hex.builtin.welcome.start.open_file": "Apri un File", "hex.builtin.welcome.start.open_other": "", diff --git a/plugins/builtin/romfs/lang/ja_JP.json b/plugins/builtin/romfs/lang/ja_JP.json index dad42c582..0fcf1cb58 100644 --- a/plugins/builtin/romfs/lang/ja_JP.json +++ b/plugins/builtin/romfs/lang/ja_JP.json @@ -880,10 +880,10 @@ "hex.builtin.welcome.plugins.author": "作者", "hex.builtin.welcome.plugins.desc": "詳細", "hex.builtin.welcome.plugins.plugin": "プラグイン", - "hex.builtin.welcome.safety_backup.delete": "破棄する", - "hex.builtin.welcome.safety_backup.desc": "ImHexがクラッシュしました。\n前のデータを復元しますか?", - "hex.builtin.welcome.safety_backup.restore": "復元する", - "hex.builtin.welcome.safety_backup.title": "セッションの回復", + "hex.builtin.popup.safety_backup.delete": "破棄する", + "hex.builtin.popup.safety_backup.desc": "ImHexがクラッシュしました。\n前のデータを復元しますか?", + "hex.builtin.popup.safety_backup.restore": "復元する", + "hex.builtin.popup.safety_backup.title": "セッションの回復", "hex.builtin.welcome.start.create_file": "新規ファイルを作成", "hex.builtin.welcome.start.open_file": "ファイルを開く…", "hex.builtin.welcome.start.open_other": "その他のファイル", diff --git a/plugins/builtin/romfs/lang/ko_KR.json b/plugins/builtin/romfs/lang/ko_KR.json index 023b9cdd2..734b41739 100644 --- a/plugins/builtin/romfs/lang/ko_KR.json +++ b/plugins/builtin/romfs/lang/ko_KR.json @@ -880,10 +880,10 @@ "hex.builtin.welcome.plugins.author": "작성자", "hex.builtin.welcome.plugins.desc": "설명", "hex.builtin.welcome.plugins.plugin": "플러그인", - "hex.builtin.welcome.safety_backup.delete": "아니요, 삭제", - "hex.builtin.welcome.safety_backup.desc": "이전에 ImHex가 비 정상적으로 종료된 것 같습니다.\n이전의 작업을 복구할까요?", - "hex.builtin.welcome.safety_backup.restore": "네, 복구", - "hex.builtin.welcome.safety_backup.title": "손상된 데이터 복구", + "hex.builtin.popup.safety_backup.delete": "아니요, 삭제", + "hex.builtin.popup.safety_backup.desc": "이전에 ImHex가 비 정상적으로 종료된 것 같습니다.\n이전의 작업을 복구할까요?", + "hex.builtin.popup.safety_backup.restore": "네, 복구", + "hex.builtin.popup.safety_backup.title": "손상된 데이터 복구", "hex.builtin.welcome.start.create_file": "새 파일 생성", "hex.builtin.welcome.start.open_file": "파일 열기", "hex.builtin.welcome.start.open_other": "다른 공급자 열기", diff --git a/plugins/builtin/romfs/lang/pt_BR.json b/plugins/builtin/romfs/lang/pt_BR.json index 7608c26d5..d543ed688 100644 --- a/plugins/builtin/romfs/lang/pt_BR.json +++ b/plugins/builtin/romfs/lang/pt_BR.json @@ -880,10 +880,10 @@ "hex.builtin.welcome.plugins.author": "Autor", "hex.builtin.welcome.plugins.desc": "Descrição", "hex.builtin.welcome.plugins.plugin": "Plugin", - "hex.builtin.welcome.safety_backup.delete": "Não, Apagar", - "hex.builtin.welcome.safety_backup.desc": "Ah não, ImHex crashou na ultima vez.\nDeseja restaurar seu trabalho anterior?", - "hex.builtin.welcome.safety_backup.restore": "Yes, Restaurar", - "hex.builtin.welcome.safety_backup.title": "Restaurar dados perdidos", + "hex.builtin.popup.safety_backup.delete": "Não, Apagar", + "hex.builtin.popup.safety_backup.desc": "Ah não, ImHex crashou na ultima vez.\nDeseja restaurar seu trabalho anterior?", + "hex.builtin.popup.safety_backup.restore": "Yes, Restaurar", + "hex.builtin.popup.safety_backup.title": "Restaurar dados perdidos", "hex.builtin.welcome.start.create_file": "Criar Novo Arquivo", "hex.builtin.welcome.start.open_file": "Abrir Arquivo", "hex.builtin.welcome.start.open_other": "Outros Provedores", diff --git a/plugins/builtin/romfs/lang/zh_CN.json b/plugins/builtin/romfs/lang/zh_CN.json index 6d5e00506..8309c753a 100644 --- a/plugins/builtin/romfs/lang/zh_CN.json +++ b/plugins/builtin/romfs/lang/zh_CN.json @@ -835,10 +835,10 @@ "hex.builtin.welcome.plugins.author": "作者", "hex.builtin.welcome.plugins.desc": "描述", "hex.builtin.welcome.plugins.plugin": "插件", - "hex.builtin.welcome.safety_backup.delete": "删除", - "hex.builtin.welcome.safety_backup.desc": "糟糕,ImHex 上次崩溃了!\n您想从异常转储中恢复之前的数据吗?", - "hex.builtin.welcome.safety_backup.restore": "恢复", - "hex.builtin.welcome.safety_backup.title": "恢复崩溃数据", + "hex.builtin.popup.safety_backup.delete": "删除", + "hex.builtin.popup.safety_backup.desc": "糟糕,ImHex 上次崩溃了!\n您想从异常转储中恢复之前的数据吗?", + "hex.builtin.popup.safety_backup.restore": "恢复", + "hex.builtin.popup.safety_backup.title": "恢复崩溃数据", "hex.builtin.welcome.start.create_file": "创建新文件", "hex.builtin.welcome.start.open_file": "打开文件", "hex.builtin.welcome.start.open_other": "其他提供器", diff --git a/plugins/builtin/romfs/lang/zh_TW.json b/plugins/builtin/romfs/lang/zh_TW.json index 4a9441b4d..0f2c03063 100644 --- a/plugins/builtin/romfs/lang/zh_TW.json +++ b/plugins/builtin/romfs/lang/zh_TW.json @@ -880,10 +880,10 @@ "hex.builtin.welcome.plugins.author": "作者", "hex.builtin.welcome.plugins.desc": "說明", "hex.builtin.welcome.plugins.plugin": "外掛程式", - "hex.builtin.welcome.safety_backup.delete": "不用,請刪除", - "hex.builtin.welcome.safety_backup.desc": "喔不,ImHex 上次崩潰了。\n您要復原您的工作階段嗎?", - "hex.builtin.welcome.safety_backup.restore": "好,請復原", - "hex.builtin.welcome.safety_backup.title": "復原遺失資料", + "hex.builtin.popup.safety_backup.delete": "不用,請刪除", + "hex.builtin.popup.safety_backup.desc": "喔不,ImHex 上次崩潰了。\n您要復原您的工作階段嗎?", + "hex.builtin.popup.safety_backup.restore": "好,請復原", + "hex.builtin.popup.safety_backup.title": "復原遺失資料", "hex.builtin.welcome.start.create_file": "建立新檔案", "hex.builtin.welcome.start.open_file": "開啟檔案", "hex.builtin.welcome.start.open_other": "其他提供者", diff --git a/plugins/builtin/source/content/events.cpp b/plugins/builtin/source/content/events.cpp index bb4630dda..2d2f54547 100644 --- a/plugins/builtin/source/content/events.cpp +++ b/plugins/builtin/source/content/events.cpp @@ -39,9 +39,7 @@ namespace hex::plugin::builtin { ImHexApi::Provider::resetDirty(); ImHexApi::System::closeImHex(); }, - []{ - PopupQuestion::close(); - } + [] { } ); } else if (TaskManager::getRunningTaskCount() > 0 || TaskManager::getRunningBackgroundTaskCount() > 0) { glfwSetWindowShouldClose(window, GLFW_FALSE); @@ -59,11 +57,8 @@ namespace hex::plugin::builtin { PopupQuestion::open("hex.builtin.popup.close_provider.desc"_lang, []{ ImHexApi::Provider::remove(ImHexApi::Provider::impl::getClosingProvider(), true); - PopupQuestion::close(); }, - []{ - PopupQuestion::close(); - } + [] { } ); } }); diff --git a/plugins/builtin/source/content/views/view_settings.cpp b/plugins/builtin/source/content/views/view_settings.cpp index 9a4cd5c48..b566b7508 100644 --- a/plugins/builtin/source/content/views/view_settings.cpp +++ b/plugins/builtin/source/content/views/view_settings.cpp @@ -88,7 +88,7 @@ namespace hex::plugin::builtin { this->getWindowOpenState() = false; if (!this->getWindowOpenState() && this->m_restartRequested) { - PopupQuestion::open("hex.builtin.view.settings.restart_question"_lang, ImHexApi::System::restartImHex, [] {}); + PopupQuestion::open("hex.builtin.view.settings.restart_question"_lang, ImHexApi::System::restartImHex, []{}); } } diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index 6baf42e7e..2e14e02e9 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -67,12 +67,12 @@ namespace hex::plugin::builtin { PopupRestoreBackup() : Popup("hex.builtin.popup.safety_backup.title") { } void drawContent() override { - ImGui::TextUnformatted("hex.builtin.welcome.safety_backup.desc"_lang); + ImGui::TextUnformatted("hex.builtin.popup.safety_backup.desc"_lang); ImGui::NewLine(); auto width = ImGui::GetWindowWidth(); ImGui::SetCursorPosX(width / 9); - if (ImGui::Button("hex.builtin.welcome.safety_backup.restore"_lang, ImVec2(width / 3, 0))) { + if (ImGui::Button("hex.builtin.popup.safety_backup.restore"_lang, ImVec2(width / 3, 0))) { ProjectFile::load(s_safetyBackupPath); ProjectFile::clearPath(); @@ -85,7 +85,7 @@ namespace hex::plugin::builtin { } ImGui::SameLine(); ImGui::SetCursorPosX(width / 9 * 5); - if (ImGui::Button("hex.builtin.welcome.safety_backup.delete"_lang, ImVec2(width / 3, 0))) { + if (ImGui::Button("hex.builtin.popup.safety_backup.delete"_lang, ImVec2(width / 3, 0))) { wolv::io::fs::remove(s_safetyBackupPath); Popup::close(); @@ -513,16 +513,17 @@ namespace hex::plugin::builtin { EventManager::subscribe([] { // documentation of the value above the setting definition - int showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2); + auto showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2); if (showCheckForUpdates == 2) { ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 0); PopupQuestion::open("hex.builtin.welcome.check_for_updates_text"_lang, - [] { // yes + [] { ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 1); - ImGui::CloseCurrentPopup(); - }, [] { // no - ImGui::CloseCurrentPopup(); - }); + }, + [] { + + } + ); } });