Audacity  3.0.3
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PlayRegion Class Reference

#include <ViewInfo.h>

Inheritance diagram for PlayRegion:
[legend]
Collaboration diagram for PlayRegion:
[legend]

Public Member Functions

 PlayRegion ()=default
 
 PlayRegion (const PlayRegion &)=delete
 
PlayRegionoperator= (const PlayRegion &that)
 
bool Active () const
 
void SetActive (bool active)
 
bool Empty () const
 
double GetStart () const
 
double GetEnd () const
 
double GetLastActiveStart () const
 
double GetLastActiveEnd () const
 
void SetStart (double start)
 
void SetEnd (double end)
 
void SetTimes (double start, double end)
 
void SetAllTimes (double start, double end)
 
void Order ()
 

Private Member Functions

void Notify ()
 

Private Attributes

double mStart { -1.0 }
 
double mEnd { -1.0 }
 
double mLastActiveStart { -1.0 }
 
double mLastActiveEnd { -1.0 }
 
bool mActive { false }
 

Detailed Description

Definition at line 128 of file ViewInfo.h.

Constructor & Destructor Documentation

◆ PlayRegion() [1/2]

PlayRegion::PlayRegion ( )
default

◆ PlayRegion() [2/2]

PlayRegion::PlayRegion ( const PlayRegion )
delete

Member Function Documentation

◆ Active()

bool PlayRegion::Active ( ) const
inline

Definition at line 145 of file ViewInfo.h.

145 { return mActive; }

Referenced by AdornedRulerPanel::DoSelectionChange().

Here is the caller graph for this function:

◆ Empty()

bool PlayRegion::Empty ( ) const
inline

Definition at line 148 of file ViewInfo.h.

148 { return GetStart() == GetEnd(); }

◆ GetEnd()

double PlayRegion::GetEnd ( ) const
inline

Definition at line 156 of file ViewInfo.h.

157  {
158  if ( mStart < 0 )
159  return mEnd;
160  else
161  return std::max( mStart, mEnd );
162  }

Referenced by operator=().

Here is the caller graph for this function:

◆ GetLastActiveEnd()

double PlayRegion::GetLastActiveEnd ( ) const
inline

Definition at line 170 of file ViewInfo.h.

171  {
172  if ( mLastActiveStart < 0 )
173  return mLastActiveEnd;
174  else
175  return std::max( mLastActiveStart, mLastActiveEnd );
176  }

Referenced by operator=().

Here is the caller graph for this function:

◆ GetLastActiveStart()

double PlayRegion::GetLastActiveStart ( ) const
inline

Definition at line 163 of file ViewInfo.h.

164  {
165  if ( mLastActiveEnd < 0 )
166  return mLastActiveStart;
167  else
169  }

References min().

Referenced by operator=().

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

◆ GetStart()

double PlayRegion::GetStart ( ) const
inline

Definition at line 149 of file ViewInfo.h.

150  {
151  if ( mEnd < 0 )
152  return mStart;
153  else
154  return std::min( mStart, mEnd );
155  }

References min().

Referenced by SelectionBar::OnIdle(), TimeToolBar::OnIdle(), operator=(), and anonymous_namespace{TransportMenus.cpp}::PlayCurrentRegionAndWait().

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

◆ Notify()

void PlayRegion::Notify ( )
private

Definition at line 227 of file ViewInfo.cpp.

228 {
229  PlayRegionEvent evt{ EVT_PLAY_REGION_CHANGE, this };
230  ProcessEvent( evt );
231 }

Referenced by Order(), SetActive(), SetEnd(), SetStart(), and SetTimes().

Here is the caller graph for this function:

◆ operator=()

PlayRegion& PlayRegion::operator= ( const PlayRegion that)
inline

Definition at line 134 of file ViewInfo.h.

135  {
136  mActive = that.mActive;
137  // Guarantee the equivalent un-swapped order of endpoints
138  mStart = that.GetStart();
139  mEnd = that.GetEnd();
142  return *this;
143  }

References GetEnd(), GetLastActiveEnd(), GetLastActiveStart(), GetStart(), and mActive.

Here is the call graph for this function:

◆ Order()

void PlayRegion::Order ( )

Definition at line 217 of file ViewInfo.cpp.

218 {
219  if ( mStart >= 0 && mEnd >= 0 && mStart > mEnd) {
220  std::swap( mStart, mEnd );
221  if (mActive)
223  Notify();
224  }
225 }

References mActive, mEnd, mLastActiveEnd, mLastActiveStart, mStart, Notify(), and anonymous_namespace{NoteTrack.cpp}::swap().

Here is the call graph for this function:

◆ SetActive()

void PlayRegion::SetActive ( bool  active)

Definition at line 168 of file ViewInfo.cpp.

169 {
170  mActive = active;
171  if (mActive) {
172  // Restore values
176  Notify();
177  }
178  }
179 }

References mActive, mEnd, mLastActiveEnd, mLastActiveStart, mStart, and Notify().

Here is the call graph for this function:

◆ SetAllTimes()

void PlayRegion::SetAllTimes ( double  start,
double  end 
)

Definition at line 211 of file ViewInfo.cpp.

212 {
213  SetTimes(start, end);
214  mLastActiveStart = start, mLastActiveEnd = end;
215 }

References mLastActiveEnd, mLastActiveStart, and SetTimes().

Here is the call graph for this function:

◆ SetEnd()

void PlayRegion::SetEnd ( double  end)

Definition at line 191 of file ViewInfo.cpp.

192 {
193  if (mEnd != end) {
194  if (mActive)
195  mLastActiveEnd = end;
196  mEnd = end;
197  Notify();
198  }
199 }

References mActive, mEnd, mLastActiveEnd, and Notify().

Here is the call graph for this function:

◆ SetStart()

void PlayRegion::SetStart ( double  start)

Definition at line 181 of file ViewInfo.cpp.

182 {
183  if (mStart != start) {
184  if (mActive)
185  mLastActiveStart = start;
186  mStart = start;
187  Notify();
188  }
189 }

References mActive, mLastActiveStart, mStart, and Notify().

Here is the call graph for this function:

◆ SetTimes()

void PlayRegion::SetTimes ( double  start,
double  end 
)

Definition at line 201 of file ViewInfo.cpp.

202 {
203  if (mStart != start || mEnd != end) {
204  if (mActive)
205  mLastActiveStart = start, mLastActiveEnd = end;
206  mStart = start, mEnd = end;
207  Notify();
208  }
209 }

References mActive, mEnd, mLastActiveEnd, mLastActiveStart, mStart, and Notify().

Referenced by SetAllTimes().

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

Member Data Documentation

◆ mActive

bool PlayRegion::mActive { false }
private

Definition at line 195 of file ViewInfo.h.

Referenced by operator=(), Order(), SetActive(), SetEnd(), SetStart(), and SetTimes().

◆ mEnd

double PlayRegion::mEnd { -1.0 }
private

Definition at line 191 of file ViewInfo.h.

Referenced by Order(), SetActive(), SetEnd(), and SetTimes().

◆ mLastActiveEnd

double PlayRegion::mLastActiveEnd { -1.0 }
private

Definition at line 193 of file ViewInfo.h.

Referenced by Order(), SetActive(), SetAllTimes(), SetEnd(), and SetTimes().

◆ mLastActiveStart

double PlayRegion::mLastActiveStart { -1.0 }
private

Definition at line 192 of file ViewInfo.h.

Referenced by Order(), SetActive(), SetAllTimes(), SetStart(), and SetTimes().

◆ mStart

double PlayRegion::mStart { -1.0 }
private

Definition at line 190 of file ViewInfo.h.

Referenced by Order(), SetActive(), SetStart(), and SetTimes().


The documentation for this class was generated from the following files:
PlayRegion::GetLastActiveEnd
double GetLastActiveEnd() const
Definition: ViewInfo.h:170
PlayRegion::GetEnd
double GetEnd() const
Definition: ViewInfo.h:156
PlayRegion::GetStart
double GetStart() const
Definition: ViewInfo.h:149
PlayRegion::mEnd
double mEnd
Definition: ViewInfo.h:191
PlayRegion::mLastActiveStart
double mLastActiveStart
Definition: ViewInfo.h:192
PlayRegionEvent
Definition: ViewInfo.h:118
PlayRegion::mStart
double mStart
Definition: ViewInfo.h:190
PlayRegion::mLastActiveEnd
double mLastActiveEnd
Definition: ViewInfo.h:193
PlayRegion::SetTimes
void SetTimes(double start, double end)
Definition: ViewInfo.cpp:201
anonymous_namespace{NoteTrack.cpp}::swap
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:735
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
PlayRegion::GetLastActiveStart
double GetLastActiveStart() const
Definition: ViewInfo.h:163
PlayRegion::mActive
bool mActive
Definition: ViewInfo.h:195
PlayRegion::Notify
void Notify()
Definition: ViewInfo.cpp:227