Audacity 3.2.0
CutlineHandle.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5CutlineHandle.h
6
7Paul Licameli
8
9**********************************************************************/
10
11#ifndef __AUDACITY_CUTLINE_HANDLE__
12#define __AUDACITY_CUTLINE_HANDLE__
13
14#include "../../../../UIHandle.h"
15#include "../../../../WaveTrackLocation.h"
16
17class wxMouseEvent;
18class wxMouseState;
19class WaveTrack;
20
21class CutlineHandle final : public UIHandle
22{
23 CutlineHandle(const CutlineHandle&) = delete;
24 static HitTestPreview HitPreview(bool unsafe);
25
26public:
27 explicit CutlineHandle(const std::shared_ptr<WaveTrack> &pTrack,
28 WaveTrackLocations locations, WaveTrackLocation location);
29
31
33 const AudacityProject *pProject, bool cutline, UIHandlePtr ptr);
34 static UIHandlePtr HitTest(
35 std::weak_ptr<CutlineHandle> &holder,
36 const wxMouseState &state, const wxRect &rect,
37 const AudacityProject *pProject,
38 std::shared_ptr<WaveTrack> pTrack);
39
40 virtual ~CutlineHandle();
41
42 std::shared_ptr<const Track> FindTrack() const override;
43
45 std::shared_ptr<WaveTrack> GetTrack() { return mpTrack; }
46
47 void Enter(bool forward, AudacityProject *) override;
48
49 bool HandlesRightClick() override;
50
52 (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
53
55 (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
56
58 (const TrackPanelMouseState &state, AudacityProject *pProject)
59 override;
60
62 (const TrackPanelMouseEvent &event, AudacityProject *pProject,
63 wxWindow *pParent) override;
64
65 Result Cancel(AudacityProject *pProject) override;
66
67 bool StopsOnKeystroke() override { return true; }
68
69private:
70 std::shared_ptr<WaveTrack> mpTrack{};
73 double mStartTime{}, mEndTime{};
76};
77
78#endif
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
std::vector< WaveTrackLocation > WaveTrackLocations
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
const WaveTrackLocation & GetLocation()
Definition: CutlineHandle.h:44
Operation mOperation
Definition: CutlineHandle.h:72
bool StopsOnKeystroke() override
Definition: CutlineHandle.h:67
CutlineHandle(const CutlineHandle &)=delete
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
std::shared_ptr< const Track > FindTrack() const override
static UIHandlePtr HitAnywhere(const AudacityProject *pProject, bool cutline, UIHandlePtr ptr)
WaveTrackLocation mLocation
Definition: CutlineHandle.h:75
WaveTrackLocations mLocations
Definition: CutlineHandle.h:74
CutlineHandle & operator=(const CutlineHandle &)=default
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
std::shared_ptr< WaveTrack > mpTrack
Definition: CutlineHandle.h:70
std::shared_ptr< WaveTrack > GetTrack()
Definition: CutlineHandle.h:45
static UIHandlePtr HitTest(std::weak_ptr< CutlineHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, std::shared_ptr< WaveTrack > pTrack)
virtual ~CutlineHandle()
double mStartTime
Definition: CutlineHandle.h:73
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
static HitTestPreview HitPreview(bool unsafe)
void Enter(bool forward, AudacityProject *) override
bool HandlesRightClick() override
Whether the handle has any special right-button handling.
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Result Cancel(AudacityProject *pProject) override
Short-lived drawing and event-handling object associated with a TrackPanelCell.
Definition: UIHandle.h:37
unsigned Result
Definition: UIHandle.h:40
A Track that contains audio waveform data.
Definition: WaveTrack.h:203