From 98c48c33dac4efb38e161ecf73f3d656aa831d70 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Mon, 15 Jun 2026 22:17:49 +0200 Subject: [PATCH] Extract document-session save dialog helper --- docs/modernization/debt.md | 5 ++++ docs/modernization/roadmap.md | 4 +++ docs/modernization/tasks.md | 35 ++++++++++++++++++++++ src/app_dialogs.cpp | 55 ++++++++++++++++++++--------------- 4 files changed, 76 insertions(+), 23 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index aa2abcc7..a84093a3 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -18,6 +18,11 @@ agent or engineer to remove them without reconstructing context from chat. ## Recent Reductions +- 2026-06-15: `DEBT-0042` was narrowed again. The retained Save dialog button + wiring in `src/app_dialogs.cpp` now routes through a focused helper instead + of living inline in `App::dialog_save()`; the remaining document-session + bridge debt stays concentrated in close prompts, save-version routing, app + document field mutation, and keyboard/dialog cleanup. - 2026-06-15: `DEBT-0042` was narrowed again. The retained Save Version execution in `src/legacy_document_session_services.cpp` now routes through a focused helper instead of living inline in diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 26bbdd97..d2eb2e5a 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -1424,6 +1424,10 @@ The retained Save Version execution in `src/legacy_document_session_services.*` now also routes through a focused helper, so the remaining document-session bridge debt is further concentrated on close prompts, save dialogs, overwrite prompts, and keyboard/dialog cleanup. +The retained Save dialog button wiring in `src/app_dialogs.cpp` now also +routes through a focused helper, so the remaining document-session bridge debt +is further concentrated on close prompts, save-version routing, app document +field mutation, and keyboard/dialog cleanup. `App::dialog_newdoc` now routes accepted new-document plans through the app-core new-document executor and `src/legacy_document_session_services.*`, preserving target overwrite prompts, legacy canvas resize/layer setup, history diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index 1279ade3..8efe180a 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -1560,6 +1560,41 @@ Completed Task Log: | --- | --- | ---: | --- | --- | | 2026-06-15 | ADP-041 | no score movement | `powershell -ExecutionPolicy Bypass -File scripts\\automation\\quiet-validate.ps1 -BuildTargets pano_cli,pp_app_core_document_session_tests -TestRegex "pp_app_core_document_session|pano_cli_plan_document_session_prompt"` | `aaf55dd7` | +### ADP-042 - Extract Document-Session Save Dialog Helper + +Status: Done +Score: no score movement +Debt: `DEBT-0042` +Scope: `src/app_dialogs.cpp` only + +Closeout: `aaf55dd7` + +Goal: + +Reduce the inline retained Save dialog button wiring by extracting the +button handling from `App::dialog_save()` into a focused helper while +preserving current behavior. + +Done Checks: + +- The retained Save dialog wiring no longer lives inline in `App::dialog_save()`. +- The retained Save dialog path now routes through a focused helper in + `src/app_dialogs.cpp`. +- `DEBT-0042` and the roadmap note the reduced remaining document-session + bridge surface. + +Validation: + +```powershell +powershell -ExecutionPolicy Bypass -File scripts\\automation\\quiet-validate.ps1 -BuildTargets pano_cli,pp_app_core_document_session_tests -TestRegex "pp_app_core_document_session|pano_cli_plan_document_session_prompt" +``` + +Completed Task Log: + +| Date | Task | Score | Validation | Commit | +| --- | --- | ---: | --- | --- | +| 2026-06-15 | ADP-042 | no score movement | `powershell -ExecutionPolicy Bypass -File scripts\\automation\\quiet-validate.ps1 -BuildTargets pano_cli,pp_app_core_document_session_tests -TestRegex "pp_app_core_document_session|pano_cli_plan_document_session_prompt"` | `aaf55dd7` | + ### RND-001 - Make Pure Equirectangular Export The Primary Success Path Status: Done diff --git a/src/app_dialogs.cpp b/src/app_dialogs.cpp index f19c6c8a..4a080418 100644 --- a/src/app_dialogs.cpp +++ b/src/app_dialogs.cpp @@ -121,6 +121,37 @@ void start_document_export_collection( }); } +void wire_document_save_dialog_buttons( + App& app, + const std::shared_ptr& dialog, + std::function close_dialog) +{ + dialog->btn_ok->on_click = [&app, dialog](Node*) + { + std::string name = dialog->input->m_text; + const auto plan = pp::app::plan_document_file_save( + app.work_path, + name, + [](const std::string& path) { + return Asset::exist(path); + }); + if (!plan) + { + app.message_box("Warning", "You need to specify a name to file."); + return; + } + + const auto status = + pp::panopainter::execute_legacy_document_file_save_plan(app, plan.value(), dialog); + if (!status.ok()) + LOG("Document file save action failed: %s", status.message); + }; + dialog->btn_cancel->on_click = [close_dialog](Node*) + { + close_dialog(); + }; +} + } std::shared_ptr App::show_progress(const std::string& title, int total /*= 0*/) @@ -464,29 +495,7 @@ void App::dialog_save() App::I->hideKeyboard(); }; - dialog->btn_ok->on_click = [this, dialog](Node*) - { - std::string name = dialog->input->m_text; - const auto plan = pp::app::plan_document_file_save( - work_path, - name, - [](const std::string& path) { - return Asset::exist(path); - }); - if (!plan) - { - message_box("Warning", "You need to specify a name to file."); - return; - } - - const auto status = pp::panopainter::execute_legacy_document_file_save_plan(*this, plan.value(), dialog); - if (!status.ok()) - LOG("Document file save action failed: %s", status.message); - }; - dialog->btn_cancel->on_click = [close_dialog](Node*) - { - close_dialog(); - }; + wire_document_save_dialog_buttons(*this, dialog, close_dialog); } }