Audacity  2.2.0
CutlineHandle.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 CutlineHandle.h
6 
7 Paul Licameli
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_CUTLINE_HANDLE__
12 #define __AUDACITY_CUTLINE_HANDLE__
13 
14 #include "../../../../MemoryX.h"
15 #include "../../../../UIHandle.h"
16 #include "../../../../MemoryX.h"
17 #include "../../../../WaveTrackLocation.h"
18 
19 class wxMouseEvent;
20 class wxMouseState;
21 class WaveTrack;
22 
23 class CutlineHandle final : public UIHandle
24 {
25  CutlineHandle(const CutlineHandle&) = delete;
26  static HitTestPreview HitPreview(bool cutline, bool unsafe);
27 
28 public:
29  explicit CutlineHandle
30  ( const std::shared_ptr<WaveTrack> &pTrack,
31  WaveTrackLocation location );
32 
33  CutlineHandle &operator=(const CutlineHandle&) = default;
34 
36  (const AudacityProject *pProject, bool cutline, UIHandlePtr ptr);
37  static UIHandlePtr HitTest
38  (std::weak_ptr<CutlineHandle> &holder,
39  const wxMouseState &state, const wxRect &rect,
40  const AudacityProject *pProject,
41  const std::shared_ptr<WaveTrack> &pTrack);
42 
43  virtual ~CutlineHandle();
44 
46  std::shared_ptr<WaveTrack> GetTrack() { return mpTrack; }
47 
48  void Enter(bool forward) override;
49 
51  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
52 
53  Result Drag
54  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
55 
57  (const TrackPanelMouseState &state, const AudacityProject *pProject)
58  override;
59 
61  (const TrackPanelMouseEvent &event, AudacityProject *pProject,
62  wxWindow *pParent) override;
63 
64  Result Cancel(AudacityProject *pProject) override;
65 
66  bool StopsOnKeystroke() override { return true; }
67 
68 private:
71  double mStartTime{}, mEndTime{};
73  std::shared_ptr<WaveTrack> mpTrack{};
74 };
75 
76 #endif
Definition: CutlineHandle.h:69
Operation mOperation
Definition: CutlineHandle.h:70
Definition: WaveTrackLocation.h:14
std::shared_ptr< WaveTrack > mpTrack
Definition: CutlineHandle.h:73
Definition: TrackPanelMouseEvent.h:23
WaveTrackLocation mLocation
Definition: CutlineHandle.h:72
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: CutlineHandle.cpp:219
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
unsigned Result
Definition: UIHandle.h:37
virtual ~CutlineHandle()
Definition: CutlineHandle.cpp:120
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
double mStartTime
Definition: CutlineHandle.h:71
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: CutlineHandle.cpp:205
Operation
Definition: CutlineHandle.h:69
static HitTestPreview HitPreview(bool cutline, bool unsafe)
Definition: CutlineHandle.cpp:41
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
CutlineHandle & operator=(const CutlineHandle &)=default
HitTestPreview Preview(const TrackPanelMouseState &state, const AudacityProject *pProject) override
Definition: CutlineHandle.cpp:211
bool StopsOnKeystroke() override
Definition: CutlineHandle.h:66
Result Cancel(AudacityProject *pProject) override
Definition: CutlineHandle.cpp:244
CutlineHandle(const CutlineHandle &)=delete
const WaveTrackLocation & GetLocation()
Definition: CutlineHandle.h:45
double mEndTime
Definition: CutlineHandle.h:71
static UIHandlePtr HitAnywhere(const AudacityProject *pProject, bool cutline, UIHandlePtr ptr)
std::shared_ptr< WaveTrack > GetTrack()
Definition: CutlineHandle.h:46
Definition: UIHandle.h:33
Definition: CutlineHandle.h:69
void Enter(bool forward) override
Definition: CutlineHandle.cpp:34
Definition: HitTestResult.h:19
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: CutlineHandle.cpp:125
Definition: CutlineHandle.h:69
Definition: CutlineHandle.h:23
Definition: TrackPanelMouseEvent.h:41
static UIHandlePtr HitTest(std::weak_ptr< CutlineHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< WaveTrack > &pTrack)
Definition: CutlineHandle.cpp:99