16#include "../../../../RefreshCode.h"
17#include "../../../ui/CommonTrackInfo.h"
18#include "../../../../TrackPanel.h"
24(
SliderFn sliderFn,
const wxRect &rect,
const std::shared_ptr<Track> &pTrack )
34 return std::static_pointer_cast<WaveTrack>(
mpTrack.lock());
52 pTrack->SetVolume(newValue);
73 value = pTrack->GetVolume();
82 return XO(
"%s: %s").Format(
XO(
"Volume"), val);
86(std::weak_ptr<VolumeSliderHandle> &holder,
87 const wxMouseState &state,
const wxRect &rect,
88 const std::shared_ptr<Track> &pTrack)
90 if (!state.ButtonIsDown(wxMOUSE_BTN_LEFT))
97 if (sliderRect.Contains(state.m_x, state.m_y)) {
103 (sliderRect,
static_cast<WaveTrack*
>( pTrack ),
true,
107 std::make_shared<VolumeSliderHandle>( sliderFn, sliderRect2, pTrack );
119(
SliderFn sliderFn,
const wxRect &rect,
const std::shared_ptr<Track> &pTrack )
129 return std::static_pointer_cast<WaveTrack>(
mpTrack.lock());
148 pTrack->SetPan(newValue);
169 value = pTrack->GetPan();
180 const auto v = 100.0f * fabsf(value);
183 val =
XO(
"%.0f%% Left").Format(v);
186 val =
XO(
"%.0f%% Right").Format(v);
190 return XO(
"%s: %s").Format(
XO(
"Pan"), val);
194(std::weak_ptr<PanSliderHandle> &holder,
195 const wxMouseState &state,
const wxRect &rect,
196 const std::shared_ptr<Track> &pTrack)
198 if (!state.ButtonIsDown(wxMOUSE_BTN_LEFT))
205 if (sliderRect.Contains(state.m_x, state.m_y)) {
209 (sliderRect,
static_cast<WaveTrack*
>( pTrack ),
true,
212 auto result = std::make_shared<PanSliderHandle>(
213 sliderFn, sliderRect, pTrack );
std::shared_ptr< UIHandle > UIHandlePtr
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
std::shared_ptr< WaveTrack > GetWaveTrack() const
PanSliderHandle(const PanSliderHandle &)=delete
float GetValue() override
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject) override
TranslatableString Tip(const wxMouseState &state, AudacityProject &) const override
Result SetValue(AudacityProject *pProject, float newValue) override
static UIHandlePtr HitTest(std::weak_ptr< PanSliderHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< Track > &pTrack)
virtual ~PanSliderHandle()
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
LWSlider *(*)(AudacityProject *, const wxRect &, Track *) SliderFn
std::weak_ptr< Track > mpTrack
Abstract base class for an object holding data associated with points on a time axis.
static TrackPanel & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.
Result SetValue(AudacityProject *pProject, float newValue) override
VolumeSliderHandle(const VolumeSliderHandle &)=delete
std::shared_ptr< WaveTrack > GetWaveTrack() const
static UIHandlePtr HitTest(std::weak_ptr< VolumeSliderHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< Track > &pTrack)
TranslatableString Tip(const wxMouseState &state, AudacityProject &) const override
virtual ~VolumeSliderHandle()
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject) override
float GetValue() override
static void GetVolumeRect(const wxRect &rect, wxRect &dest)
static void GetPanRect(const wxRect &rect, wxRect &dest)
static LWSlider * VolumeSlider(CellularPanel &panel, const WaveTrack &wt)
static LWSlider * PanSlider(CellularPanel &panel, const WaveTrack &wt)
A Track that contains audio waveform data.
AUDACITY_DLL_API bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
Namespace containing an enum 'what to do on a refresh?'.