Extract open legacy project branch helpers
This commit is contained in:
@@ -38,24 +38,33 @@ pp::foundation::Status apply_document_history(const pp::app::HistoryUiPlan& plan
|
|||||||
return pp::app::execute_history_ui_plan(plan, services);
|
return pp::app::execute_history_ui_plan(plan, services);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void refresh_opened_legacy_project_layers(App& app)
|
||||||
|
{
|
||||||
|
app.title_update();
|
||||||
|
for (std::size_t layer_index = 0; layer_index < app.canvas->m_canvas->m_layers.size(); ++layer_index)
|
||||||
|
{
|
||||||
|
auto layer = app.layers->add_layer(app.canvas->m_canvas->m_layers[layer_index]->m_name.c_str(), false);
|
||||||
|
layer->m_visibility->set_value(app.canvas->m_canvas->m_layers[layer_index]->m_visible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_open_legacy_project_error(App& app)
|
||||||
|
{
|
||||||
|
app.message_box(
|
||||||
|
"Open Document Error",
|
||||||
|
"There was an error opening the document.\n"
|
||||||
|
"It may be inaccessible or corrupted.");
|
||||||
|
}
|
||||||
|
|
||||||
void handle_open_legacy_project_result(App& app, bool success)
|
void handle_open_legacy_project_result(App& app, bool success)
|
||||||
{
|
{
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
app.title_update();
|
refresh_opened_legacy_project_layers(app);
|
||||||
for (std::size_t layer_index = 0; layer_index < app.canvas->m_canvas->m_layers.size(); ++layer_index)
|
return;
|
||||||
{
|
|
||||||
auto layer = app.layers->add_layer(app.canvas->m_canvas->m_layers[layer_index]->m_name.c_str(), false);
|
|
||||||
layer->m_visibility->set_value(app.canvas->m_canvas->m_layers[layer_index]->m_visible);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
app.message_box(
|
|
||||||
"Open Document Error",
|
|
||||||
"There was an error opening the document.\n"
|
|
||||||
"It may be inaccessible or corrupted.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show_open_legacy_project_error(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_legacy_project(App& app, const pp::app::DocumentOpenRoute& route)
|
void open_legacy_project(App& app, const pp::app::DocumentOpenRoute& route)
|
||||||
|
|||||||
Reference in New Issue
Block a user