Audacity  2.2.0
WaveTrackSliderHandles.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 WavelTrackSliderHandles.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_WAVE_TRACK_SLIDER_HANDLES__
12 #define __AUDACITY_WAVE_TRACK_SLIDER_HANDLES__
13 
14 #include "../../../ui/SliderHandle.h"
15 
16 class wxMouseState;
17 class WaveTrack;
18 
19 class GainSliderHandle final : public SliderHandle
20 {
21  GainSliderHandle(const GainSliderHandle&) = delete;
22 
23  std::shared_ptr<WaveTrack> GetWaveTrack();
24 
25 public:
26  explicit GainSliderHandle
27  ( SliderFn sliderFn, const wxRect &rect,
28  const std::shared_ptr<Track> &pTrack );
29 
30  GainSliderHandle &operator=(const GainSliderHandle&) = default;
31 
32  virtual ~GainSliderHandle();
33 
34 protected:
35  float GetValue() override;
37  (AudacityProject *pProject, float newValue) override;
39  (const wxMouseEvent &event, AudacityProject *pProject) override;
40 
41  bool StopsOnKeystroke () override { return true; }
42 
43 public:
44  static UIHandlePtr HitTest
45  (std::weak_ptr<GainSliderHandle> &holder,
46  const wxMouseState &state, const wxRect &rect,
47  const std::shared_ptr<Track> &pTrack);
48 };
49 
51 
52 class PanSliderHandle final : public SliderHandle
53 {
54  PanSliderHandle(const PanSliderHandle&) = delete;
55 
56  std::shared_ptr<WaveTrack> GetWaveTrack();
57 
58 public:
59  explicit PanSliderHandle
60  ( SliderFn sliderFn, const wxRect &rect,
61  const std::shared_ptr<Track> &pTrack );
62 
63  PanSliderHandle &operator=(const PanSliderHandle&) = default;
64 
65  virtual ~PanSliderHandle();
66 
67 protected:
68  float GetValue() override;
69  Result SetValue(AudacityProject *pProject, float newValue) override;
71  (const wxMouseEvent &event, AudacityProject *pProject) override;
72 
73  bool StopsOnKeystroke () override { return true; }
74 
75 public:
76  static UIHandlePtr HitTest
77  (std::weak_ptr<PanSliderHandle> &holder,
78  const wxMouseState &state, const wxRect &rect,
79  const std::shared_ptr<Track> &pTrack);
80 };
81 
82 #endif
Result SetValue(AudacityProject *pProject, float newValue) override
Definition: WaveTrackSliderHandles.cpp:127
Definition: SliderHandle.h:22
float GetValue() override
Definition: WaveTrackSliderHandles.cpp:119
PanSliderHandle(const PanSliderHandle &)=delete
LWSlider *(*)(AudacityProject *, const wxRect &, Track *) SliderFn
Definition: SliderHandle.h:27
GainSliderHandle(const GainSliderHandle &)=delete
PanSliderHandle & operator=(const PanSliderHandle &)=default
Definition: WaveTrackSliderHandles.h:19
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
std::shared_ptr< WaveTrack > GetWaveTrack()
Definition: WaveTrackSliderHandles.cpp:31
float GetValue() override
Definition: WaveTrackSliderHandles.cpp:36
Result SetValue(AudacityProject *pProject, float newValue) override
Definition: WaveTrackSliderHandles.cpp:45
unsigned Result
Definition: UIHandle.h:37
bool StopsOnKeystroke() override
Definition: WaveTrackSliderHandles.h:41
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
Definition: WaveTrackSliderHandles.h:52
GainSliderHandle & operator=(const GainSliderHandle &)=default
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
virtual ~GainSliderHandle()
Definition: WaveTrackSliderHandles.cpp:27
std::shared_ptr< WaveTrack > GetWaveTrack()
Definition: WaveTrackSliderHandles.cpp:114
static UIHandlePtr HitTest(std::weak_ptr< GainSliderHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< Track > &pTrack)
Definition: WaveTrackSliderHandles.cpp:73
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject) override
Definition: WaveTrackSliderHandles.cpp:66
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject) override
Definition: WaveTrackSliderHandles.cpp:160
virtual ~PanSliderHandle()
Definition: WaveTrackSliderHandles.cpp:110
bool StopsOnKeystroke() override
Definition: WaveTrackSliderHandles.h:73
static UIHandlePtr HitTest(std::weak_ptr< PanSliderHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< Track > &pTrack)
Definition: WaveTrackSliderHandles.cpp:167