Audacity 3.2.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
ZoomInfo Class Reference

#include <ZoomInfo.h>

Inheritance diagram for ZoomInfo:
[legend]

Classes

struct  Interval
 

Public Types

enum  FisheyeState { HIDDEN , PINNED , NUM_STATES }
 
using int64 = std::int64_t
 
typedef std::vector< IntervalIntervals
 

Public Member Functions

 ZoomInfo (double start, double pixelsPerSecond)
 
 ~ZoomInfo ()
 
 ZoomInfo (const ZoomInfo &)=delete
 
ZoomInfooperator= (const ZoomInfo &)=delete
 
double PositionToTime (int64 position, int64 origin=0, bool ignoreFisheye=false) const
 
int64 TimeToPosition (double time, int64 origin=0, bool ignoreFisheye=false) const
 STM: Converts a project time to screen x position. More...
 
double TimeRangeToPixelWidth (double timeRange) const
 
double OffsetTimeByPixels (double time, int64 offset, bool ignoreFisheye=false) const
 
int GetWidth () const
 
void SetWidth (int width)
 
int GetVRulerWidth () const
 
void SetVRulerWidth (int width)
 
int GetVRulerOffset () const
 
int GetLeftOffset () const
 
int GetTracksUsableWidth () const
 
double GetScreenEndTime () const
 
bool ZoomInAvailable () const
 
bool ZoomOutAvailable () const
 
void SetZoom (double pixelsPerSecond)
 
double GetZoom () const
 
double GetAbsoluteOffset (double offset) const
 
void ZoomBy (double multiplier)
 
Intervals FindIntervals (int64 width, int64 origin=0) const
 
FisheyeState GetFisheyeState () const
 
bool InFisheye (int64, int64=0) const
 
int64 GetFisheyeLeftBoundary (int64=0) const
 
int64 GetFisheyeRightBoundary (int64=0) const
 

Static Public Member Functions

static double GetDefaultZoom ()
 
static double GetMaxZoom ()
 
static double GetMinZoom ()
 

Public Attributes

double hpos
 Leftmost visible timeline position in seconds. More...
 
int mWidth { 0 }
 
int mVRulerWidth { 36 }
 

Protected Attributes

double zoom
 pixels per second More...
 

Detailed Description

Definition at line 36 of file ZoomInfo.h.

Member Typedef Documentation

◆ int64

using ZoomInfo::int64 = std::int64_t

Definition at line 41 of file ZoomInfo.h.

◆ Intervals

typedef std::vector<Interval> ZoomInfo::Intervals

Definition at line 144 of file ZoomInfo.h.

Member Enumeration Documentation

◆ FisheyeState

Enumerator
HIDDEN 
PINNED 
NUM_STATES 

Definition at line 155 of file ZoomInfo.h.

155 {
156 HIDDEN,
157 PINNED,
158
160 };
@ PINNED
Definition: ZoomInfo.h:157
@ HIDDEN
Definition: ZoomInfo.h:156
@ NUM_STATES
Definition: ZoomInfo.h:159

Constructor & Destructor Documentation

◆ ZoomInfo() [1/2]

ZoomInfo::ZoomInfo ( double  start,
double  pixelsPerSecond 
)
Parameters
startleftmost visible timeline position, in seconds

Definition at line 21 of file ZoomInfo.cpp.

22 : hpos{ start }
23 , zoom{ pixelsPerSecond }
24{
25}
double zoom
pixels per second
Definition: ZoomInfo.h:58
double hpos
Leftmost visible timeline position in seconds.
Definition: ZoomInfo.h:54

◆ ~ZoomInfo()

ZoomInfo::~ZoomInfo ( )

Definition at line 27 of file ZoomInfo.cpp.

28{
29}

◆ ZoomInfo() [2/2]

ZoomInfo::ZoomInfo ( const ZoomInfo )
delete

Member Function Documentation

◆ FindIntervals()

ZoomInfo::Intervals ZoomInfo::FindIntervals ( int64  width,
int64  origin = 0 
) const

Definition at line 99 of file ZoomInfo.cpp.

100{
101 ZoomInfo::Intervals results;
102 results.reserve(2);
103
104 const int64 rightmost(origin + (0.5 + width));
105 assert(origin <= rightmost);
106 {
107 results.push_back(Interval(origin, zoom, false));
108 }
109
110 if (origin < rightmost)
111 results.push_back(Interval(rightmost, 0, false));
112 assert(!results.empty() && results[0].position == origin);
113 return results;
114}
std::vector< Interval > Intervals
Definition: ZoomInfo.h:144
std::int64_t int64
Definition: ZoomInfo.h:41

References zoom.

Referenced by anonymous_namespace{WaveformView.cpp}::FindWavePortions().

Here is the caller graph for this function:

◆ GetAbsoluteOffset()

double ZoomInfo::GetAbsoluteOffset ( double  offset) const

Get the absolute pixel offset, that corresponds to an offset on time line. This function effectively return std::floor(0.5 + h * zoom + offset)

Definition at line 77 of file ZoomInfo.cpp.

78{
79 return std::floor(0.5 + hpos * zoom + offset);
80}

References hpos, and zoom.

Referenced by anonymous_namespace{TrackArt.cpp}::BeatsGridlinePainter::GetBoundaries().

Here is the caller graph for this function:

◆ GetDefaultZoom()

static double ZoomInfo::GetDefaultZoom ( )
inlinestatic

Definition at line 116 of file ZoomInfo.h.

117 { return 44100.0 / 512.0; }

Referenced by anonymous_namespace{ViewMenus.cpp}::GetZoomOfPreset(), anonymous_namespace{ViewMenus.cpp}::OnZoomNormal(), ZoomHandle::Release(), TEST_CASE(), and TrackPanel::UpdateViewIfNoTracks().

Here is the caller graph for this function:

◆ GetFisheyeLeftBoundary()

int64 ZoomInfo::GetFisheyeLeftBoundary ( int64  = 0) const
inline

Definition at line 171 of file ZoomInfo.h.

172 {return 0;} // stub

◆ GetFisheyeRightBoundary()

int64 ZoomInfo::GetFisheyeRightBoundary ( int64  = 0) const
inline

Definition at line 174 of file ZoomInfo.h.

175 {return 0;} // stub

◆ GetFisheyeState()

FisheyeState ZoomInfo::GetFisheyeState ( ) const
inline

Definition at line 161 of file ZoomInfo.h.

162 { return HIDDEN; } // stub

◆ GetLeftOffset()

int ZoomInfo::GetLeftOffset ( ) const
inline

Definition at line 96 of file ZoomInfo.h.

97 { return GetVRulerOffset() + GetVRulerWidth() + 1; }
int GetVRulerOffset() const
Definition: ZoomInfo.h:93
int GetVRulerWidth() const
Definition: ZoomInfo.h:91

Referenced by LabelTrackView::DialogForLabelName(), TrackPanel::GetMostRecentXPos(), and TrackPanel::UpdateVRulerSize().

Here is the caller graph for this function:

◆ GetMaxZoom()

double ZoomInfo::GetMaxZoom ( )
static

Definition at line 82 of file ZoomInfo.cpp.

83{
84 return gMaxZoom;
85};
static const double gMaxZoom
Definition: ZoomInfo.cpp:17

References anonymous_namespace{ZoomInfo.cpp}::gMaxZoom.

Referenced by anonymous_namespace{ViewMenus.cpp}::GetZoomOfPreset().

Here is the caller graph for this function:

◆ GetMinZoom()

double ZoomInfo::GetMinZoom ( )
static

Definition at line 86 of file ZoomInfo.cpp.

86{ return gMinZoom;};
static const double gMinZoom
Definition: ZoomInfo.cpp:18

References anonymous_namespace{ZoomInfo.cpp}::gMinZoom.

◆ GetScreenEndTime()

double ZoomInfo::GetScreenEndTime ( ) const
inline

Definition at line 107 of file ZoomInfo.h.

108 {
109 auto width = GetTracksUsableWidth();
110 return PositionToTime(width, 0, true);
111 }
double PositionToTime(int64 position, int64 origin=0, bool ignoreFisheye=false) const
Definition: ZoomInfo.cpp:34
int GetTracksUsableWidth() const
Definition: ZoomInfo.h:99

Referenced by TrackPanel::HandlePageDownKey(), and TrackPanel::HandlePageUpKey().

Here is the caller graph for this function:

◆ GetTracksUsableWidth()

int ZoomInfo::GetTracksUsableWidth ( ) const
inline

Definition at line 99 of file ZoomInfo.h.

100 {
101 return
102 std::max( 0, GetWidth() - ( GetLeftOffset() + kRightMargin ) );
103 }
@ kRightMargin
Definition: ZoomInfo.h:28
int GetWidth() const
Definition: ZoomInfo.h:88
int GetLeftOffset() const
Definition: ZoomInfo.h:96

References kRightMargin.

◆ GetVRulerOffset()

int ZoomInfo::GetVRulerOffset ( ) const
inline

Definition at line 93 of file ZoomInfo.h.

93{ return kTrackInfoWidth + kLeftMargin; }
@ kTrackInfoWidth
Definition: ZoomInfo.h:30
@ kLeftMargin
Definition: ZoomInfo.h:27

References kLeftMargin, and kTrackInfoWidth.

Referenced by TrackPanel::UpdateTrackVRuler().

Here is the caller graph for this function:

◆ GetVRulerWidth()

int ZoomInfo::GetVRulerWidth ( ) const
inline

Definition at line 91 of file ZoomInfo.h.

91{ return mVRulerWidth; }
int mVRulerWidth
Definition: ZoomInfo.h:178

Referenced by TrackPanel::UpdateTrackVRuler(), and TrackPanel::UpdateVRulerSize().

Here is the caller graph for this function:

◆ GetWidth()

int ZoomInfo::GetWidth ( ) const
inline

Definition at line 88 of file ZoomInfo.h.

88{ return mWidth; }
int mWidth
Definition: ZoomInfo.h:177

◆ GetZoom()

double ZoomInfo::GetZoom ( ) const

Definition at line 75 of file ZoomInfo.cpp.

75{ return zoom;};

References zoom.

Referenced by GraphicsDataCacheBase::PerformBaseLookup().

Here is the caller graph for this function:

◆ InFisheye()

bool ZoomInfo::InFisheye ( int64  ,
int64  = 0 
) const
inline

Definition at line 166 of file ZoomInfo.h.

167 {return false;} // stub

◆ OffsetTimeByPixels()

double ZoomInfo::OffsetTimeByPixels ( double  time,
int64  offset,
bool  ignoreFisheye = false 
) const
inline

Definition at line 83 of file ZoomInfo.h.

84 {
85 return PositionToTime(offset + TimeToPosition(time, ignoreFisheye), ignoreFisheye);
86 }
int64 TimeToPosition(double time, int64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
Definition: ZoomInfo.cpp:44

◆ operator=()

ZoomInfo & ZoomInfo::operator= ( const ZoomInfo )
delete

◆ PositionToTime()

double ZoomInfo::PositionToTime ( int64  position,
int64  origin = 0,
bool  ignoreFisheye = false 
) const

◆ SetVRulerWidth()

void ZoomInfo::SetVRulerWidth ( int  width)
inline

Definition at line 92 of file ZoomInfo.h.

92{ mVRulerWidth = width; }

Referenced by TrackPanel::UpdateVRulerSize().

Here is the caller graph for this function:

◆ SetWidth()

void ZoomInfo::SetWidth ( int  width)
inline

Definition at line 89 of file ZoomInfo.h.

89{ mWidth = width; }

Referenced by TrackPanel::OnSize().

Here is the caller graph for this function:

◆ SetZoom()

void ZoomInfo::SetZoom ( double  pixelsPerSecond)

Definition at line 88 of file ZoomInfo.cpp.

89{
90 zoom = std::max(gMinZoom, std::min(gMaxZoom, pixelsPerSecond));
91}
int min(int a, int b)

References anonymous_namespace{ZoomInfo.cpp}::gMaxZoom, anonymous_namespace{ZoomInfo.cpp}::gMinZoom, min(), and zoom.

Referenced by TrackPanel::UpdateViewIfNoTracks(), and ZoomBy().

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

◆ TimeRangeToPixelWidth()

double ZoomInfo::TimeRangeToPixelWidth ( double  timeRange) const

Definition at line 60 of file ZoomInfo.cpp.

61{
62 return timeRange * zoom;
63}

References zoom.

Referenced by anonymous_namespace{TrackArt.cpp}::BeatsGridlinePainter::GetMinorTick().

Here is the caller graph for this function:

◆ TimeToPosition()

auto ZoomInfo::TimeToPosition ( double  time,
int64  origin = 0,
bool  ignoreFisheye = false 
) const

◆ ZoomBy()

void ZoomInfo::ZoomBy ( double  multiplier)

Definition at line 93 of file ZoomInfo.cpp.

94{
95 SetZoom(zoom * multiplier);
96}
void SetZoom(double pixelsPerSecond)
Definition: ZoomInfo.cpp:88

References SetZoom(), and zoom.

Here is the call graph for this function:

◆ ZoomInAvailable()

bool ZoomInfo::ZoomInAvailable ( ) const

Definition at line 65 of file ZoomInfo.cpp.

66{
67 return zoom < gMaxZoom;
68}

References anonymous_namespace{ZoomInfo.cpp}::gMaxZoom, and zoom.

Referenced by ZoomInAvailableFlag().

Here is the caller graph for this function:

◆ ZoomOutAvailable()

bool ZoomInfo::ZoomOutAvailable ( ) const

Definition at line 70 of file ZoomInfo.cpp.

71{
72 return zoom > gMinZoom;
73}

References anonymous_namespace{ZoomInfo.cpp}::gMinZoom, and zoom.

Referenced by ZoomOutAvailableFlag().

Here is the caller graph for this function:

Member Data Documentation

◆ hpos

double ZoomInfo::hpos

◆ mVRulerWidth

int ZoomInfo::mVRulerWidth { 36 }

Definition at line 178 of file ZoomInfo.h.

◆ mWidth

int ZoomInfo::mWidth { 0 }

Definition at line 177 of file ZoomInfo.h.

◆ zoom

double ZoomInfo::zoom
protected

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