confirm dialog when opening from shell
This commit is contained in:
26
src/app.cpp
26
src/app.cpp
@@ -57,10 +57,23 @@ void App::open_document(std::string path)
|
||||
|
||||
if (str_iequals(m[3].str(), "abr"))
|
||||
{
|
||||
auto mb = message_box("Import ABR", "Would you like to import the brushes?", true);
|
||||
mb->on_submit = [this, path] (Node* target) {
|
||||
std::thread(&NodePanelBrushPreset::import_abr, presets, path).detach();
|
||||
target->destroy();
|
||||
};
|
||||
}
|
||||
else if (str_iequals(m[3].str(), "ppbr"))
|
||||
{
|
||||
auto mb = message_box("Import PPBR", "Would you like to import the brushes?", true);
|
||||
mb->on_submit = [this, path] (Node* target) {
|
||||
std::thread(&NodePanelBrushPreset::import_ppbr, presets, path).detach();
|
||||
target->destroy();
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
auto open_action = [this, path, m] {
|
||||
doc_name = m[2].str();
|
||||
doc_dir = m[1].str();
|
||||
doc_path = path;
|
||||
@@ -85,6 +98,19 @@ void App::open_document(std::string path)
|
||||
}
|
||||
});
|
||||
ActionManager::clear();
|
||||
};
|
||||
if (!Canvas::I->m_unsaved)
|
||||
{
|
||||
open_action();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto mb = message_box("Unsaved document", "Do you want to close the unsaved document before opening the file?", true);
|
||||
mb->on_submit = [this, open_action] (Node* target) {
|
||||
open_action();
|
||||
target->destroy();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -606,6 +606,7 @@ void App::dialog_ppbr_export()
|
||||
info.email = dialog->txt_email->m_text;
|
||||
info.descr = dialog->txt_descr->m_text;
|
||||
info.header_image = dialog->m_header_image;
|
||||
if (dialog->export_check)
|
||||
info.export_data = dialog->export_check->checked;
|
||||
#if __IOS__
|
||||
App::I->pick_file_save("ppbr",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define LOG(M,...) { printf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); }
|
||||
#define LOGW
|
||||
#elif __ANDROID__
|
||||
#define LOG(...) { ((void)__android_log_print(ANDROID_LOG_INFO, "PanoPainterCPP", __VA_ARGS__)); LogRemote::I.log(__VA_ARGS__); }
|
||||
#define LOGW
|
||||
|
||||
Reference in New Issue
Block a user