Audacity 3.2.0
SampleHandle.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5SampleHandle.h
6
7Paul Licameli
8
9**********************************************************************/
10
11#ifndef __AUDACITY_SAMPLE_HANDLE__
12#define __AUDACITY_SAMPLE_HANDLE__
13
14#include "../../../../UIHandle.h"
15#include "SampleCount.h"
16
17class wxMouseEvent;
18class wxMouseState;
19
20class Track;
21class ViewInfo;
22class WaveTrack;
23
24class SampleHandle final : public UIHandle
25{
26 SampleHandle(const SampleHandle&) = delete;
28 (const wxMouseState &state, const AudacityProject *pProject, bool unsafe);
29
30public:
31 explicit SampleHandle( const std::shared_ptr<WaveTrack> &pTrack );
32
34
36 (std::weak_ptr<SampleHandle> &holder,
37 const wxMouseState &state, const std::shared_ptr<WaveTrack> &pTrack);
38 static UIHandlePtr HitTest
39 (std::weak_ptr<SampleHandle> &holder,
40 const wxMouseState &state, const wxRect &rect,
41 const AudacityProject *pProject, const std::shared_ptr<WaveTrack> &pTrack);
42
43 virtual ~SampleHandle();
44
45 std::shared_ptr<WaveTrack> GetTrack() const { return mClickedTrack; }
46
47 void Enter(bool forward, AudacityProject *) override;
48
50 (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
51
53 (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
54
56 (const TrackPanelMouseState &state, AudacityProject *pProject)
57 override;
58
60 (const TrackPanelMouseEvent &event, AudacityProject *pProject,
61 wxWindow *pParent) override;
62
63 Result Cancel(AudacityProject *pProject) override;
64
65 bool StopsOnKeystroke() override { return true; }
66
67private:
69 (const wxMouseEvent &event, const ViewInfo &viewInfo, double t0);
70
71 std::shared_ptr<WaveTrack> mClickedTrack;
72 wxRect mRect{};
73
77 bool mAltKey{};
78};
79
80#endif
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
virtual ~SampleHandle()
float FindSampleEditingLevel(const wxMouseEvent &event, const ViewInfo &viewInfo, double t0)
float mLastDragSampleValue
Definition: SampleHandle.h:76
sampleCount mClickedStartSample
Definition: SampleHandle.h:74
Result Cancel(AudacityProject *pProject) override
bool StopsOnKeystroke() override
Definition: SampleHandle.h:65
static HitTestPreview HitPreview(const wxMouseState &state, const AudacityProject *pProject, bool unsafe)
static UIHandlePtr HitAnywhere(std::weak_ptr< SampleHandle > &holder, const wxMouseState &state, const std::shared_ptr< WaveTrack > &pTrack)
void Enter(bool forward, AudacityProject *) override
sampleCount mLastDragSample
Definition: SampleHandle.h:75
static UIHandlePtr HitTest(std::weak_ptr< SampleHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< WaveTrack > &pTrack)
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
wxRect mRect
Definition: SampleHandle.h:72
SampleHandle & operator=(const SampleHandle &)=default
std::shared_ptr< WaveTrack > mClickedTrack
Definition: SampleHandle.h:71
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
std::shared_ptr< WaveTrack > GetTrack() const
Definition: SampleHandle.h:45
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
SampleHandle(const SampleHandle &)=delete
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:225
Short-lived drawing and event-handling object associated with a TrackPanelCell.
Definition: UIHandle.h:35
unsigned Result
Definition: UIHandle.h:38
A Track that contains audio waveform data.
Definition: WaveTrack.h:57
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18