diff --git a/data/pref.xml b/data/pref.xml
index 35ac47108..efdfaa909 100644
--- a/data/pref.xml
+++ b/data/pref.xml
@@ -115,6 +115,7 @@
+
diff --git a/data/strings/en.ini b/data/strings/en.ini
index 2a15d5812..5d9b4f473 100644
--- a/data/strings/en.ini
+++ b/data/strings/en.ini
@@ -799,6 +799,7 @@ skip = &Skip
[options]
title = Preferences
section_general = General
+section_files = Files
section_alerts = Alerts
section_editor = Editor
section_selection = Selection
@@ -842,6 +843,10 @@ Uncheck this option if you would prefer to hide
full path on UI (e.g. useful for live streaming)
END
default_extension = Default extension when saving files
+recent_files = Recent Items:
+recent_files_tooltip = Number of recent files and folders
+clear_recent_files = Clear
+clear_recent_files_tooltip = Clear the list of recent files and folders
locate_file = Locate Configuration File
locate_crash_folder = Locate Crash Folder
wheel_zoom = Zoom with scroll wheel
diff --git a/data/widgets/options.xml b/data/widgets/options.xml
index 2d9fdc6f7..d0fa595c8 100644
--- a/data/widgets/options.xml
+++ b/data/widgets/options.xml
@@ -7,6 +7,7 @@
+
@@ -70,16 +71,30 @@
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/laf b/laf
index dbcc5745d..0246ba538 160000
--- a/laf
+++ b/laf
@@ -1 +1 @@
-Subproject commit dbcc5745d8433fc99a2da3faffebfb04a539bae9
+Subproject commit 0246ba538ce7ccd073739618bbd11c7bd28e44a2
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 1b5f23fe1..a8cf2ab53 100644
--- a/src/app/app.cpp
+++ b/src/app/app.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.
@@ -103,9 +103,10 @@ public:
// This is a raw pointer because we want to delete this explicitly.
app::crash::DataRecovery* m_recovery;
- Modules(bool createLogInDesktop)
+ Modules(bool createLogInDesktop, Preferences& pref)
: m_loggerModule(createLogInDesktop)
, m_activeToolManager(&m_toolbox)
+ , m_recent_files(pref.general.recentItems())
, m_recovery(nullptr) {
}
@@ -173,7 +174,7 @@ void App::initialize(const AppOptions& options)
break;
}
- m_modules = new Modules(createLogInDesktop);
+ m_modules = new Modules(createLogInDesktop, preferences());
m_legacy = new LegacyModules(isGui() ? REQUIRE_INTERFACE: 0);
m_brushes.reset(new AppBrushes);
diff --git a/src/app/commands/cmd_options.cpp b/src/app/commands/cmd_options.cpp
index 351880b64..9a29c9cff 100644
--- a/src/app/commands/cmd_options.cpp
+++ b/src/app/commands/cmd_options.cpp
@@ -19,6 +19,7 @@
#include "app/ini_file.h"
#include "app/launcher.h"
#include "app/pref/preferences.h"
+#include "app/recent_files.h"
#include "app/resource_finder.h"
#include "app/send_crash.h"
#include "app/ui/color_button.h"
@@ -152,6 +153,10 @@ public:
}
}
+ // Number of recent items
+ recentFiles()->setValue(m_pref.general.recentItems());
+ clearRecentFiles()->Click.connect(base::Bind(&OptionsWindow::onClearRecentFiles, this));
+
// Alerts
fileFormatDoesntSupportAlert()->setSelected(m_pref.saveFile.showFileFormatDoesntSupportAlert());
exportAnimationInSequenceAlert()->setSelected(m_pref.saveFile.showExportAnimationInSequenceAlert());
@@ -393,6 +398,11 @@ public:
Widget* defExt = defaultExtension()->getSelectedItem();
m_pref.saveFile.defaultExtension(defExt ? defExt->text(): std::string());
}
+ {
+ const int limit = recentFiles()->getValue();
+ m_pref.general.recentItems(limit);
+ App::instance()->recentFiles()->setLimit(limit);
+ }
bool expandOnMouseover = expandMenubarOnMouseover()->isSelected();
m_pref.general.expandMenubarOnMouseover(expandOnMouseover);
@@ -592,6 +602,10 @@ private:
loadExtensions();
}
+ void onClearRecentFiles() {
+ App::instance()->recentFiles()->clear();
+ }
+
void onResetAlerts() {
fileFormatDoesntSupportAlert()->setSelected(m_pref.saveFile.showFileFormatDoesntSupportAlert.defaultValue());
exportAnimationInSequenceAlert()->setSelected(m_pref.saveFile.showExportAnimationInSequenceAlert.defaultValue());
diff --git a/src/app/recent_files.cpp b/src/app/recent_files.cpp
index b301db2fd..3bf548b98 100644
--- a/src/app/recent_files.cpp
+++ b/src/app/recent_files.cpp
@@ -43,9 +43,9 @@ std::string format_folder_var(const int i) {
namespace app {
-RecentFiles::RecentFiles()
- : m_files(16)
- , m_paths(16)
+RecentFiles::RecentFiles(const int limit)
+ : m_files(limit)
+ , m_paths(limit)
{
for (int c=m_files.limit()-1; c>=0; c--) {
const char* filename = get_config_string(kRecentFilesSection,
@@ -130,6 +130,22 @@ void RecentFiles::removeRecentFolder(const std::string& dir)
Changed();
}
+void RecentFiles::setLimit(const int n)
+{
+ m_files.setLimit(n);
+ m_paths.setLimit(n);
+
+ Changed();
+}
+
+void RecentFiles::clear()
+{
+ m_files.clear();
+ m_paths.clear();
+
+ Changed();
+}
+
std::string RecentFiles::normalizePath(const std::string& filename)
{
return base::normalize_path(filename);
diff --git a/src/app/recent_files.h b/src/app/recent_files.h
index 2d4139d53..7c298d94f 100644
--- a/src/app/recent_files.h
+++ b/src/app/recent_files.h
@@ -29,12 +29,14 @@ namespace app {
const_iterator paths_begin() { return m_paths.begin(); }
const_iterator paths_end() { return m_paths.end(); }
- RecentFiles();
+ RecentFiles(const int limit);
~RecentFiles();
void addRecentFile(const std::string& filename);
void removeRecentFile(const std::string& filename);
void removeRecentFolder(const std::string& dir);
+ void setLimit(const int n);
+ void clear();
obs::signal Changed;