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
13#include "TimeTrackControls.h"
14
15#include "../../../HitTestResult.h"
16#include "NumberScale.h"
17#include "Prefs.h"
18#include "ProjectHistory.h"
19#include "../../../RefreshCode.h"
20#include "../../../TrackPanelMouseEvent.h"
21#include "TimeTrack.h"
22
24 const std::shared_ptr<TimeTrack> &pTrack, const wxRect &rect, int y)
25 : mpTrack{ pTrack }
26{
27}
28
30
31std::shared_ptr<const Track> TimeTrackVZoomHandle::FindTrack() const
32{
33 return mpTrack.lock();
34}
35
37{
38#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
40#endif
41}
42
44{
45 return true;
46}
47
50{
52}
53
55(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
56{
57 using namespace RefreshCode;
58 auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
59 if (!pTrack)
60 return Cancelled;
61 return RefreshNone;
62}
63
66{
67 static wxCursor arrowCursor{ wxCURSOR_ARROW };
68
69 return {
70 XO("Right-click for menu."),
71 &arrowCursor
72 // , message
73 };
74}
75
77(const TrackPanelMouseEvent &evt, AudacityProject *pProject,
78 wxWindow *pParent)
79{
80 auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
81 using namespace RefreshCode;
82 if (!pTrack)
83 return RefreshNone;
84
85 const wxMouseEvent &event = evt.event;
86 const bool shiftDown = event.ShiftDown();
87 const bool rightUp = event.RightUp();
88
89 // Popup menu...
90 if (
91 rightUp &&
92 !(event.ShiftDown() || event.CmdDown()))
93 {
95 *pProject, *pTrack, pParent, RefreshNone
96 };
97
98 auto pMenu = PopupMenuTable::BuildMenu(
100 pMenu->Popup( *pParent, { event.m_x, event.m_y } );
101 }
102
103 return UpdateVRuler | RefreshAll;
104}
105
107{
108 // Cancel is implemented! And there is no initial state to restore,
109 // so just return a code.
111}
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::shared_ptr< const Track > FindTrack() const 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:1079
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
Result mChangeHighlight
Definition: UIHandle.h:152
unsigned Result
Definition: UIHandle.h:40
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16