Audacity  2.2.0
EnvelopeHandle.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 EnvelopeHandle.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_ENVELOPE_HANDLE__
12 #define __AUDACITY_ENVELOPE_HANDLE__
13 
14 #include "../../UIHandle.h"
15 #include "../../MemoryX.h"
16 
17 class wxMouseEvent;
18 class wxMouseState;
19 #include <wx/gdicmn.h>
20 
21 class Envelope;
22 class EnvelopeEditor;
23 class ViewInfo;
24 class TimeTrack;
25 class WaveTrack;
26 
27 class EnvelopeHandle final : public UIHandle
28 {
29  EnvelopeHandle(const EnvelopeHandle&) = delete;
30  EnvelopeHandle &operator=(const EnvelopeHandle&) = delete;
31 
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 
39 public:
40  explicit EnvelopeHandle( Envelope *pEnvelope );
41 
42  virtual ~EnvelopeHandle();
43 
45  (std::weak_ptr<EnvelopeHandle> &holder, Envelope *envelope,
46  bool timeTrack);
48  (std::weak_ptr<EnvelopeHandle> &holder,
49  const wxMouseState &state, const wxRect &rect,
50  const AudacityProject *pProject, const std::shared_ptr<TimeTrack> &tt);
52  (std::weak_ptr<EnvelopeHandle> &holder,
53  const wxMouseState &state, const wxRect &rect,
54  const AudacityProject *pProject, const std::shared_ptr<WaveTrack> &wt);
55 
56  Envelope *GetEnvelope() const { return mEnvelope; }
57 
58  void Enter(bool forward) override;
59 
61  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
62 
63  Result Drag
64  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
65 
67  (const TrackPanelMouseState &state, const AudacityProject *pProject)
68  override;
69 
71  (const TrackPanelMouseEvent &event, AudacityProject *pProject,
72  wxWindow *pParent) override;
73 
74  Result Cancel(AudacityProject *pProject) override;
75 
76  bool StopsOnKeystroke() override { return true; }
77 
78 private:
80  (const wxMouseEvent &event, const ViewInfo &viewInfo);
81 
82  wxRect mRect{};
83  bool mLog{};
84  float mLower{}, mUpper{};
85  double mdBRange{};
86 
88  std::unique_ptr<EnvelopeEditor> mEnvelopeEditor;
89  std::unique_ptr<EnvelopeEditor> mEnvelopeEditorRight;
90 
91  bool mTimeTrack{};
92 };
93 
94 #endif
std::unique_ptr< EnvelopeEditor > mEnvelopeEditor
Definition: EnvelopeHandle.h:88
std::unique_ptr< EnvelopeEditor > mEnvelopeEditorRight
Definition: EnvelopeHandle.h:89
EnvelopeHandle & operator=(const EnvelopeHandle &)=delete
ViewInfo is used mainly to hold the zooming, selection and scroll information. It also has some statu...
Definition: ViewInfo.h:138
float mUpper
Definition: EnvelopeHandle.h:84
Envelope * mEnvelope
Definition: EnvelopeHandle.h:87
Definition: Envelope.h:286
Draggable curve used in TrackPanel for varying amplification.
Definition: Envelope.h:78
EnvelopeHandle(const EnvelopeHandle &)=delete
Definition: TrackPanelMouseEvent.h:23
static UIHandlePtr WaveTrackHitTest(std::weak_ptr< EnvelopeHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< WaveTrack > &wt)
Definition: EnvelopeHandle.cpp:87
Result Cancel(AudacityProject *pProject) override
Definition: EnvelopeHandle.cpp:290
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: EnvelopeHandle.cpp:265
bool ForwardEventToEnvelopes(const wxMouseEvent &event, const ViewInfo &viewInfo)
Definition: EnvelopeHandle.cpp:299
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: EnvelopeHandle.cpp:226
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:29
unsigned Result
Definition: UIHandle.h:37
static UIHandlePtr HitEnvelope(std::weak_ptr< EnvelopeHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, Envelope *envelope, float zoomMin, float zoomMax, bool dB, float dBRange, bool timeTrack)
Definition: EnvelopeHandle.cpp:117
virtual ~EnvelopeHandle()
Definition: EnvelopeHandle.cpp:41
Definition: EnvelopeHandle.h:27
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
static UIHandlePtr HitAnywhere(std::weak_ptr< EnvelopeHandle > &holder, Envelope *envelope, bool timeTrack)
Definition: EnvelopeHandle.cpp:45
wxRect mRect
Definition: EnvelopeHandle.h:82
Envelope * GetEnvelope() const
Definition: EnvelopeHandle.h:56
bool StopsOnKeystroke() override
Definition: EnvelopeHandle.h:76
bool mTimeTrack
Definition: EnvelopeHandle.h:91
float mLower
Definition: EnvelopeHandle.h:84
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: EnvelopeHandle.cpp:170
double mdBRange
Definition: EnvelopeHandle.h:85
Definition: UIHandle.h:33
HitTestPreview Preview(const TrackPanelMouseState &state, const AudacityProject *pProject) override
Definition: EnvelopeHandle.cpp:242
Definition: HitTestResult.h:19
void Enter(bool forward) override
Definition: EnvelopeHandle.cpp:34
bool mLog
Definition: EnvelopeHandle.h:83
Definition: TrackPanelMouseEvent.h:41
static UIHandlePtr TimeTrackHitTest(std::weak_ptr< EnvelopeHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< TimeTrack > &tt)
Definition: EnvelopeHandle.cpp:70