mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-19 09:01:15 +02:00
Do not require AudacityApp.h when using global file history
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*******************************************************************//**
|
||||
|
||||
\class FileHistory
|
||||
\brief Similar to FileHistory, but customized to our needs.
|
||||
\brief Similar to wxFileHistory, but customized to our needs.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
#include <wx/menu.h>
|
||||
|
||||
#include "../Internat.h"
|
||||
#include "../Prefs.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
FileHistory::FileHistory(size_t maxfiles, wxWindowID base)
|
||||
{
|
||||
@@ -32,6 +35,19 @@ FileHistory::~FileHistory()
|
||||
{
|
||||
}
|
||||
|
||||
FileHistory &FileHistory::Global()
|
||||
{
|
||||
// TODO - read the number of files to store in history from preferences
|
||||
static FileHistory history{
|
||||
ID_RECENT_LAST - ID_RECENT_FIRST + 1, ID_RECENT_CLEAR };
|
||||
static std::once_flag flag;
|
||||
std::call_once( flag, [&]{
|
||||
history.Load(*gPrefs, wxT("RecentFiles"));
|
||||
});
|
||||
|
||||
return history;
|
||||
}
|
||||
|
||||
// File history management
|
||||
void FileHistory::AddFileToHistory(const FilePath & file, bool update)
|
||||
{
|
||||
|
@@ -28,6 +28,15 @@ class AUDACITY_DLL_API FileHistory
|
||||
FileHistory(size_t maxfiles = 12, wxWindowID idbase = wxID_FILE);
|
||||
virtual ~FileHistory();
|
||||
|
||||
// These constants define the range of IDs reserved by the global file history
|
||||
enum {
|
||||
ID_RECENT_CLEAR = 6100,
|
||||
ID_RECENT_FIRST = 6101,
|
||||
ID_RECENT_LAST = 6112
|
||||
};
|
||||
|
||||
static FileHistory &Global();
|
||||
|
||||
void AddFileToHistory(const FilePath & file, bool update = true);
|
||||
void RemoveFileFromHistory(size_t i, bool update = true);
|
||||
void Clear();
|
||||
|
Reference in New Issue
Block a user