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(std::weak_ptr<EnvelopeHandle> &holder,
33 const wxMouseState &state, const wxRect &rect,
34 const AudacityProject *pProject,
35 Envelope *envelope, std::weak_ptr<const Channel> wChannel,
36 float zoomMin, float zoomMax,
37 bool dB, float dBRange, bool timeTrack);
38
39public:
40 EnvelopeHandle(Envelope *pEnvelope, std::weak_ptr<const Channel> wChannel);
41
44
45 virtual ~EnvelopeHandle();
46
47 std::shared_ptr<const Channel> FindChannel() const override;
48
49 static UIHandlePtr HitAnywhere(std::weak_ptr<EnvelopeHandle> &holder,
50 Envelope *envelope, std::weak_ptr<const Channel> wChannel,
51 bool timeTrack);
52 static UIHandlePtr TimeTrackHitTest
53 (std::weak_ptr<EnvelopeHandle> &holder,
54 const wxMouseState &state, const wxRect &rect,
55 const AudacityProject *pProject, const std::shared_ptr<TimeTrack> &tt);
56 static UIHandlePtr WaveTrackHitTest
57 (std::weak_ptr<EnvelopeHandle> &holder,
58 const wxMouseState &state, const wxRect &rect,
59 const AudacityProject *pProject, const std::shared_ptr<WaveTrack> &wt);
60
61 Envelope *GetEnvelope() const { return mEnvelope; }
62
63 void Enter(bool forward, AudacityProject *) override;
64
66 (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
67
69 (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
70
72 (const TrackPanelMouseState &state, AudacityProject *pProject)
73 override;
74
76 (const TrackPanelMouseEvent &event, AudacityProject *pProject,
77 wxWindow *pParent) override;
78
79 Result Cancel(AudacityProject *pProject) override;
80
81 bool StopsOnKeystroke() override { return true; }
82
83private:
84 bool ForwardEventToEnvelopes
85 (const wxMouseEvent &event, const ViewInfo &viewInfo);
86
87 wxRect mRect{};
88 bool mLog{};
89 float mLower{}, mUpper{};
90 double mdBRange{};
91
92 Envelope *mEnvelope{};
93 std::weak_ptr<const Channel> mwChannel;
94 std::unique_ptr<EnvelopeEditor> mpEnvelopeEditor;
95
96 bool mTimeTrack{};
97};
98
99#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::unique_ptr< EnvelopeEditor > mpEnvelopeEditor
std::weak_ptr< const Channel > mwChannel
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:36
virtual void Enter(bool forward, AudacityProject *pProject)
Definition: UIHandle.cpp:20
virtual Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
virtual std::shared_ptr< const Channel > FindChannel() const =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:227