Audacity  3.0.3
WaveTrackControls.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 WavelTrackControls.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_WAVE_TRACK_CONTROLS__
12 #define __AUDACITY_WAVE_TRACK_CONTROLS__
13 
14 #include "../../ui/PlayableTrackControls.h" // to inherit
15 
16 class CellularPanel;
17 class LWSlider;
18 class MuteButtonHandle;
19 class SoloButtonHandle;
20 class GainSliderHandle;
21 class PanSliderHandle;
22 class WaveTrack;
23 class wxEvent;
24 class wxWindow;
25 
26 class AUDACITY_DLL_API WaveTrackControls final : public PlayableTrackControls
27 {
30 
31 public:
32  explicit
33  WaveTrackControls( std::shared_ptr<Track> pTrack )
34  : PlayableTrackControls( pTrack ) {}
36 
37  std::vector<UIHandlePtr> HitTest
38  (const TrackPanelMouseState &state,
39  const AudacityProject *pProject) override;
40 
41  PopupMenuTable *GetMenuExtension(Track *pTrack) override;
42 
43  const TCPLines& GetTCPLines() const override;
44 
45  static unsigned DefaultWaveTrackHeight();
46  static void GetGainRect(const wxPoint & topLeft, wxRect &dest);
47  static void GetPanRect(const wxPoint & topLeft, wxRect &dest);
48 
49  static LWSlider *GainSlider( CellularPanel &panel, const WaveTrack &wt );
50  static LWSlider * GainSlider
51  (const wxRect &sliderRect, const WaveTrack *t, bool captured,
52  wxWindow *pParent);
53 
54  static LWSlider *PanSlider( CellularPanel &panel, const WaveTrack &wt );
55  static LWSlider * PanSlider
56  (const wxRect &sliderRect, const WaveTrack *t, bool captured,
57  wxWindow *pParent);
58 
59  static void ReCreateSliders();
60 
61 private:
62  static void ReCreatePanSlider( wxEvent& );
63  static void ReCreateGainSlider( wxEvent& );
64 
65  std::weak_ptr<MuteButtonHandle> mMuteHandle;
66  std::weak_ptr<SoloButtonHandle> mSoloHandle;
67  std::weak_ptr<GainSliderHandle> mGainHandle;
68  std::weak_ptr<PanSliderHandle> mPanHandle;
69 };
70 
71 #include "../../../../widgets/PopupMenuTable.h"
72 
73 struct AUDACITY_DLL_API WaveTrackPopupMenuTable : public PopupMenuTable
74 {
77  WaveTrack &FindWaveTrack () const;
78  int ReserveId() { return mNextId++; }
79 protected:
80  int mNextId = 0;
81 };
82 
83 // Expose the wave track menu table to registration of menu items
84 AUDACITY_DLL_API
86 
87 #endif
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
MuteButtonHandle
Definition: PlayableTrackButtonHandles.h:18
TCPLines
TrackInfo::TCPLines TCPLines
Definition: TrackInfo.cpp:101
WaveTrackControls::WaveTrackControls
WaveTrackControls(const WaveTrackControls &)=delete
PopupMenuTable
Definition: PopupMenuTable.h:115
WaveTrackControls::ReCreateSliders
static void ReCreateSliders()
WaveTrackControls::mPanHandle
std::weak_ptr< PanSliderHandle > mPanHandle
Definition: WaveTrackControls.h:68
WaveTrackControls
Definition: WaveTrackControls.h:27
PanSliderHandle
Definition: WaveTrackSliderHandles.h:56
WaveTrackControls::WaveTrackControls
WaveTrackControls(std::shared_ptr< Track > pTrack)
Definition: WaveTrackControls.h:33
WaveTrackControls::mGainHandle
std::weak_ptr< GainSliderHandle > mGainHandle
Definition: WaveTrackControls.h:67
LWSlider
Lightweight version of ASlider. In other words it does not have a window permanently associated with ...
Definition: ASlider.h:62
CommonTrackControls::HitTest
virtual std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *) override=0
Definition: CommonTrackControls.cpp:36
PopupMenuTable::PopupMenuTable
PopupMenuTable(const Identifier &id, const TranslatableString &caption={})
Definition: PopupMenuTable.h:120
WaveTrackControls::mSoloHandle
std::weak_ptr< SoloButtonHandle > mSoloHandle
Definition: WaveTrackControls.h:66
PlayableTrackControls
Definition: PlayableTrackControls.h:21
CommonTrackControls::InitMenuData
Definition: CommonTrackControls.h:34
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
GainSliderHandle
Definition: WaveTrackSliderHandles.h:20
SoloButtonHandle
Definition: PlayableTrackButtonHandles.h:49
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
CellularPanel
Formerly part of TrackPanel, this abstract base class has no special knowledge of Track objects and i...
Definition: CellularPanel.h:34
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
WaveTrackControls::operator=
WaveTrackControls & operator=(const WaveTrackControls &)=delete
WaveTrackPopupMenuTable
Definition: WaveTrackControls.h:74
CommonTrackControls::GetMenuExtension
virtual PopupMenuTable * GetMenuExtension(Track *pTrack)=0
WaveTrackPopupMenuTable::ReserveId
int ReserveId()
Definition: WaveTrackControls.h:78
CommonTrackControls::GetTCPLines
virtual const TCPLines & GetTCPLines() const
Definition: TrackInfo.cpp:190
WaveTrackControls::mMuteHandle
std::weak_ptr< MuteButtonHandle > mMuteHandle
Definition: WaveTrackControls.h:65
GetWaveTrackMenuTable
AUDACITY_DLL_API WaveTrackPopupMenuTable & GetWaveTrackMenuTable()
Definition: WaveTrackControls.cpp:960