Audacity 3.2.0
EnvelopeHandle.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5EnvelopeHandle.h
6
7Paul Licameli split from TrackPanel.cpp
8
9**********************************************************************/
10
11#ifndef __AUDACITY_ENVELOPE_HANDLE__
12#define __AUDACITY_ENVELOPE_HANDLE__
13
14#include "../../UIHandle.h"
15
16#include <vector>
17
18class wxMouseEvent;
19class wxMouseState;
20
21class Envelope;
22class EnvelopeEditor;
23class ViewInfo;
24class TimeTrack;
25class WaveTrack;
26
27class AUDACITY_DLL_API EnvelopeHandle final : public UIHandle
28{
31
32 static UIHandlePtr HitEnvelope
33 (std::weak_ptr<EnvelopeHandle> &holder,
34 const wxMouseState &state, const wxRect &rect,
35 const AudacityProject *pProject,
36 Envelope *envelope, float zoomMin, float zoomMax,
37 bool dB, float dBRange, bool timeTrack);
38
39public:
40 explicit EnvelopeHandle( Envelope *pEnvelope );
41
44
45 virtual ~EnvelopeHandle();
46
47 static UIHandlePtr HitAnywhere
48 (std::weak_ptr<EnvelopeHandle> &holder, Envelope *envelope,
49 bool timeTrack);
50 static UIHandlePtr TimeTrackHitTest
51 (std::weak_ptr<EnvelopeHandle> &holder,
52 const wxMouseState &state, const wxRect &rect,
53 const AudacityProject *pProject, const std::shared_ptr<TimeTrack> &tt);
54 static UIHandlePtr WaveTrackHitTest
55 (std::weak_ptr<EnvelopeHandle> &holder,
56 const wxMouseState &state, const wxRect &rect,
57 const AudacityProject *pProject, const std::shared_ptr<WaveTrack> &wt);
58
59 Envelope *GetEnvelope() const { return mEnvelope; }
60
61 void Enter(bool forward, AudacityProject *) override;
62
64 (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
65
67 (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
68
70 (const TrackPanelMouseState &state, AudacityProject *pProject)
71 override;
72
74 (const TrackPanelMouseEvent &event, AudacityProject *pProject,
75 wxWindow *pParent) override;
76
77 Result Cancel(AudacityProject *pProject) override;
78
79 bool StopsOnKeystroke() override { return true; }
80
81private:
82 bool ForwardEventToEnvelopes
83 (const wxMouseEvent &event, const ViewInfo &viewInfo);
84
85 wxRect mRect{};
86 bool mLog{};
87 float mLower{}, mUpper{};
88 double mdBRange{};
89
90 Envelope *mEnvelope{};
91 std::vector< std::unique_ptr<EnvelopeEditor> > mEnvelopeEditors;
92
93 bool mTimeTrack{};
94};
95
96#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
std::vector< std::unique_ptr< EnvelopeEditor > > mEnvelopeEditors
EnvelopeHandle & operator=(const EnvelopeHandle &)=delete
Envelope * GetEnvelope() const
EnvelopeHandle(const EnvelopeHandle &)=delete
bool StopsOnKeystroke() override
EnvelopeHandle(EnvelopeHandle &&)=default
EnvelopeHandle & operator=(EnvelopeHandle &&)=default
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:72
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:24
Short-lived drawing and event-handling object associated with a TrackPanelCell.
Definition: UIHandle.h:35
virtual void Enter(bool forward, AudacityProject *pProject)
Definition: UIHandle.cpp:20
virtual Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
virtual Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0
virtual HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject)=0
virtual Result Cancel(AudacityProject *pProject)=0
virtual Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
A Track that contains audio waveform data.
Definition: WaveTrack.h:57