Audacity 3.2.0
Typedefs | Functions
WaveTrackVZoomHandle Namespace Reference

Typedefs

using Result = unsigned
 
using DoZoomFunction = void(*)(AudacityProject *pProject, WaveTrack *pTrack, WaveTrackViewConstants::ZoomActions ZoomKind, const wxRect &rect, int zoomStart, int zoomEnd, bool fixedMousePoint)
 

Functions

AUDACITY_DLL_API HitTestPreview HitPreview (const wxMouseState &state)
 
AUDACITY_DLL_API bool IsDragZooming (int zoomStart, int zoomEnd)
 
AUDACITY_DLL_API Result DoDrag (const TrackPanelMouseEvent &event, AudacityProject *pProject, int zoomStart, int &zoomEnd)
 
AUDACITY_DLL_API Result DoRelease (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent, WaveTrack *pTrack, const wxRect &mRect, DoZoomFunction doZoom, PopupMenuTable &table, int zoomStart, int zoomEnd)
 
AUDACITY_DLL_API void DoDraw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass, int zoomStart, int zoomEnd)
 
AUDACITY_DLL_API wxRect DoDrawingArea (const wxRect &rect, const wxRect &panelRect, unsigned iPass)
 

Typedef Documentation

◆ DoZoomFunction

using WaveTrackVZoomHandle::DoZoomFunction = typedef void (*)( AudacityProject *pProject, WaveTrack *pTrack, WaveTrackViewConstants::ZoomActions ZoomKind, const wxRect &rect, int zoomStart, int zoomEnd, bool fixedMousePoint)

Definition at line 32 of file WaveTrackVZoomHandle.h.

◆ Result

using WaveTrackVZoomHandle::Result = typedef unsigned

Definition at line 24 of file WaveTrackVZoomHandle.h.

Function Documentation

◆ DoDrag()

UIHandle::Result WaveTrackVZoomHandle::DoDrag ( const TrackPanelMouseEvent event,
AudacityProject pProject,
int  zoomStart,
int &  zoomEnd 
)

Definition at line 82 of file WaveTrackVZoomHandle.cpp.

85{
86 using namespace RefreshCode;
87
88 const wxMouseEvent &event = evt.event;
89 if ( event.RightIsDown() )
90 return RefreshNone;
91 zoomEnd = event.m_y;
92 if (IsDragZooming( zoomStart, zoomEnd ))
93 return RefreshAll;
94 return RefreshNone;
95}
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16
bool IsDragZooming(int zoomStart, int zoomEnd)

References TrackPanelMouseEvent::event, anonymous_namespace{NoteTrackVZoomHandle.cpp}::IsDragZooming(), RefreshCode::RefreshAll, and RefreshCode::RefreshNone.

Referenced by SpectrumVZoomHandle::Drag(), and WaveformVZoomHandle::Drag().

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

◆ DoDraw()

void WaveTrackVZoomHandle::DoDraw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass,
int  zoomStart,
int  zoomEnd 
)

Definition at line 150 of file WaveTrackVZoomHandle.cpp.

153{
154 if ( iPass == TrackArtist::PassZooming ) {
155 if ( IsDragZooming( zoomStart, zoomEnd ) )
157 ( context, rect, zoomStart, zoomEnd );
158 }
159}
static void DrawZooming(TrackPanelDrawingContext &context, const wxRect &rect, int zoomStart, int zoomEnd)

References TrackVRulerControls::DrawZooming(), anonymous_namespace{NoteTrackVZoomHandle.cpp}::IsDragZooming(), and TrackArtist::PassZooming.

Referenced by SpectrumVZoomHandle::Draw(), and WaveformVZoomHandle::Draw().

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

◆ DoDrawingArea()

wxRect WaveTrackVZoomHandle::DoDrawingArea ( const wxRect &  rect,
const wxRect &  panelRect,
unsigned  iPass 
)

Definition at line 161 of file WaveTrackVZoomHandle.cpp.

163{
164 if ( iPass == TrackArtist::PassZooming )
165 return TrackVRulerControls::ZoomingArea( rect, panelRect );
166 else
167 return rect;
168}
static wxRect ZoomingArea(const wxRect &rect, const wxRect &panelRect)

References TrackArtist::PassZooming, and TrackVRulerControls::ZoomingArea().

Referenced by SpectrumVZoomHandle::DrawingArea(), and WaveformVZoomHandle::DrawingArea().

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

◆ DoRelease()

UIHandle::Result WaveTrackVZoomHandle::DoRelease ( const TrackPanelMouseEvent event,
AudacityProject pProject,
wxWindow *  pParent,
WaveTrack pTrack,
const wxRect &  mRect,
DoZoomFunction  doZoom,
PopupMenuTable table,
int  zoomStart,
int  zoomEnd 
)

Definition at line 97 of file WaveTrackVZoomHandle.cpp.

102{
103 using namespace RefreshCode;
104 if (!pTrack)
105 return RefreshNone;
106
107 const wxMouseEvent &event = evt.event;
108 const bool shiftDown = event.ShiftDown();
109 const bool rightUp = event.RightUp();
110
111
112 // Popup menu...
113 using namespace WaveTrackViewConstants;
114 if (
115 rightUp &&
116 !(event.ShiftDown() || event.CmdDown()))
117 {
119 *pProject,
120 pTrack, rect, RefreshCode::RefreshNone, event.m_y, doZoom };
121
122 auto pMenu = PopupMenuTable::BuildMenu( &table, &data );
123 pMenu->Popup( *pParent, { event.m_x, event.m_y } );
124
125 return data.result;
126 }
127 else{
128 bool bVZoom;
129 gPrefs->Read(wxT("/GUI/VerticalZooming"), &bVZoom, false);
130 // Ignore Capture Lost event
131 bVZoom &= event.GetId() != kCaptureLostEventId;
132 // shiftDown | rightUp | ZoomKind
133 // T | T | 1to1
134 // T | F | Out
135 // F | - | In
136 if( bVZoom ) {
137 if( shiftDown )
138 zoomStart = zoomEnd;
139 doZoom(pProject, pTrack,
140 shiftDown
141 ? (rightUp ? kZoom1to1 : kZoomOut)
142 : kZoomIn,
143 rect, zoomStart, zoomEnd, !shiftDown);
144 }
145 }
146
147 return UpdateVRuler | RefreshAll;
148}
wxT("CloseDown"))
bool bVZoom
FileConfig * gPrefs
Definition: Prefs.cpp:70
const int kCaptureLostEventId
static std::unique_ptr< PopupMenu > BuildMenu(PopupMenuTable *pTable, void *pUserData=NULL)

References PopupMenuTable::BuildMenu(), bVZoom, TrackPanelMouseEvent::event, gPrefs, kCaptureLostEventId, WaveTrackViewConstants::kZoom1to1, WaveTrackViewConstants::kZoomIn, WaveTrackViewConstants::kZoomOut, RefreshCode::RefreshAll, RefreshCode::RefreshNone, RefreshCode::UpdateVRuler, and wxT().

Referenced by SpectrumVZoomHandle::Release(), and WaveformVZoomHandle::Release().

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

◆ HitPreview()

HitTestPreview WaveTrackVZoomHandle::HitPreview ( const wxMouseState &  state)

Definition at line 61 of file WaveTrackVZoomHandle.cpp.

62{
63 static auto zoomInCursor =
64 ::MakeCursor(wxCURSOR_MAGNIFIER, ZoomInCursorXpm, 19, 15);
65 static auto zoomOutCursor =
66 ::MakeCursor(wxCURSOR_MAGNIFIER, ZoomOutCursorXpm, 19, 15);
67 static wxCursor arrowCursor{ wxCURSOR_ARROW };
68 bool bVZoom;
69 gPrefs->Read(wxT("/GUI/VerticalZooming"), &bVZoom, false);
70 bVZoom &= !state.RightIsDown();
71 const auto message = bVZoom ?
72 XO("Click to vertically zoom in. Shift-click to zoom out. Drag to specify a zoom region.") :
73 XO("Right-click for menu.");
74
75 return {
76 message,
77 bVZoom ? (state.ShiftDown() ? &*zoomOutCursor : &*zoomInCursor) : &arrowCursor
78 // , message
79 };
80}
XO("Cut/Copy/Paste")
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
Definition: TrackPanel.cpp:186

References bVZoom, gPrefs, MakeCursor(), wxT(), and XO().

Referenced by SpectrumVZoomHandle::Preview(), and WaveformVZoomHandle::Preview().

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

◆ IsDragZooming()

bool WaveTrackVZoomHandle::IsDragZooming ( int  zoomStart,
int  zoomEnd 
)

Definition at line 24 of file WaveTrackVZoomHandle.cpp.

25{
26 const int DragThreshold = 3;// Anything over 3 pixels is a drag, else a click.
27 bool bVZoom;
28 gPrefs->Read(wxT("/GUI/VerticalZooming"), &bVZoom, false);
29 return bVZoom && (abs(zoomEnd - zoomStart) > DragThreshold);
30}
const int DragThreshold
Definition: TrackPanel.h:59

References bVZoom, DragThreshold, gPrefs, and wxT().

Referenced by SpectrumVZoomHandle::DoZoom(), and WaveformVZoomHandle::DoZoom().

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