... 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.
... and LabelTrack listens to its own events, to update certain state.
This is roundabout for now, but that state is view-related and will move into
another class.
... which will simplify later rewrites that associate selection state with
the track group, not the track.
Since LabelTrack isn't notified immediately of selection changes, instead it
always tests whether it is selected, before using the stored selected label
index.
... and eliminate some unnecessary calls to SubstitutePendingChangedTrack,
because the track and the substitute store Y and height in their shared
TrackView object.
Also make GetMinimizedHeight() virtual to avoid inclusion of TrackPanel.h in
TrackView.cpp.
... 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.
... 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.
... and use std::enable_shared_from_this
Temporarily putting TrackControls.cpp back into the big s.c.c, now 59 files
Future rewriting might even eliminate all mention of those classes in
the definition of the Track classes.
... generalizing the fix of commit 7591891 to other cases, making the iterators
safe for adaptation with std::reverse_iterator should the need ever arise
... 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.
... so that we can use Track::SharedPointer without undefined behavior even on
tracks that don't yet belong to any TrackList.
Also fix the return type of function template TrackList::Add and remove some
casts.
Problem:
1. Set no access to microphone in Privacy category of Settings app.
2. Try to record in a new track. (not append to an existing track.)
3. Audacity crashes.
Cause of crash:
TrackPanel::OnTrackListResizing is called with a track after a call to
TrackList::ClearPendingTracks, which has removed its owner.
TrackPanel::OnTrackListResizing ends up calling TrackPanel::UpdateTrackVRuler,
and this function calls TrackList::Channels(t)), which assumes the track has an owner.
Crash.
Fix: in TrackPanel::OnTrackListResizing, check that the track has an owner.