Reuse shared history service in document bridges
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "legacy_brush_package_import_services.h"
|
#include "legacy_brush_package_import_services.h"
|
||||||
#include "legacy_canvas_view_services.h"
|
#include "legacy_canvas_view_services.h"
|
||||||
|
#include "legacy_history_services.h"
|
||||||
#include "legacy_ui_overlay_services.h"
|
#include "legacy_ui_overlay_services.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "node_panel_brush.h"
|
#include "node_panel_brush.h"
|
||||||
@@ -14,33 +15,10 @@
|
|||||||
namespace pp::panopainter {
|
namespace pp::panopainter {
|
||||||
namespace {
|
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)
|
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()) {
|
if (!history_status.ok()) {
|
||||||
LOG("Project open history effect failed: %s", history_status.message);
|
LOG("Project open history effect failed: %s", history_status.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "legacy_app_dialog_services.h"
|
#include "legacy_app_dialog_services.h"
|
||||||
#include "legacy_document_canvas_services.h"
|
#include "legacy_document_canvas_services.h"
|
||||||
#include "legacy_canvas_view_services.h"
|
#include "legacy_canvas_view_services.h"
|
||||||
|
#include "legacy_history_services.h"
|
||||||
#include "legacy_ui_overlay_services.h"
|
#include "legacy_ui_overlay_services.h"
|
||||||
#include "node_dialog_open.h"
|
#include "node_dialog_open.h"
|
||||||
|
|
||||||
@@ -15,28 +16,9 @@
|
|||||||
namespace pp::panopainter {
|
namespace pp::panopainter {
|
||||||
namespace {
|
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)
|
pp::foundation::Status apply_document_history(const pp::app::HistoryUiPlan& plan)
|
||||||
{
|
{
|
||||||
LegacyDocumentHistoryServices services;
|
return pp::panopainter::execute_legacy_history_plan(plan);
|
||||||
return pp::app::execute_history_ui_plan(plan, services);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_legacy_document_save_snapshot(
|
void log_legacy_document_save_snapshot(
|
||||||
|
|||||||
Reference in New Issue
Block a user