Commit Graph

100 Commits

Author SHA1 Message Date
Paul Licameli
c5ebc396eb Audacity.h has shrunk to nothing, now remove it! 2021-05-10 00:05:23 -05:00
Paul Licameli
1efebb7cdc Bug2600 residual: cause update of menu item text after compact 2020-11-25 13:43:04 -05:00
Paul Licameli
ebb6e5de1c Bug2600: Should rename current undo state after compacting 2020-11-25 13:31:04 -05:00
Paul Licameli
7fcd90e351 Fix assertions on close, again, better 2020-11-22 16:47:10 -05:00
Paul Licameli
b32ce8ab21 Fix assertions on project close about mis-estimated block count 2020-11-22 12:09:13 -05:00
Paul Licameli
ccffaca0fa Fix possible crash updating Undo History window during compacting 2020-11-21 13:53:38 -05:00
Paul Licameli
caa312ab7b Remove some unneeded #includes and forward declarations 2020-11-20 13:47:47 -05:00
Paul Licameli
93b098b8d2 Make Undo history window update properly when you compact the project 2020-11-18 20:50:40 -05:00
Paul Licameli
7edbad3cd1 Bug2570 residual: Compact should not change last saved state...
... 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.
2020-11-18 19:21:26 -05:00
Paul Licameli
490271f259 Define UndoManager::VisitStates 2020-11-18 17:07:00 -05:00
Paul Licameli
4cb4b1ab6d Fix signed/unsigned comparison 2020-11-17 14:13:44 -05:00
Paul Licameli
8a86fe139f Bug2531: need progress indication when discarding undo history...
... 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.
2020-09-06 17:54:14 -04:00
Paul Licameli
a2e22dc17b TransactionScope for performance also when abandoning redo states 2020-09-06 17:05:33 -04:00
Paul Licameli
7c9e824943 Require UndoManager to have empty history when destroying it...
...which is a justified assumption now.

Do not call ClearStates().  Do not attempt to repopulate ConnectionPtr if the
project is being destroyed.
2020-09-05 16:08:15 -04:00
Paul Licameli
49fc197e42 Bug2531 mitigation: Reduce the pause without progress dialog...
... 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.
2020-09-05 15:45:08 -04:00
Paul Licameli
a8fd6c6ce8
Preliminaries for grouped block deletion (#628)
* 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
2020-07-23 11:17:29 -05:00
Paul Licameli
73c6225906 Correct space usage calculation for the clipboard in History dialog 2020-07-21 06:26:00 -04:00
Paul Licameli
bd6536f3c4 Remove obsolete mentions of blockfiles in comments & incomplete types 2020-07-20 19:03:31 -04:00
Leland Lucius
5eb9f75150 AUP3: UP-33 History window shows misleading "space used"
Possible fix...will need feedback.
2020-07-15 09:26:23 -05:00
Paul Licameli
06f22e942b More exception-safety for recording...
... 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.
2020-07-10 13:46:21 -04:00
Leland Lucius
d39590cf41 AUP3: First round of updates
!!! 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.
2020-07-01 02:30:18 -05:00
Leland Lucius
cbf1bb558e AUP3: Removes OD code related to project file handling
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.
2020-07-01 01:14:05 -05:00
Paul Licameli
db690d94f7 Remove 27 various macro _ ...
... and supply a few missing translations in Dependencies.cpp

And substitute-don't-concatenate in a few places in Internat.cpp
2020-05-23 08:07:24 -04:00
Paul Licameli
2527bdecaf Add and correct various comments 2020-05-23 06:00:56 -04:00
Yuri Chornoivan
d1ada5f08c Fix minor typos 2020-04-11 10:06:24 +01:00
Paul Licameli
a93c4472f5 TrackList has back-pointer to project...
... 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
2020-01-06 14:14:21 -05:00
Paul Licameli
4eb220e7b9 TranslatableString for undo history short and long descriptions 2019-12-16 14:19:23 -05:00
James Crook
5a3e9cd063 Fix dialog naming
For nicer Doxygen results, we need consistency in naming of classes.
Dialag classes are now called SomethingDialog.
2019-12-06 10:39:07 +00:00
Paul Licameli
705b4b28e7 Register a predicate with each CommandFlag bit 2019-06-14 00:31:15 -04:00
Paul Licameli
e17fc86c23 Distinguish another undo event type 2019-06-12 11:08:50 -04:00
Paul Licameli
06c9896498 Send Undo events through the project, not the UndoManager 2019-06-12 11:08:50 -04:00
Paul Licameli
72b7c776a8 static UndoManager::Get()...
... not member functions of AudacityProject
2019-05-23 12:58:47 -04:00
Paul Licameli
d5b2507af9 Remove unneeded inclusions of Project.h, no cycles broken 2019-05-22 10:02:24 -04:00
Paul Licameli
338d7cd164 A class encapsulating the global clipboard 2019-05-17 06:47:53 -04:00
Paul Licameli
6c57948d8f Remove unnecessary #include-s from .cpp files...
... 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.
2019-05-16 17:21:00 -04:00
Paul Licameli
c09edbb18a Define and use const version of WaveTrack::GetAllClips 2019-05-16 12:30:27 -04:00
Paul Licameli
b4ce681867 WaveTrack.h does not include WaveClip.h 2019-03-18 01:44:42 -04:00
Paul Licameli
5e7d41ec07 Each .cpp/.mm file includes corresponding header before any other...
... 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.
2019-03-17 22:54:52 -04:00
Paul Licameli
2db49dc1f0 Use standard library style members of wxArrayString (and wxString) ...
... 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
2019-03-10 14:43:57 -04:00
Paul Licameli
cee0d35da2 UndoManager emits events when state changes 2018-10-27 12:51:59 -04:00
Paul Licameli
4f7d308ca3 Some inversion of control flow when popping Undo state 2018-10-27 11:31:42 -04:00
Paul Licameli
968d63d5fd Rewrite many iterations over tracks and channels in various places 2018-10-01 13:35:51 -04:00
Paul Licameli
8c486b50f6 Changes via History affect selection exactly as undo/redo...
... 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.
2018-08-09 13:22:07 -04:00
James Crook
9357c90b43 Bug 1859 - Macros on files - Save Project causes overwrites. thus loses data
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().
2018-08-05 21:34:24 +01:00
Paul Licameli
b8a8712ba0 make_movable -> std::make_unique 2018-05-10 00:56:36 -04:00
Paul Licameli
7a0475e39f Remove most uses of AUDACITY_OLD_STD 2018-05-10 00:56:36 -04:00
Paul Licameli
6d687136aa Bug1845: Remove the vacuous undo check, wasn't good enough anyway 2018-02-26 09:49:01 -05:00
Paul Licameli
43776f5263 Don't push vacuous undo items...
... 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.
2018-02-21 19:20:57 -05:00
Paul Licameli
539e870302 Add machinery to TrackList for pending changes to tracks 2018-02-21 19:20:56 -05:00
Paul Licameli
4ef8da8f16 Revert "Preliminaries to support better interaction of undo and recording"
This reverts commit 6e75ae58ac, reversing
changes made to 714d53e00f.
2018-01-14 21:36:33 -05:00