Audacity 3.2.0
TimeTrackVZoomHandle.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5TimeTrackVZoomHandle.cpp
6
7Paul Licameli split from TimeTrackVZoomHandle.cpp
8
9**********************************************************************/
10
11
14#include "TimeTrackControls.h"
15
16#include "../../../HitTestResult.h"
17#include "NumberScale.h"
18#include "Prefs.h"
19#include "ProjectHistory.h"
20#include "../../../RefreshCode.h"
21#include "../../../TrackPanelMouseEvent.h"
22#include "../../../TimeTrack.h"
23
25 const std::shared_ptr<TimeTrack> &pTrack, const wxRect &rect, int y)
26 : mpTrack{ pTrack }
27{
28}
29
31
33{
34#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
36#endif
37}
38
40{
41 return true;
42}
43
46{
48}
49
51(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
52{
53 using namespace RefreshCode;
54 auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
55 if (!pTrack)
56 return Cancelled;
57 return RefreshNone;
58}
59
62{
63 static wxCursor arrowCursor{ wxCURSOR_ARROW };
64
65 return {
66 XO("Right-click for menu."),
67 &arrowCursor
68 // , message
69 };
70}
71
73(const TrackPanelMouseEvent &evt, AudacityProject *pProject,
74 wxWindow *pParent)
75{
76 auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
77 using namespace RefreshCode;
78 if (!pTrack)
79 return RefreshNone;
80
81 const wxMouseEvent &event = evt.event;
82 const bool shiftDown = event.ShiftDown();
83 const bool rightUp = event.RightUp();
84
85 // Popup menu...
86 if (
87 rightUp &&
88 !(event.ShiftDown() || event.CmdDown()))
89 {
91 *pProject, pTrack.get(), pParent, RefreshNone
92 };
93
94 auto pMenu = PopupMenuTable::BuildMenu(
96 pMenu->Popup( *pParent, { event.m_x, event.m_y } );
97 }
98
99 return UpdateVRuler | RefreshAll;
100}
101
103{
104 // Cancel is implemented! And there is no initial state to restore,
105 // so just return a code.
107}
XO("Cut/Copy/Paste")
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
static std::unique_ptr< PopupMenu > BuildMenu(PopupMenuTable *pTable, void *pUserData=NULL)
static TimeTrackMenuTable & Instance()
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
~TimeTrackVZoomHandle() override
bool HandlesRightClick() override
Whether the handle has any special right-button handling.
void Enter(bool forward, AudacityProject *) override
std::weak_ptr< TimeTrack > mpTrack
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Result Cancel(AudacityProject *pProject) override
TimeTrackVZoomHandle(const TimeTrackVZoomHandle &)
std::shared_ptr< Subclass > Lock(const std::weak_ptr< Subclass > &wTrack)
Definition: Track.h:1606
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:487
Result mChangeHighlight
Definition: UIHandle.h:139
unsigned Result
Definition: UIHandle.h:38
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16