Reuse shared history service in document bridges

This commit is contained in:
2026-06-15 22:48:40 +02:00
parent 6844256937
commit 9bf79beec2
2 changed files with 5 additions and 45 deletions

View File

@@ -6,6 +6,7 @@
#include "app.h"
#include "legacy_brush_package_import_services.h"
#include "legacy_canvas_view_services.h"
#include "legacy_history_services.h"
#include "legacy_ui_overlay_services.h"
#include "log.h"
#include "node_panel_brush.h"
@@ -14,33 +15,10 @@
namespace pp::panopainter {
namespace {
class LegacyDocumentHistoryServices final : public pp::app::HistoryUiServices {
public:
void invoke_undo() override
{
ActionManager::undo();
}
void invoke_redo() override
{
ActionManager::redo();
}
void clear_history() override
{
ActionManager::clear();
}
};
pp::foundation::Status apply_document_history(const pp::app::HistoryUiPlan& plan)
{
LegacyDocumentHistoryServices services;
return pp::app::execute_history_ui_plan(plan, services);
}
void apply_open_legacy_project_history(const pp::app::DocumentOpenRoute& route)
{
const auto history_status = apply_document_history(pp::app::plan_document_open_history(route));
const auto history_status = pp::panopainter::execute_legacy_history_plan(
pp::app::plan_document_open_history(route));
if (!history_status.ok()) {
LOG("Project open history effect failed: %s", history_status.message);
}

View File

@@ -7,6 +7,7 @@
#include "legacy_app_dialog_services.h"
#include "legacy_document_canvas_services.h"
#include "legacy_canvas_view_services.h"
#include "legacy_history_services.h"
#include "legacy_ui_overlay_services.h"
#include "node_dialog_open.h"
@@ -15,28 +16,9 @@
namespace pp::panopainter {
namespace {
class LegacyDocumentHistoryServices final : public pp::app::HistoryUiServices {
public:
void invoke_undo() override
{
ActionManager::undo();
}
void invoke_redo() override
{
ActionManager::redo();
}
void clear_history() override
{
ActionManager::clear();
}
};
pp::foundation::Status apply_document_history(const pp::app::HistoryUiPlan& plan)
{
LegacyDocumentHistoryServices services;
return pp::app::execute_history_ui_plan(plan, services);
return pp::panopainter::execute_legacy_history_plan(plan);
}
void log_legacy_document_save_snapshot(