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]
Collaboration diagram for ZoomInfo:
[legend]

Classes

struct  Interval
 

Public Types

enum  FisheyeState { HIDDEN , PINNED , NUM_STATES }
 
typedef std::vector< IntervalIntervals
 

Public Member Functions

 ZoomInfo (double start, double pixelsPerSecond)
 
 ~ZoomInfo ()
 
 ZoomInfo (const ZoomInfo &) PROHIBITED
 
ZoomInfooperator= (const ZoomInfo &) PROHIBITED
 
void UpdatePrefs () override
 
double PositionToTime (wxInt64 position, wxInt64 origin=0, bool ignoreFisheye=false) const
 
wxInt64 TimeToPosition (double time, wxInt64 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, wxInt64 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
 
void ZoomBy (double multiplier)
 
void FindIntervals (double rate, Intervals &results, wxInt64 width, wxInt64 origin=0) const
 
FisheyeState GetFisheyeState () const
 
bool InFisheye (wxInt64, wxInt64 WXUNUSED(origin=0)) const
 
wxInt64 GetFisheyeLeftBoundary (wxInt64 WXUNUSED(origin=0)) const
 
wxInt64 GetFisheyeRightBoundary (wxInt64 WXUNUSED(origin=0)) const
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

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

Public Attributes

int vpos
 
double h
 
float dBr
 
int mWidth { 0 }
 
int mVRulerWidth { 36 }
 

Protected Attributes

double zoom
 

Additional Inherited Members

- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
- Static Protected Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Detailed Description

Definition at line 42 of file ZoomInfo.h.

Member Typedef Documentation

◆ Intervals

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

Definition at line 146 of file ZoomInfo.h.

Member Enumeration Documentation

◆ FisheyeState

Enumerator
HIDDEN 
PINNED 
NUM_STATES 

Definition at line 158 of file ZoomInfo.h.

158 {
159 HIDDEN,
160 PINNED,
161
163 };
@ PINNED
Definition: ZoomInfo.h:160
@ HIDDEN
Definition: ZoomInfo.h:159
@ NUM_STATES
Definition: ZoomInfo.h:162

Constructor & Destructor Documentation

◆ ZoomInfo() [1/2]

ZoomInfo::ZoomInfo ( double  start,
double  pixelsPerSecond 
)

Definition at line 21 of file ZoomInfo.cpp.

22 : vpos(0)
23 , h(start)
24 , zoom(pixelsPerSecond)
25{
27}
double zoom
Definition: ZoomInfo.h:63
void UpdatePrefs() override
Definition: ZoomInfo.cpp:33
double h
Definition: ZoomInfo.h:60
int vpos
Definition: ZoomInfo.h:58

References UpdatePrefs().

Here is the call graph for this function:

◆ ~ZoomInfo()

ZoomInfo::~ZoomInfo ( )

Definition at line 29 of file ZoomInfo.cpp.

30{
31}

◆ ZoomInfo() [2/2]

ZoomInfo::ZoomInfo ( const ZoomInfo )

Member Function Documentation

◆ FindIntervals()

void ZoomInfo::FindIntervals ( double  rate,
Intervals results,
wxInt64  width,
wxInt64  origin = 0 
) const

Definition at line 109 of file ZoomInfo.cpp.

111{
112 results.clear();
113 results.reserve(2);
114
115 const wxInt64 rightmost(origin + (0.5 + width));
116 wxASSERT(origin <= rightmost);
117 {
118 results.push_back(Interval(origin, zoom, false));
119 }
120
121 if (origin < rightmost)
122 results.push_back(Interval(rightmost, 0, false));
123 wxASSERT(!results.empty() && results[0].position == origin);
124}

References zoom.

Referenced by anonymous_namespace{WaveformView.cpp}::FindWavePortions(), and anonymous_namespace{SampleHandle.cpp}::SampleResolutionTest().

Here is the caller graph for this function:

◆ GetDefaultZoom()

static double ZoomInfo::GetDefaultZoom ( )
inlinestatic

Definition at line 123 of file ZoomInfo.h.

124 { return 44100.0 / 512.0; }

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

Here is the caller graph for this function:

◆ GetFisheyeLeftBoundary()

wxInt64 ZoomInfo::GetFisheyeLeftBoundary ( wxInt64   WXUNUSEDorigin=0) const
inline

Definition at line 174 of file ZoomInfo.h.

175 {return 0;} // stub

◆ GetFisheyeRightBoundary()

wxInt64 ZoomInfo::GetFisheyeRightBoundary ( wxInt64   WXUNUSEDorigin=0) const
inline

Definition at line 177 of file ZoomInfo.h.

178 {return 0;} // stub

◆ GetFisheyeState()

FisheyeState ZoomInfo::GetFisheyeState ( ) const
inline

Definition at line 164 of file ZoomInfo.h.

165 { return HIDDEN; } // stub

◆ GetLeftOffset()

int ZoomInfo::GetLeftOffset ( ) const
inline

Definition at line 103 of file ZoomInfo.h.

104 { return GetVRulerOffset() + GetVRulerWidth() + 1; }
int GetVRulerOffset() const
Definition: ZoomInfo.h:100
int GetVRulerWidth() const
Definition: ZoomInfo.h:98

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 83 of file ZoomInfo.cpp.

83{ return gMaxZoom;};
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 84 of file ZoomInfo.cpp.

84{ 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 114 of file ZoomInfo.h.

115 {
116 auto width = GetTracksUsableWidth();
117 return PositionToTime(width, 0, true);
118 }
double PositionToTime(wxInt64 position, wxInt64 origin=0, bool ignoreFisheye=false) const
Definition: ZoomInfo.cpp:41
int GetTracksUsableWidth() const
Definition: ZoomInfo.h:106

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

Here is the caller graph for this function:

◆ GetTracksUsableWidth()

int ZoomInfo::GetTracksUsableWidth ( ) const
inline

Definition at line 106 of file ZoomInfo.h.

107 {
108 return
109 std::max( 0, GetWidth() - ( GetLeftOffset() + kRightMargin ) );
110 }
@ kRightMargin
Definition: ZoomInfo.h:34
int GetWidth() const
Definition: ZoomInfo.h:95
int GetLeftOffset() const
Definition: ZoomInfo.h:103

References kRightMargin.

◆ GetVRulerOffset()

int ZoomInfo::GetVRulerOffset ( ) const
inline

Definition at line 100 of file ZoomInfo.h.

100{ return kTrackInfoWidth + kLeftMargin; }
@ kTrackInfoWidth
Definition: ZoomInfo.h:36
@ kLeftMargin
Definition: ZoomInfo.h:33

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 98 of file ZoomInfo.h.

98{ return mVRulerWidth; }
int mVRulerWidth
Definition: ZoomInfo.h:181

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

Here is the caller graph for this function:

◆ GetWidth()

int ZoomInfo::GetWidth ( ) const
inline

Definition at line 95 of file ZoomInfo.h.

95{ return mWidth; }
int mWidth
Definition: ZoomInfo.h:180

◆ GetZoom()

double ZoomInfo::GetZoom ( ) const

Definition at line 82 of file ZoomInfo.cpp.

82{ return zoom;};

References zoom.

◆ InFisheye()

bool ZoomInfo::InFisheye ( wxInt64  ,
wxInt64   WXUNUSEDorigin=0 
) const
inline

Definition at line 169 of file ZoomInfo.h.

170 {return false;} // stub

◆ OffsetTimeByPixels()

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

Definition at line 90 of file ZoomInfo.h.

91 {
92 return PositionToTime(offset + TimeToPosition(time, ignoreFisheye), ignoreFisheye);
93 }
wxInt64 TimeToPosition(double time, wxInt64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
Definition: ZoomInfo.cpp:51

◆ operator=()

ZoomInfo & ZoomInfo::operator= ( const ZoomInfo )

◆ PositionToTime()

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

◆ SetVRulerWidth()

void ZoomInfo::SetVRulerWidth ( int  width)
inline

Definition at line 99 of file ZoomInfo.h.

99{ mVRulerWidth = width; }

Referenced by TrackPanel::UpdateVRulerSize().

Here is the caller graph for this function:

◆ SetWidth()

void ZoomInfo::SetWidth ( int  width)
inline

Definition at line 96 of file ZoomInfo.h.

96{ mWidth = width; }

Referenced by TrackPanel::OnSize().

Here is the caller graph for this function:

◆ SetZoom()

void ZoomInfo::SetZoom ( double  pixelsPerSecond)

Definition at line 86 of file ZoomInfo.cpp.

87{
88 zoom = std::max(gMinZoom, std::min(gMaxZoom, pixelsPerSecond));
89// DA: Avoids stuck in snap-to
90#ifdef EXPERIMENTAL_DA
91 // Disable snapping if user zooms in a long way.
92 // Helps stop users be trapped in snap-to.
93 // The level chosen is in sample viewing range with samples
94 // still quite close together.
95 if( zoom > (gMaxZoom * 0.06 ))
96 {
98 if( project )
99 project->OnSnapToOff();
100 }
101#endif
102}
AUDACITY_DLL_API std::weak_ptr< AudacityProject > GetActiveProject()
int min(int a, int b)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89

References GetActiveProject(), 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 67 of file ZoomInfo.cpp.

68{
69 return timeRange * zoom;
70}

References zoom.

◆ TimeToPosition()

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

STM: Converts a project time to screen x position.

Definition at line 51 of file ZoomInfo.cpp.

55{
56 double t = 0.5 + zoom * (projectTime - h) + origin ;
57 if( t < wxINT64_MIN )
58 return wxINT64_MIN;
59 if( t > wxINT64_MAX )
60 return wxINT64_MAX;
61 t = floor( t );
62 return t;
63}

References h, and zoom.

Referenced by anonymous_namespace{SelectHandle.cpp}::ChooseTimeBoundary(), ClipParameters::ClipParameters(), LabelTrackView::ComputeLayout(), LabelTrackView::DialogForLabelName(), anonymous_namespace{TimeShiftHandle.cpp}::FindDesiredSlideAmount(), ClipParameters::GetClipRect(), LabelGlyphHandle::HandleGlyphClick(), EnvelopeEditor::HandleMouseButtonDown(), anonymous_namespace{CutlineHandle.cpp}::IsOverCutline(), SnapManager::PixelDiff(), anonymous_namespace{SampleHandle.cpp}::SampleResolutionTest(), SnapManager::Snap(), and AdornedRulerPanel::Time2Pos().

Here is the caller graph for this function:

◆ UpdatePrefs()

void ZoomInfo::UpdatePrefs ( )
overridevirtual

Implements PrefsListener.

Definition at line 33 of file ZoomInfo.cpp.

34{
36}
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
Definition: Decibels.cpp:12
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:200
float dBr
Definition: ZoomInfo.h:66

References dBr, DecibelScaleCutoff, and Setting< T >::Read().

Referenced by ViewInfo::UpdatePrefs(), and ZoomInfo().

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

◆ ZoomBy()

void ZoomInfo::ZoomBy ( double  multiplier)

Definition at line 104 of file ZoomInfo.cpp.

105{
106 SetZoom(zoom * multiplier);
107}
void SetZoom(double pixelsPerSecond)
Definition: ZoomInfo.cpp:86

References SetZoom(), and zoom.

Here is the call graph for this function:

◆ ZoomInAvailable()

bool ZoomInfo::ZoomInAvailable ( ) const

Definition at line 72 of file ZoomInfo.cpp.

73{
74 return zoom < gMaxZoom;
75}

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 77 of file ZoomInfo.cpp.

78{
79 return zoom > gMinZoom;
80}

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

Referenced by ZoomOutAvailableFlag().

Here is the caller graph for this function:

Member Data Documentation

◆ dBr

float ZoomInfo::dBr

Definition at line 66 of file ZoomInfo.h.

Referenced by UpdatePrefs().

◆ h

double ZoomInfo::h

◆ mVRulerWidth

int ZoomInfo::mVRulerWidth { 36 }

Definition at line 181 of file ZoomInfo.h.

◆ mWidth

int ZoomInfo::mWidth { 0 }

Definition at line 180 of file ZoomInfo.h.

◆ vpos

int ZoomInfo::vpos

◆ zoom

double ZoomInfo::zoom
protected

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