diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index 00b52956..ca8b8987 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -18,6 +18,12 @@ agent or engineer to remove them without reconstructing context from chat. ## Recent Reductions +- 2026-06-15: `DEBT-0039` was narrowed again. The retained ABR/PPBR import + prompt wiring in `src/legacy_document_open_services.cpp` now routes through + a focused helper instead of living inline in each document-open import + prompt; the remaining document-open bridge debt stays concentrated in + unsaved-project prompts, project-open execution, layer refresh, title + updates, and retained history services. - 2026-06-15: `DEBT-0038` was narrowed again. The retained cloud downloaded- project open camera reset and layer-clear setup in `execute_legacy_downloaded_project_open()` now routes through a focused diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index e5499d0f..2d8ff458 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -1387,6 +1387,10 @@ the app-core brush package import executor and `src/legacy_brush_package_import_services.*`, preserving detached legacy preset panel import threads while retained brush asset execution remains tracked under `DEBT-0048`. +The retained ABR/PPBR import prompt wiring in `src/legacy_document_open_services.*` +now also routes through a focused helper, so the remaining document-open bridge +debt is further concentrated on unsaved-project prompts, project-open +execution, layer refresh, title updates, and retained history services. `App::request_close`, `App::save_document`, and `App::continue_document_workflow_after_optional_save` now route through app-core document-session executors and `src/legacy_document_session_services.*`, diff --git a/src/legacy_document_open_services.cpp b/src/legacy_document_open_services.cpp index 291f9e7b..a3d28ebc 100644 --- a/src/legacy_document_open_services.cpp +++ b/src/legacy_document_open_services.cpp @@ -86,6 +86,22 @@ void prepare_downloaded_project_open(App& app) app.layers->clear(); } +void prompt_import_brush_package( + App& app, + const char* title, + const char* log_prefix, + pp::app::BrushPackageImportKind kind, + const pp::app::DocumentOpenRoute& route) +{ + auto mb = app.message_box(title, "Would you like to import the brushes?", true); + mb->on_submit = [&app, path = route.path, kind, log_prefix](Node* target) { + const auto status = pp::panopainter::execute_legacy_brush_package_import(app, kind, path); + if (!status.ok()) + LOG("%s import failed: %s", log_prefix, status.message); + pp::panopainter::close_legacy_dialog_node(*target); + }; +} + class LegacyDocumentOpenServices final : public pp::app::DocumentOpenServices { public: explicit LegacyDocumentOpenServices(App& app) noexcept @@ -95,32 +111,22 @@ public: void prompt_import_abr(const pp::app::DocumentOpenRoute& route) override { - auto* app = &app_; - auto mb = app_.message_box("Import ABR", "Would you like to import the brushes?", true); - mb->on_submit = [app, path = route.path](Node* target) { - const auto status = pp::panopainter::execute_legacy_brush_package_import( - *app, - pp::app::BrushPackageImportKind::abr, - path); - if (!status.ok()) - LOG("ABR import failed: %s", status.message); - pp::panopainter::close_legacy_dialog_node(*target); - }; + prompt_import_brush_package( + app_, + "Import ABR", + "ABR", + pp::app::BrushPackageImportKind::abr, + route); } void prompt_import_ppbr(const pp::app::DocumentOpenRoute& route) override { - auto* app = &app_; - auto mb = app_.message_box("Import PPBR", "Would you like to import the brushes?", true); - mb->on_submit = [app, path = route.path](Node* target) { - const auto status = pp::panopainter::execute_legacy_brush_package_import( - *app, - pp::app::BrushPackageImportKind::ppbr, - path); - if (!status.ok()) - LOG("PPBR import failed: %s", status.message); - pp::panopainter::close_legacy_dialog_node(*target); - }; + prompt_import_brush_package( + app_, + "Import PPBR", + "PPBR", + pp::app::BrushPackageImportKind::ppbr, + route); } void open_project_now(const pp::app::DocumentOpenRoute& route) override