Audacity  3.0.3
TimeTrackVZoomHandle.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 TimeTrackVZoomHandle.cpp
6 
7 Paul Licameli split from TimeTrackVZoomHandle.cpp
8 
9 **********************************************************************/
10 
11 
12 #include "TimeTrackVZoomHandle.h"
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 }
RefreshCode::RefreshAll
@ RefreshAll
Definition: RefreshCode.h:26
NumberScale.h
RefreshCode::RefreshNone
@ RefreshNone
Definition: RefreshCode.h:21
TrackList::Lock
std::shared_ptr< Subclass > Lock(const std::weak_ptr< Subclass > &wTrack)
Definition: Track.h:1563
TimeTrackVZoomHandle::Preview
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
Definition: TimeTrackVZoomHandle.cpp:61
TimeTrackVZoomHandle::Release
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: TimeTrackVZoomHandle.cpp:73
RefreshCode::Cancelled
@ Cancelled
Definition: RefreshCode.h:23
XO
#define XO(s)
Definition: Internat.h:31
TimeTrackVZoomHandle::Enter
void Enter(bool forward, AudacityProject *) override
Definition: TimeTrackVZoomHandle.cpp:32
TimeTrackVRulerControls.h
UIHandle::mChangeHighlight
Result mChangeHighlight
Definition: UIHandle.h:139
TimeTrackVZoomHandle::~TimeTrackVZoomHandle
~TimeTrackVZoomHandle() override
TimeTrackVZoomHandle::mpTrack
std::weak_ptr< TimeTrack > mpTrack
Definition: TimeTrackVZoomHandle.h:51
UIHandle::Result
unsigned Result
Definition: UIHandle.h:38
HitTestPreview
Definition: HitTestResult.h:20
RefreshCode::UpdateVRuler
@ UpdateVRuler
Definition: RefreshCode.h:30
CommonTrackControls::InitMenuData
Definition: CommonTrackControls.h:34
RefreshCode::RefreshCell
@ RefreshCell
Definition: RefreshCode.h:24
TimeTrackVZoomHandle::TimeTrackVZoomHandle
TimeTrackVZoomHandle(const TimeTrackVZoomHandle &)
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:383
TimeTrackControls.h
TimeTrackVZoomHandle::HandlesRightClick
bool HandlesRightClick() override
Whether the handle has any special right-button handling.
Definition: TimeTrackVZoomHandle.cpp:39
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
TrackPanelMouseEvent
Definition: TrackPanelMouseEvent.h:46
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
TimeTrackMenuTable::Instance
static TimeTrackMenuTable & Instance()
Definition: TimeTrackControls.cpp:41
PopupMenuTable::BuildMenu
static std::unique_ptr< PopupMenu > BuildMenu(PopupMenuTable *pTable, void *pUserData=NULL)
Definition: PopupMenuTable.cpp:190
Prefs.h
TimeTrackVZoomHandle::Drag
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: TimeTrackVZoomHandle.cpp:51
TimeTrackVZoomHandle::Cancel
Result Cancel(AudacityProject *pProject) override
Definition: TimeTrackVZoomHandle.cpp:102
TimeTrackVZoomHandle.h
RefreshCode
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16
TimeTrackVZoomHandle::Click
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: TimeTrackVZoomHandle.cpp:45
TrackPanelMouseEvent::event
wxMouseEvent & event
Definition: TrackPanelMouseEvent.h:58