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 Channel;
22class Envelope;
23class EnvelopeEditor;
24class ViewInfo;
25class TimeTrack;
26class WaveChannel;
27
28class AUDACITY_DLL_API EnvelopeHandle final : public UIHandle
29{
32
33 static UIHandlePtr HitEnvelope(std::weak_ptr<EnvelopeHandle> &holder,
34 const wxMouseState &state, const wxRect &rect,
35 const AudacityProject *pProject,
36 Envelope *envelope, std::weak_ptr<const Channel> wChannel,
37 float zoomMin, float zoomMax,
38 bool dB, float dBRange, bool timeTrack);
39
40public:
41 EnvelopeHandle(Envelope *pEnvelope, std::weak_ptr<const Channel> wChannel);
42
45
46 virtual ~EnvelopeHandle();
47
48 std::shared_ptr<const Track> FindTrack() const override;
49
50 static UIHandlePtr HitAnywhere(std::weak_ptr<EnvelopeHandle> &holder,
51 Envelope *envelope, std::weak_ptr<const Channel> wChannel,
52 bool timeTrack);
53 static UIHandlePtr TimeTrackHitTest
54 (std::weak_ptr<EnvelopeHandle> &holder,
55 const wxMouseState &state, const wxRect &rect,
56 const AudacityProject *pProject, const std::shared_ptr<TimeTrack> &tt);
57 static UIHandlePtr WaveChannelHitTest(std::weak_ptr<EnvelopeHandle> &holder,
58 const wxMouseState &state, const wxRect &rect,
59 const AudacityProject *pProject, const std::shared_ptr<WaveChannel> &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:37
virtual void Enter(bool forward, AudacityProject *pProject)
Definition: UIHandle.cpp:19
virtual Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
virtual Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0
virtual std::shared_ptr< const Track > FindTrack() const =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