Audacity  2.2.0
TrackSelectHandle.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 TrackSelectHandle.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_TRACK_SELECT_HANDLE__
12 #define __AUDACITY_TRACK_SELECT_HANDLE__
13 
14 #include "../../UIHandle.h"
15 #include "../../MemoryX.h"
16 
17 class wxMouseEvent;
18 class Track;
19 
20 class TrackSelectHandle final : public UIHandle
21 {
22  TrackSelectHandle(const TrackSelectHandle&) = delete;
23 
24 public:
25  explicit TrackSelectHandle( const std::shared_ptr<Track> &pTrack );
26 
28 
30  (std::weak_ptr<TrackSelectHandle> &holder,
31  const std::shared_ptr<Track> &pTrack);
32 
33  virtual ~TrackSelectHandle();
34 
36  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
37 
38  Result Drag
39  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
40 
42  (const TrackPanelMouseState &state, const AudacityProject *pProject)
43  override;
44 
46  (const TrackPanelMouseEvent &event, AudacityProject *pProject,
47  wxWindow *pParent) override;
48 
49  Result Cancel(AudacityProject *) override;
50 
51  bool StopsOnKeystroke() override { return true; }
52 
53 private:
54  std::shared_ptr<Track> mpTrack;
55  bool mClicked{};
56 
57  // JH: if the user is dragging a track, at what y
58  // coordinate should the dragging track move up or down?
62 
63  void CalculateRearrangingThresholds(const wxMouseEvent & event);
64 };
65 
66 #endif
Definition: TrackSelectHandle.h:20
Result Cancel(AudacityProject *) override
Definition: TrackSelectHandle.cpp:208
std::shared_ptr< Track > mpTrack
Definition: TrackSelectHandle.h:54
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: TrackSelectHandle.cpp:184
Definition: TrackPanelMouseEvent.h:27
int mMoveUpThreshold
Definition: TrackSelectHandle.h:59
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: TrackSelectHandle.cpp:111
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
TrackSelectHandle & operator=(const TrackSelectHandle &)=default
unsigned Result
Definition: UIHandle.h:37
virtual ~TrackSelectHandle()
Definition: TrackSelectHandle.cpp:65
bool mClicked
Definition: TrackSelectHandle.h:55
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:85
void CalculateRearrangingThresholds(const wxMouseEvent &event)
Definition: TrackSelectHandle.cpp:218
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
bool StopsOnKeystroke() override
Definition: TrackSelectHandle.h:51
int mRearrangeCount
Definition: TrackSelectHandle.h:61
int mMoveDownThreshold
Definition: TrackSelectHandle.h:60
Definition: UIHandle.h:33
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: TrackSelectHandle.cpp:70
static UIHandlePtr HitAnywhere(std::weak_ptr< TrackSelectHandle > &holder, const std::shared_ptr< Track > &pTrack)
Definition: TrackSelectHandle.cpp:57
HitTestPreview Preview(const TrackPanelMouseState &state, const AudacityProject *pProject) override
Definition: TrackSelectHandle.cpp:153
Definition: HitTestResult.h:19
TrackSelectHandle(const TrackSelectHandle &)=delete
Definition: TrackPanelMouseEvent.h:45