diff --git a/cmake/PanoPainterSources.cmake b/cmake/PanoPainterSources.cmake index 6ed683f..21198b0 100644 --- a/cmake/PanoPainterSources.cmake +++ b/cmake/PanoPainterSources.cmake @@ -58,6 +58,8 @@ set(PP_LEGACY_UI_CORE_SOURCES set(PP_LEGACY_APP_SOURCES src/canvas_modes.cpp + src/legacy_document_canvas_services.cpp + src/legacy_document_canvas_services.h src/legacy_history_services.cpp src/legacy_history_services.h src/pch.cpp diff --git a/docs/modernization/build-inventory.md b/docs/modernization/build-inventory.md index b17efcd..f40d6d1 100644 --- a/docs/modernization/build-inventory.md +++ b/docs/modernization/build-inventory.md @@ -540,6 +540,11 @@ Known local toolchain state: `pp_app_core` history plans and legacy `ActionManager`; toolbar and `NodeCanvas` hotkeys share it while document-history extraction remains tracked by DEBT-0026. +- `src/legacy_document_canvas_services.*` is the current app-shell bridge + between `pp_app_core` canvas-clear/resize plans and legacy `Canvas`; + toolbar clear, Layer menu clear, and the resize dialog share it while + document/canvas execution extraction remains tracked by DEBT-0020 and + DEBT-0028. - `pp_ui_core` consumes vcpkg tinyxml2 only when `PP_USE_VCPKG_TINYXML2=ON` through the vcpkg preset; default and Android validation still use the retained vendored fallback tracked by DEBT-0012. diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index d697725..d518d83 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -37,7 +37,7 @@ agent or engineer to remove them without reconstructing context from chat. | DEBT-0016 | Open | Modernization | Clipboard get/set requests now consume pure `pp_app_core` planning through `pano_cli plan-clipboard-read` and `pano_cli plan-clipboard-write`, and Windows live execution uses injected `WindowsPlatformServices`, but Apple/Android clipboard execution still reaches retained fallback adapter branches from `App::clipboard_get_text` and `App::clipboard_set_text` | Keep picker/color text clipboard behavior stable while platform shells are extracted incrementally | `pp_app_core_document_platform_io_tests`; `pano_cli plan-clipboard-write --text #ff00aa`; `ctest --preset desktop-fast --build-config Debug` | Clipboard execution is owned by injected `pp_platform_*` services for every supported platform | | DEBT-0017 | Open | Modernization | Startup storage path preparation, `App::clipboard_get_text`, `App::clipboard_set_text`, `App::show_cursor`, `App::hide_cursor`, `App::showKeyboard`, `App::hideKeyboard`, `App::display_file`, `App::share_file`, native app/window close, UI-thread lifecycle hooks, render-context acquire/release/present hooks, render-target binding hooks, render platform hint hooks, render debug callback hooks, render-capture frame hooks, recording cleanup, live asset/layout reload policy, diagnostic stacktrace/crash hooks, per-frame platform hooks, `App::pick_image`, `App::pick_file`, the non-writer `App::pick_file_save`, `App::pick_dir`, and prepared-file save/download handoff now call the SDK-free `pp::platform::PlatformServices` interface, and Windows injects `WindowsPlatformServices` from `src/platform_windows/windows_platform_services.*`; non-Windows live implementations still use `src/platform_legacy/legacy_platform_services.*`, a named fallback adapter that forwards to retained Apple/Android/Linux/Web bridge functions and retained no-op branches | Preserve behavior while moving platform execution behind a testable service boundary before platform shell implementations are injected | `pp_platform_api_tests`; `pp_app_core_document_platform_io_tests`; `ctest --preset desktop-fast --build-config Debug`; `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug` | Replace `src/platform_legacy/legacy_platform_services.*` with injected `pp_platform_*` service implementations owned by each non-Windows platform shell | | DEBT-0019 | Open | Modernization | Unreferenced-parameter warnings are muted globally through `pp_project_warnings` with MSVC `/wd4100` and Clang/GCC `-Wno-unused-parameter` | Legacy callbacks, virtual hooks, serializer methods, and platform/API compatibility functions carry many intentionally unused parameters during the component split; muting this keeps stricter warning builds focused on higher-signal migration issues | `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter`; `ctest --preset desktop-fast --build-config Debug`; `cmake --build --preset linux-clang --target pp_foundation` | Remove `/wd4100` and `-Wno-unused-parameter`, mark intentionally unused parameters with names/comments or `[[maybe_unused]]`, and make the Windows app plus headless Clang/GCC tests pass without unreferenced-parameter warnings | -| DEBT-0020 | Open | Modernization | Document resize dialog state, selected-resolution planning, and execution dispatch now consume pure `pp_app_core` through `NodeDialogResize`, `App::dialog_resize`, `pano_cli plan-document-resize`, and the `DocumentResizeServices` boundary, but the live adapter still calls legacy `Canvas::resize`, updates the legacy app title, and clears legacy `ActionManager` history | Preserve existing layer/frame GPU resize behavior while the document model and canvas execution boundary are extracted incrementally | `pp_app_core_document_resize_tests`; `pano_cli plan-document-resize --current-resolution 2048 --selected-resolution-index 4`; `ctest --preset desktop-fast --build-config Debug` | Document resize execution is owned by injected document/app services with no legacy resize adapter, title shim, or direct `ActionManager` history clearing | +| DEBT-0020 | Open | Modernization | Document resize dialog state, selected-resolution planning, and execution dispatch now consume pure `pp_app_core` through `NodeDialogResize`, `App::dialog_resize`, `pano_cli plan-document-resize`, and the `DocumentResizeServices` boundary, and live resize shares `src/legacy_document_canvas_services.*` with canvas clear commands, but the shared live bridge still calls legacy `Canvas::resize`, updates the legacy app title, and clears legacy `ActionManager` history through the history bridge | Preserve existing layer/frame GPU resize behavior while the document model and canvas execution boundary are extracted incrementally | `pp_app_core_document_resize_tests`; `pano_cli plan-document-resize --current-resolution 2048 --selected-resolution-index 4`; `ctest --preset desktop-fast --build-config Debug` | Document resize execution is owned by injected document/app services with no legacy resize adapter, title shim, or direct `ActionManager` history clearing | | DEBT-0021 | Open | Modernization | Layer rename planning/execution dispatch and layer panel operation planning/execution dispatch now consume pure `pp_app_core` through `App::dialog_layer_rename`, `App::init_sidebar` layer callbacks, `pano_cli plan-layer-rename`, `pano_cli plan-layer-operation`, `DocumentLayerRenameServices`, and `DocumentLayerOperationServices`, but the live adapters still mutate legacy `Canvas` layer state, `NodeLayer`/`NodePanelLayer`, and `ActionManager` undo entries | Preserve existing UI/canvas behavior while document layer commands and undo history are extracted incrementally | `pp_app_core_document_layer_tests`; `pano_cli plan-layer-rename --old-name Base --new-name Paint`; `pano_cli plan-layer-operation --kind add --layer-count 2 --index 1 --name Paint`; `ctest --preset desktop-fast --build-config Debug` | Layer command execution is owned by the document/app command boundary with legacy `Canvas`/UI nodes acting only as adapters or removed entirely | | DEBT-0022 | Open | Modernization | Animation panel frame command planning, panel action planning, panel-control/timeline execution dispatch, selected-frame click dispatch, playback tick stepping, and play-mode toggles now consume pure `pp_app_core` through `NodePanelAnimation`, `pano_cli plan-animation-operation`, `pano_cli plan-animation-panel-action`, and `DocumentAnimationServices`, and `pp_legacy_ui_core` temporarily links `pp_app_core`, but the live adapter still mutates or reads legacy `Canvas`/`Layer` frame state and canvas mode directly | Preserve existing animation panel behavior while timeline/frame commands move toward the document/app command boundary | `pp_app_core_document_animation_tests`; `pano_cli plan-animation-operation --kind add --frame-count 2 --current-frame 0`; `pano_cli plan-animation-operation --kind select --frame-count 3 --selected-frame 1 --layer-index 2 --layer-id 42`; `pano_cli plan-animation-operation --kind playback --total-duration 5 --current-frame 4 --offset 1`; `pano_cli plan-animation-operation --kind toggle-playback --playing`; `pano_cli plan-animation-panel-action --action next --total-duration 5 --current-frame 4`; `ctest --preset desktop-fast --build-config Debug` | Animation frame/timeline/playback execution is owned by injected document/app timeline services with no legacy `Canvas`/`Layer`/canvas-mode adapter and UI nodes acting only as adapters or removed entirely | | DEBT-0023 | Open | Modernization | Brush/color/preset/stroke-settings UI planning, texture-list add/remove/reorder planning, stroke-panel slider/toggle/blend/reset planning, and execution dispatch now consume pure `pp_app_core` through `App::init_sidebar`, `NodePanelBrush`, `NodePanelStroke`, restored/docked floating-panel callbacks, `pano_cli plan-brush-operation`, `pano_cli plan-brush-texture-list`, `pano_cli plan-brush-stroke-control`, `BrushUiServices`, `BrushTextureListServices`, and `BrushStrokeControlServices`, but the live adapter still mutates legacy `Brush`/`Canvas::I`, loads/saves legacy brush texture images, and refreshes legacy quick/stroke/color widgets | Preserve existing brush UI behavior while brush commands move toward a brush/app/asset command boundary and asset-managed texture selection | `pp_app_core_brush_ui_tests`; `pano_cli plan-brush-operation --kind color --r 0.25 --g 0.5 --b 0.75 --a 1`; `pano_cli plan-brush-operation --kind pattern --path data/patterns/noise.png --thumb data/patterns/thumbs/noise.png`; `pano_cli plan-brush-texture-list --kind add --dir brushes --data-path data --source C:/Temp/soft.png`; `pano_cli plan-brush-stroke-control --kind float --setting tip-size --value 42.5`; `pano_cli plan-brush-stroke-control --kind blend --setting pattern --blend-mode 3`; `ctest --preset desktop-fast --build-config Debug` | Brush color/texture/preset/stroke-settings, texture-list, and stroke-control execution are owned by injected brush/app/asset/UI services with no legacy brush/canvas adapter | @@ -45,7 +45,7 @@ agent or engineer to remove them without reconstructing context from chat. | DEBT-0025 | Open | Modernization | Quick brush/color slot and mini-state planning and execution dispatch now consume pure `pp_app_core` through `NodePanelQuick`, `pano_cli plan-quick-operation`, and the `QuickUiServices` boundary, but the live adapter still mutates legacy quick UI widgets, `Brush` previews, color picker popup state, and preset popup state | Preserve quick-panel behavior while quick brush/color commands move toward a brush/app command boundary with safer automation coverage | `pp_app_core_quick_ui_tests`; `pano_cli plan-quick-operation --kind brush --current-index 0 --slot-index 2`; `pano_cli plan-quick-operation --kind restore --brush-index 2 --color-index 1 --fire-event`; `ctest --preset desktop-fast --build-config Debug` | Quick-panel selection, popup, restore, reset, brush preview, and color execution are owned by injected app/brush/UI services with no legacy quick-panel adapter | | DEBT-0026 | Open | Modernization | Toolbar history command planning and canvas hotkey history dispatch now consume pure `pp_app_core` through `App::init_toolbar_main`, `NodeCanvas`, `pano_cli plan-history-operation`, and the `HistoryUiServices` boundary, and both live callers share `src/legacy_history_services.*` for saturated legacy history metrics and execution, but the shared live bridge still mutates legacy `ActionManager` stacks directly | Preserve undo/redo/clear behavior while moving action history toward document/app command services | `pp_app_core_history_ui_tests`; `pano_cli plan-history-operation --kind undo --undo-count 2`; `pano_cli plan-history-operation --kind clear --undo-count 2 --redo-count 1 --memory-bytes 4096`; `ctest --preset desktop-fast --build-config Debug` | Undo/redo/clear execution is owned by injected document/app history services with no legacy `ActionManager` adapter | | DEBT-0027 | Open | Modernization | Canvas draw-tool toolbar command, canvas input mode switching, active-state planning/execution dispatch, and canvas keyboard/touch command planning now consume pure `pp_app_core` through `App::init_toolbar_draw`, `App::update`, `NodeCanvas`, `pano_cli plan-canvas-tool`, `pano_cli plan-canvas-tool-state`, `pano_cli plan-canvas-hotkey`, `CanvasToolServices`, and `CanvasHotkeyServices`, but live adapters still mutate or read legacy `Canvas` mode state, pen picking state, touch-lock state, transform copy/cut action objects, `ActionManager`, legacy save UI, legacy stroke size controls, and cursor/UI singletons | Preserve current toolbar, stylus eraser, keyboard, and touch command behavior while canvas input/tools move toward an app/document command boundary | `pp_app_core_canvas_tool_ui_tests`; `pp_app_core_canvas_hotkey_tests`; `pano_cli plan-canvas-tool --kind copy`; `pano_cli plan-canvas-tool-state --mode draw --picking --touch-lock`; `pano_cli plan-canvas-hotkey --event key-up --key z --ctrl --undo-count 2`; `pano_cli plan-canvas-hotkey --event key-up --key s --ctrl --shift`; `ctest --preset desktop-fast --build-config Debug` | Canvas tool selection, toolbar state refresh, picking, touch lock, stylus eraser/key mode switching, hotkey/touch command dispatch, save hotkeys, history hotkeys, brush-size hotkeys, and transform action execution are owned by injected app/document/canvas services with no legacy toolbar/canvas adapter | -| DEBT-0028 | Open | Modernization | Canvas clear command planning and execution dispatch now consume pure `pp_app_core` through `App::init_toolbar_main`, Layer menu clear, `pano_cli plan-canvas-clear`, and the `DocumentCanvasClearServices` boundary, but the live adapter still calls legacy `Canvas::clear`, which records `ActionLayerClear`, clears the current layer/frame, and marks legacy `Canvas::I` unsaved | Preserve clear-current-layer behavior while canvas/document commands move toward document/app command services | `pp_app_core_document_canvas_tests`; `pano_cli plan-canvas-clear --r 0 --g 0.1 --b 0.2 --a 0.3`; `pano_cli plan-canvas-clear --no-canvas`; `pano_cli plan-layer-menu --command clear --current-index 1 --current-name Paint`; `ctest --preset desktop-fast --build-config Debug` | Canvas clear execution, undo recording, dirty-state updates, and clear color handling are owned by injected document/app services with no legacy canvas-clear adapter | +| DEBT-0028 | Open | Modernization | Canvas clear command planning and execution dispatch now consume pure `pp_app_core` through `App::init_toolbar_main`, Layer menu clear, `pano_cli plan-canvas-clear`, and the `DocumentCanvasClearServices` boundary, and toolbar/Layer-menu clear share `src/legacy_document_canvas_services.*`, but the shared live bridge still calls legacy `Canvas::clear`, which records `ActionLayerClear`, clears the current layer/frame, and marks legacy `Canvas::I` unsaved | Preserve clear-current-layer behavior while canvas/document commands move toward document/app command services | `pp_app_core_document_canvas_tests`; `pano_cli plan-canvas-clear --r 0 --g 0.1 --b 0.2 --a 0.3`; `pano_cli plan-canvas-clear --no-canvas`; `pano_cli plan-layer-menu --command clear --current-index 1 --current-name Paint`; `ctest --preset desktop-fast --build-config Debug` | Canvas clear execution, undo recording, dirty-state updates, and clear color handling are owned by injected document/app services with no legacy canvas-clear adapter | | DEBT-0029 | Open | Modernization | Image import route planning and execution dispatch now consume pure `pp_app_core` through the File menu, `pano_cli plan-image-import`, and the `DocumentImageImportServices` boundary, but the live adapter still loads images with legacy `Image`, calls legacy `Canvas::import_equirectangular`, or configures legacy import transform mode directly | Preserve current File > Import behavior while image import moves toward document/app/asset command services | `pp_app_core_document_import_tests`; `pano_cli plan-image-import --width 4096 --height 2048`; `pano_cli plan-image-import --width 1024 --height 1024`; `ctest --preset desktop-fast --build-config Debug` | Image loading, equirectangular import, transform-placement import, and failure reporting are owned by injected document/app/asset services with File-menu callbacks acting only as adapters and no legacy image-import adapter | | DEBT-0030 | Open | Modernization | File export menu action planning and execution dispatch now consume pure `pp_app_core` through the File menu, `pano_cli plan-export-menu`, and the `DocumentExportMenuServices` boundary, but the live adapter still opens legacy export dialogs and then reaches legacy canvas/render/video export code | Preserve current export menu behavior while export command execution moves toward document/app/renderer/video services | `pp_app_core_document_export_tests`; `pano_cli plan-export-menu --kind png`; `pano_cli plan-export-menu --kind animation-mp4 --demo`; `pano_cli plan-export-menu --kind layers --no-canvas`; `ctest --preset desktop-fast --build-config Debug` | Export menu routing, license gating, target creation, image/layer/cube/depth/animation/timelapse execution, and error reporting are owned by injected document/app/renderer/video services with File-menu callbacks acting only as UI adapters and no legacy export adapter | | DEBT-0031 | Open | Modernization | Top-level File menu command planning and execution dispatch now consume pure `pp_app_core` through `App::init_menu_file`, `pano_cli plan-file-menu`, and the `FileMenuServices` boundary, but the live adapter still invokes legacy dialogs, platform pickers, cloud code, share code, and canvas import/export paths directly | Preserve File menu behavior while app workflows move toward app/document/platform command services | `pp_app_core_file_menu_tests`; `pano_cli plan-file-menu --command save-as`; `pano_cli plan-file-menu --command import`; `pano_cli plan-file-menu --command cloud-upload`; `ctest --preset desktop-fast --build-config Debug` | File menu routing, picker dispatch, save/share/cloud/resize/export execution, and image/project import execution are owned by injected app/document/platform services with `App::init_menu_file` acting only as a UI adapter and no legacy File menu adapter | diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 7eac171..421dd63 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -486,7 +486,8 @@ before retained platform clipboard bridges continue. `pano_cli plan-document-resize` exposes the app-core resize dialog state and selected-resolution commit plan used by the live document resize dialog, and resize execution now dispatches through `DocumentResizeServices` before the -legacy `Canvas` resize adapter and `ActionManager` history clearing continue. +shared app-shell document-canvas bridge runs the legacy `Canvas` resize adapter +and history clearing. `pano_cli plan-layer-rename` exposes the app-core layer rename decision used by the live layer rename dialog, and rename execution now dispatches through `DocumentLayerRenameServices` before legacy `Canvas`, `NodeLayer`, and @@ -544,8 +545,8 @@ adapters execute the command. `pano_cli plan-canvas-clear` exposes app-core planning for the main toolbar clear-current-layer command, including clear color validation, no-canvas handling, undo recording intent, and dirty-state intent; live toolbar execution -now dispatches through `DocumentCanvasClearServices` before the legacy -`Canvas::clear` adapter continues. +and Layer menu clear now dispatch through the shared app-shell document-canvas +bridge before the legacy `Canvas::clear` adapter continues. `pano_cli plan-image-import` exposes app-core planning for File > Import image route decisions, including wide equirectangular images, legacy vertical cube strips, regular transform-placement images, and invalid image dimensions; live diff --git a/src/app_dialogs.cpp b/src/app_dialogs.cpp index 08d25f4..b84a288 100644 --- a/src/app_dialogs.cpp +++ b/src/app_dialogs.cpp @@ -5,6 +5,8 @@ #include "app_core/document_resize.h" #include "app_core/document_export.h" #include "app_core/document_session.h" +#include "legacy_document_canvas_services.h" +#include "legacy_history_services.h" #include "settings.h" #include "node_dialog_open.h" #include "node_dialog_browse.h" @@ -282,7 +284,7 @@ void App::dialog_newdoc() canvas->m_canvas->m_layers.clear(); canvas->m_canvas->resize(plan.resolution, plan.resolution); canvas->reset_camera(); - ActionManager::clear(); + pp::panopainter::clear_legacy_history(); layers->add_layer("Default", false, true); @@ -622,33 +624,6 @@ void App::dialog_export_depth() void App::dialog_resize() { - class LegacyDocumentResizeServices final : public pp::app::DocumentResizeServices { - public: - explicit LegacyDocumentResizeServices(App& app) noexcept - : app_(app) - { - } - - void resize_document(int width, int height) override - { - if (app_.canvas) - app_.canvas->m_canvas->resize(width, height); - } - - void update_title() override - { - app_.title_update(); - } - - void clear_history() override - { - ActionManager::clear(); - } - - private: - App& app_; - }; - auto dialog = std::make_shared(); dialog->set_manager(&layout); dialog->init(); @@ -666,8 +641,7 @@ void App::dialog_resize() dialog->destroy(); return; } - LegacyDocumentResizeServices services(*this); - const auto status = pp::app::execute_document_resize_plan(plan.value(), services); + const auto status = pp::panopainter::execute_legacy_document_resize_plan(*this, plan.value()); if (!status.ok()) LOG("Document resize failed: %s", status.message); dialog->destroy(); diff --git a/src/app_layout.cpp b/src/app_layout.cpp index cd69fc5..bab67fb 100644 --- a/src/app_layout.cpp +++ b/src/app_layout.cpp @@ -18,6 +18,7 @@ #include "app_core/app_status.h" #include "app_core/main_toolbar.h" #include "app_core/tools_menu.h" +#include "legacy_document_canvas_services.h" #include "legacy_history_services.h" #include "settings.h" #include "serializer.h" @@ -140,33 +141,6 @@ bool apply_brush_preset_plan(App& app, const std::shared_ptr& brush) return status.ok(); } -class LegacyDocumentCanvasClearServices final : public pp::app::DocumentCanvasClearServices { -public: - explicit LegacyDocumentCanvasClearServices(App& app) noexcept - : app_(app) - { - } - - void clear_current_canvas(float r, float g, float b, float a) override - { - if (!app_.canvas || !app_.canvas->m_canvas) - return; - - app_.canvas->m_canvas->clear({ r, g, b, a }); - } - -private: - App& app_; -}; - -void execute_document_canvas_clear_plan(App& app, const pp::app::DocumentCanvasClearPlan& plan) -{ - LegacyDocumentCanvasClearServices services(app); - const auto status = pp::app::execute_document_canvas_clear_plan(plan, services); - if (!status.ok()) - LOG("Canvas clear failed: %s", status.message); -} - void execute_document_layer_merge_plan(App& app, const pp::app::DocumentLayerMergePlan& plan); bool apply_document_export_menu_plan(App& app, pp::app::DocumentExportMenuKind kind) @@ -420,7 +394,9 @@ public: void clear_canvas(const pp::app::DocumentCanvasClearPlan& plan) override { - execute_document_canvas_clear_plan(app_, plan); + const auto status = pp::panopainter::execute_legacy_document_canvas_clear_plan(app_, plan); + if (!status.ok()) + LOG("Canvas clear failed: %s", status.message); } void show_message_box() override @@ -578,7 +554,9 @@ public: if (!plan) return; - execute_document_canvas_clear_plan(app_, plan.value()); + const auto status = pp::panopainter::execute_legacy_document_canvas_clear_plan(app_, plan.value()); + if (!status.ok()) + LOG("Canvas clear failed: %s", status.message); } void show_rename_dialog() override diff --git a/src/legacy_document_canvas_services.cpp b/src/legacy_document_canvas_services.cpp new file mode 100644 index 0000000..c18e4a0 --- /dev/null +++ b/src/legacy_document_canvas_services.cpp @@ -0,0 +1,84 @@ +#include "pch.h" + +#include "legacy_document_canvas_services.h" + +#include "app.h" +#include "legacy_history_services.h" + +namespace pp::panopainter { +namespace { + +class LegacyDocumentCanvasClearServices final : public pp::app::DocumentCanvasClearServices { +public: + explicit LegacyDocumentCanvasClearServices(App& app) noexcept + : app_(app) + { + } + + void clear_current_canvas(float r, float g, float b, float a) override + { + if (!legacy_document_canvas_available(app_)) { + return; + } + + app_.canvas->m_canvas->clear({ r, g, b, a }); + } + +private: + App& app_; +}; + +class LegacyDocumentResizeServices final : public pp::app::DocumentResizeServices { +public: + explicit LegacyDocumentResizeServices(App& app) noexcept + : app_(app) + { + } + + void resize_document(int width, int height) override + { + if (!legacy_document_canvas_available(app_)) { + return; + } + + app_.canvas->m_canvas->resize(width, height); + } + + void update_title() override + { + app_.title_update(); + } + + void clear_history() override + { + clear_legacy_history(); + } + +private: + App& app_; +}; + +} // namespace + +bool legacy_document_canvas_available(const App& app) noexcept +{ + return app.canvas != nullptr && app.canvas->m_canvas != nullptr; +} + +pp::foundation::Status execute_legacy_document_canvas_clear_plan( + App& app, + const pp::app::DocumentCanvasClearPlan& plan) +{ + LegacyDocumentCanvasClearServices services(app); + return pp::app::execute_document_canvas_clear_plan(plan, services); +} + +pp::foundation::Status execute_legacy_document_resize_plan( + App& app, + const pp::app::DocumentResizePlan& plan) +{ + LegacyDocumentResizeServices services(app); + return pp::app::execute_document_resize_plan(plan, services); +} + +} // namespace pp::panopainter diff --git a/src/legacy_document_canvas_services.h b/src/legacy_document_canvas_services.h new file mode 100644 index 0000000..6f7ba30 --- /dev/null +++ b/src/legacy_document_canvas_services.h @@ -0,0 +1,19 @@ +#pragma once + +#include "app_core/document_canvas.h" +#include "app_core/document_resize.h" +#include "foundation/result.h" + +class App; + +namespace pp::panopainter { + +[[nodiscard]] bool legacy_document_canvas_available(const App& app) noexcept; +[[nodiscard]] pp::foundation::Status execute_legacy_document_canvas_clear_plan( + App& app, + const pp::app::DocumentCanvasClearPlan& plan); +[[nodiscard]] pp::foundation::Status execute_legacy_document_resize_plan( + App& app, + const pp::app::DocumentResizePlan& plan); + +} // namespace pp::panopainter