16#include "../../../ui/ChannelVRulerControls.h"
18#include "../../../../HitTestResult.h"
22#include "../../../../RefreshCode.h"
23#include "../../../../TrackArtist.h"
24#include "../../../../TrackPanelMouseEvent.h"
25#include "../../../../widgets/PopupMenuTable.h"
26#include "../../../../../images/Cursors.h"
53(
const std::shared_ptr<NoteTrack> &pTrack,
const wxRect &rect,
int y)
54 : mpTrack{ pTrack } , mZoomStart(y), mZoomEnd(y), mRect(rect)
60#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
67 static auto zoomInCursor =
68 ::MakeCursor(wxCURSOR_MAGNIFIER, ZoomInCursorXpm, 19, 15);
69 static auto zoomOutCursor =
70 ::MakeCursor(wxCURSOR_MAGNIFIER, ZoomOutCursorXpm, 19, 15);
71 static wxCursor arrowCursor{ wxCURSOR_ARROW };
74 XO(
"Click to vertically zoom in. Shift-click to zoom out. Drag to specify a zoom region.");
78 state.ShiftDown() ? &*zoomOutCursor : &*zoomInCursor
83(std::weak_ptr<NoteTrackVZoomHandle> &holder,
84 const wxMouseState &state,
85 const std::shared_ptr<NoteTrack> &pTrack,
const wxRect &rect)
88 auto result = std::make_shared<NoteTrackVZoomHandle>(
89 pTrack, rect, state.m_y);
127 const wxMouseEvent &
event = evt.
event;
189 void OnZoom(
int iZoomCode );
217 mpData =
static_cast<InitMenuData*
>(pUserData);
224 data.ZoomAllNotes(&
mpData->pTrack->GetSeq());
233 data.ZoomMaxExtent();
236 data.ShiftNoteRange(12);
239 data.ShiftNoteRange(-12);
292 const wxMouseEvent &
event = evt.event;
294 const bool rightUp =
event.RightUp();
300 !(event.ShiftDown() || event.CmdDown()))
303 *pProject, pTrack.get(), mRect,
RefreshNone,
event.m_y
310 pMenu->Popup( *pParent, {
event.m_x,
event.m_y } );
320 data.
ZoomTo(mZoomStart, mZoomEnd);
322 else if (event.ShiftDown() || event.RightUp()) {
323 if (event.ShiftDown() && event.RightUp()) {
325 auto oldBotNote = data.GetBottomNote();
326 auto oldTopNote = data.GetTopNote();
328 data.ZoomAllNotes(&pTrack->GetSeq());
329 if (data.GetBottomNote() == oldBotNote &&
330 data.GetTopNote() == oldTopNote) {
332 data.ZoomMaxExtent();
336 data.ZoomOut(mZoomEnd);
340 data.ZoomIn(mZoomEnd);
343 mZoomEnd = mZoomStart = 0;
358 const wxRect &rect,
unsigned iPass )
372 const wxRect &rect,
const wxRect &panelRect,
unsigned iPass )
std::shared_ptr< UIHandle > UIHandlePtr
XXO("&Cut/Copy/Paste Toolbar")
AppendItem("Reset", OnZoomResetID, MakeLabel(XXO("Zoom Reset"), bVZoom, XXO("Shift-Right-Click")), POPUP_MENU_FN(OnZoomReset))
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
const int kCaptureLostEventId
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 ZoomingArea(const wxRect &rect, const wxRect &panelRect)
static void DrawZooming(TrackPanelDrawingContext &context, const wxRect &rect, int zoomStart, int zoomEnd)
Temporary data used to display a note track.
void ZoomTo(int start, int end)
A Track that is used for Midi notes. (Somewhat old code).
static NoteTrackRange & Get(const NoteTrack &track)
Allow mutative access to attached data of a const track.
std::shared_ptr< const Track > FindTrack() const override
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
NoteTrackVZoomHandle(const NoteTrackVZoomHandle &)
std::weak_ptr< NoteTrack > mpTrack
wxRect DrawingArea(TrackPanelDrawingContext &, const wxRect &rect, const wxRect &panelRect, unsigned iPass) override
static HitTestPreview HitPreview(const wxMouseState &state)
virtual ~NoteTrackVZoomHandle()
Result Cancel(AudacityProject *pProject) override
bool HandlesRightClick() override
Whether the handle has any special right-button handling.
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
void Enter(bool forward, AudacityProject *) override
static UIHandlePtr HitTest(std::weak_ptr< NoteTrackVZoomHandle > &holder, const wxMouseState &state, const std::shared_ptr< NoteTrack > &pTrack, const wxRect &rect)
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
A listener notified of changes in preferences.
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
std::shared_ptr< Subclass > Lock(const std::weak_ptr< Subclass > &wTrack)
static TrackList & Get(AudacityProject &project)
Short-lived drawing and event-handling object associated with a TrackPanelCell.
void Release(wxWindow *handler)
Namespace containing an enum 'what to do on a refresh?'.
wxStaticText * MakeLabel(wxWindow *parent, const wxString &text)
bool IsDragZooming(int zoomStart, int zoomEnd)
AudacityProject & project