Extract document-session close prompt helper

This commit is contained in:
2026-06-15 22:09:49 +02:00
parent f6afd34256
commit be8dee8de5
4 changed files with 63 additions and 10 deletions

View File

@@ -18,6 +18,12 @@ agent or engineer to remove them without reconstructing context from chat.
## Recent Reductions ## Recent Reductions
- 2026-06-15: `DEBT-0040` was narrowed again. The retained close-unsaved
prompt wiring in `src/legacy_document_session_services.cpp` now routes
through a focused helper instead of living inline in
`show_unsaved_close_prompt()`; the remaining document-session bridge debt
stays concentrated in save-before-workflow prompts, save-version routing,
app document field mutation, and keyboard/dialog cleanup.
- 2026-06-15: `DEBT-0040` was narrowed again. The retained save-before- - 2026-06-15: `DEBT-0040` was narrowed again. The retained save-before-
continue workflow prompt wiring in `src/legacy_document_session_services.cpp` continue workflow prompt wiring in `src/legacy_document_session_services.cpp`
now routes through a focused helper instead of living inline in now routes through a focused helper instead of living inline in

View File

@@ -1415,6 +1415,11 @@ The retained save-before-continue workflow prompt wiring in
helper, so the remaining document-session bridge debt is further concentrated helper, so the remaining document-session bridge debt is further concentrated
on close prompts, native close requests, save-version routing, app document on close prompts, native close requests, save-version routing, app document
field mutation, and keyboard/dialog cleanup. field mutation, and keyboard/dialog cleanup.
The retained close-unsaved prompt wiring in
`src/legacy_document_session_services.*` now also routes through a focused
helper, so the remaining document-session bridge debt is further concentrated
on save-before-workflow prompts, save-version routing, app document field
mutation, and keyboard/dialog cleanup.
`App::dialog_newdoc` now routes accepted new-document plans through the `App::dialog_newdoc` now routes accepted new-document plans through the
app-core new-document executor and `src/legacy_document_session_services.*`, app-core new-document executor and `src/legacy_document_session_services.*`,
preserving target overwrite prompts, legacy canvas resize/layer setup, history preserving target overwrite prompts, legacy canvas resize/layer setup, history

View File

@@ -1488,6 +1488,42 @@ Completed Task Log:
| --- | --- | ---: | --- | --- | | --- | --- | ---: | --- | --- |
| 2026-06-15 | ADP-039 | 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"` | `c37451e9` | | 2026-06-15 | ADP-039 | 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"` | `c37451e9` |
### ADP-040 - Extract Document-Session Close Prompt Helper
Status: Done
Score: no score movement
Debt: `DEBT-0040`
Scope: `src/legacy_document_session_services.cpp` only
Closeout: `c37451e9`
Goal:
Reduce the inline retained close-unsaved prompt surface by extracting the
button wiring from `show_unsaved_close_prompt()` into a focused helper while
preserving current behavior.
Done Checks:
- The retained close-unsaved prompt wiring no longer lives inline in
`show_unsaved_close_prompt()`.
- The retained close prompt path now routes through a focused helper in
`src/legacy_document_session_services.cpp`.
- `DEBT-0040` 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-040 | 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"` | `c37451e9` |
### RND-001 - Make Pure Equirectangular Export The Primary Success Path ### RND-001 - Make Pure Equirectangular Export The Primary Success Path
Status: Done Status: Done

View File

@@ -118,6 +118,21 @@ void project_save_after_snapshot(App& app, std::function<void(bool)> on_complete
app.canvas->m_canvas->project_save(std::move(on_complete)); app.canvas->m_canvas->project_save(std::move(on_complete));
} }
void wire_unsaved_close_prompt_buttons(
App& app,
bool& dialog_already_opened,
const std::shared_ptr<NodeMessageBox>& dialog)
{
dialog->btn_ok->on_click = [&app](Node*) {
app.request_app_close();
Canvas::I->m_unsaved = false;
};
dialog->btn_cancel->on_click = [&dialog_already_opened, dialog](Node*) {
pp::panopainter::close_legacy_dialog_node(*dialog);
dialog_already_opened = false;
};
}
void create_legacy_new_document( void create_legacy_new_document(
App& app, App& app,
const pp::app::NewDocumentPlan& plan, const pp::app::NewDocumentPlan& plan,
@@ -285,20 +300,11 @@ public:
if (!history_status.ok()) { if (!history_status.ok()) {
LOG("Close prompt history effect failed: %s", history_status.message); LOG("Close prompt history effect failed: %s", history_status.message);
} }
auto* app = &app_;
auto* dialog_already_opened = &dialog_already_opened_;
auto m = pp::panopainter::create_legacy_app_message_dialog( auto m = pp::panopainter::create_legacy_app_message_dialog(
app_, app_,
pp::app::plan_document_session_prompt( pp::app::plan_document_session_prompt(
pp::app::DocumentSessionPromptKind::close_unsaved_document)); pp::app::DocumentSessionPromptKind::close_unsaved_document));
m->btn_ok->on_click = [app](Node*) { wire_unsaved_close_prompt_buttons(app_, dialog_already_opened_, m);
app->request_app_close();
Canvas::I->m_unsaved = false;
};
m->btn_cancel->on_click = [dialog_already_opened, m](Node*) {
pp::panopainter::close_legacy_dialog_node(*m);
*dialog_already_opened = false;
};
dialog_already_opened_ = true; dialog_already_opened_ = true;
} }