From 6470c6a6a85239bf1fbd1dcce29f7161500c957b Mon Sep 17 00:00:00 2001 From: omigamedev Date: Fri, 12 Jun 2026 15:54:39 +0200 Subject: [PATCH] Centralize retained document session dialog closing --- docs/modernization/debt.md | 4 ++++ docs/modernization/roadmap.md | 3 +++ src/legacy_document_session_services.cpp | 17 ++++++++--------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index c54b07c..cd343ec 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -534,6 +534,10 @@ agent or engineer to remove them without reconstructing context from chat. - 2026-06-12: DEBT-0063/DEBT-0058 were narrowed again. Open/Browse delete-confirmation message boxes and shared destroy-on-click bindings now use the retained dialog close helper in `src/legacy_ui_overlay_services.*`. +- 2026-06-12: DEBT-0063/DEBT-0040/DEBT-0041/DEBT-0042 were narrowed again. + Document-session overwrite prompts, unsaved-close prompts, save-before-workflow + prompts, and accepted new/save document cleanup now route retained dialog + closing through `src/legacy_ui_overlay_services.*`. - 2026-06-05: DEBT-0011 was narrowed. The Windows app package smoke target now passes the configure-time CMake executable into `package-smoke.ps1`, so VS 2026 generator validation does not depend on an older `cmake` on PATH, and diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index b40b7eb..e3ee443 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -508,6 +508,9 @@ Browse accept, resize accept/failure, and what's-new read-later/close callbacks now use a named retained dialog close helper instead of direct `destroy()` calls. Open/Browse delete-confirmation message boxes and shared destroy-on-click bindings now use that same retained dialog close helper. +Document-session overwrite, unsaved-close, save-before-workflow, and accepted +new/save document cleanup now route retained dialog closing through the same +helpers. Raw popup callback captures and full close/capture ownership remain part of `DEBT-0063`. `pano_cli inspect-image` exposes PNG IHDR metadata as JSON, diff --git a/src/legacy_document_session_services.cpp b/src/legacy_document_session_services.cpp index ce355f1..a1c6926 100644 --- a/src/legacy_document_session_services.cpp +++ b/src/legacy_document_session_services.cpp @@ -7,6 +7,7 @@ #include "legacy_document_canvas_services.h" #include "legacy_canvas_view_services.h" #include "legacy_history_services.h" +#include "legacy_ui_overlay_services.h" #include "node_dialog_open.h" #include @@ -117,8 +118,7 @@ void create_legacy_new_document( app.canvas->m_canvas->m_newdoc = false; app.title_update(); - dialog->destroy(); - App::I->hideKeyboard(); + pp::panopainter::close_legacy_dialog_and_hide_keyboard(app, *dialog); } class LegacyNewDocumentServices final : public pp::app::NewDocumentServices { @@ -144,7 +144,7 @@ public: auto dialog = dialog_; msgbox->btn_ok->on_click = [app, msgbox, dialog, plan](Node*) { create_legacy_new_document(*app, plan, dialog); - msgbox->destroy(); + pp::panopainter::close_legacy_dialog_node(*msgbox); }; } @@ -163,8 +163,7 @@ void save_legacy_document_file( app.doc_path = plan.target.path; app.doc_dir = plan.target.directory; app.title_update(); - dialog->destroy(); - App::I->hideKeyboard(); + pp::panopainter::close_legacy_dialog_and_hide_keyboard(app, *dialog); } class LegacyDocumentFileSaveServices final : public pp::app::DocumentFileSaveServices { @@ -191,7 +190,7 @@ public: auto dialog = dialog_; msgbox->btn_ok->on_click = [app, msgbox, dialog, plan](Node*) { save_legacy_document_file(*app, plan, dialog); - msgbox->destroy(); + pp::panopainter::close_legacy_dialog_node(*msgbox); }; } @@ -245,7 +244,7 @@ public: Canvas::I->m_unsaved = false; }; m->btn_cancel->on_click = [dialog_already_opened, m](Node*) { - m->destroy(); + pp::panopainter::close_legacy_dialog_node(*m); *dialog_already_opened = false; }; dialog_already_opened_ = true; @@ -313,11 +312,11 @@ public: app->message_box(plan.title, plan.message, plan.show_cancel); } }); - m->destroy(); + pp::panopainter::close_legacy_dialog_node(*m); }; m->btn_cancel->on_click = [m, action](Node*) { action(); - m->destroy(); + pp::panopainter::close_legacy_dialog_node(*m); }; }