20#include "../../HitTestResult.h"
21#include "../../RefreshCode.h"
22#include "../../TrackArtist.h"
23#include "../../TrackPanelDrawingContext.h"
24#include "../../TrackPanelMouseEvent.h"
26#include "../../../images/Cursors.h"
45 static auto zoomInCursor =
46 ::MakeCursor(wxCURSOR_MAGNIFIER, ZoomInCursorXpm, 19, 15);
47 static auto zoomOutCursor =
48 ::MakeCursor(wxCURSOR_MAGNIFIER, ZoomOutCursorXpm, 19, 15);
51#if defined( __WXMAC__ )
52 message =
XO(
"Click to Zoom In, Shift-Click to Zoom Out");
53#elif defined( __WXMSW__ )
54 message =
XO(
"Drag to Zoom Into Region, Right-Click to Zoom Out");
55#elif defined( __WXGTK__ )
56 message =
XO(
"Left=Zoom In, Right=Zoom Out, Middle=Normal");
60 (state.ShiftDown() ? &*zoomOutCursor : &*zoomInCursor)
65(std::weak_ptr<ZoomHandle> &holder)
67 auto result = std::make_shared<ZoomHandle>();
73(std::weak_ptr<ZoomHandle> &holder,
74 const wxMouseState &state)
76 if (state.ButtonIsDown(wxMOUSE_BTN_RIGHT))
99 const wxMouseEvent &
event = evt.
event;
100 if (event.ButtonDown() || event.LeftDClick()) {
112 const wxMouseEvent &
event = evt.
event;
113 const int left =
mRect.GetLeft();
114 const int right =
mRect.GetRight();
118 if (event.m_x < left) {
121 else if (event.m_x > right) {
140 const wxMouseEvent &
event = evt.
event;
145 const int trackLeftEdge =
mRect.x;
150 double left = viewInfo.PositionToTime(
mZoomStart, trackLeftEdge);
151 double right = viewInfo.PositionToTime(
mZoomEnd, trackLeftEdge);
154 (viewInfo.PositionToTime(
mRect.width) - viewInfo.PositionToTime(0)) /
156 if (event.ShiftDown())
157 multiplier = 1.0 / multiplier;
159 viewInfo.ZoomBy(multiplier);
161 viewInfo.hpos = left;
168 const double center_h =
169 viewInfo.PositionToTime(event.m_x, trackLeftEdge);
171 const double multiplier =
172 (
event.RightUp() ||
event.RightDClick() ||
event.ShiftDown())
174 viewInfo.ZoomBy(multiplier);
176 if (event.MiddleUp() ||
event.MiddleDClick())
179 const double new_center_h =
180 viewInfo.PositionToTime(event.m_x, trackLeftEdge);
182 viewInfo.hpos += (center_h - new_center_h);
200 const wxRect &rect,
unsigned iPass )
206 auto &dc = context.
dc;
207 dc.SetBrush(*wxTRANSPARENT_BRUSH);
208 dc.SetPen(*wxBLACK_DASHED_PEN);
222 const wxRect &rect,
const wxRect &panelRect,
unsigned iPass )
std::shared_ptr< UIHandle > UIHandlePtr
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
static wxRect MaximizeHeight(const wxRect &rect, const wxRect &panelRect)
Holds a msgid for the translation catalog; may also bind format arguments.
static ViewInfo & Get(AudacityProject &project)
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Result Cancel(AudacityProject *pProject) override
bool IsDragZooming() const
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
static UIHandlePtr HitAnywhere(std::weak_ptr< ZoomHandle > &holder)
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
bool HandlesRightClick() override
Whether the handle has any special right-button handling.
static HitTestPreview HitPreview(const wxMouseState &state, const AudacityProject *pProject)
std::shared_ptr< const Track > FindTrack() const override
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
static UIHandlePtr HitTest(std::weak_ptr< ZoomHandle > &holder, const wxMouseState &state)
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
wxRect DrawingArea(TrackPanelDrawingContext &, const wxRect &rect, const wxRect &panelRect, unsigned iPass) override
static double GetDefaultZoom()
Namespace containing an enum 'what to do on a refresh?'.
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)