Commit Graph

171 Commits

Author SHA1 Message Date
luzpaz 7a3bdcf3f2
Fix typos (user facing and non-user facing) (#727)
Found via `codespell v2.1.dev0`  
`codespell -q 3 -S *.po,./lib-src -L parm,parms,toke`
2021-01-24 09:46:08 +00:00
Paul Licameli 67db388b25 Fix comments 2020-12-07 17:22:13 -05:00
Paul Licameli 9d6dd45973 More use of constSamplePtr instead of samplePtr 2020-11-29 19:45:18 -05:00
Paul Licameli 6050edb3ca Bug2598: Envelope edit not dependend on visibility of channels...
... And other rewrites.  Don't use a cache of wave clip X coordinates computed
during drawing.
2020-11-19 22:29:21 -05:00
Paul Licameli 9d6cfcc746 WaveTrackView::BuildSubViews can be simplified...
... The setting of scale type now happens in the default constructor of
WaveformSettings, which calls LoadPrefs.

Since creation of WaveformSettings is always forced, we don't need the
distinction between WaveTrack::GetWaveformSettings and
WaveTrack::GetIndependentWaveformSettings.

That distinction was more analogy with the handling of SpectrogramSettings that
we don't need now.
2020-10-10 11:27:06 -04:00
Paul Licameli c98285c544 New method of TrackShifter, simplify ClipMoveState::DoSlideHorizontal...
... Also the clips to shift within a WaveTrack are tested all at once, more
simply
2020-09-20 00:26:47 -04:00
Paul Licameli 32c0d462b7 Another method of TrackShifter to test before attachment of intervals 2020-09-20 00:26:47 -04:00
Paul Licameli d3ab8b7f76 Compatibility sanity check for inserting clips into a WaveTrack...
... And don't move from the shared pointer argument
2020-09-19 19:16:47 -04:00
Paul Licameli 6510b859f3 Define new virtual functions Track::GetIntervals (const and non-const) 2020-09-19 13:23:45 -04:00
binarywisdom a10a1b81aa fixed bug/enh 266 2020-09-04 11:39:11 -04:00
Paul Licameli cc08455453 Fix #include guard in WaveTrack.h 2020-08-24 12:24:01 -04:00
Paul Licameli 0e10a27172 Fix comments for WaveTrackFactory, remove friend 2020-08-22 21:20:00 -04:00
Paul Licameli 4ca3e7096f
Track factory cleanup (#646)
* Don't need TrackFactory to make LabelTrack

* Don't need TrackFactory to make NoteTrack

* Don't need TrackFactory to make TimeTrack, or ZoomInfo in the factory

* Remove some forward declarations

* Rename TrackFactory as WaveTrackFactory, move it out of Track.cpp
2020-08-22 18:44:49 -05: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 6eb6aab8f5 Commit autosave blobs during recording only as needed...
... when there really is at least one new sample block committed to the table,
which is typically only once in about every six seconds, with the default rate
and sample format.

Also renamed a callback function more aptly, since blocks are not files any
more.
2020-07-11 05:13:38 -04:00
Paul Licameli 875e8e0984
Cross project copy data loss (#604)
* Need only CloseLock now, not old Lock and Unlock...

... which were for cross-project cut and paste, but they no longer work and we
need another solution.  So delete much old code.

* Fix dangling reference to AudacityProject completely! ...

... in SqliteSampleBlockFactory: retain ONLY the shared pointer to
ProjectFileIO, then pass that, not project, to constructors of blocks.

completing the work of 127696879d

* Restore part of the Bug2436 fix...

... which needs the non-default arguments to WaveTrack::EmptyCopy that got lost
at d39590cf41

So that pasted WaveTracks refer to the correct SampleBlockFactory and database
for their project

But this is not yet a sufficient re-fix for the bug

* Complete the fix for cross-project copies and 2436...

... by duplicating sample blocks, in Sequence.cpp, when it is wrong just to
share them.

And to determine which case it is, see whether source and destination Sequences
have the same sample block factories when doing Copy or Paste.  Duplicate
when the factories are different.  Otherwise sharing is safe and more space
efficient.

This does the analogous to what DirManager::CopyBlockFile did before commit
d39590c.
2020-07-07 15:41:50 -05:00
Paul Licameli 127696879d
Unitary changes (#599)
* Define SampleBlockFactory replacing static members of SampleBlock...

... This will become an abstract base class

* Sequence and WaveTrack only store SampleBlockFactory not Project...

... This adds a dependency from Track to SampleBlock which temporarily enlarges
a cycle in the dependency graph

* Register a global factory of SampleBlockFactory...

... so that later we can make an abstract SampleBlockFactory, separate from the
concrete implementation in terms of sqlite, and inject the dependency at startup
avoiding static dependency

* New concrete classes SqliteSampleBlock, SqliteSampleBlockFactory...

... separated from abstract base classes and put into a new source file,
breaking dependency cycles, and perhaps allowing easy reimplementation for other
databases in the future.

Note that the new file is a header-less plug-in!  Nothing depends on it.  It
uses static initialization to influence the program's behavior.

* Compile dependency on sqlite3.h limited to just two .cpp files...

... these are ProjectFileIO.cpp and SqliteSampleBlock.cpp.

But there is still close cooperation of ProjectFileIO and SqliteSampleBlock.cpp.
This suggests that these files ought to be merged, and perhaps ProjectFileIO
also needs to be split into abstract and concrete classes, and there should be
another injection of a factory function at startup.  That will make the choice
of database implementation even more modular.

Also removed one unnecessary inclusion of ProjectFileIO.h

* Fix crashes cutting and pasting cross-project...

... in case the source project is closed before the paste happens.

This caused destruction of the ProjectFileIO object and a closing of the sqlite
database with the sample data in it, leaving dangling references in the
SqliteSampleBlock objects.

The fix is that the SqliteSampleBlockFactory object holds a shared_ptr to the
ProjectFileIO object.  So the clipboard may own WaveTracks, which own WaveClips,
which own Sequences, which own SqliteSampleBlockFactories, which keep the
ProjectFileIO and the database connection alive until the clipboard is cleared.

The consequence of the fix is delayed closing of the entire database associated
with the source project.

If the source project is reopened before the clipboard is cleared, will there
be correct concurrent access to the same persistent store?  My preliminary
trials suggest this is so (reopening a saved project, deleting from it, closing
it again -- the clipboard contents are still unchanged and available).
2020-07-02 18:11:38 -05:00
Paul Licameli 1fcb77ebce
Unitary fixes (#598)
* Eliminate unneeded back-pointer to project from non-wave Tracks...

... now that DirManager is gone

* Remove unused declarations

* SampleData::mProject was not used

* Correct ProjectFileIO::GetLibraryError

* Remove unnecessary #include directives
2020-07-02 11:42:25 -05: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 9a7b7c36d8 comments 2020-05-18 13:09:06 -04:00
Paul Licameli ecb65f8c2b Bug2436: Cross-project paste should duplicate block files...
... to avoid data loss!

Bug caused by commit c2feee6
2020-05-18 10:57:23 -04:00
Yuri Chornoivan d1ada5f08c Fix minor typos 2020-04-11 10:06:24 +01:00
Paul Licameli 7aa2667c33 Some comments to avoid further confusions using WaveTrack::Get(). 2020-03-21 15:48:58 -04:00
Paul Licameli c2feee6cea Bug2346: Complete fix...
... without making undesirable dependency cycles.

Eliminate calls to NewWaveTrack in effects, but in Edit>Copy too, which was
not mentioned in the bug report.  (Copying a track, deselecting all, and pasting
preserved CLIP colors, but not the TRACK color setting which applies to newly
generated clips.)

Instead, always use the new function WaveTrack::EmptyCopy from the track to be
later replaced, getting color information.

NewWaveTrack is still used in benchmark test, import, the Track menu
commands that make new tracks, recording to new tracks, and generators without
a selection, where there is no track to copy from.

Also when deserializing tracks from the .aup file, in which case the saved
color is later retrieved from the file.

Also, in mix-and-render, where other logic decides whether to copy colors
afterward.

See commit a9658e6ef7
2020-03-10 22:32:23 -04:00
Paul Licameli 852c07bc58 Eliminate GetActiveProject from WaveTrack.cpp 2020-01-07 16:16:18 -05:00
Paul Licameli 6ccca16a75 Move display type from WaveTrack to WaveTrackView 2019-07-09 20:09:59 -04:00
Paul Licameli 71250b1dc3 WaveTrack.cpp does not depend on ODDecodeBlockFile.cpp...
... cutting off ODDecodeBlockFile and ODDecodeTask into a small cycle of 2
2019-06-22 21:46:34 -04:00
Paul Licameli f1b04c79d8 WaveClip does not depend on ondemand files besides ODTaskThread...
... Lifting the specification of factory function arguments for Sequence even
higher

This frees ODPCMAliasBlockFile from cycles
2019-06-22 21:46:34 -04:00
Paul Licameli a6e2ca0aa8 Move some enums into new files WaveTrackViewConstants.* ...
... freeing TracksPrefs from the second largest s.c.c. which is now only 20
2019-06-22 21:46:32 -04:00
Paul Licameli aa1ce03100 WaveTrack does not depend directly on ProjectHistory...
... because  we undo the move,
"Demote vertical zooming code into WaveTrack.cpp ..." done at 1f4bf26

That was done so that WaveTrack would not depend on WaveTrackVZoomHandle, but
made it instead depend on ProjectHistory, which is undesirable.

But since then, commit 3797a52 moved the special minimizing code for WaveTrack
into WaveTrackView.
2019-06-22 21:46:32 -04:00
Paul Licameli 3e0d48cc14 Redefine the factories for track views and controls...
... non-intrusively in the Track suclasses, registering functions instead.

For each abstract factory function (of two), build a table of concrete factory
functions, paralleling the hierarchy of Track subclesses.  Dispatch using
runt time type information in the Track objects.
2019-06-21 09:16:49 -04:00
Paul Licameli 3797a5227a Minimized state moved into TrackView 2019-06-18 16:01:06 -04:00
Paul Licameli e581fa60d9 Move responsibilities from Track to TrackView classes...
... And Track no longer inherits TrackPanelCell, so be careful to rewrite
some dynamic_casts too to check instead for TrackView.  Those casts won't fail
to recompile if not rewritten.
2019-06-18 16:01:06 -04:00
Paul Licameli 79191d985d Separate Track::Clone (protected virtual) from Track::Duplicate 2019-06-18 16:01:06 -04:00
Paul Licameli 18b4c01c51 TrackVRulerControl is directly owned by TrackView not Track...
... in anticipation of making views to tracks many-to-one, but then the rulers
should be one-to-one with the views.  So go through the view to get the ruler.
The ruler is really a left-hand extension for each view.
2019-06-18 16:01:06 -04:00
Paul Licameli 059d7eaa42 Associate View object with Track, analogous with controls 2019-06-18 16:01:06 -04:00
Paul Licameli 291bd7258f Track.cpp does not depend directly on its subclasses 2019-06-12 11:14:19 -04:00
Paul Licameli 1f4bf262b1 Demote vertical zooming code into WaveTrack.cpp ...
... Freeing WaveTrackVRulerControls and WaveTrackVZoomHandle from the big
s.c.c., to higher levels, though still in a cycle of two
2019-06-10 21:56:46 -04:00
Paul Licameli 548192fcf3 Remove redundant #include-s from .h files...
Redundant, because transitively implied.  But don't do this for inclusions of
Audacity.h or Experimental.h.
2019-05-16 14:58:34 -04:00
Paul Licameli 56f51d8176 Revert "Remove redundant #include-s from .h files..."
This reverts commit b7fe62d170.
2019-05-16 14:33:55 -04:00
Paul Licameli b7fe62d170 Remove redundant #include-s from .h files...
Redundant, because transitively implied.  But don't do this for inclusions of
Audacity.h or Experimental.h.
2019-05-16 14:15:05 -04:00
Paul Licameli c09edbb18a Define and use const version of WaveTrack::GetAllClips 2019-05-16 12:30:27 -04:00
Paul Licameli 0b733eed3f Remove (or comment) ProgressDialog.h in headers...
... For ImportPlugin, use unique_ptr not Maybe to hold it, and take constructors
out-of-line.
2019-04-04 09:47:57 -04:00
Paul Licameli 4d29686116 Remove wx/gdicmn.h from headers 2019-03-30 11:52:48 -04:00
Paul Licameli ec2f26e48c Remove wx/pen.h, wx/thread.h from headers 2019-03-30 10:17:18 -04:00
Paul Licameli d261ea2558 Define and use utility template ValueIterator...
... generalizing the fix of commit 7591891 to other cases, making the iterators
safe for adaptation with std::reverse_iterator should the need ever arise
2019-03-18 08:44:40 -04:00
Paul Licameli b4ce681867 WaveTrack.h does not include WaveClip.h 2019-03-18 01:44:42 -04:00
Paul Licameli 906e55f047 Experimental.h in all .h or .cpp files that directly use EXPERIMENTALs...
... except Audacity.h; and in no others.

Do so even if Experimental.h gets multiply included, as in both the .h and
.cpp files.

This makes it easier to do a text scan to be sure there are no unintended quiet
changes of meaning because of omission of Experimental.h when the flag is
an enabled one.

Also move inclusions of Experimental.h earlier.

Also don't require Experimental.h to be preceded by Audacity.h to define
EXPERIMENTAL_MIDI_OUT correctly.
2019-03-17 22:54:00 -04:00
Paul Licameli 6f31a9f7dc Specific types, const versions: getting track & vruler controls...
... See changes to classes CommonTrackPanelCell and Track; the rest follows
2019-03-17 15:20:52 -04:00