| 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 |
#include "Observer.h" |
| 16 |
|
| 17 |
class CellularPanel; |
| 18 |
class LWSlider; |
| 19 |
class MuteButtonHandle; |
| 20 |
class SoloButtonHandle; |
| 21 |
class EffectsButtonHandle; |
| 22 |
class VolumeSliderHandle; |
| 23 |
class PanSliderHandle; |
| 24 |
class WaveTrack; |
| 25 |
class wxEvent; |
| 26 |
class wxWindow; |
| 27 |
|
| 28 |
class AUDACITY_DLL_API WaveTrackControls final : public PlayableTrackControls |
| 29 |
{ |
| 30 |
WaveTrackControls(const WaveTrackControls&) = delete; |
| 31 |
WaveTrackControls &operator=(const WaveTrackControls&) = delete; |
| 32 |
|
| 33 |
public: |
| 34 |
explicit |
| 35 |
WaveTrackControls( std::shared_ptr<Track> pTrack ) |
| 36 |
: PlayableTrackControls( pTrack ) {} |
| 37 |
~WaveTrackControls() override; |
| 38 |
|
| 39 |
std::vector<UIHandlePtr> HitTest |
| 40 |
(const TrackPanelMouseState &state, |
| 41 |
const AudacityProject *pProject) override; |
| 42 |
|
| 43 |
PopupMenuTable *GetMenuExtension(Track *pTrack) override; |
| 44 |
|
| 45 |
const TCPLines& GetTCPLines() const override; |
| 46 |
|
| 47 |
static unsigned DefaultWaveTrackHeight(); |
| 48 |
static void GetVolumeRect(const wxRect &rect, wxRect &dest); |
| 49 |
static void GetPanRect(const wxRect &rect, wxRect &dest); |
| 50 |
|
| 51 |
static LWSlider *VolumeSlider( CellularPanel &panel, const WaveTrack &wt ); |
| 52 |
static LWSlider * VolumeSlider |
| 53 |
(const wxRect &sliderRect, const WaveTrack *t, bool captured, |
| 54 |
wxWindow *pParent); |
| 55 |
|
| 56 |
static LWSlider *PanSlider( CellularPanel &panel, const WaveTrack &wt ); |
| 57 |
static LWSlider * PanSlider |
| 58 |
(const wxRect &sliderRect, const WaveTrack *t, bool captured, |
| 59 |
wxWindow *pParent); |
| 60 |
|
| 61 |
static void ReCreateSliders(); |
| 62 |
|
| 63 |
private: |
| 64 |
static void ReCreatePanSlider(struct ThemeChangeMessage); |
| 65 |
static void ReCreateVolumeSlider(struct ThemeChangeMessage); |
| 66 |
|
| 67 |
std::weak_ptr<MuteButtonHandle> mMuteHandle; |
| 68 |
std::weak_ptr<SoloButtonHandle> mSoloHandle; |
| 69 |
std::weak_ptr<EffectsButtonHandle> mEffectsHandle; |
| 70 |
std::weak_ptr<VolumeSliderHandle> mVolumeHandle; |
| 71 |
std::weak_ptr<PanSliderHandle> mPanHandle; |
| 72 |
}; |
| 73 |
|
| 74 |
#include "../../../../widgets/PopupMenuTable.h" |
| 75 |
|
| 76 |
struct AUDACITY_DLL_API WaveTrackPopupMenuTable : public PopupMenuTable |
| 77 |
{ |
| 78 |
using PopupMenuTable::PopupMenuTable; |
| 79 |
PlayableTrackControls::InitMenuData *mpData{}; |
| 80 |
WaveTrack &FindWaveTrack () const; |
| 81 |
int ReserveId() { return mNextId++; } |
| 82 |
protected: |
| 83 |
int mNextId = 0; |
| 84 |
}; |
| 85 |
|
| 86 |
// Expose the wave track menu table to registration of menu items |
| 87 |
AUDACITY_DLL_API |
| 88 |
WaveTrackPopupMenuTable &GetWaveTrackMenuTable(); |
| 89 |
|
| 90 |
#endif |