Audacity 3.2.0
Typedefs | Functions
WaveChannelVZoomHandle Namespace Reference

Typedefs

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

Functions

AUDACITY_DLL_API HitTestPreview HitPreview (const bool bVZoom)
 
AUDACITY_DLL_API bool IsDragZooming (int zoomStart, int zoomEnd, bool hasDragZoom)
 
AUDACITY_DLL_API Result DoDrag (const TrackPanelMouseEvent &event, AudacityProject *pProject, int zoomStart, int &zoomEnd, bool hasDragZoom)
 
AUDACITY_DLL_API Result DoRelease (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent, WaveChannel &wc, 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, bool hasDragZoom)
 
AUDACITY_DLL_API wxRect DoDrawingArea (const wxRect &rect, const wxRect &panelRect, unsigned iPass)
 

Typedef Documentation

◆ DoZoomFunction

using WaveChannelVZoomHandle::DoZoomFunction = typedef void (*)(AudacityProject *pProject, WaveChannel &wc, WaveChannelViewConstants::ZoomActions ZoomKind, const wxRect &rect, int zoomStart, int zoomEnd, bool fixedMousePoint)

Definition at line 33 of file WaveChannelVZoomHandle.h.

◆ Result

using WaveChannelVZoomHandle::Result = typedef unsigned

Definition at line 25 of file WaveChannelVZoomHandle.h.

Function Documentation

◆ DoDrag()

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

Definition at line 74 of file WaveChannelVZoomHandle.cpp.

77{
78 using namespace RefreshCode;
79
80 const wxMouseEvent &event = evt.event;
81 if ( event.RightIsDown() )
82 return RefreshNone;
83 zoomEnd = event.m_y;
84 if (IsDragZooming( zoomStart, zoomEnd, hasDragZooming))
85 return RefreshAll;
86 return RefreshNone;
87}
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 WaveChannelVZoomHandle::DoDraw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass,
int  zoomStart,
int  zoomEnd,
bool  hasDragZoom 
)

Definition at line 130 of file WaveChannelVZoomHandle.cpp.

133{
134 if (iPass == TrackArtist::PassZooming) {
135 if (IsDragZooming(zoomStart, zoomEnd, hasDragZoom))
136 ChannelVRulerControls::DrawZooming(context, rect, zoomStart, zoomEnd);
137 }
138}
static void DrawZooming(TrackPanelDrawingContext &context, const wxRect &rect, int zoomStart, int zoomEnd)

References ChannelVRulerControls::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 WaveChannelVZoomHandle::DoDrawingArea ( const wxRect &  rect,
const wxRect &  panelRect,
unsigned  iPass 
)

Definition at line 140 of file WaveChannelVZoomHandle.cpp.

142{
143 if (iPass == TrackArtist::PassZooming)
144 return ChannelVRulerControls::ZoomingArea(rect, panelRect);
145 else
146 return rect;
147}
static wxRect ZoomingArea(const wxRect &rect, const wxRect &panelRect)

References TrackArtist::PassZooming, and ChannelVRulerControls::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 WaveChannelVZoomHandle::DoRelease ( const TrackPanelMouseEvent event,
AudacityProject pProject,
wxWindow *  pParent,
WaveChannel wc,
const wxRect &  mRect,
DoZoomFunction  doZoom,
PopupMenuTable table,
int  zoomStart,
int  zoomEnd 
)

Definition at line 89 of file WaveChannelVZoomHandle.cpp.

94{
95 using namespace RefreshCode;
96 const wxMouseEvent &event = evt.event;
97 const bool shiftDown = event.ShiftDown();
98 const bool rightUp = event.RightUp();
99
100
101 // Popup menu...
102 using namespace WaveChannelViewConstants;
103 if (
104 rightUp &&
105 !(event.ShiftDown() || event.CmdDown()))
106 {
108 *pProject,
109 wc, rect, RefreshCode::RefreshNone, event.m_y, doZoom };
110
111 auto pMenu = PopupMenuTable::BuildMenu( &table, &data );
112 pMenu->Popup( *pParent, { event.m_x, event.m_y } );
113
114 return data.result;
115 }
116 else {
117 // Ignore Capture Lost event
118 bool notLost = event.GetId() != kCaptureLostEventId;
119 // Shift+rightclick to reset zoom
120 if( shiftDown && notLost)
121 zoomStart = zoomEnd;
122 doZoom(pProject, wc, kZoom1to1,
123 rect, zoomStart, zoomEnd, !shiftDown);
124
125 }
126
127 return UpdateVRuler | RefreshAll;
128}
const int kCaptureLostEventId
static std::unique_ptr< PopupMenu > BuildMenu(PopupMenuTable *pTable, void *pUserData=NULL)

References PopupMenuTable::BuildMenu(), TrackPanelMouseEvent::event, kCaptureLostEventId, WaveChannelViewConstants::kZoom1to1, RefreshCode::RefreshAll, RefreshCode::RefreshNone, and RefreshCode::UpdateVRuler.

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 WaveChannelVZoomHandle::HitPreview ( const bool  bVZoom)

Definition at line 59 of file WaveChannelVZoomHandle.cpp.

60{
61 static wxCursor crossCursor{wxCURSOR_CROSS};
62 static wxCursor arrowCursor{ wxCURSOR_ARROW };
63 const auto message = bVZoom ?
64 XO("Drag to specify a zoom region. Right-click for menu. Ctrl+scroll to zoom.") :
65 XO("Right-click for menu. Ctrl+scroll to zoom.");
66
67 return {
68 message,
69 bVZoom ? &crossCursor : &arrowCursor
70 // , message
71 };
72}
XO("Cut/Copy/Paste")
bool bVZoom

References bVZoom, 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 WaveChannelVZoomHandle::IsDragZooming ( int  zoomStart,
int  zoomEnd,
bool  hasDragZoom 
)

Definition at line 24 of file WaveChannelVZoomHandle.cpp.

25{
26 const int DragThreshold = 3;// Anything over 3 pixels is a drag, else a click.
27 return hasDragZoom && (abs(zoomEnd - zoomStart) > DragThreshold);
28}
const int DragThreshold
Definition: TrackPanel.h:57

References DragThreshold.

Referenced by SpectrumVZoomHandle::DoZoom().

Here is the caller graph for this function: