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

Public Member Functions

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

Public Attributes

AudacityProjectmProject
 

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 179 of file TrackView.cpp.

Constructor & Destructor Documentation

◆ TrackPositioner() [1/2]

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

Definition at line 183 of file TrackView.cpp.

184  : mProject{ project }
185  {
186  TrackList::Get( project ).Bind(
187  EVT_TRACKLIST_ADDITION, &TrackPositioner::OnUpdate, this );
188  TrackList::Get( project ).Bind(
189  EVT_TRACKLIST_DELETION, &TrackPositioner::OnUpdate, this );
190  TrackList::Get( project ).Bind(
191  EVT_TRACKLIST_PERMUTED, &TrackPositioner::OnUpdate, this );
192  TrackList::Get( project ).Bind(
193  EVT_TRACKLIST_RESIZING, &TrackPositioner::OnUpdate, this );
194  }

◆ TrackPositioner() [2/2]

anonymous_namespace{TrackView.cpp}::TrackPositioner::TrackPositioner ( const TrackPositioner )

Member Function Documentation

◆ OnUpdate()

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

Definition at line 198 of file TrackView.cpp.

199  {
200  e.Skip();
201 
202  auto iter =
203  TrackList::Get( mProject ).Find( e.mpTrack.lock().get() );
204  if ( !*iter )
205  return;
206 
207  auto prev = iter;
208  auto yy = TrackView::GetCumulativeHeight( *--prev );
209 
210  while( auto pTrack = *iter ) {
211  auto &view = TrackView::Get( *pTrack );
212  view.SetCumulativeHeightBefore( yy );
213  yy += view.GetHeight();
214  ++iter;
215  }
216  }

References TrackList::Find(), TrackList::Get(), TrackView::Get(), TrackView::GetCumulativeHeight(), and TrackListEvent::mpTrack.

Here is the call graph for this function:

◆ operator=()

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

Member Data Documentation

◆ mProject

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

Definition at line 181 of file TrackView.cpp.


The documentation for this struct was generated from the following file:
anonymous_namespace{TrackView.cpp}::TrackPositioner::OnUpdate
void OnUpdate(TrackListEvent &e)
Definition: TrackView.cpp:198
TrackView::Get
static TrackView & Get(Track &)
Definition: TrackView.cpp:63
TrackView::GetCumulativeHeight
static int GetCumulativeHeight(const Track *pTrack)
Definition: TrackView.cpp:39
TrackList::Find
auto Find(Track *pTrack) -> TrackIter< TrackType >
Turn a pointer into a TrackIter (constant time); get end iterator if this does not own the track.
Definition: Track.h:1333
anonymous_namespace{TrackView.cpp}::TrackPositioner::mProject
AudacityProject & mProject
Definition: TrackView.cpp:181
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:506
TrackListEvent::mpTrack
std::weak_ptr< Track > mpTrack
Definition: Track.h:1238