Audacity  3.0.3
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 
16 #include <vector>
17 
18 class wxMouseEvent;
19 class wxMouseState;
20 
21 class Envelope;
22 class EnvelopeEditor;
23 class ViewInfo;
24 class TimeTrack;
25 class WaveTrack;
26 
27 class AUDACITY_DLL_API EnvelopeHandle final : public UIHandle
28 {
29  EnvelopeHandle(const EnvelopeHandle&) = delete;
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 
39 public:
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 
66  Result Drag
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 
81 private:
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
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
UIHandle::Preview
virtual HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject)=0
EnvelopeHandle::GetEnvelope
Envelope * GetEnvelope() const
Definition: EnvelopeHandle.h:59
ViewInfo
Definition: ViewInfo.h:202
Envelope
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:71
EnvelopeHandle::StopsOnKeystroke
bool StopsOnKeystroke() override
Definition: EnvelopeHandle.h:79
EnvelopeHandle
Definition: EnvelopeHandle.h:28
UIHandle
Short-lived drawing and event-handling object associated with a TrackPanelCell.
Definition: UIHandle.h:35
EnvelopeHandle::EnvelopeHandle
EnvelopeHandle(const EnvelopeHandle &)=delete
EnvelopeHandle::EnvelopeHandle
EnvelopeHandle(EnvelopeHandle &&)=default
EnvelopeHandle::operator=
EnvelopeHandle & operator=(EnvelopeHandle &&)=default
UIHandle::Click
virtual Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
UIHandlePtr
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
UIHandle::Cancel
virtual Result Cancel(AudacityProject *pProject)=0
HitTestPreview
Definition: HitTestResult.h:20
EnvelopeHandle::operator=
EnvelopeHandle & operator=(const EnvelopeHandle &)=delete
EnvelopeHandle::mEnvelopeEditors
std::vector< std::unique_ptr< EnvelopeEditor > > mEnvelopeEditors
Definition: EnvelopeHandle.h:91
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
TrackPanelMouseEvent
Definition: TrackPanelMouseEvent.h:46
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
UIHandle::Enter
virtual void Enter(bool forward, AudacityProject *pProject)
Definition: UIHandle.cpp:20
UIHandle::Drag
virtual Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
UIHandle::Release
virtual Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0
WaveTrackVZoomHandle::Result
unsigned Result
Definition: WaveTrackVZoomHandle.h:24
TimeTrack
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:24
EnvelopeEditor
Definition: EnvelopeEditor.h:23