Commit Graph

214 Commits

Author SHA1 Message Date
Paul Licameli
191cd23b54 XMLTagHandler.cpp has fewer dependencies...
... freeing three files from dependency cycles
2019-05-18 20:29:25 -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
580e1a8a63 move a comment 2019-04-23 13:40:17 -04:00
Paul Licameli
4d29686116 Remove wx/gdicmn.h from headers 2019-03-30 11:52:48 -04:00
Paul Licameli
c3aad2e026 Remove wx/event.h from headers 2019-03-27 04:36:51 -04:00
Paul Licameli
1d0247607a Remove wx/string.h from headers 2019-03-26 11:33:55 -04:00
Paul Licameli
bb634614e6 static overloads of Track::SharedPointer when null check is needed...
... Some optimizing compilers don't let us get away with null check on this
in a nonstatic member function.
2019-03-23 13:23:46 -04:00
Paul Licameli
f45300f032 This is only comments, in files where USE_ macros are tested...
... following the comment convention used in the preceding commit.
2019-03-22 12:38:30 -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
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
Paul Licameli
166e73fdeb Make inherited TrackList::push_back private 2019-03-16 14:29:34 -04:00
Paul Licameli
47fa651d79 TrackList inherits std::enable_shared_from_this 2019-03-16 13:11:33 -04:00
Paul Licameli
41175e94cd Simplify by removing many std::move of shared_ptr to tracks...
... Don't need them, as we did with std::unique_ptr
2019-03-16 13:11:33 -04:00
Paul Licameli
a0aa69a248 All tracks allocated with make_shared, no more make_unique...
... 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.
2019-03-16 13:11:33 -04:00
Paul Licameli
6f89c48873 Reimplement Track::Pointer using std::enable_shared_from_this...
... now the Track need not be owned yet by a TrackList
2019-03-16 13:11:32 -04:00
David Bailes
012d707a8a Bug 2060: Windows: no access to microphone causes crash
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.
2019-02-05 14:29:22 +00:00
James Crook
7030c9fc4f More doxygen 2018-11-03 13:18:26 +00:00
Paul Licameli
26abe0255d Precautions also in TrackIterRange::StaringWith() as in EndingAfter() 2018-10-30 11:37:08 -04:00
Paul Licameli
74a360f682 Bug2020: Fix sync-lock groupings 2018-10-30 10:54:37 -04:00
Paul Licameli
793949aa29 more comments about TrackIterRange operators 2018-10-30 09:32:29 -04:00
Paul Licameli
3be57fce49 Bug2015: crash repeatedly append-recording with sync-lock on 2018-10-29 20:35:45 -04:00
Paul Licameli
cda9715ce6 Fix TrackList event propagation 2018-10-27 21:26:07 -04:00
Paul Licameli
2741d58880 TrackList emits more events for certain changes of state of tracks...
... Also rewrote some of the existing event handling so all events from
TrackList are of the same, custom event class, and distinguishing addition
from resizing events, though this distinction is not yet used
2018-10-27 11:31:42 -04:00
Paul Licameli
75918918c4 Correct template parameters to std::iterator base of TrackIter...
... so that std::reverse_iterator<TrackIter<T>> works right, not making a
subtle error of return of reference to a temporary in its operator * with some
compilers.
2018-10-03 22:47:21 -04:00
Paul Licameli
32d767c7f5 Track::SetLinked() and Track::SetChannel() are private...
... but class WaveTrack needs to invoke SetLinked still during project load
2018-10-01 13:42:36 -04:00
Paul Licameli
7e6a543473 Define TrackList::GroupChannels() 2018-10-01 13:42:35 -04:00
Paul Licameli
2ee87082cb Track::GetLink and GetLinked are private, but SetLinked isn't yet 2018-10-01 13:42:34 -04:00
Paul Licameli
b36c3efec1 Track::GetKind is private 2018-10-01 13:42:34 -04:00
Paul Licameli
b5f52e7c1c Remove old style track iterator classes 2018-10-01 13:42:34 -04:00
Paul Licameli
b94e8fec96 Remove VisibleTrackIterator 2018-10-01 11:20:52 -04:00
Paul Licameli
05ddfaf82b Remove TrackList::Select 2018-10-01 10:47:51 -04:00
Paul Licameli
5c6fd64a0e TrackList::GetPrev and ::GetNext are private 2018-10-01 10:44:58 -04:00
Paul Licameli
a0e15cfbbd Remove TrackListIterator::RemoveCurrent 2018-10-01 10:42:02 -04:00
Paul Licameli
89748cbe3c Remove "skiplinked" argument of old track iterators 2018-10-01 10:35:46 -04:00
Paul Licameli
52848e4483 Define Track::TypeSwitch for type-safe dispatching 2018-10-01 10:32:48 -04:00
Paul Licameli
a3cdb08ee0 Classes and functions for type-safe iteration over tracks 2018-09-29 22:17:55 -04:00
Paul Licameli
6a9f9d7899 Define track_cast, like dynamic_cast...
... but perhaps faster using our custom type-query method.
2018-09-29 21:41:47 -04:00
Paul Licameli
6930b63192 Redo track kind as an enum class defined at global scope 2018-09-29 21:41:47 -04:00
Paul Licameli
35f5555216 Track::mChannel has an enum type 2018-09-29 12:42:46 -04:00
Paul Licameli
998556205d Replace wxWidgets arrays with std::vector 2018-09-29 12:10:28 -04:00
Paul Licameli
34cc1ff577 Rename, rewrite, and simplify use of FindPendingChangedTrack 2018-09-13 13:56:47 -04:00
Paul Licameli
4b950927b5 TrackList::GetGroupHeight is const 2018-09-13 09:53:48 -04:00
James Crook
0ce83abbfb Bug 1940 - Clicky play when adjusting Pan or Volume TCP controls 2018-08-24 22:30:20 +01:00
Paul Licameli
7f84e71324 Context menu handling is also in CellularPanel 2018-08-05 14:02:55 -04:00
Paul Licameli
35a97e09e7 Group arguments to StartStream, and a bit less of #ifdef for MIDI play...
... And pull choice of tracks and options out of DoRecord
2018-05-29 00:22:12 -04:00
Paul Licameli
4474dec9c2 Fix more hassle from the MSVC STL implementation. 2018-02-28 05:14:21 -05:00
Paul Licameli
bab8ea8393 Thanks for nothing, MSVC std::list<T>::iterator implementation...
... I worked around the unhelpful helps that made gratuitous runtime errors,
in debug builds but not in release.
2018-02-23 14:58:12 -05:00
Paul Licameli
080dd34e61 Get rid of wx object arrays, use std::vector 2018-02-21 19:33:27 -05:00
Paul Licameli
2fbe04eda0 Replace more Connect with Bind; needed redeclaration of custom events 2018-02-21 19:30:40 -05:00
Paul Licameli
e0d826a542 Prohibit copy of TrackList, no longer needed; allow swap and move 2018-02-21 19:21:01 -05:00
Paul Licameli
539e870302 Add machinery to TrackList for pending changes to tracks 2018-02-21 19:20:56 -05:00
Paul Licameli
33cfd92c0a Define TrackId to identify tracks across undo states 2018-02-21 19:20:56 -05:00
Paul Licameli
3f05063681 Split "Do" functions out of the "Set" functions for some Track settings 2018-02-21 19:20:55 -05:00
Paul Licameli
242e9a5668 Some reimplementation of track iterators and GetLink() ...
... avoiding direct usage of the inherited end() and of the increment and
decrement of the std::list iterators
2018-02-21 19:20:55 -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
Paul Licameli
950898dcb9 Revert "Bug 1823: Better interaction of undo and record..."
This reverts commit 1e8aba968d, reversing
changes made to 6e75ae58ac.
2018-01-14 21:27:41 -05:00
Paul Licameli
2409d46d4c Prohibit copy of TrackList, no longer needed; allow swap and move 2018-01-14 19:33:39 -05:00
Paul Licameli
ce5a67a9e9 Iterate over the pending tracks for drawing 2018-01-14 19:04:03 -05:00
Paul Licameli
a0c3a4b43c Add machinery to TrackList for pending changes to tracks 2018-01-14 19:03:57 -05:00
Paul Licameli
bd2c7e6abc Define TrackId to identify tracks across undo states 2018-01-14 19:03:54 -05:00
Paul Licameli
8b60e7f02d Split "Do" functions out of the "Set" functions for some Track settings 2018-01-14 19:03:52 -05:00
Paul Licameli
92ba1f10e1 Some reimplementation of track iterators and GetLink() ...
... avoiding direct usage of the inherited end() and of the increment and
decrement of the std::list iterators
2018-01-14 19:03:50 -05:00
Paul Licameli
0265b8792d More stl idiom for TrackList and its iterators 2018-01-14 16:58:19 -05:00
Paul Licameli
a30defe8ca Redo "Provide STL idiom for iterating tracks..." ...
... Being careful not to use operator == on a default-constructed
std::list::iterator, which violates assertions in the MSVC libraries.

This reverts commit 7fb5ec4b7a.
2018-01-14 14:25:02 -05:00
James Crook
7fb5ec4b7a Revert "Provide STL idiom for iterating tracks..."
Unsafe on MSVC 2013.
2018-01-14 14:24:21 +00:00
Paul Licameli
f9dab3679c Provide STL idiom for iterating tracks...
... and require qualified name access to use the underlying std::list iterators
that return shared_ptr to Track.

Which should not be done very much outside of class TrackList, but a few
places need it.
2018-01-13 19:37:05 -05:00
Paul Licameli
5407079c62 Remove EXPERIMENTAL_OUTPUT_DISPLAY...
... Maybe a good feature idea, but the implementation pollutes the code in
too many places.

It's a special case of the more general idea of many-to-one associations
between screen rectangles and track objects.  More generalized ways to
accommodate that should be sought.
2018-01-12 12:08:09 -05:00
Paul Licameli
c975de8c5e More use of shared_ptr to Track, for safety...
... This even makes it possible to remove the prohibition of undo and redo
during transport, not that we want to though.  Playback and recording will
continue, using track objects that might not be in the current project.
2018-01-10 20:05:11 -05:00
James Crook
13c6fdf663 VZooming Changes
1: Guard zone 8 pixels wide in VRuler to reduce risk of accidental use.
2: VerticalZooming preference, for VRuler zooming, off by default,
3: Enabled Paul's right-click menu in VRuler with some extra
presets (x2 and x0.5)
4: Rearranged some messy code with lots of ifs to use a switch.

Also, with EXPERIMENTAL_HALF_WAVE defined we now get a
'half wave' option in the VRuler menu, that shows the wave top half.
We also use it in collapsed waves (and collapsing and restoring
a WaveTrack will get you back to normal zoom.
2017-12-11 18:41:48 +00:00
James Crook
f463eda36c Clean up some dead code and MSVC warnings.
- Dead code from experiments in SelectionBar removed.
- Many warnings about unused parameters fixed with WXUNUSED()
- Many warnings about signed / unsigned comparisons cleaned up.
- Several 'local variable declared but not used' warnings fixed.
2017-12-08 15:20:39 +00:00
Paul Licameli
f136b5c530 Reviewed uses of InconsistencyException outside Sequence.cpp 2017-11-19 01:48:41 -05:00
Paul Licameli
5dd72acc02 Bug1770: fix crash applying chains 2017-11-04 20:59:55 -04:00
Paul Licameli
8279adc797 Changing NoteTrack height, keep # of piano keys (roughly) constant...
This fix is imperfect, but quick and easy
2017-07-19 14:46:23 -04:00
Paul Licameli
8fae9802dc Prohibit use of inherited TrackList::clear() 2017-07-14 22:30:02 -04:00
Paul Licameli
8bf3791edf TrackList constructed only by factory function, to avoid more trouble 2017-07-14 21:55:32 -04:00
Paul Licameli
67282cbb61 SnapManager::Snap returns its results in a struct 2017-07-13 12:11:13 -04:00
Paul Licameli
bca09f4320 null check 2017-07-10 11:53:23 -04:00
Paul Licameli
16645f6b95 Back-pointer from Track to TrackList is weak (fixes crashes) 2017-07-10 11:48:11 -04:00
Paul Licameli
8e44827980 TrackPanelCell hit tests can return multiple results...
.. though only the first is used yet
2017-07-09 08:17:40 -04:00
Paul Licameli
b3d62e2ab6 Simplify by removing class HitTestResult...
... Because all hit tests returned all fields blank, or else, returned a
UIHandle object whose Preview method gives the rest of the information; so
the other fields were redundant.
2017-07-09 07:57:34 -04:00
Paul Licameli
2c1a16f593 Changed lifetime management of UIHandle objects, no singletons...
... Rather, construct them during hit tests (also capturing more state sooner
rather than at Click time, and adding some accessors for later use)

This also fixes bug 1677 by other means and avoids similar problems.

A cell may be implemented to re-use a previously hit handle object, not yet
clicked, in a later hit test, by remembering a weak pointer, but TrackPanel
holds the strong pointers that determine when the object is destroyed.

And the objects will surely be destroyed after drag-release, or ESC key.

For now they are also destroyed whenever not dragging, and hit-testing is
re-invoked; that will be changed later, so that the re-use mentioned above
becomes effective, but still they will be destroyed when the pointer moves
from one cell to another.
2017-07-09 07:23:28 -04:00
Paul Licameli
3a8280c562 Distinguish TrackPanelMouseState from TrackPanelMouseEvent...
... Let cell hit tests, and handle preview, know states only, not transitions.

Cell hit tests are passed a mouse state that does not always match the current,
but anticipates the button click to come; usually left, but if the Control
[sic] key on Mac is down, then right.

Thus, pressing and releasing Mac Control in multi-tool switches in and out of
the magnifier cursor.
2017-07-09 06:38:55 -04:00
Paul Licameli
6684c7b9b0 More careful use of weak pointers to tracks in UIHandles 2017-06-28 01:46:59 -04:00
Paul Licameli
708d84ac22 CommonTrackPanelCell::FindTrack returns shared_ptr 2017-06-27 23:09:35 -04:00
Paul Licameli
bce3571372 Redo hit test priorities in TrackPanel...
Zoom tool takes precedence;

Otherwise do special hits appropriate to the track subclass -- and only
WaveTrack here uses Tools toolbar state, and now disallows clicks on things
when they are not drawn because the view is spectrogram;

Finally, default to right button zooming in Multi tool, or to time shift in
that tool, or to selection adjustment in Multi or in Select tool.
2017-06-27 08:26:07 -04:00
Paul Licameli
28b40e02fb Manage TrackPanelResizerCell by shared_ptr, no singleton 2017-06-26 16:39:07 -04:00
Paul Licameli
35ce499ce1 Manage TrackControls and TrackVRulerControls by shared_ptr; ...
... they are not singletons; and the back-pointers to their Tracks are weak.
2017-06-26 16:34:10 -04:00
Paul Licameli
2806b509e2 Fix crashes in repainting, and update first visible track correctly 2017-06-26 15:20:35 -04:00
Paul Licameli
d3c9a1decb JAWS fix?: Now do the delay of event handling...
... Queue, don't immediately process, TrackList events, and if listeners want
to hold pointers to tracks, let them use weak_ptr or shared_ptr
2017-06-25 13:35:17 -04:00
Paul Licameli
bd5d2bf114 Accessor for shared pointer to track, given only a bare pointer 2017-06-25 13:35:15 -04:00
Paul Licameli
750fc34fac Clarify what the TrackList events are for...
Also fixes this bug:

Vertical rulers did not narrow as needed after deletion of the lowest track.
2017-06-25 03:00:28 -04:00
Paul Licameli
68dfdab843 Store tracks in TrackList with shared_ptr ...
... but still use unique_ptr from track factories and importers.
2017-06-23 15:05:50 -04:00
Paul Licameli
14d45eda33 Define and use the UIHandle and TrackPanelCell protocols, but...
...no actions reimplemented to them yet.

Later commits will move special cases one at a time from TrackPanel, preserving
all click and drag capabilities at each step.  With a few exceptions, but those
lost abilities are restored in yet later commits.  (Ctrl+Click on the Label
track being one.)
2017-06-15 08:20:56 -04:00
Paul Licameli
f0c149b890 Default MIDI track height is enough to display velocity slider...
... It is computed from the layout table, and in fact comes to 158 pixels,
versus 150 for other tracks.
2017-06-06 22:39:30 -04:00
Paul Licameli
721faf89c6 Avoid possible dangling pointer problems with EVT_TRACKLIST_UPDATED 2017-06-01 14:40:05 -04:00
Paul Licameli
4b2b0d9b91 Fix Windows warning: inconsistent DLL linkage between base & derived 2017-05-23 13:06:50 -04:00
Paul Licameli
3aff330671 Fix compilation of EXPERIMENTAL_OUTPUT_DISPLAY; fix a warning in it 2017-04-23 07:58:11 -04:00