Plan document open actions in app core
This commit is contained in:
10
src/app.cpp
10
src/app.cpp
@@ -193,7 +193,10 @@ void App::open_document(std::string path)
|
||||
if (!route)
|
||||
return;
|
||||
|
||||
if (route.value().kind == pp::app::DocumentOpenKind::import_abr)
|
||||
const bool has_unsaved_project =
|
||||
route.value().kind == pp::app::DocumentOpenKind::open_project && Canvas::I->m_unsaved;
|
||||
const auto open_plan = pp::app::plan_document_open(route.value().kind, has_unsaved_project);
|
||||
if (open_plan == pp::app::DocumentOpenPlanAction::prompt_import_abr)
|
||||
{
|
||||
auto mb = message_box("Import ABR", "Would you like to import the brushes?", true);
|
||||
mb->on_submit = [this, path] (Node* target) {
|
||||
@@ -201,7 +204,7 @@ void App::open_document(std::string path)
|
||||
target->destroy();
|
||||
};
|
||||
}
|
||||
else if (route.value().kind == pp::app::DocumentOpenKind::import_ppbr)
|
||||
else if (open_plan == pp::app::DocumentOpenPlanAction::prompt_import_ppbr)
|
||||
{
|
||||
auto mb = message_box("Import PPBR", "Would you like to import the brushes?", true);
|
||||
mb->on_submit = [this, path] (Node* target) {
|
||||
@@ -239,8 +242,7 @@ void App::open_document(std::string path)
|
||||
});
|
||||
ActionManager::clear();
|
||||
};
|
||||
const auto open_decision = pp::app::plan_project_open(Canvas::I->m_unsaved);
|
||||
if (open_decision == pp::app::ProjectOpenDecision::open_now)
|
||||
if (open_plan == pp::app::DocumentOpenPlanAction::open_project_now)
|
||||
{
|
||||
open_action();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user