diff --git a/data/pref.xml b/data/pref.xml
index a66481875..f21e548bd 100644
--- a/data/pref.xml
+++ b/data/pref.xml
@@ -248,6 +248,10 @@
+
diff --git a/data/strings/en.ini b/data/strings/en.ini
index 76a9ddde2..8330fa28b 100644
--- a/data/strings/en.ini
+++ b/data/strings/en.ini
@@ -947,6 +947,8 @@ the current frame & layer will be modified
to focus the undid/redid change.
END
undo_allow_nonlinear_history = Allow non-linear history
+file_format_doesnt_support_alert = Show warning when saving a file with unsupported features
+export_animation_in_sequence_alert = Show warning when saving an animation as a sequence of static images
gif_options_alert = Show GIF options when saving .gif files
jpeg_options_alert = Show JPEG options when saving .jpeg files
advanced_mode_alert = Show alert when we enter to Advanced Mode
diff --git a/data/widgets/options.xml b/data/widgets/options.xml
index 5219f13df..89a8303f4 100644
--- a/data/widgets/options.xml
+++ b/data/widgets/options.xml
@@ -270,6 +270,8 @@
+
+
diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt
index b3a3e014f..16af2849d 100644
--- a/src/app/CMakeLists.txt
+++ b/src/app/CMakeLists.txt
@@ -1,5 +1,5 @@
# Aseprite
-# Copyright (C) 2001-2017 David Capello
+# Copyright (C) 2001-2018 David Capello
# Generate a ui::Widget for each widget in a XML file
file(GLOB widget_files ${CMAKE_SOURCE_DIR}/data/widgets/*.xml)
@@ -495,6 +495,7 @@ add_library(app-lib
ui/main_window.cpp
ui/news_listbox.cpp
ui/notifications.cpp
+ ui/optional_alert.cpp
ui/palette_popup.cpp
ui/palette_view.cpp
ui/palettes_listbox.cpp
diff --git a/src/app/commands/cmd_options.cpp b/src/app/commands/cmd_options.cpp
index 4254442ee..0d87fa1c3 100644
--- a/src/app/commands/cmd_options.cpp
+++ b/src/app/commands/cmd_options.cpp
@@ -141,6 +141,8 @@ public:
sectionListbox()->Change.connect(base::Bind(&OptionsWindow::onChangeSection, this));
// Alerts
+ fileFormatDoesntSupportAlert()->setSelected(m_pref.saveFile.showFileFormatDoesntSupportAlert());
+ exportAnimationInSequenceAlert()->setSelected(m_pref.saveFile.showExportAnimationInSequenceAlert());
gifOptionsAlert()->setSelected(m_pref.gif.showAlert());
jpegOptionsAlert()->setSelected(m_pref.jpeg.showAlert());
advancedModeAlert()->setSelected(m_pref.advancedMode.showAlert());
@@ -390,6 +392,8 @@ public:
warnings += "<<- " + Strings::alerts_restart_by_preferences_save_recovery_data_period();
}
+ m_pref.saveFile.showFileFormatDoesntSupportAlert(fileFormatDoesntSupportAlert()->isSelected());
+ m_pref.saveFile.showExportAnimationInSequenceAlert(exportAnimationInSequenceAlert()->isSelected());
m_pref.gif.showAlert(gifOptionsAlert()->isSelected());
m_pref.jpeg.showAlert(jpegOptionsAlert()->isSelected());
m_pref.advancedMode.showAlert(advancedModeAlert()->isSelected());
@@ -571,6 +575,8 @@ private:
}
void onResetAlerts() {
+ fileFormatDoesntSupportAlert()->setSelected(m_pref.saveFile.showFileFormatDoesntSupportAlert.defaultValue());
+ exportAnimationInSequenceAlert()->setSelected(m_pref.saveFile.showExportAnimationInSequenceAlert.defaultValue());
gifOptionsAlert()->setSelected(m_pref.gif.showAlert.defaultValue());
jpegOptionsAlert()->setSelected(m_pref.jpeg.showAlert.defaultValue());
advancedModeAlert()->setSelected(m_pref.advancedMode.showAlert.defaultValue());
diff --git a/src/app/file/file.cpp b/src/app/file/file.cpp
index 5b07b2586..e2fa27b55 100644
--- a/src/app/file/file.cpp
+++ b/src/app/file/file.cpp
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2001-2017 David Capello
+// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@@ -22,6 +22,8 @@
#include "app/i18n/strings.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
+#include "app/pref/preferences.h"
+#include "app/ui/optional_alert.h"
#include "app/ui/status_bar.h"
#include "base/fs.h"
#include "base/mutex.h"
@@ -33,7 +35,6 @@
#include "fmt/format.h"
#include "render/quantization.h"
#include "render/render.h"
-#include "ui/alert.h"
#include "open_sequence.xml.h"
@@ -447,7 +448,9 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
if (!warnings.empty()) {
// Interative
if (context && context->isUIAvailable()) {
- int ret = ui::Alert::show(
+ int ret = OptionalAlert::show(
+ Preferences::instance().saveFile.showFileFormatDoesntSupportAlert,
+ 1, // Yes is the default option when the alert dialog is disabled
fmt::format(
(fatal ? Strings::alerts_file_format_doesnt_support_error():
Strings::alerts_file_format_doesnt_support_warning()),
@@ -505,7 +508,9 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
if (context && context->isUIAvailable() &&
fop->m_seq.filename_list.size() > 1 &&
- ui::Alert::show(
+ OptionalAlert::show(
+ Preferences::instance().saveFile.showExportAnimationInSequenceAlert,
+ 1,
fmt::format(
Strings::alerts_export_animation_in_sequence(),
int(fop->m_seq.filename_list.size()),
diff --git a/src/app/ui/optional_alert.cpp b/src/app/ui/optional_alert.cpp
new file mode 100644
index 000000000..93557c1e2
--- /dev/null
+++ b/src/app/ui/optional_alert.cpp
@@ -0,0 +1,35 @@
+// Aseprite
+// Copyright (C) 2018 David Capello
+//
+// This program is distributed under the terms of
+// the End-User License Agreement for Aseprite.
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "app/ui/optional_alert.h"
+
+#include "app/i18n/strings.h"
+#include "ui/alert.h"
+#include "ui/button.h"
+
+namespace app {
+
+// static
+int OptionalAlert::show(Option& option,
+ const int optionWhenDisabled,
+ const std::string& msg)
+{
+ if (!option())
+ return optionWhenDisabled;
+
+ ui::AlertPtr alert(ui::Alert::create(msg));
+ ui::CheckBox* cb = alert->addCheckBox(Strings::general_dont_show());
+ const int ret = alert->show();
+ if (ret == optionWhenDisabled)
+ option(!cb->isSelected());
+ return ret;
+}
+
+} // namespace app
diff --git a/src/app/ui/optional_alert.h b/src/app/ui/optional_alert.h
new file mode 100644
index 000000000..ac0715ec4
--- /dev/null
+++ b/src/app/ui/optional_alert.h
@@ -0,0 +1,26 @@
+// Aseprite
+// Copyright (C) 2018 David Capello
+//
+// This program is distributed under the terms of
+// the End-User License Agreement for Aseprite.
+
+#ifndef APP_UI_OPTIONAL_ALERT_H_INCLUDED
+#define APP_UI_OPTIONAL_ALERT_H_INCLUDED
+#pragma once
+
+#include "app/pref/option.h"
+
+#include
+
+namespace app {
+
+ class OptionalAlert {
+ public:
+ static int show(Option& option,
+ const int optionWhenDisabled,
+ const std::string& msg);
+ };
+
+}
+
+#endif
diff --git a/src/ui/alert.cpp b/src/ui/alert.cpp
index dfd7cdf89..e23d61e04 100644
--- a/src/ui/alert.cpp
+++ b/src/ui/alert.cpp
@@ -1,5 +1,5 @@
// Aseprite UI Library
-// Copyright (C) 2001-2017 David Capello
+// Copyright (C) 2001-2018 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@@ -66,6 +66,14 @@ void Alert::addProgress()
m_progressPlaceholder->setVisible(true);
}
+CheckBox* Alert::addCheckBox(const std::string& text)
+{
+ auto checkBox = new CheckBox(text);
+ m_progressPlaceholder->addChild(checkBox);
+ m_progressPlaceholder->setVisible(true);
+ return checkBox;
+}
+
void Alert::setProgress(double progress)
{
ASSERT(m_progress);
diff --git a/src/ui/alert.h b/src/ui/alert.h
index 99bb6ebe0..35edaf5a6 100644
--- a/src/ui/alert.h
+++ b/src/ui/alert.h
@@ -1,5 +1,5 @@
// Aseprite UI Library
-// Copyright (C) 2001-2017 David Capello
+// Copyright (C) 2001-2018 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@@ -17,6 +17,7 @@
namespace ui {
class Box;
+ class CheckBox;
class Slider;
class Alert;
@@ -29,6 +30,8 @@ namespace ui {
void addProgress();
void setProgress(double progress);
+ CheckBox* addCheckBox(const std::string& text);
+
int show();
static AlertPtr create(const std::string& msg);