11namespace tracktion {
inline namespace engine
21 if (lockInsertPointCount != 0)
27 nextInsertPointClipOwner = clipOwner !=
nullptr ? clipOwner->
getClipOwnerID()
30 if (
auto cs =
dynamic_cast<ClipSlot*
> (clipOwner))
31 nextInsertPointTrack = cs->track.itemID;
32 else if (
dynamic_cast<Track*
> (clipOwner) !=
nullptr)
33 nextInsertPointTrack = nextInsertPointClipOwner;
40 if (lockInsertPointCount == 0)
43 nextInsertIsAfterSelected =
false;
49 if (lockInsertPointCount == 0)
52 nextInsertPointClipOwner = {};
53 nextInsertPointTrack = track !=
nullptr ? track->itemID :
EditItemID();
60 ++lockInsertPointCount;
62 --lockInsertPointCount;
67 nextInsertIsAfterSelected =
true;
74 [] (
auto& t) {
return t.isAudioTrack() || t.isFolderTrack(); });
81 jassert (allowedTrackPredicate);
83 start = nextInsertPointTime;
85 if (nextInsertIsAfterSelected || pasteAfterSelection)
90 track = firstSelectedTrack;
94 if (! selectedClipTimeRange.isEmpty())
96 start = selectedClipTimeRange.getEnd();
104 while (track !=
nullptr && ! allowedTrackPredicate (*track))
106 if (
auto next = track->getSiblingTrack (1,
false))
112 if (track ==
nullptr)
117 if (track ==
nullptr)
131 jassert (allowedTrackPredicate);
133 auto clipOwner = nextInsertPointClipOwner.isValid() ?
findClipOwnerForID (edit, nextInsertPointClipOwner)
134 : track !=
nullptr ?
dynamic_cast<ClipOwner*
> (track)
136 auto time = nextInsertPointTime;
139 if (nextInsertIsAfterSelected || pasteAfterSelection)
145 track = firstSelectedTrack;
148 if (
auto clipSlot = sm->getFirstItemOfType<
ClipSlot>())
150 clipOwner = clipSlot;
151 track = &clipSlot->track;
153 else if (
auto clip = sm->getFirstItemOfType<
Clip>())
156 if (
auto clipClipSlot = clip->getClipSlot())
158 clipOwner = clipClipSlot;
159 track = &clipClipSlot->track;
164 ! selectedClipTimeRange.isEmpty())
166 time = selectedClipTimeRange.getEnd();
175 while (track !=
nullptr && ! allowedTrackPredicate (*track))
177 if (
auto next = track->getSiblingTrack (1,
false))
184 if (track ==
nullptr)
189 if (track ==
nullptr)
193 clipOwner =
dynamic_cast<ClipOwner*
> (track);
198 return { track, clipOwner, {
time } };
ElementType getFirst() const noexcept
Base class for items that can contain clips.
virtual EditItemID getClipOwnerID()=0
Must return the ID of this ClipOwner.
Represents a slot on a track that a Clip can live in to be played as a launched clip.
bool setNextInsertPoint(ClipOwner *, std::optional< TimePosition >)
Sets the next insertion point to a given ClipOwner and Time (if provided).
EditInsertPoint(Edit &)
Creates an EditInsertPoint for a given Edit.
void lockInsertPoint(bool lock) noexcept
Locks the insert point so calls to setNextInsertPoint won't have any effect.
virtual void chooseInsertPoint(juce::ReferenceCountedObjectPtr< Track > &, TimePosition &start, bool pasteAfterSelection, SelectionManager *)
Returns the track and time position content should be pasted at.
void setNextInsertPointAfterSelected()
Sets a flag to signify chooseInsertPoint should use the selected track as the insertion point.
A struct representing a resolved insertion point.
The Tracktion Edit class!
TransportControl & getTransport() const noexcept
Returns the TransportControl which is used to stop/stop/position playback and recording.
void ensureNumberOfAudioTracks(int minimumNumTracks)
Creates new tracks to ensure the minimum number.
TempoSequence tempoSequence
The global TempoSequence of this Edit.
Manages a list of items that are currently selected.
Base class for tracks which contain clips and plugins and can be added to Edit[s].
TimecodeSnapType getSnapType() const noexcept
Returns the current snap type.
TimeRange getTimeRangeForSelectedItems(const SelectableList &selected)
Returns the time range covered by the given items.
ClipTrack * findFirstClipTrackFromSelection(const SelectableList &items)
Returns the first ClipTrack from the selected tracks or clips.
ClipOwner * findClipOwnerForID(const Edit &edit, EditItemID id)
Returns the ClipOwner with a given ID if it can be found in the Edit.
juce::Array< AudioTrack * > getAudioTracks(const Edit &edit)
Returns all the AudioTracks in an Edit.
Track * findTrackForID(const Edit &edit, EditItemID id)
Returns the Track with a given ID if contained in the Edit.
juce::Array< Track * > findAllTracksContainingSelectedItems(const SelectableList &items)
Returns all the tracks containing the selected tracks or TrackItems.
Represents a position in real-life time.
ID for objects of type EditElement - e.g.
#define CRASH_TRACER
This macro adds the current location to a stack which gets logged if a crash happens.