Add document resize service boundary

This commit is contained in:
2026-06-03 13:09:12 +02:00
parent 9c3f56954e
commit 7c76703355
5 changed files with 149 additions and 8 deletions

View File

@@ -550,6 +550,33 @@ 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<NodeDialogResize>();
dialog->set_manager(&layout);
dialog->init();
@@ -567,10 +594,10 @@ void App::dialog_resize()
dialog->destroy();
return;
}
if (canvas)
canvas->m_canvas->resize(plan.value().width, plan.value().height);
App::I->title_update();
ActionManager::clear();
LegacyDocumentResizeServices services(*this);
const auto status = pp::app::execute_document_resize_plan(plan.value(), services);
if (!status.ok())
LOG("Document resize failed: %s", status.message);
dialog->destroy();
};
}