Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
anonymous_namespace{ChannelView.cpp}::TrackPositioner Struct Referencefinal
Inheritance diagram for anonymous_namespace{ChannelView.cpp}::TrackPositioner:
[legend]
Collaboration diagram for anonymous_namespace{ChannelView.cpp}::TrackPositioner:
[legend]

Public Member Functions

 TrackPositioner (AudacityProject &project)
 
 TrackPositioner (const TrackPositioner &)=delete
 
TrackPositioneroperator= (const TrackPositioner &)=delete
 
void OnUpdate (const TrackListEvent &e)
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Public Attributes

AudacityProjectmProject
 
Observer::Subscription mSubscription
 

Detailed Description

Attached to each project, it receives track list events and maintains the cache of cumulative track view heights for use by TrackPanel.

Definition at line 253 of file ChannelView.cpp.

Constructor & Destructor Documentation

◆ TrackPositioner() [1/2]

anonymous_namespace{ChannelView.cpp}::TrackPositioner::TrackPositioner ( AudacityProject project)
inlineexplicit

Definition at line 257 of file ChannelView.cpp.

258 : mProject{ project }
259 {
262 }
const auto project
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
static PendingTracks & Get(AudacityProject &project)

References PendingTracks::Get(), project, and Observer::Publisher< Message, NotifyAll >::Subscribe().

Here is the call graph for this function:

◆ TrackPositioner() [2/2]

anonymous_namespace{ChannelView.cpp}::TrackPositioner::TrackPositioner ( const TrackPositioner )
delete

Member Function Documentation

◆ OnUpdate()

void anonymous_namespace{ChannelView.cpp}::TrackPositioner::OnUpdate ( const TrackListEvent e)
inline

Definition at line 266 of file ChannelView.cpp.

267 {
268 switch (e.mType) {
273 break;
274 default:
275 return;
276 }
277 auto iter =
278 TrackList::Get(mProject).Find(e.mpTrack.lock().get());
279 if (!*iter)
280 return;
281
282 auto prev = iter;
283 auto yy = ChannelView::GetCumulativeHeight(*--prev);
284
285 while (auto pTrack = *iter) {
286 for (auto pChannel : (*iter)->Channels()) {
287 auto &view = ChannelView::Get(*pChannel);
288 view.SetCumulativeHeightBefore(yy);
289 yy += view.GetHeight();
290 }
291 ++iter;
292 }
293 }
static ChannelView & Get(Channel &channel)
static int GetCumulativeHeight(const Channel *pChannel)
Definition: ChannelView.cpp:47
TrackIter< Track > Find(Track *pTrack)
Definition: Track.cpp:470
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
const std::weak_ptr< Track > mpTrack
Definition: Track.h:838
const Type mType
Definition: Track.h:837
@ RESIZING
Posted when some track changed its height.
Definition: Track.h:816
@ DELETION
Posted when a track has been deleted from a tracklist. Also posted when one track replaces another.
Definition: Track.h:825
@ ADDITION
Posted when a track has been added to a tracklist. Also posted when one track replaces another.
Definition: Track.h:819
@ PERMUTED
Posted when tracks are reordered but otherwise unchanged.
Definition: Track.h:813

References TrackListEvent::ADDITION, TrackListEvent::DELETION, TrackList::Find(), TrackList::Get(), ChannelView::Get(), ChannelView::GetCumulativeHeight(), TrackListEvent::mpTrack, TrackListEvent::mType, TrackListEvent::PERMUTED, and TrackListEvent::RESIZING.

Here is the call graph for this function:

◆ operator=()

TrackPositioner & anonymous_namespace{ChannelView.cpp}::TrackPositioner::operator= ( const TrackPositioner )
delete

Member Data Documentation

◆ mProject

AudacityProject& anonymous_namespace{ChannelView.cpp}::TrackPositioner::mProject

Definition at line 255 of file ChannelView.cpp.

◆ mSubscription

Observer::Subscription anonymous_namespace{ChannelView.cpp}::TrackPositioner::mSubscription

Definition at line 295 of file ChannelView.cpp.


The documentation for this struct was generated from the following file: