Audacity  2.2.2
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
std::unique_ptr< EnvelopeEditor > mEnvelopeEditorRight
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:141
Envelope * mEnvelope
Draggable curve used in TrackPanel for varying amplification.
Definition: Envelope.h:77
EnvelopeHandle(const EnvelopeHandle &)=delete
static UIHandlePtr WaveTrackHitTest(std::weak_ptr< EnvelopeHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< WaveTrack > &wt)
Result Cancel(AudacityProject *pProject) override
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
bool ForwardEventToEnvelopes(const wxMouseEvent &event, const ViewInfo &viewInfo)
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
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)
virtual ~EnvelopeHandle()
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
static UIHandlePtr HitAnywhere(std::weak_ptr< EnvelopeHandle > &holder, Envelope *envelope, bool timeTrack)
Envelope * GetEnvelope() const
bool StopsOnKeystroke() override
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
HitTestPreview Preview(const TrackPanelMouseState &state, const AudacityProject *pProject) override
void Enter(bool forward) override
static UIHandlePtr TimeTrackHitTest(std::weak_ptr< EnvelopeHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< TimeTrack > &tt)