16#include <wx/evtloop.h>
74 auto result = std::make_shared< ProjectFileManager >( parent );
95 projectFileManager.ReadProjectFile(filename,
true);
97 if (projectFileManager.mLastSavedTracks) {
98 for (
auto wt : projectFileManager.mLastSavedTracks->Any<
WaveTrack>())
100 projectFileManager.mLastSavedTracks.reset();
117 "FAQ:Errors_on_opening_or_recovering_an_Audacity_project";
119using Pair = std::pair< const char *, const char * >;
122 "not well-formed (invalid token)",
123 "Error:_not_well-formed_(invalid_token)_at_line_x"
126 "reference to invalid character number",
127 "Error_Opening_Project:_Reference_to_invalid_character_number_at_line_x"
140 if ( !libraryError.
empty() ) {
143 auto msgid = libraryError.
MSGID().
GET();
145 [&](
const Pair &pair ) {
146 return msgid.Contains( pair.first ); }
149 auto url = found->second;
163 const FilePath &fileName,
bool discardAutosave )
173 auto parseResult = projectFileIO.LoadProject(fileName, discardAutosave);
174 const bool bParseSuccess = parseResult.has_value();
177 std::optional<TranslatableString> linkTypeChangeReason;
192 mLastSavedTracks->Append(
198 [&](
const auto& errorMessage) { otherError = errorMessage; err =
true; },
199 [&](
const auto& unlinkReason) { linkTypeChangeReason = unlinkReason; });
202 if(linkTypeChangeReason && !discardAutosave)
210"This feature is not supported in Audacity versions past 3.3.3.\n"
211"These stereo tracks have been split into mono tracks.\n"
212"As a result, some realtime effects may be missing.\n"
213"Please verify that everything works as intended before saving."
214 ).
Format(linkTypeChangeReason->Translation()));
217 parseResult->Commit();
220 projectFileIO.AutoSaveDelete();
221 else if (projectFileIO.IsRecovered()) {
222 bool resaved =
false;
224 if (!projectFileIO.IsTemporary() &&
225 !linkTypeChangeReason)
229 resaved = projectFileIO.SaveProject(fileName,
nullptr);
235"This project was not saved properly the last time Audacity ran.\n\n"
236"It has been recovered to the last snapshot.")
238"This project was not saved properly the last time Audacity ran.\n\n"
239"It has been recovered to the last snapshot, but you must save it\n"
240"to preserve its contents."),
241 XO(
"Project Recovered"),
251 (bParseSuccess ? otherError : projectFileIO.GetLastError()),
261 if (projectFileIO.IsTemporary())
266 return DoSave(projectFileIO.GetFileName(),
false);
286 ProjectDisabler(wxWindow *w)
289 mWindow->GetEventHandler()->SetEvtHandlerEnabled(
false);
293 mWindow->GetEventHandler()->SetEvtHandlerEnabled(
true);
325 "Your project is now empty.\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nClick 'No', Edit > Undo until all tracks\nare open, then File > Save Project.\n\nSave anyway?"),
326 XO(
"Warning - Empty Project"),
327 wxYES_NO | wxICON_QUESTION,
336 wxULongLong fileSize = wxFileName::GetSize(projectFileIO.GetFileName());
338 wxDiskspaceSize_t freeSpace;
341 if (freeSpace.GetValue() <= fileSize.GetValue())
344 XO(
"Insufficient Disk Space"),
345 XO(
"The project size exceeds the available free space on the target disk.\n\n"
346 "Please select a different disk with more free space."),
347 "Error:_Disk_full_or_not_writable"
357 std::optional<ProjectFileIO::BackupProject> pBackupProject;
358 if (fromSaveAs && wxFileExists(fileName))
360 pBackupProject.emplace(projectFileIO, fileName);
361 if (!pBackupProject->IsOk())
367 if (wxFileName::GetSize(projectFileIO.GetFileName()) > UINT32_MAX)
370 XO(
"Error Saving Project"),
371 XO(
"The project exceeds the maximum size of 4GB when writing to a FAT32 formatted filesystem."),
372 "Error:_Unsuitable_drive"
383 if (!projectFileIO.HasConnection()) {
386 XO(
"Error Saving Project"),
388 "Error:_Disk_full_or_not_writable",
394 proj.SetProjectName(wxFileName(fileName).GetName());
395 projectFileIO.SetProjectTitle();
414 pBackupProject->Discard();
426 auto oldFileName = projectFileIO.GetFileName();
428 bool bOwnsNewName = !projectFileIO.IsTemporary() && (oldFileName == newFileName);
432 if( !bOwnsNewName && wxFileExists(newFileName)) {
435 XO(
"The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."),
436 XO(
"Error Saving Project"),
442 auto success =
DoSave(newFileName, !bOwnsNewName);
443 if (success && addToHistory) {
459 if (projectFileIO.IsTemporary()) {
460 filename.SetPath(defaultSavePath);
461 filename.SetName(
project.GetProjectName());
464 filename = projectFileIO.GetFileName();
469 filename.SetPath(defaultSavePath);
475'Save Project' is for an Audacity project, not an audio file.\n\
476For an audio file that will open in other apps, use 'Export'.\n");
482 bool bPrompt = (
project.mBatchMode == 0) || (projectFileIO.GetFileName().empty());
490 fName =
SelectFile(FileNames::Operation::Save,
493 filename.GetFullName(),
496 wxFD_SAVE | wxRESIZE_BORDER,
505 filename.SetExt(
wxT(
"aup3"));
507 if ((!bPrompt || !allowOverwrite) && filename.FileExists()) {
511 XO(
"The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."),
512 XO(
"Error Saving Project"),
518 fName = filename.GetFullPath();
520 bOwnsNewName = !projectFileIO.IsTemporary() && ( projectFileIO.GetFileName() == fName );
524 if (!bOwnsNewName && filename.FileExists()) {
531 int mayOverwrite = ( projectFileIO.GetFileName() == fName ) ? 2 : 1;
534 if (openProjectName.SameAs(fName)) {
536 if (mayOverwrite == 0)
541 if (mayOverwrite > 0) {
545 Do you want to overwrite the project:\n\"%s\"?\n\n\
546 If you select \"Yes\" the project\n\"%s\"\n\
547 will be irreversibly overwritten.").Format( fName, fName );
553 XO(
"Overwrite Project Warning"),
554 wxYES_NO | wxNO_DEFAULT | wxICON_WARNING,
556 if (result == wxNO) {
559 if (result == wxCANCEL) {
567 XO(
"The project was not saved because the selected project is open in another window.\nPlease try again and select an original name."),
568 XO(
"Error Saving Project"),
579 auto success =
DoSave(fName, !bOwnsNewName);
593 wxFileName filename = fileName;
596 if (fileName.empty())
598 if (projectFileIO.IsTemporary())
600 filename.SetPath(defaultSavePath);
604 filename = projectFileIO.GetFileName();
611 filename.SetPath(defaultSavePath);
615 XO(
"%sSave Copy of Project \"%s\" As...")
618 bool bPrompt = (
project.mBatchMode == 0) || (projectFileIO.GetFileName().empty());
630 fName =
SelectFile(FileNames::Operation::Export,
633 filename.GetFullName(),
636 wxFD_SAVE | wxRESIZE_BORDER,
647 filename.SetExt(
wxT(
"aup3"));
659 if (filename.FileExists())
663 XO(
"Saving a copy must not overwrite an existing saved project.\nPlease try again and select an original name."),
664 XO(
"Error Saving Copy of Project"),
665 wxOK | wxICON_ERROR);
676 wxULongLong fileSize = wxFileName::GetSize(projectFileIO.GetFileName());
678 wxDiskspaceSize_t freeSpace;
681 if (freeSpace.GetValue() <= fileSize.GetValue())
684 XO(
"Insufficient Disk Space"),
685 XO(
"The project size exceeds the available free space on the target disk.\n\n"
686 "Please select a different disk with more free space."),
687 "Error:_Unsuitable_drive"
696 if (fileSize > UINT32_MAX)
699 XO(
"Error Saving Project"),
700 XO(
"The project exceeds the maximum size of 4GB when writing to a FAT32 formatted filesystem."),
701 "Error:_Unsuitable_drive"
713 fName = filename.GetFullPath();
717 if (!projectFileIO.SaveCopy(fName))
721 nullptr, msg,
XO(
"Error Saving Project"), wxOK | wxICON_ERROR);
739 wxString sNewFileName = fnFile.GetFullPath();
744 if (!projectFileIO.IsModified()) {
745 sOldFilename = projectFileIO.GetFileName();
751 if (wxFileExists(sNewFileName)) {
755 auto success =
DoSave(sNewFileName,
true);
780 if ( !projectFileIO.WasCompacted() &&
798 return projectFileIO.OpenProject();
822 projectFileIO.CloseProject();
844 wxArrayString selected;
847 XO(
"Select one or more files"),
851 wxFD_OPEN | wxFD_MULTIPLE | wxRESIZE_BORDER);
859 const auto &saveType = fileTypes[ index ];
864 if (dialogResult == wxID_OK) {
878 const wxFileName newProjPathName(projPathName);
880 iter = std::find_if( start, finish,
884 if (iter != finish) {
886 XO(
"%s is already open in another window.")
887 .Format( newProjPathName.GetName() );
888 wxLogError(errMsg.Translation());
891 XO(
"Error Opening Project"),
899 const FilePath &fileNameArg,
bool addtohistory)
919 if (fileName.Lower().EndsWith(
wxT(
".aup3.bak")))
923"You are trying to open an automatically created backup file.\nDoing this may result in severe data loss.\n\nPlease open the actual Audacity project file instead."),
924 XO(
"Warning - Backup File Detected"),
930 if (!::wxFileExists(fileName)) {
932 XO(
"Could not open file: %s").
Format( fileName ),
933 XO(
"Error Opening File"),
941 wxFFile ff(fileName,
wxT(
"rb"));
943 auto cleanup =
finally([&]
951 if (!ff.IsOpened()) {
953 XO(
"Could not open file: %s").
Format( fileName ),
954 XO(
"Error opening file"),
961 auto numRead = ff.Read(buf, 6);
964 XO(
"File may be invalid or corrupted: \n%s").
Format( fileName ),
965 XO(
"Error Opening File or Project"),
971 if (wxStrncmp(buf,
"SQLite", 6) != 0)
974#ifdef EXPERIMENTAL_DRAG_DROP_PLUG_INS
983 auto &
project = chooser(
false);
989 if (!fileName.AfterLast(
'.').IsSameAs(
wxT(
"lof"),
false))
1000 XO(
"Project resides on FAT formatted drive.\n"
1001 "Copy it to another drive to open it.")))
1006 auto &
project = chooser(
true);
1014 Track* unlinkedTrack {};
1015 for (
const auto t :
tracks) {
1020 if (!t->LinkConsistencyFix()) {
1021 onError(
XO(
"A channel of a stereo track was missing."));
1022 unlinkedTrack =
nullptr;
1024 if(unlinkedTrack !=
nullptr)
1028 if(
const auto left =
dynamic_cast<WaveTrack*
>(unlinkedTrack))
1030 if(
const auto right =
dynamic_cast<WaveTrack*
>(t))
1032 left->SetPan(-1.0f);
1033 right->SetPan(1.0f);
1037 if(left->GetRate() != right->GetRate())
1039 onUnlink(
XO(
"This project contained stereo tracks with different sample rates per channel."));
1040 if(left->GetSampleFormat() != right->GetSampleFormat())
1042 onUnlink(
XO(
"This project contained stereo tracks with different sample formats in channels."));
1044 onUnlink(
XO(
"This project contained stereo tracks with non-aligned content."));
1047 unlinkedTrack =
nullptr;
1057 if (
const auto message = t->GetErrorOpening()) {
1059 wxT(
"Track %s had error reading clip values from project file."),
1067 const FilePath &fileName,
bool addtohistory)
1077 const bool bParseSuccess = results.parseSuccess;
1078 const auto &errorStr = results.errorString;
1079 const bool err = results.trackError;
1081 if (bParseSuccess && !err) {
1086 viewport.HandleResize();
1087 trackPanel.Refresh(
false);
1091 trackPanel.Update();
1099 if (bParseSuccess && !err) {
1100 if (projectFileIO.IsRecovered())
1103 history.PushState(
XO(
"Project was recovered"),
XO(
"Recover"));
1119 pTrack->CloseLock();
1123 wxLogError(
wxT(
"Could not parse file \"%s\". \nError: %s"), fileName, errorStr.Debug());
1126 XO(
"Error Opening Project"),
1143 std::vector<Track*> results;
1147 wxFileName
fn(fileName);
1149 bool initiallyEmpty =
tracks.empty();
1151 wxString trackNameBase =
fn.GetName();
1157 const bool projectHasSolo =
1159 if (projectHasSolo) {
1160 for (
auto &group : newTracks)
1162 pTrack->SetMute(
true);
1166 for (
auto &group : newTracks) {
1167 if (group->empty()) {
1171 for (
const auto pTrack : group->Any<
WaveTrack>())
1172 results.push_back(pTrack);
1173 tracks.Append(std::move(*group));
1181 const bool useSuffix = results.size() > 1;
1183 for (
const auto &newTrack : results) {
1185 newTrack->SetSelected(
true);
1188 newTrack->SetName(
XC(
"%s %d",
"clip name template")
1189 .
Format(trackNameBase, i + 1).Translation());
1191 newTrack->SetName(trackNameBase);
1193 newTrack->TypeSwitch([&](
WaveTrack &wt) {
1196 const auto trackName = wt.
GetName();
1197 for(
const auto& interval : wt.
Intervals())
1198 interval->SetName(trackName);
1202 history.PushState(
XO(
"Imported '%s'").
Format( fileName ),
1205#if defined(__WXGTK__)
1211 wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI | wxEVT_CATEGORY_USER_INPUT);
1216 if (initiallyEmpty && projectFileIO.IsTemporary()) {
1218 project.SetInitialImportPath(
fn.GetPath());
1219 projectFileIO.SetProjectTitle();
1233 if (!projectFileIO.LoadProject(fileName,
false))
1237 for (
const Track *pTrack : srcTracks)
1238 pTrack->PasteInto(dest, destTracks);
1258 mImportFileHandle = &importFileHandle;
1264 if (ImportDlg.ShowModal() == wxID_CANCEL)
1275 constexpr double ProgressSteps { 1000.0 };
1276 if(!mProgressDialog)
1278 wxFileName ff( mImportFileHandle->GetFilename() );
1279 auto title =
XO(
"Importing %s").Format( mImportFileHandle->GetFileDescription() );
1282 auto result = mProgressDialog->Poll(progress * ProgressSteps, ProgressSteps);
1284 mImportFileHandle->Cancel();
1286 mImportFileHandle->Stop();
1291 mProgressDialog.reset();
1292 if(result == ImportResult::Error)
1294 auto message = mImportFileHandle->GetErrorMessage();
1295 if(!message.empty())
1312 return Import(std::vector<FilePath> { fileName }, addToHistory);
1318 const std::vector<std::shared_ptr<ClipMirAudioReader>>& readers,
1321 const auto isBeatsAndMeasures =
project.ViewIsBeatsAndMeasures();
1322 const auto projectTempo =
project.GetTempo();
1326 XO(
"Music Information Retrieval"),
XO(
"Analyzing imported audio"),
1329 const auto reportProgress = [&](
double progressFraction) {
1330 const auto result = progress->Poll(
1331 (count + progressFraction) / readers.size() * 1000, 1000);
1336 std::vector<std::shared_ptr<MIR::AnalyzedAudioClip>> analyzedClips;
1337 analyzedClips.reserve(readers.size());
1339 readers.begin(), readers.end(), std::back_inserter(analyzedClips),
1340 [&](
const std::shared_ptr<ClipMirAudioReader>& reader) {
1341 const MIR::ProjectSyncInfoInput input {
1342 *reader, reader->filename, reader->tags, reportProgress,
1343 projectTempo, projectWasEmpty, isBeatsAndMeasures,
1347 return std::make_shared<AnalyzedWaveClip>(reader, syncInfo);
1349 return analyzedClips;
1354 const std::vector<FilePath>& fileNames,
bool addToHistory)
1356 const auto projectWasEmpty =
1358 std::vector<std::shared_ptr<ClipMirAudioReader>> resultingReaders;
1359 const auto success = std::all_of(
1360 fileNames.begin(), fileNames.end(), [&](
const FilePath& fileName) {
1361 std::shared_ptr<ClipMirAudioReader> resultingReader;
1362 const auto success = Import(fileName, addToHistory, resultingReader);
1363 if (success && resultingReader)
1364 resultingReaders.push_back(std::move(resultingReader));
1367 if (success && !resultingReaders.empty())
1369 const auto pProj =
mProject.shared_from_this();
1372 const auto analyzedClips =
1382 const FilePath& fileName,
bool addToHistory,
1383 std::shared_ptr<ClipMirAudioReader>& resultingReader)
1392#ifdef EXPERIMENTAL_IMPORT_AUP3
1394 if (fileName.AfterLast(
'.').IsSameAs(
wxT(
"aup3"),
false)) {
1400 if (initiallyEmpty && projectFileIO.IsTemporary()) {
1401 wxFileName
fn(fileName);
1403 project.SetInitialImportPath(
fn.GetPath());
1404 projectFileIO.SetProjectTitle();
1407 history.PushState(
XO(
"Imported '%s'").
Format(fileName),
XO(
"Import"));
1414 errorMessage = projectFileIO.GetLastError();
1415 if (errorMessage.
empty()) {
1416 errorMessage =
XO(
"Failed to import project");
1421 XO(
"Error Importing"),
1422 errorMessage,
wxT(
"Importing_Audio"));
1431 bool committed =
false;
1432 auto cleanup =
finally([&]{
1436 auto newTags = oldTags->Duplicate();
1439#ifndef EXPERIMENTAL_IMPORT_AUP3
1441 if (fileName.AfterLast(
'.').IsSameAs(
wxT(
"aup3"),
false)) {
1443 XO(
"Error Importing"),
1444 XO(
"Cannot import AUP3 format. Use File > Open instead"),
1450 ImportProgress importProgress(
project);
1451 std::optional<LibFileFormats::AcidizerTags> acidTags;
1454 newTracks, newTags.get(), acidTags, errorMessage);
1455 if (!errorMessage.
empty()) {
1459 XO(
"Error Importing"), errorMessage,
wxT(
"Importing_Audio"));
1465 for (
auto trackList : newTracks)
1466 for (
auto track : *trackList)
1467 track->OnProjectTempoChange(projectTempo);
1469 if (!newTracks.empty() && newTracks[0])
1471 const auto waveTracks = (*newTracks[0]).Any<WaveTrack>();
1472 if (waveTracks.size() == 1)
1474 std::move(acidTags), fileName.ToStdString(),
1475 **waveTracks.begin() });
1488 if (fileName.AfterLast(
'.').IsSameAs(
wxT(
"lof"),
false)) {
1498 if (fileName.AfterLast(
'.').IsSameAs(
wxT(
"aup"),
false)) {
1501 if (initiallyEmpty && projectFileIO.IsTemporary()) {
1502 wxFileName
fn(fileName);
1504 project.SetInitialImportPath(
fn.GetPath());
1505 projectFileIO.SetProjectTitle();
1510 history.PushState(
XO(
"Imported '%s'").
Format( fileName ),
XO(
"Import"));
1516 AddImportedTracks(fileName, std::move(newTracks));
1535 S.StartVerticalLay(
true);
1537 S.AddFixedText(text,
false, 500);
1543 FindWindowById(wxID_YES,
this)->Bind(wxEVT_BUTTON, &CompactDialog::OnYes,
this);
1544 FindWindowById(wxID_NO,
this)->Bind(wxEVT_BUTTON, &CompactDialog::OnNo,
this);
1545 FindWindowById(wxID_HELP,
this)->Bind(wxEVT_BUTTON, &CompactDialog::OnGetURL,
this);
1552 void OnYes(wxCommandEvent &WXUNUSED(evt))
1557 void OnNo(wxCommandEvent &WXUNUSED(evt))
1575 bool isBatch =
project.mBatchMode > 0;
1578 projectFileIO.ReopenProject();
1580 auto savedState = undoManager.GetSavedState();
1581 const auto currentState = undoManager.GetCurrentState();
1582 if (savedState < 0) {
1583 undoManager.StateSaved();
1584 savedState = undoManager.GetSavedState();
1585 if (savedState < 0) {
1590 const auto least = std::min<size_t>(savedState, currentState);
1591 const auto greatest = std::max<size_t>(savedState, currentState);
1592 std::vector<const TrackList*> trackLists;
1595 trackLists.push_back(pTracks);
1597 undoManager.VisitStates(
fn, least, 1 + least);
1598 if (least != greatest)
1599 undoManager.VisitStates(
fn, greatest, 1 + greatest);
1601 int64_t total = projectFileIO.GetTotalUsage();
1602 int64_t used = projectFileIO.GetCurrentUsage(trackLists);
1604 auto before = wxFileName::GetSize(projectFileIO.GetFileName());
1607 XO(
"Compacting this project will free up disk space by removing unused bytes within the file.\n\n"
1608 "There is %s of free disk space and this project is currently using %s.\n"
1610 "If you proceed, the current Undo/Redo History and clipboard contents will be discarded "
1611 "and you will recover approximately %s of disk space.\n"
1613 "Do you want to continue?")
1617 if (isBatch || dlg.ShowModal() == wxYES)
1620 undoManager.RemoveStates(1 + greatest, undoManager.GetNumStates());
1623 if (least < greatest)
1624 undoManager.RemoveStates(least + 1, greatest);
1627 undoManager.RemoveStates(0, least);
1630 if (&
mProject == clipboard.Project().lock().get())
1635 auto before = wxFileName::GetSize(projectFileIO.GetFileName());
1637 projectFileIO.Compact(trackLists,
true);
1639 auto after = wxFileName::GetSize(projectFileIO.GetFileName());
1644 XO(
"Compacting actually freed %s of disk space.")
1646 XO(
"Compact Project"));
1649 undoManager.RenameState( undoManager.GetCurrentState(),
1650 XO(
"Compacted project file"),
1660 bShowProjectNumbers ? pProject->GetProjectNumber() : -1 );
1668 if( window.IsIconized() )
1679 return ptr->GetProjectName().empty();
1684 _(
"[Project %02i] "),
project.GetProjectNumber() + 1 );
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
Toolkit-neutral facade for basic user interface services.
Declare functions to perform UTF-8 to std::wstring conversions.
The interface that all file import "plugins" (if you want to call them that) must implement....
std::vector< std::shared_ptr< TrackList > > TrackHolders
std::unique_ptr< const BasicUI::WindowPlacement > ProjectFramePlacement(AudacityProject *project)
Make a WindowPlacement object suitable for project (which may be null)
static const AudacityProject::AttachedObjects::RegisteredFactory sFileManagerKey
static void RefreshAllTitles(bool bShowProjectNumbers)
an object holding per-project preferred sample rate
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
accessors for certain important windows associated with each project
FilePath SelectFile(FileNames::Operation op, const TranslatableString &message, const FilePath &default_path, const FilePath &default_filename, const FileExtension &default_extension, const FileTypes &fileTypes, int flags, wxWindow *parent)
static Settings & settings()
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
An AudacityException with no visible message.
int ShowWarningDialog(wxWindow *parent, const wxString &internalDialogName, const TranslatableString &message, bool showCancelButton, const TranslatableString &footer)
Contains some useful wave track external routines grouped into a single namespace.
const_iterator end() const
Container::value_type value_type
const_iterator begin() const
Wrap wxMessageDialog so that caption IS translatable.
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
virtual int GetFilterIndex() const
virtual wxString GetPath() const
virtual void GetPaths(wxArrayString &paths) const
virtual void SetFilterIndex(int filterIndex)
static TranslatableString WriteFailureMessage(const wxFileName &fileName)
void Append(const FilePath &file)
static FileHistory & Global()
FILES_API const FileType AudacityProjects
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
const wxString & GET() const
Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct...
Base class for FlacImportFileHandle, LOFImportFileHandle, MP3ImportFileHandle, OggImportFileHandle an...
virtual wxInt32 GetStreamCount()=0
virtual void SetStreamUsage(wxInt32 StreamID, bool Use)=0
Interface used to report on import state and progress.
static void SetLastOpenType(const FileNames::FileType &type)
FileNames::FileTypes GetFileTypes(const FileNames::FileType &extraType={})
bool Import(AudacityProject &project, const FilePath &fName, ImportProgressListener *importProgressListener, WaveTrackFactory *trackFactory, TrackHolders &tracks, Tags *tags, std::optional< LibFileFormats::AcidizerTags > &outAcidTags, TranslatableString &errorMessage)
static size_t SelectDefaultOpenType(const FileNames::FileTypes &fileTypes)
static void SetDefaultOpenType(const FileNames::FileType &type)
static TranslatableString FormatSize(wxLongLong size)
Convert a number to a string while formatting it in bytes, KB, MB, GB.
Makes a temporary project that doesn't display on the screen.
AudacityProject & Project()
AudioTrack subclass that can also be audibly replayed by the program.
static PluginManager & Get()
void SetProjectTitle(int number=-1)
static ProjectFileIO & Get(AudacityProject &project)
const FilePath & GetFileName() const
static void FixTracks(TrackList &tracks, const std::function< void(const TranslatableString &)> &onError, const std::function< void(const TranslatableString &)> &onUnlink)
Attempts to find and fix problems in tracks.
std::shared_ptr< TrackList > mLastSavedTracks
static bool IsAlreadyOpen(const FilePath &projPathName)
AudacityProject & mProject
void CompactProjectOnClose()
bool SaveCopy(const FilePath &fileName=wxT(""))
bool Import(const std::vector< FilePath > &fileNames, bool addToHistory=true)
bool SaveAs(bool allowOverwrite=false)
static void DiscardAutosave(const FilePath &filename)
void AddImportedTracks(const FilePath &fileName, TrackHolders &&newTracks)
static wxArrayString ShowOpenDialog(FileNames::Operation op, const FileNames::FileType &extraType={})
Show an open dialogue for opening audio files, and possibly other sorts of files.
bool DoSave(const FilePath &fileName, bool fromSaveAs)
bool SaveFromTimerRecording(wxFileName fnFile)
static AudacityProject * OpenFile(const ProjectChooserFn &chooser, const FilePath &fileName, bool addtohistory=true)
ReadProjectResults ReadProjectFile(const FilePath &fileName, bool discardAutosave=false)
std::function< AudacityProject &(bool)> ProjectChooserFn
A function that returns a project to use for opening a file; argument is true if opening a project fi...
static ProjectFileManager & Get(AudacityProject &project)
ProjectFileManager(AudacityProject &project)
AudacityProject * OpenProjectFile(const FilePath &fileName, bool addtohistory)
static ProjectHistory & Get(AudacityProject &project)
static ProjectSettings & Get(AudacityProject &project)
static ProjectStatus & Get(AudacityProject &project)
void Set(const TranslatableString &msg, StatusBarField field=mainStatusBarField)
static ProjectTimeSignature & Get(AudacityProject &project)
static RealtimeEffectList & Get(AudacityProject &project)
void Clear()
Use only in the main thread. Sends Remove messages.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
TitleRestorer(wxTopLevelWindow &window, AudacityProject &project)
Abstract base class for an object holding data associated with points on a time axis.
const wxString & GetName() const
Name is always the same for all channels of a group.
LinkType GetLinkType() const noexcept
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
static TrackListHolder Create(AudacityProject *pOwner)
static TrackList * FindUndoTracks(const UndoStackElem &state)
auto Any() -> TrackIterRange< TrackType >
static TrackList & Get(AudacityProject &project)
static TrackPanel & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.
Identifier MSGID() const
MSGID is the English lookup key in the catalog, not necessarily for user's eyes if locale is some oth...
static UndoManager & Get(AudacityProject &project)
bool UnsavedChanges() const
An error dialog about unwritable location, that allows to navigate to settings quickly.
Can be thrown when user cancels operations, as with a progress dialog. Delayed handler does nothing.
void ZoomFitHorizontallyAndShowTrack(Track *pTrack)
static Viewport & Get(AudacityProject &project)
static WaveTrackFactory & Get(AudacityProject &project)
A Track that contains audio waveform data.
double GetRate() const override
void OnYes(wxCommandEvent &WXUNUSED(evt))
void OnGetURL(wxCommandEvent &WXUNUSED(evt))
CompactDialog(TranslatableString text)
void OnNo(wxCommandEvent &WXUNUSED(evt))
void OnImportResult(ImportResult result) override
Used to report on import result for file handle passed as argument to OnImportFileOpened.
ImportProgress(AudacityProject &project)
void OnImportProgress(double progress) override
bool OnImportFileOpened(ImportFileHandle &importFileHandle) override
wxWeakRef< AudacityProject > mProject
std::unique_ptr< BasicUI::ProgressDialog > mProgressDialog
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
void ShowErrorDialog(const WindowPlacement &placement, const TranslatableString &dlogTitle, const TranslatableString &message, const ManualPageID &helpPage, const ErrorDialogOptions &options={})
Show an error dialog with a link to the manual for further help.
MessageBoxResult ShowMessageBox(const TranslatableString &message, MessageBoxOptions options={})
Show a modal message box with either Ok or Yes and No, and optionally Cancel.
std::unique_ptr< ProgressDialog > MakeProgress(const TranslatableString &title, const TranslatableString &message, unsigned flags=(ProgressShowStop|ProgressShowCancel), const TranslatableString &remainingLabelText={})
Create and display a progress dialog.
FILES_API bool IsOnFATFileSystem(const FilePath &path)
FILES_API bool IsPathAvailable(const FilePath &Path)
FILES_API wxString AbbreviatePath(const wxFileName &fileName)
Give enough of the path to identify the device. (On Windows, drive letter plus ':')
FILES_API void UpdateDefaultPath(Operation op, const FilePath &path)
FILES_API FilePath FindDefaultPath(Operation op)
std::optional< ProjectSyncInfo > GetProjectSyncInfo(const ProjectSyncInfoInput &in)
void SynchronizeProject(const std::vector< std::shared_ptr< AnalyzedAudioClip > > &clips, ProjectInterface &project, bool projectWasEmpty)
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
void SelectNone(AudacityProject &project)
FILES_API bool FATFilesystemDenied(const FilePath &path, const TranslatableString &msg, const BasicUI::WindowPlacement &placement={})
FILES_API wxString UnsavedProjectFileName()
bool ImportProject(AudacityProject &dest, const FilePath &fileName)
std::pair< const char *, const char * > Pair
const Pair helpURLTable[]
wxString FindHelpUrl(const TranslatableString &libraryError)
const char *const defaultHelpUrl
std::vector< std::shared_ptr< MIR::AnalyzedAudioClip > > RunTempoDetection(const std::vector< std::shared_ptr< ClipMirAudioReader > > &readers, const MIR::ProjectInterface &project, bool projectWasEmpty)
TranslatableString Message(unsigned trackCount)
Options for variations of error dialogs; the default is for modal dialogs.
Choices when duplicating a track.
DuplicateOptions Backup() &&
Holds one item with description and time range for the UndoManager.