... So that if you save, edit, compact, close without saving, then reopen,
you recover the saved state as expected, not the compacted state.
Implications:
Do not push an undo state for compaction. Discard redo states instead.
Do not purge undo states after the last saved. The database still needs them.
So we might reclaim less space than before.
... You may see this also when abandoning lots of redo history, and not only
when doing compaction.
If in compaction you discard much undo and also much redo, you may see two
progresses.
It's debatable whether this might have been better implemented by reuse of
ProjectFileIO::DeleteBlocks instead, putting callbacks to a progress indicator
in the function InSet(). But I wanted to avoid more dependency onto
ProjectFileIO.
Doing real work in DeleteBlocks() is supposed to happen only if there is a bug
elsewhere that allowed orphans. So, still no progress indicator there.
... Do so by lowering the usage of TransactionScope into UndoManager, so that
deletion of blocks is more often grouped into a transaction, as when invoking
Compact via the menu item.
* Change usage of AutoCommitTransaction::Rollback...
... It is the more useful pattern (as in many finally blocks) for the failure
path in the destructor (which rolls back) to be the default, but an explicit
call must inform it of success.
This corrects the early return paths in Effect::DoEffect().
Throw inconsistency exception if Commit() is called again after having been
called once, successfully
Also remove a friend declaration
* UndoManager's interface uses consistent 0-based indexing of states...
... Returned by GetCurrentState() and used by SetStateTo(),
GetLongDescription(), GetShortDescription()
* SampleBlock::GetBlockID is const
* Generalized function to visit sample blocks used in a TrackList...
... Eliminating some duplication; put it in WaveTrack, not Track, to avoid
a dependency cycle.
* Eliminate more repetition with BlockSpaceUsageAccumulator
* Function to delete all blocks of/not-of a given set in one command
... Do not call Autosave (which might fail) when recovering from exceptions in
recording, but rely on the last good Autosave that happened during recording.
If dropout labels are needed, then immediately modify the undo history item, but
we can accept it if that modification fails.
Also, be sure NOT to skip Autosave in all other places that push the undo
history. Make Autosave the default unless otherwise specified.
Finally removed one unnecessary call to Autosave.
!!! THERE WILL NO DOUBT BE BUGS !!!
This is a big one and there's still several things to
complete. Just want to get this in the wild to start
receiving feedback.
One big thing right now is that it will NOT load pre-aup3
files. An importer is on the way for that.
This removes all of the OnDemand code embedded throughout
the main codebase. Individual files related specifically
to OD have been left in place, but removed from the build.
... and Track::GetOwner() is publicized, so that now you can find the
the AudacityProject, if any, that owns a given Track; this will help eliminate
some uses of GetActiveProject
... Unnecessary because transitively included.
But each .cpp file still includes its own .h file near the top to ensure
that it compiles indenendently, even if it is reincluded transitively later.
... except Audacity.h
This forces us to make each header contain all forward declarations or nested
headers that it requires, rather than depend on context.
... which will make it easier to change the types of those containers to
std::vectors of other string-like classes
for wxString,
IsEmpty => empty
Clear => clear
Alloc => reserve
for wxArrayString,
Count => size
GetCount => size
IsEmpty => empty
Add => push_back
Clear => clear
Empty => clear
Sort => std::sort (only with default comparator)
SetCount => resize
Last => back
Item => operator []
Alloc => reserve
... I don't know a good reason why they didn't before. It was ancient (2010)
behavior.
This also means that RollbackState really will properly rollback the selection
too, even when there are redo items.
This simplifies away an odd special case.
AudacityProject::Save() is now batch mode sensitive, and if in batch mode (and not overwriting) will save without prompting.
The loop for applying macros to multiple files now also clears down the project, using the new function ResetProjectToEmpty().
... Vacuous pushes should not happen yet, but may happen after the machinery
for pending track changes is added and used.
This will only detect the case of one new recording track being modified. It
will not detect it if that track is modified, but other tracks exist that are
not modified.