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 *pTrack)
 
static bool IsSelectedOrSyncLockSelected (const Track *pTrack)
 
static TrackIterRange< TrackGroup (Track *pTrack)
 
static TrackIterRange< const TrackGroup (const Track *pTrack)
 

Detailed Description

Definition at line 17 of file SyncLock.h.

Member Function Documentation

◆ Group() [1/2]

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

Precondition
pTrack->GetOwner() != nullptr

Definition at line 29 of file SyncLock.h.

30 {
31 return Group(const_cast<Track*>(pTrack)).Filter<const Track>();
32 }
static TrackIterRange< Track > Group(Track *pTrack)
Definition: SyncLock.cpp:122
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:225

References TrackIterRange< TrackType >::Filter().

Here is the call graph for this function:

◆ Group() [2/2]

TrackIterRange< Track > SyncLock::Group ( Track pTrack)
static
Precondition
pTrack->GetOwner() != nullptr

Definition at line 122 of file SyncLock.cpp.

123{
124 auto pList = pTrack->GetOwner();
125 auto tracks = FindSyncLockGroup(const_cast<Track*>( pTrack ) );
126 return pList->Any().StartingWith(tracks.first).EndingAfter(tracks.second);
127}
std::shared_ptr< TrackList > GetOwner() const
Definition: Track.h:402
std::pair< Track *, Track * > FindSyncLockGroup(Track *pMember)
Definition: SyncLock.cpp:79

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

Referenced by ClipMoveState::Init(), IsSyncLockSelected(), NyquistEffect::Process(), EffectTruncSilence::ProcessIndependently(), NyquistEffect::ProcessOne(), StretchHandle::Release(), and SelectionState::SelectTrackLength().

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

◆ IsSelectedOrSyncLockSelected()

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

Definition at line 73 of file SyncLock.cpp.

74{
75 return pTrack && (pTrack->IsSelected() || IsSyncLockSelected(pTrack));
76}
static bool IsSyncLockSelected(const Track *pTrack)
Definition: SyncLock.cpp:43
bool IsSelected() const
Definition: Track.cpp:384

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

Referenced by Effect::CopyInputTracks(), anonymous_namespace{TrackMenus.cpp}::DoAlign(), EffectTruncSilence::DoRemoval(), LabelTrackView::Draw(), TrackArt::DrawBackgroundWithSelection(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), EditActions::Handler::OnCut(), EditActions::Handler::OnDelete(), EditActions::Handler::OnPaste(), EffectChangeSpeed::Process(), EffectRepeat::Process(), and EffectReverse::Process().

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

◆ IsSyncLockSelected()

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

Definition at line 43 of file SyncLock.cpp.

44{
45 if (!pTrack)
46 return false;
47 auto pList = pTrack->GetOwner();
48 if (!pList)
49 return false;
50
51 auto p = pList->GetOwner();
52 if (!p || !ProjectSettings::Get( *p ).IsSyncLocked())
53 return false;
54
55 auto shTrack = pTrack->SubstituteOriginalTrack();
56 if (!shTrack)
57 return false;
58
59 const auto pOrigTrack = shTrack.get();
60 auto trackRange = Group( pOrigTrack );
61
62 if (trackRange.size() <= 1) {
63 // Not in a sync-locked group.
64 // Return true iff selected and of a sync-lockable type.
65 return (IsSyncLockableNonSeparatorTrack( pOrigTrack ) ||
66 IsSeparatorTrack( pOrigTrack )) && pTrack->GetSelected();
67 }
68
69 // Return true iff any track in the group is selected.
70 return *(trackRange + &Track::IsSelected).begin();
71}
static ProjectSettings & Get(AudacityProject &project)
bool IsSyncLocked() const
bool GetSelected() const
Definition: Track.h:461
std::shared_ptr< const Track > SubstituteOriginalTrack() const
Definition: Track.cpp:1209
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:150
bool IsSeparatorTrack(const Track *pTrack)
Definition: SyncLock.cpp:23
bool IsSyncLockableNonSeparatorTrack(const Track *pTrack)
Definition: SyncLock.cpp:18

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

Referenced by ClipParameters::ClipParameters(), anonymous_namespace{LabelMenus.cpp}::EditByLabel(), anonymous_namespace{LabelMenus.cpp}::EditClipboardByLabel(), IsSelectedOrSyncLockSelected(), TrackInfo::MinimizeSyncLockDrawFunction(), EditActions::Handler::OnPaste(), SelectActions::Handler::OnSelectSyncLockSel(), EffectChangeSpeed::Process(), Generator::Process(), EffectRepeat::Process(), EffectSBSMS::Process(), NyquistEffect::ProcessOne(), and PerTrackEffect::ProcessPass().

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

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