Centralize retained dialog close bindings

This commit is contained in:
2026-06-12 15:27:13 +02:00
parent 9b482d7f6b
commit d60f4d30e2
7 changed files with 22 additions and 4 deletions

View File

@@ -513,6 +513,10 @@ agent or engineer to remove them without reconstructing context from chat.
routes through `src/legacy_ui_overlay_services.*` for release, root removal,
and callback dispatch instead of repeating that sequence in each panel class.
Broader checked-handle and scoped-callback adoption remains open.
- 2026-06-12: DEBT-0063/DEBT-0058 were narrowed again. About, changelog,
settings, and user-manual close buttons now bind retained destroy-on-click
behavior through `src/legacy_ui_overlay_services.*` instead of per-dialog
lambdas. Broader checked-handle and scoped-callback adoption remains 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

View File

@@ -496,6 +496,8 @@ callbacks are bound through the overlay service instead of per-panel lambdas.
Brush, brush-preset, color, layer, grid, stroke, and color-picker popup-panel
outside-click close handling now shares the same retained release/remove/
callback helper.
About, changelog, settings, and user-manual close buttons now share retained
destroy-on-click binding through the same overlay service.
Raw popup callback captures and full close/capture ownership remain part of
`DEBT-0063`.
`pano_cli inspect-image` exposes PNG IHDR metadata as JSON,

View File

@@ -74,4 +74,12 @@ void bind_legacy_popup_close_destroys_overlay(
};
}
template <class ButtonT>
void bind_legacy_click_destroys_node(ButtonT& button, Node& target) noexcept
{
button.on_click = [&target](Node*) {
target.destroy();
};
}
} // namespace pp::panopainter

View File

@@ -1,5 +1,6 @@
#include "pch.h"
#include "log.h"
#include "legacy_ui_overlay_services.h"
#include "node_about.h"
#include "layout.h"
@@ -16,7 +17,7 @@ void NodeAbout::init()
SetPositioning(YGPositionTypeAbsolute);
add_child_file("data/dialogs/about.xml", "about");
btn_ok = find<NodeButton>("btn-ok");
btn_ok->on_click = [&](Node*) { destroy(); };
pp::panopainter::bind_legacy_click_destroys_node(*btn_ok, *this);
}
kEventResult NodeAbout::handle_event(Event* e)

View File

@@ -1,5 +1,6 @@
#include "pch.h"
#include "log.h"
#include "legacy_ui_overlay_services.h"
#include "node_changelog.h"
#include "layout.h"
@@ -16,7 +17,7 @@ void NodeChangelog::init()
SetPositioning(YGPositionTypeAbsolute);
add_child_file("data/dialogs/changelog.xml", "changelog");
btn_ok = find<NodeButton>("btn-ok");
btn_ok->on_click = [&](Node*) { destroy(); };
pp::panopainter::bind_legacy_click_destroys_node(*btn_ok, *this);
}
kEventResult NodeChangelog::handle_event(Event* e)

View File

@@ -1,5 +1,6 @@
#include "pch.h"
#include "log.h"
#include "legacy_ui_overlay_services.h"
#include "node_settings.h"
#include "layout.h"
@@ -16,7 +17,7 @@ void NodeSettings::init()
SetPositioning(YGPositionTypeAbsolute);
add_child_file("data/dialogs/settings.xml", "settings");
btnOk = find<NodeButton>("btn-ok");
btnOk->on_click = [&](Node*) { destroy(); };
pp::panopainter::bind_legacy_click_destroys_node(*btnOk, *this);
}
kEventResult NodeSettings::handle_event(Event* e)

View File

@@ -1,5 +1,6 @@
#include "pch.h"
#include "log.h"
#include "legacy_ui_overlay_services.h"
#include "node_usermanual.h"
#include "layout.h"
@@ -16,7 +17,7 @@ void NodeUserManual::init()
SetPositioning(YGPositionTypeAbsolute);
add_child_file("data/dialogs/usermanual.xml", "usermanual");
btn_ok = find<NodeButton>("btn-ok");
btn_ok->on_click = [&](Node*) { destroy(); };
pp::panopainter::bind_legacy_click_destroys_node(*btn_ok, *this);
}
kEventResult NodeUserManual::handle_event(Event* e)