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 WaveChannel;
23class WaveClipChannel;
24
25class SampleHandle final : public UIHandle
26{
27 SampleHandle(const SampleHandle&) = delete;
29 (const wxMouseState &state, const AudacityProject *pProject, bool unsafe);
30
31public:
32 explicit SampleHandle(const std::shared_ptr<WaveChannel> &pTrack);
33
35
37 std::weak_ptr<SampleHandle> &holder,
38 const wxMouseState &state, const std::shared_ptr<WaveChannel> &pChannel);
39 static UIHandlePtr HitTest(
40 std::weak_ptr<SampleHandle> &holder,
41 const wxMouseState &state, const wxRect &rect,
42 const AudacityProject *pProject,
43 const std::shared_ptr<WaveChannel> &pChannel);
44
45 virtual ~SampleHandle();
46
47 std::shared_ptr<const Track> FindTrack() const override;
48
49 void Enter(bool forward, AudacityProject *) 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:
71 (const wxMouseEvent &event, const ViewInfo &viewInfo, double t0);
72
73 std::shared_ptr<WaveChannel> mClickedTrack;
74 std::shared_ptr<WaveClipChannel> mClickedClip {};
75 wxRect mRect{};
76
80 bool mAltKey{};
81};
82
83#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:90
std::shared_ptr< WaveClipChannel > mClickedClip
Definition: SampleHandle.h:74
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:79
std::shared_ptr< WaveChannel > mClickedTrack
Definition: SampleHandle.h:73
int mClickedStartPixel
Definition: SampleHandle.h:77
Result Cancel(AudacityProject *pProject) override
bool StopsOnKeystroke() override
Definition: SampleHandle.h:67
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< WaveChannel > &pChannel)
void Enter(bool forward, AudacityProject *) override
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
wxRect mRect
Definition: SampleHandle.h:75
SampleHandle & operator=(const SampleHandle &)=default
std::shared_ptr< const Track > FindTrack() const override
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
static UIHandlePtr HitTest(std::weak_ptr< SampleHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< WaveChannel > &pChannel)
SampleHandle(const SampleHandle &)=delete
int mLastDragPixel
Definition: SampleHandle.h:78
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110
Short-lived drawing and event-handling object associated with a TrackPanelCell.
Definition: UIHandle.h:37
unsigned Result
Definition: UIHandle.h:40