Add history command service boundary
This commit is contained in:
@@ -317,19 +317,19 @@ public:
|
||||
app_.dialog_save();
|
||||
}
|
||||
|
||||
void invoke_undo() override
|
||||
void invoke_undo(const pp::app::HistoryUiPlan& plan) override
|
||||
{
|
||||
ActionManager::undo();
|
||||
execute_history_plan(plan);
|
||||
}
|
||||
|
||||
void invoke_redo() override
|
||||
void invoke_redo(const pp::app::HistoryUiPlan& plan) override
|
||||
{
|
||||
ActionManager::redo();
|
||||
execute_history_plan(plan);
|
||||
}
|
||||
|
||||
void clear_history() override
|
||||
void clear_history(const pp::app::HistoryUiPlan& plan) override
|
||||
{
|
||||
ActionManager::clear();
|
||||
execute_history_plan(plan);
|
||||
}
|
||||
|
||||
void clear_canvas(const pp::app::DocumentCanvasClearPlan& plan) override
|
||||
@@ -376,6 +376,32 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
class LegacyHistoryUiServices final : public pp::app::HistoryUiServices {
|
||||
public:
|
||||
void invoke_undo() override
|
||||
{
|
||||
ActionManager::undo();
|
||||
}
|
||||
|
||||
void invoke_redo() override
|
||||
{
|
||||
ActionManager::redo();
|
||||
}
|
||||
|
||||
void clear_history() override
|
||||
{
|
||||
ActionManager::clear();
|
||||
}
|
||||
};
|
||||
|
||||
void execute_history_plan(const pp::app::HistoryUiPlan& plan)
|
||||
{
|
||||
LegacyHistoryUiServices services;
|
||||
const auto status = pp::app::execute_history_ui_plan(plan, services);
|
||||
if (!status.ok())
|
||||
LOG("History action failed: %s", status.message);
|
||||
}
|
||||
|
||||
App& app_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user