diff --git a/cmake/PanoPainterSources.cmake b/cmake/PanoPainterSources.cmake index be749f1..77058e0 100644 --- a/cmake/PanoPainterSources.cmake +++ b/cmake/PanoPainterSources.cmake @@ -84,6 +84,8 @@ set(PP_PANOPAINTER_APP_SOURCES src/app_layout.cpp src/app_shaders.cpp src/app_vr.cpp + src/legacy_app_dialog_services.cpp + src/legacy_app_dialog_services.h src/legacy_app_preference_services.cpp src/legacy_app_preference_services.h src/legacy_app_startup_services.cpp diff --git a/docs/modernization/build-inventory.md b/docs/modernization/build-inventory.md index 197de0b..9984204 100644 --- a/docs/modernization/build-inventory.md +++ b/docs/modernization/build-inventory.md @@ -851,6 +851,12 @@ Known local toolchain state: metadata planning, progress initialization, negative progress-total clamping, message cancel-button/caption policy, input OK-caption propagation, and malformed empty OK-caption rejection without requiring legacy `Node*` dialogs. +- `src/legacy_app_dialog_services.*` is the current app-shell bridge between + `pp_app_core` app dialog plans and retained `NodeProgressBar`, + `NodeMessageBox`, and `NodeInputBox` creation. `App::show_progress`, + `App::message_box`, and `App::input_box` now act as thin adapters while + layout insertion, callback wiring, and dialog lifetime remain tracked by + `DEBT-0058`. - `pp_app_core_app_startup_tests` covers startup run-counter increment planning, optional auto-timelapse/license/VR-controller decisions, negative and overflow run-counter rejection, stable full startup dispatch ordering, diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index e1a4591..c1b0531 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -182,6 +182,10 @@ agent or engineer to remove them without reconstructing context from chat. `App::show_progress`, `App::message_box`, `App::input_box`, and `pano_cli plan-app-dialog`, but retained `Node*` dialog creation, layout insertion, callback wiring, and lifetime ownership remain in the legacy app. + Later on 2026-06-05, retained `NodeProgressBar`, `NodeMessageBox`, and + `NodeInputBox` creation moved into `src/legacy_app_dialog_services.*`, making + the `App` methods thin adapters while retained layout/lifetime ownership + remains open. - 2026-06-05: DEBT-0043 and DEBT-0044 were narrowed. Export success, failure, and license-disabled dialog metadata plus export execution log labels now live in tested `pp_app_core` planning consumed by @@ -261,7 +265,7 @@ agent or engineer to remove them without reconstructing context from chat. | DEBT-0055 | Open | Modernization | `src/app.h` now forward-declares retained iOS/macOS/Android/Linux/Web platform handles instead of including platform SDK headers, and full SDK includes are isolated in `src/platform_legacy/legacy_platform_services.cpp`, but the `App` singleton still stores those platform handles directly | Reduce central header platform coupling incrementally without rewriting non-Windows platform entrypoints before Phase 6 | Windows app build; Apple/Android/Linux/Web package smoke once platform root builds are active | Platform handles are owned by injected `pp_platform_*` shell state or services, and `App` has no platform SDK handle fields or platform conditional members | | DEBT-0056 | Open | Modernization | `src/asset.h` now forward-declares Android asset-manager types and uses `Asset::set_android_asset_manager` instead of public mutable manager state, but retained `Asset` still stores Android asset handles and `src/asset.cpp` still performs Android `AAssetManager` reads directly; the current `android-arm64` root preset is headless and does not expose `pp_legacy_assets_io` | Reduce legacy asset I/O header coupling without rewriting Android asset loading before the asset manager/storage boundary exists | Windows app build; `cmake --build --preset android-arm64 --target pp_assets`; Android package smoke once package builds consume shared targets | Android asset loading is owned by injected asset storage/platform services or `pp_assets` file providers, with no static Android asset manager on `Asset` | | DEBT-0057 | Open | Modernization | Default canvas allocation size now dispatches through `PlatformServices::default_canvas_resolution`, removing the `CANVAS_RES` platform macro from `src/canvas.h`, but WebGL's retained 512 default still lives in `src/platform_legacy/legacy_platform_services.cpp` until the Web shell owns injected services | Preserve WebGL memory behavior while moving canvas creation policy out of shared canvas headers and into the platform boundary | `pp_platform_api_tests`; `ctest --preset desktop-fast --build-config Debug -R pp_platform_api_tests`; Windows app build; WebGL package smoke once root Web build exists | Default canvas resolution is owned by injected `pp_platform_*` services for every supported platform, with no WebGL branch in the legacy fallback | -| DEBT-0058 | Open | Modernization | App-level progress/message/input dialog metadata, including message-dialog OK/cancel captions, now consumes pure `pp_app_core` through `App::show_progress`, `App::message_box`, `App::input_box`, `pano_cli plan-app-dialog`, and `pp_app_core_app_dialog_tests`, but live execution still creates retained `NodeProgressBar`, `NodeMessageBox`, and `NodeInputBox` instances directly in `src/app_dialogs.cpp` and inserts them into the legacy layout tree | Preserve current app-shell dialog behavior while moving shared dialog policy toward UI/app services | `pp_app_core_app_dialog_tests`; `pano_cli plan-app-dialog --kind progress --total -4`; `pano_cli plan-app-dialog --kind message --cancel`; `pano_cli plan-app-dialog --kind input --ok-caption Save`; `ctest --preset desktop-fast --build-config Debug`; Windows app build | Progress/message/input dialog creation, callback wiring, layout insertion, lifetime ownership, and headless automation are owned by injected app/UI services with `App` methods acting only as adapters | +| DEBT-0058 | Open | Modernization | App-level progress/message/input dialog metadata, including message-dialog OK/cancel captions, now consumes pure `pp_app_core` through `App::show_progress`, `App::message_box`, `App::input_box`, `pano_cli plan-app-dialog`, and `pp_app_core_app_dialog_tests`; live execution is centralized in `src/legacy_app_dialog_services.*`, but the bridge still creates retained `NodeProgressBar`, `NodeMessageBox`, and `NodeInputBox` instances and inserts them into the legacy layout tree | Preserve current app-shell dialog behavior while moving shared dialog policy toward UI/app services | `pp_app_core_app_dialog_tests`; `pano_cli plan-app-dialog --kind progress --total -4`; `pano_cli plan-app-dialog --kind message --cancel`; `pano_cli plan-app-dialog --kind input --ok-caption Save`; `ctest --preset desktop-fast --build-config Debug`; Windows app build | Progress/message/input dialog creation, callback wiring, layout insertion, lifetime ownership, and headless automation are owned by injected app/UI services with `App` methods acting only as adapters | ## Closed Debt diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index a50ef3f..968b10f 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -202,9 +202,9 @@ App-level progress, message, and input dialog metadata now also lives in `pp_app_core` through `plan_app_progress_dialog`, `plan_app_message_dialog`, and `plan_app_input_dialog`; `App::show_progress`, `App::message_box`, `App::input_box`, and `pano_cli plan-app-dialog` consume -those plans before retained `NodeProgressBar`, `NodeMessageBox`, and -`NodeInputBox` creation. Legacy dialog node lifetime/layout ownership remains -tracked under `DEBT-0058`. +those plans before `src/legacy_app_dialog_services.*` creates retained +`NodeProgressBar`, `NodeMessageBox`, and `NodeInputBox` instances. Legacy +dialog node lifetime/layout ownership remains tracked under `DEBT-0058`. Frame-level app decisions for the initial surface size, redraw/animation update gating, layout ticking, resize render-target recreation, canvas-stroke drawing, VR UI drawing, main UI drawing, UI observer clipping/on-screen transition/scissor @@ -1755,6 +1755,14 @@ Results: input-dialog OK captions. - Android arm64 headless `pp_app_core`, `pano_cli`, and `pp_app_core_app_dialog_tests` built after the app-dialog planning slice. +- `PanoPainter`, `pp_app_core_app_dialog_tests`, and `pano_cli` built after + retained progress/message/input `Node*` creation moved into + `src/legacy_app_dialog_services.*`. +- Focused app-dialog CTest coverage passed again for + `pp_app_core_app_dialog_tests` and the `pano_cli_plan_app_dialog_*` smoke + tests after the legacy bridge split. +- Android arm64 headless `pp_app_core`, `pano_cli`, and + `pp_app_core_app_dialog_tests` built after the app-dialog bridge split. - `PanoPainter`, `pp_app_core_app_startup_tests`, and `pano_cli` built after startup preference/runtime execution and startup resource sequencing moved behind app startup services. diff --git a/src/app_dialogs.cpp b/src/app_dialogs.cpp index f791456..3c9391a 100644 --- a/src/app_dialogs.cpp +++ b/src/app_dialogs.cpp @@ -6,6 +6,7 @@ #include "app_core/document_export.h" #include "app_core/document_session.h" #include "legacy_document_canvas_services.h" +#include "legacy_app_dialog_services.h" #include "legacy_brush_package_export_services.h" #include "legacy_document_export_services.h" #include "legacy_document_layer_services.h" @@ -124,36 +125,13 @@ void start_document_export_collection( std::shared_ptr App::show_progress(const std::string& title, int total /*= 0*/) { const auto plan = pp::app::plan_app_progress_dialog(title, total); - auto pb = std::make_shared(); - pb->set_manager(&layout); - pb->init(); - pb->create(); - pb->loaded(); - pb->m_progress->SetWidthP(plan.progress_fraction); - pb->m_title->set_text(plan.title.c_str()); - pb->m_total = plan.total; - pb->m_count = plan.count; - layout[main_id]->add_child(pb); - return pb; + return pp::panopainter::create_legacy_app_progress_dialog(*this, plan); } std::shared_ptr App::message_box(const std::string &title, const std::string& text, bool cancel_button) { const auto plan = pp::app::plan_app_message_dialog(title, text, cancel_button); - auto m = std::make_shared(); - m->set_manager(&layout); - m->init(); - m->create(); - m->loaded(); - m->m_title->set_text(plan.title.c_str()); - m->m_message->set_text(plan.message.c_str()); - m->btn_ok->m_text->set_text(plan.ok_caption.c_str()); - if (plan.show_cancel) - m->btn_cancel->m_text->set_text(plan.cancel_caption.c_str()); - else - m->btn_cancel->destroy(); - layout[main_id]->add_child(m); - return m; + return pp::panopainter::create_legacy_app_message_dialog(*this, plan); } std::shared_ptr App::input_box(const std::string& title, @@ -164,17 +142,7 @@ std::shared_ptr App::input_box(const std::string& title, LOG("input dialog skipped: %s", plan_result.status().message); return nullptr; } - const auto& plan = plan_result.value(); - auto m = std::make_shared(); - m->set_manager(&layout); - m->init(); - m->create(); - m->loaded(); - m->m_title->set_text(plan.title.c_str()); - m->m_field_name->set_text(plan.field_name.c_str()); - m->btn_ok->m_text->set_text(plan.ok_caption.c_str()); - layout[main_id]->add_child(m); - return m; + return pp::panopainter::create_legacy_app_input_dialog(*this, plan_result.value()); } void App::dialog_usermanual() diff --git a/src/legacy_app_dialog_services.cpp b/src/legacy_app_dialog_services.cpp new file mode 100644 index 0000000..fc13bfd --- /dev/null +++ b/src/legacy_app_dialog_services.cpp @@ -0,0 +1,64 @@ +#include "pch.h" +#include "legacy_app_dialog_services.h" + +#include "app.h" +#include "node_input_box.h" +#include "node_message_box.h" +#include "node_progress_bar.h" + +namespace pp::panopainter { + +std::shared_ptr create_legacy_app_progress_dialog( + App& app, + const pp::app::AppProgressDialogPlan& plan) +{ + auto progress = std::make_shared(); + progress->set_manager(&app.layout); + progress->init(); + progress->create(); + progress->loaded(); + progress->m_progress->SetWidthP(plan.progress_fraction); + progress->m_title->set_text(plan.title.c_str()); + progress->m_total = plan.total; + progress->m_count = plan.count; + app.layout[app.main_id]->add_child(progress); + return progress; +} + +std::shared_ptr create_legacy_app_message_dialog( + App& app, + const pp::app::AppMessageDialogPlan& plan) +{ + auto message = std::make_shared(); + message->set_manager(&app.layout); + message->init(); + message->create(); + message->loaded(); + message->m_title->set_text(plan.title.c_str()); + message->m_message->set_text(plan.message.c_str()); + message->btn_ok->m_text->set_text(plan.ok_caption.c_str()); + if (plan.show_cancel) + message->btn_cancel->m_text->set_text(plan.cancel_caption.c_str()); + else + message->btn_cancel->destroy(); + app.layout[app.main_id]->add_child(message); + return message; +} + +std::shared_ptr create_legacy_app_input_dialog( + App& app, + const pp::app::AppInputDialogPlan& plan) +{ + auto input = std::make_shared(); + input->set_manager(&app.layout); + input->init(); + input->create(); + input->loaded(); + input->m_title->set_text(plan.title.c_str()); + input->m_field_name->set_text(plan.field_name.c_str()); + input->btn_ok->m_text->set_text(plan.ok_caption.c_str()); + app.layout[app.main_id]->add_child(input); + return input; +} + +} // namespace pp::panopainter diff --git a/src/legacy_app_dialog_services.h b/src/legacy_app_dialog_services.h new file mode 100644 index 0000000..e5fef29 --- /dev/null +++ b/src/legacy_app_dialog_services.h @@ -0,0 +1,26 @@ +#pragma once + +#include "app_core/app_dialog.h" + +#include + +class App; +class NodeInputBox; +class NodeMessageBox; +class NodeProgressBar; + +namespace pp::panopainter { + +std::shared_ptr create_legacy_app_progress_dialog( + App& app, + const pp::app::AppProgressDialogPlan& plan); + +std::shared_ptr create_legacy_app_message_dialog( + App& app, + const pp::app::AppMessageDialogPlan& plan); + +std::shared_ptr create_legacy_app_input_dialog( + App& app, + const pp::app::AppInputDialogPlan& plan); + +} // namespace pp::panopainter