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
 
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
 
int mWidth { 0 }
 
int mVRulerWidth { 36 }
 

Protected Attributes

double zoom
 

Detailed Description

Definition at line 41 of file ZoomInfo.h.

Member Typedef Documentation

◆ Intervals

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

Definition at line 140 of file ZoomInfo.h.

Member Enumeration Documentation

◆ FisheyeState

Enumerator
HIDDEN 
PINNED 
NUM_STATES 

Definition at line 152 of file ZoomInfo.h.

152 {
153 HIDDEN,
154 PINNED,
155
157 };
@ PINNED
Definition: ZoomInfo.h:154
@ HIDDEN
Definition: ZoomInfo.h:153
@ NUM_STATES
Definition: ZoomInfo.h:156

Constructor & Destructor Documentation

◆ ZoomInfo() [1/2]

ZoomInfo::ZoomInfo ( double  start,
double  pixelsPerSecond 
)

Definition at line 20 of file ZoomInfo.cpp.

21 : vpos(0)
22 , h(start)
23 , zoom(pixelsPerSecond)
24{
25}
double zoom
Definition: ZoomInfo.h:59
double h
Definition: ZoomInfo.h:56
int vpos
Definition: ZoomInfo.h:54

◆ ~ZoomInfo()

ZoomInfo::~ZoomInfo ( )

Definition at line 27 of file ZoomInfo.cpp.

28{
29}

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

104{
105 results.clear();
106 results.reserve(2);
107
108 const wxInt64 rightmost(origin + (0.5 + width));
109 wxASSERT(origin <= rightmost);
110 {
111 results.push_back(Interval(origin, zoom, false));
112 }
113
114 if (origin < rightmost)
115 results.push_back(Interval(rightmost, 0, false));
116 wxASSERT(!results.empty() && results[0].position == origin);
117}

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

118 { 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 168 of file ZoomInfo.h.

169 {return 0;} // stub

◆ GetFisheyeRightBoundary()

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

Definition at line 171 of file ZoomInfo.h.

172 {return 0;} // stub

◆ GetFisheyeState()

FisheyeState ZoomInfo::GetFisheyeState ( ) const
inline

Definition at line 158 of file ZoomInfo.h.

159 { return HIDDEN; } // stub

◆ GetLeftOffset()

int ZoomInfo::GetLeftOffset ( ) const
inline

Definition at line 97 of file ZoomInfo.h.

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

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

76{ return gMaxZoom;};
static const double gMaxZoom
Definition: ZoomInfo.cpp:16

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

77{ return gMinZoom;};
static const double gMinZoom
Definition: ZoomInfo.cpp:17

References anonymous_namespace{ZoomInfo.cpp}::gMinZoom.

◆ GetScreenEndTime()

double ZoomInfo::GetScreenEndTime ( ) const
inline

Definition at line 108 of file ZoomInfo.h.

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

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

Here is the caller graph for this function:

◆ GetTracksUsableWidth()

int ZoomInfo::GetTracksUsableWidth ( ) const
inline

Definition at line 100 of file ZoomInfo.h.

101 {
102 return
103 std::max( 0, GetWidth() - ( GetLeftOffset() + kRightMargin ) );
104 }
@ kRightMargin
Definition: ZoomInfo.h:33
int GetWidth() const
Definition: ZoomInfo.h:89
int GetLeftOffset() const
Definition: ZoomInfo.h:97

References kRightMargin.

◆ GetVRulerOffset()

int ZoomInfo::GetVRulerOffset ( ) const
inline

Definition at line 94 of file ZoomInfo.h.

94{ return kTrackInfoWidth + kLeftMargin; }
@ kTrackInfoWidth
Definition: ZoomInfo.h:35
@ kLeftMargin
Definition: ZoomInfo.h:32

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

92{ return mVRulerWidth; }
int mVRulerWidth
Definition: ZoomInfo.h:175

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

Here is the caller graph for this function:

◆ GetWidth()

int ZoomInfo::GetWidth ( ) const
inline

Definition at line 89 of file ZoomInfo.h.

89{ return mWidth; }
int mWidth
Definition: ZoomInfo.h:174

◆ GetZoom()

double ZoomInfo::GetZoom ( ) const

Definition at line 75 of file ZoomInfo.cpp.

75{ return zoom;};

References zoom.

◆ InFisheye()

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

Definition at line 163 of file ZoomInfo.h.

164 {return false;} // stub

◆ OffsetTimeByPixels()

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

Definition at line 84 of file ZoomInfo.h.

85 {
86 return PositionToTime(offset + TimeToPosition(time, ignoreFisheye), ignoreFisheye);
87 }
wxInt64 TimeToPosition(double time, wxInt64 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 )

◆ PositionToTime()

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

◆ SetVRulerWidth()

void ZoomInfo::SetVRulerWidth ( int  width)
inline

Definition at line 93 of file ZoomInfo.h.

93{ mVRulerWidth = width; }

Referenced by TrackPanel::UpdateVRulerSize().

Here is the caller graph for this function:

◆ SetWidth()

void ZoomInfo::SetWidth ( int  width)
inline

Definition at line 90 of file ZoomInfo.h.

90{ mWidth = width; }

Referenced by TrackPanel::OnSize().

Here is the caller graph for this function:

◆ SetZoom()

void ZoomInfo::SetZoom ( double  pixelsPerSecond)

Definition at line 79 of file ZoomInfo.cpp.

80{
81 zoom = std::max(gMinZoom, std::min(gMaxZoom, pixelsPerSecond));
82// DA: Avoids stuck in snap-to
83#ifdef EXPERIMENTAL_DA
84 // Disable snapping if user zooms in a long way.
85 // Helps stop users be trapped in snap-to.
86 // The level chosen is in sample viewing range with samples
87 // still quite close together.
88 if( zoom > (gMaxZoom * 0.06 ))
89 {
91 if( project )
92 project->OnSnapToOff();
93 }
94#endif
95}
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:90

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

61{
62 return timeRange * zoom;
63}

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

48{
49 double t = 0.5 + zoom * (projectTime - h) + origin ;
50 if( t < wxINT64_MIN )
51 return wxINT64_MIN;
52 if( t > wxINT64_MAX )
53 return wxINT64_MAX;
54 t = floor( t );
55 return t;
56}

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:

◆ ZoomBy()

void ZoomInfo::ZoomBy ( double  multiplier)

Definition at line 97 of file ZoomInfo.cpp.

98{
99 SetZoom(zoom * multiplier);
100}
void SetZoom(double pixelsPerSecond)
Definition: ZoomInfo.cpp:79

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

◆ h

double ZoomInfo::h

◆ mVRulerWidth

int ZoomInfo::mVRulerWidth { 36 }

Definition at line 175 of file ZoomInfo.h.

◆ mWidth

int ZoomInfo::mWidth { 0 }

Definition at line 174 of file ZoomInfo.h.

◆ vpos

int ZoomInfo::vpos

◆ zoom

double ZoomInfo::zoom
protected

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