Audacity 3.2.0
Static Public Member Functions | List of all members
SyncLock Class Reference

#include <SyncLock.h>

Static Public Member Functions

static bool IsSyncLockSelected (const Track &track)
 
static bool IsSyncLockSelectedP (const Track *pTrack)
 
static bool IsSelectedOrSyncLockSelected (const Track &track)
 
static bool IsSelectedOrSyncLockSelectedP (const Track *pTrack)
 
static TrackIterRange< TrackGroup (Track &track)
 
static TrackIterRange< const TrackGroup (const Track &track)
 

Detailed Description

Definition at line 41 of file SyncLock.h.

Member Function Documentation

◆ Group() [1/2]

static TrackIterRange< const Track > SyncLock::Group ( const Track track)
inlinestatic

Precondition
track.GetOwner() != nullptr

Definition at line 68 of file SyncLock.h.

69 {
70 return Group(const_cast<Track&>(track)).Filter<const Track>();
71 }
static TrackIterRange< Track > Group(Track &track)
Definition: SyncLock.cpp:150
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110

◆ Group() [2/2]

TrackIterRange< Track > SyncLock::Group ( Track track)
static
Precondition
track.GetOwner() != nullptr

Definition at line 150 of file SyncLock.cpp.

151{
152 auto pList = track.GetOwner();
153 assert(pList); // precondition
154 auto tracks = FindSyncLockGroup(const_cast<Track&>(track));
155 return pList->Any()
156 .StartingWith(tracks.first).EndingAfter(tracks.second);
157}
const auto tracks
std::shared_ptr< TrackList > GetOwner() const
Definition: Track.h:230
std::pair< Track *, Track * > FindSyncLockGroup(Track &member)
Definition: SyncLock.cpp:110

References anonymous_namespace{SyncLock.cpp}::FindSyncLockGroup(), Track::GetOwner(), and tracks.

Referenced by ClipMoveState::Init(), IsSyncLockSelected(), anonymous_namespace{EditMenus.cpp}::OnPaste(), NyquistBase::Process(), TruncSilenceBase::ProcessIndependently(), NyquistBase::ProcessOne(), StretchHandle::Release(), SelectionState::SelectTrackLength(), and RateMenuTable::SetRate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsSelectedOrSyncLockSelected()

bool SyncLock::IsSelectedOrSyncLockSelected ( const Track track)
static
Returns
track is selected, or is sync-lock selected

Definition at line 104 of file SyncLock.cpp.

105{
106 return track.IsSelected() || IsSyncLockSelected(track);
107}
static bool IsSyncLockSelected(const Track &track)
Definition: SyncLock.cpp:80
bool IsSelected() const
Definition: Track.cpp:258

References Track::IsSelected(), and IsSyncLockSelected().

Referenced by LabelTrackView::Draw(), TrackArt::DrawBackgroundWithSelection(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), anonymous_namespace{WaveformView.cpp}::DrawWaveform(), EffectOutputTracks::EffectOutputTracks(), anonymous_namespace{EditMenus.cpp}::OnDelete(), ChangeSpeedBase::Process(), and RepeatBase::Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsSelectedOrSyncLockSelectedP()

static bool SyncLock::IsSelectedOrSyncLockSelectedP ( const Track pTrack)
inlinestatic
Returns
pTrack is not null, and is selected, or is sync-lock selected

Useful as a predicate for track iteration, which must test a pointer

Definition at line 61 of file SyncLock.h.

62 { return pTrack && IsSelectedOrSyncLockSelected(*pTrack); }
static bool IsSelectedOrSyncLockSelected(const Track &track)
Definition: SyncLock.cpp:104

Referenced by anonymous_namespace{TrackMenus.cpp}::DoAlign(), TruncSilenceBase::DoRemoval(), anonymous_namespace{EditMenus.cpp}::OnCut(), and Reverse::Process().

Here is the caller graph for this function:

◆ IsSyncLockSelected()

bool SyncLock::IsSyncLockSelected ( const Track track)
static
Returns
sync lock is on, and some member of track's group is selected

Definition at line 80 of file SyncLock.cpp.

81{
82 auto pList = track.GetOwner();
83 if (!pList)
84 return false;
85
86 auto p = pList->GetOwner();
87 if (!p || !SyncLockState::Get( *p ).IsSyncLocked())
88 return false;
89
90 auto &orig = PendingTracks::Get(*p).SubstituteOriginalTrack(track);
91 auto trackRange = Group(orig);
92
93 if (trackRange.size() <= 1) {
94 // Not in a sync-locked group.
95 // Return true iff selected and of a sync-lockable type.
96 return (IsSyncLockableNonSeparatorTrack(orig) ||
97 IsSeparatorTrack(orig)) && track.GetSelected();
98 }
99
100 // Return true iff any track in the group is selected.
101 return *(trackRange + &Track::IsSelected).begin();
102}
const Track & SubstituteOriginalTrack(const Track &track) const
static PendingTracks & Get(AudacityProject &project)
bool IsSyncLocked() const
Definition: SyncLock.cpp:44
static SyncLockState & Get(AudacityProject &project)
Definition: SyncLock.cpp:27
bool GetSelected() const
Selectedness is always the same for all channels of a group.
Definition: Track.cpp:78
bool IsSyncLockableNonSeparatorTrack(const Track &track)
Definition: SyncLock.cpp:58
bool IsSeparatorTrack(const Track &track)
Definition: SyncLock.cpp:63
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101

References details::begin(), SyncLockState::Get(), PendingTracks::Get(), Track::GetOwner(), Track::GetSelected(), Group(), Track::IsSelected(), anonymous_namespace{SyncLock.cpp}::IsSeparatorTrack(), anonymous_namespace{SyncLock.cpp}::IsSyncLockableNonSeparatorTrack(), SyncLockState::IsSyncLocked(), and PendingTracks::SubstituteOriginalTrack().

Referenced by anonymous_namespace{LabelMenus.cpp}::GetTracksToEditByLabel(), IsSelectedOrSyncLockSelected(), ChangeSpeedBase::Process(), Generator::Process(), PaulstretchBase::Process(), RepeatBase::Process(), SBSMSBase::Process(), NyquistBase::ProcessOne(), PerTrackEffect::ProcessPass(), and CommonTrackInfo::SyncLockDrawFunction().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsSyncLockSelectedP()

static bool SyncLock::IsSyncLockSelectedP ( const Track pTrack)
inlinestatic
Returns
pTrack is not null, sync lock is on, and some member of its group is selected

Useful as a predicate for track iteration, which must test a pointer

Definition at line 51 of file SyncLock.h.

52 { return pTrack && IsSyncLockSelected(*pTrack); }

Referenced by SelectActions::Handler::OnSelectSyncLockSel().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: