From 2e98efa13a60846692870a4cfc1617668c06272a Mon Sep 17 00:00:00 2001 From: omigamedev Date: Fri, 12 Jun 2026 14:45:04 +0200 Subject: [PATCH] Centralize retained popup tick overlays --- docs/modernization/debt.md | 8 +++++++- docs/modernization/roadmap.md | 7 ++++--- src/app_layout.cpp | 20 ++++++++++++-------- src/legacy_quick_ui_services.cpp | 6 ++++-- src/legacy_ui_overlay_services.h | 13 ++++++++++++- src/node_panel_brush.cpp | 5 ++++- src/node_panel_stroke.cpp | 12 ++++++++---- 7 files changed, 51 insertions(+), 20 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index 4519e87..56dbf44 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -487,6 +487,12 @@ agent or engineer to remove them without reconstructing context from chat. `src/legacy_ui_overlay_services.*` instead of direct root insertion. Raw popup callback captures, retained close/capture semantics, and broader `Node` handle adoption remain open. +- 2026-06-12: DEBT-0063 was narrowed again. Top-toolbar stroke/color/layer/grid + panel popups, quick-panel and stroke-panel popup tick decoration nodes, and + brush preset menu template attachment now route through + `src/legacy_ui_overlay_services.*` instead of direct root insertion or + temporary panel child insertion. Raw popup callback captures, retained + close/capture semantics, and broader `Node` handle adoption remain open. - 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 @@ -753,7 +759,7 @@ agent or engineer to remove them without reconstructing context from chat. | DEBT-0060 | Open | Modernization | Retained Android package CMake generates a patched `nanort.h` overlay in the build tree for `native-lib` instead of modifying the `libs/nanort` submodule | Current SDK Manager NDK/Clang rejects `TriangleSAHPred::operator=` assigning to a `const size_t` member, but the retained grid/lightmap path still includes `nanort` before that dependency is replaced or updated | `powershell -ExecutionPolicy Bypass -File scripts\automation\android-legacy-package-build.ps1 -Packages standard`; Quest/Focus retained package configure checks; Windows app build | Update/replace `nanort`, move grid/lightmap baking behind a component that owns its dependency, or retire the retained Android package CMake path so no generated vendor overlay is required | | DEBT-0061 | Open | Modernization | Desktop XR runtime selection now lives in tested `pp_platform_api` policy and prefers OpenXR, but `WindowsPlatformServices` still reports OpenXR unavailable and reaches the retained OpenVR SDK bridge as a legacy fallback; Windows runtime deployment copies `openvr_api.dll` beside `PanoPainter.exe` until that fallback is removed | Preserve current desktop VR behavior while replacing OpenVR with OpenXR behind the platform/renderer boundary | `pp_platform_api_tests`; `ctest --preset desktop-fast --build-config Debug -R pp_platform_api_tests --output-on-failure`; `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter` | Add an OpenXR SDK/package target, implement desktop OpenXR startup/shutdown/pose/controller submission behind `pp_platform_vr` or `PlatformServices`, validate parity with mocked/runtime smoke coverage, and remove `libs/openvr` plus the OpenVR link/include paths from root CMake | | DEBT-0062 | Open | Modernization | VS 2026 builds generate a patched fmt `format.h` overlay in the build tree for `pp_legacy_vendor`, disabling the old `_SECURE_SCL` checked-array iterator branch while leaving the fmt submodule clean | VS 2026's STL no longer exposes the legacy checked-array iterator used by this old fmt release, but replacing fmt is part of the dependency migration rather than this platform unblock | `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter`; `cmake --build --preset windows-msvc-default --config Debug --target pp_platform_api_tests`; `ctest --preset desktop-fast --build-config Debug -R pp_platform_api_tests --output-on-failure` | Move fmt to a supported vcpkg/package version or update the vendored fmt release, then remove the generated fmt overlay from `pp_legacy_vendor` | -| DEBT-0063 | Open | Modernization | The retained UI tree still exposes `Node* m_parent`, public `std::vector> m_children`, raw `find()` lookup results, `add_child()` allocation through `new`, callbacks/observers that take or capture raw `Node*`, and manual `destroy()`/`m_destroyed` semantics. `pp_ui_core` now owns a tested `NodeLifetimeTree` target model with checked node handles, scoped callback connections, subtree destruction, pointer/keyboard capture release, whole-tree clear for layout reload, and mutation-safe dispatch, plus a tested `UiOverlayLifetime` popup/dialog stack model. Retained app-dialog root insertion, app-menu popup template cloning/root attachment, quick/stroke/brush panel popup root attachment, combo-box popup insertion, and Open/Browse delete-confirmation dialog insertion are now centralized in `src/legacy_ui_overlay_services.*`, but retained `Node`/`NodePopupMenu`/`NodeDialog*` still have not adopted checked handles or scoped callback ownership | Preserve current UI behavior while making panel/dialog extraction safe instead of spreading lifetime hazards into the new architecture | `pp_ui_core_layout_xml_tests`; `pp_ui_core_node_lifetime_tests`; `pp_ui_core_overlay_lifetime_tests`; future `pp_panopainter_ui_dialog_lifetime_tests`; `ctest --preset desktop-fast --build-config Debug`; `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter` | Retained `Node` and `pp_panopainter_ui` adopt checked node handles or equivalent non-owning references, scoped callback connection/disconnect semantics, mutation-safe event dispatch, parent/child invariants hidden behind APIs, and destroy-during-callback/capture-release/popup-close/layout-reload tests; retained `Node*` APIs are removed or isolated behind compatibility adapters | +| DEBT-0063 | Open | Modernization | The retained UI tree still exposes `Node* m_parent`, public `std::vector> m_children`, raw `find()` lookup results, `add_child()` allocation through `new`, callbacks/observers that take or capture raw `Node*`, and manual `destroy()`/`m_destroyed` semantics. `pp_ui_core` now owns a tested `NodeLifetimeTree` target model with checked node handles, scoped callback connections, subtree destruction, pointer/keyboard capture release, whole-tree clear for layout reload, and mutation-safe dispatch, plus a tested `UiOverlayLifetime` popup/dialog stack model. Retained app-dialog root insertion, app-menu popup template cloning/root attachment, quick/stroke/brush panel popup root attachment, combo-box popup insertion, Open/Browse delete-confirmation dialog insertion, popup tick decoration insertion, and top-toolbar panel popup insertion are now centralized in `src/legacy_ui_overlay_services.*`, but retained `Node`/`NodePopupMenu`/`NodeDialog*` still have not adopted checked handles or scoped callback ownership | Preserve current UI behavior while making panel/dialog extraction safe instead of spreading lifetime hazards into the new architecture | `pp_ui_core_layout_xml_tests`; `pp_ui_core_node_lifetime_tests`; `pp_ui_core_overlay_lifetime_tests`; future `pp_panopainter_ui_dialog_lifetime_tests`; `ctest --preset desktop-fast --build-config Debug`; `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter` | Retained `Node` and `pp_panopainter_ui` adopt checked node handles or equivalent non-owning references, scoped callback connection/disconnect semantics, mutation-safe event dispatch, parent/child invariants hidden behind APIs, and destroy-during-callback/capture-release/popup-close/layout-reload tests; retained `Node*` APIs are removed or isolated behind compatibility adapters | | 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`; WebGL's retained 512 default now lives in tested `pp_platform_api::platform_policy`, but the Web shell still reaches it through the legacy platform fallback until injected Web services own the policy | 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`; live execution is centralized in `src/legacy_app_dialog_services.*`, and retained root insertion now routes through `src/legacy_ui_overlay_services.*`, but the bridge still creates retained `NodeProgressBar`, `NodeMessageBox`, and `NodeInputBox` instances with raw callback/lifetime ownership | 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-0059 | Open | Modernization | iOS root CMake headless builds assign generated bundle identifiers and disable code signing for executable test/tool targets | The current Apple gate is compile validation for shared component targets; signed iOS app/package validation is not migrated to root CMake yet | `powershell -ExecutionPolicy Bypass -File scripts\automation\apple-remote-build.ps1 -Presets macos,ios-simulator,ios-device`; `sh scripts/automation/platform-build.sh "ios-device"` on `panopainter-mac` | Root CMake owns the signed Apple app/package targets, package-smoke validates Apple bundles where signing material is available, and headless iOS test/tool targets are either excluded from signed package builds or use explicit test-runner signing policy | diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 475066a..dec197d 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -486,9 +486,10 @@ Edit, Tools, Panels, Options, About, and Layers menu popups, replacing the previous direct template-child indexing in `App::init_menu_*`. The helper now also exposes retained root-popup attachment for `pp_panopainter_ui`, and the quick-panel brush/color popups, stroke-panel preset/tip/dual/pattern popups, -brush-panel preset menu root insertion, retained combo-box popups, and -Open/Browse delete-confirmation dialogs route through it. Raw popup callback -captures and close/capture semantics remain part of `DEBT-0063`. +brush-panel preset menu root insertion, retained combo-box popups, +Open/Browse delete-confirmation dialogs, popup tick decoration nodes, and +top-toolbar panel popups route through it. Raw popup callback captures and +close/capture semantics remain part of `DEBT-0063`. `pano_cli inspect-image` exposes PNG IHDR metadata as JSON, `pano_cli import-image` accepts a PNG path and imports decoded RGBA8 pixels into a new pure `pp_document` face payload, diff --git a/src/app_layout.cpp b/src/app_layout.cpp index 1f7d82e..56cf0ad 100644 --- a/src/app_layout.cpp +++ b/src/app_layout.cpp @@ -473,14 +473,15 @@ void App::init_sidebar() fp->destroy(); } } - layout[main_id]->add_child(stroke); + (void)pp::panopainter::attach_legacy_overlay_node(*this, stroke); stroke->SetSize(350, glm::max(100.f, screen.y - pos.y - 50.f)); stroke->find("title")->SetVisibility(true); - auto tick = layout[main_id]->add_child(); + auto tick = pp::panopainter::make_legacy_overlay_node_for_anchor(*layout[main_id]); tick->SetPositioning(YGPositionTypeAbsolute); tick->SetSize(32, 16); tick->SetPosition(pos.x - 16, pos.y); tick->set_image("data/ui/popup-tick-up.png"); + (void)pp::panopainter::attach_legacy_overlay_node(*this, tick); layout[main_id]->update(); stroke->SetPosition(pos.x - stroke->m_size.x / 2.f, pos.y + 16); @@ -517,14 +518,15 @@ void App::init_sidebar() button->on_click = [this, button](Node*) { auto screen = layout[main_id]->m_size; glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y); - layout[main_id]->add_child(color); + (void)pp::panopainter::attach_legacy_overlay_node(*this, color); color->find("title")->SetVisibility(true); color->SetSize(350, 350); - auto tick = layout[main_id]->add_child(); + auto tick = pp::panopainter::make_legacy_overlay_node_for_anchor(*layout[main_id]); tick->SetPositioning(YGPositionTypeAbsolute); tick->SetSize(32, 16); tick->SetPosition(pos.x - 16, pos.y); tick->set_image("data/ui/popup-tick-up.png"); + (void)pp::panopainter::attach_legacy_overlay_node(*this, tick); layout[main_id]->update(); color->SetPosition(pos.x - color->m_size.x / 2.f, pos.y + 16); @@ -553,12 +555,13 @@ void App::init_sidebar() fp->destroy(); } } - layout[main_id]->add_child(layers); - auto tick = layout[main_id]->add_child(); + (void)pp::panopainter::attach_legacy_overlay_node(*this, layers); + auto tick = pp::panopainter::make_legacy_overlay_node_for_anchor(*layout[main_id]); tick->SetPositioning(YGPositionTypeAbsolute); tick->SetSize(32, 16); tick->SetPosition(pos.x - 16, pos.y); tick->set_image("data/ui/popup-tick-up.png"); + (void)pp::panopainter::attach_legacy_overlay_node(*this, tick); layout[main_id]->update(); layers->SetPosition(pos.x - layers->m_size.x / 2.f, pos.y + 16); @@ -589,12 +592,13 @@ void App::init_sidebar() fp->destroy(); } } - layout[main_id]->add_child(grid); - auto tick = layout[main_id]->add_child(); + (void)pp::panopainter::attach_legacy_overlay_node(*this, grid); + auto tick = pp::panopainter::make_legacy_overlay_node_for_anchor(*layout[main_id]); tick->SetPositioning(YGPositionTypeAbsolute); tick->SetSize(32, 16); tick->SetPosition(pos.x - 16, pos.y); tick->set_image("data/ui/popup-tick-up.png"); + (void)pp::panopainter::attach_legacy_overlay_node(*this, tick); layout[main_id]->update(); grid->SetPosition(pos.x - grid->m_size.x / 2.f, pos.y + 16); diff --git a/src/legacy_quick_ui_services.cpp b/src/legacy_quick_ui_services.cpp index 421e6a9..912e3a7 100644 --- a/src/legacy_quick_ui_services.cpp +++ b/src/legacy_quick_ui_services.cpp @@ -84,12 +84,13 @@ private: glm::vec2 tick_pos = button->m_pos + glm::vec2(button->m_size.x, 0); glm::vec2 popup_pos = { tick_pos.x + tick_sz.x, tick_pos.y }; - auto tick = panel_.root()->add_child(); + auto tick = make_legacy_overlay_node_for_anchor(panel_); tick->SetPositioning(YGPositionTypeAbsolute); tick->SetPosition(tick_pos.x, tick_pos.y + (button->m_size.y - tick_sz.y) * 0.5f); tick->SetSize(tick_sz); tick->set_image("data/ui/popup-tick.png"); tick->m_scale = { 1, 1 }; + (void)attach_legacy_overlay_node_to_root(panel_, tick); float hh = popup->m_container->m_children.size() > 10 ? (screen.y - 90.f) : 400.f; popup->SetWidth(350); @@ -145,12 +146,13 @@ private: glm::vec2 tick_pos = target->m_pos + glm::vec2(target->m_size.x, 0); glm::vec2 popup_pos = { tick_pos.x + tick_sz.x, tick_pos.y - 140.f }; - auto tick = panel_.root()->add_child(); + auto tick = make_legacy_overlay_node_for_anchor(panel_); tick->SetPositioning(YGPositionTypeAbsolute); tick->SetPosition(tick_pos.x, tick_pos.y + (target->m_size.y - tick_sz.y) * 0.5f); tick->SetSize(tick_sz); tick->set_image("data/ui/popup-tick.png"); tick->m_scale = { 1, 1 }; + (void)attach_legacy_overlay_node_to_root(panel_, tick); popup->SetPositioning(YGPositionTypeAbsolute); popup->SetPosition(popup_pos); diff --git a/src/legacy_ui_overlay_services.h b/src/legacy_ui_overlay_services.h index 3b49196..d72d6d5 100644 --- a/src/legacy_ui_overlay_services.h +++ b/src/legacy_ui_overlay_services.h @@ -1,11 +1,11 @@ #pragma once #include "foundation/result.h" +#include "node.h" #include class App; -class Node; class NodePopupMenu; namespace pp::panopainter { @@ -35,6 +35,17 @@ std::shared_ptr make_legacy_overlay_node(App& app) return node; } +template +std::shared_ptr make_legacy_overlay_node_for_anchor(Node& anchor) +{ + auto node = std::make_shared(); + node->set_manager(anchor.m_manager); + node->init(); + node->create(); + node->loaded(); + return node; +} + template std::shared_ptr add_legacy_overlay_node(App& app) { diff --git a/src/node_panel_brush.cpp b/src/node_panel_brush.cpp index 32d51e5..de2aa57 100644 --- a/src/node_panel_brush.cpp +++ b/src/node_panel_brush.cpp @@ -578,7 +578,10 @@ void NodePanelBrushPreset::init() }; m_btn_menu = find("btn-menu"); m_btn_menu->on_click = [this](Node* b) { - auto popup = add_child_file("data/dialogs/panel-brushes.xml", "tpl-brush-popup"); + auto popup = std::dynamic_pointer_cast( + load_template("data/dialogs/panel-brushes.xml", "tpl-brush-popup")); + if (!popup) + return; popup->SetPosition(b->m_pos.x + b->m_size.x, b->m_pos.y); (void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, popup); root()->update(); diff --git a/src/node_panel_stroke.cpp b/src/node_panel_stroke.cpp index 9083db5..1ad77ce 100644 --- a/src/node_panel_stroke.cpp +++ b/src/node_panel_stroke.cpp @@ -318,11 +318,12 @@ void NodePanelStroke::init_controls() auto screen = root()->m_size; glm::vec2 pos = m_preset_button->m_pos + glm::vec2(m_preset_button->m_size.x, 0); (void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, App::I->presets); - auto tick = root()->add_child(); + auto tick = pp::panopainter::make_legacy_overlay_node_for_anchor(*this); tick->SetPositioning(YGPositionTypeAbsolute); tick->SetSize(16, 32); tick->SetPosition(pos.x, pos.y + (m_preset_button->m_size.y - 32) * 0.5f); tick->set_image("data/ui/popup-tick.png"); + (void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, tick); float hh = App::I->presets->m_container->m_children.size() > 10 ? App::I->height / App::I->zoom * .75f : 400.f; App::I->presets->SetHeight(glm::max(hh, 400.f)); App::I->presets->SetWidth(300); @@ -369,11 +370,12 @@ void NodePanelStroke::init_controls() auto screen = root()->m_size; glm::vec2 pos = m_brush_button->m_pos + glm::vec2(m_brush_button->m_size.x, 0); (void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, m_brush_popup); - auto tick = root()->add_child(); + auto tick = pp::panopainter::make_legacy_overlay_node_for_anchor(*this); tick->SetPositioning(YGPositionTypeAbsolute); tick->SetSize(16, 32); tick->SetPosition(pos.x, pos.y + (m_brush_button->m_size.y - 32) * 0.5f); tick->set_image("data/ui/popup-tick.png"); + (void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, tick); root()->update(); if ((pos.y + m_brush_popup->m_size.y) > screen.y) pos.y = screen.y - m_brush_popup->m_size.y; @@ -405,11 +407,12 @@ void NodePanelStroke::init_controls() auto screen = root()->m_size; glm::vec2 pos = m_dual_brush_button->m_pos + glm::vec2(m_dual_brush_button->m_size.x, 0); (void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, m_brush_popup); - auto tick = root()->add_child(); + auto tick = pp::panopainter::make_legacy_overlay_node_for_anchor(*this); tick->SetPositioning(YGPositionTypeAbsolute); tick->SetSize(16, 32); tick->SetPosition(pos.x, pos.y + (m_dual_brush_button->m_size.y - 32) * 0.5f); tick->set_image("data/ui/popup-tick.png"); + (void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, tick); root()->update(); if ((pos.y + m_brush_popup->m_size.y) > screen.y) pos.y = screen.y - m_brush_popup->m_size.y; @@ -441,11 +444,12 @@ void NodePanelStroke::init_controls() auto screen = root()->m_size; glm::vec2 pos = m_pattern_button->m_pos + glm::vec2(m_pattern_button->m_size.x, 0); (void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, m_pattern_popup); - auto tick = root()->add_child(); + auto tick = pp::panopainter::make_legacy_overlay_node_for_anchor(*this); tick->SetPositioning(YGPositionTypeAbsolute); tick->SetSize(16, 32); tick->SetPosition(pos.x, pos.y + (m_pattern_button->m_size.y - 32) * 0.5f); tick->set_image("data/ui/popup-tick.png"); + (void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, tick); root()->update(); if ((pos.y + m_pattern_popup->m_size.y) > screen.y) pos.y = screen.y - m_pattern_popup->m_size.y;