30#include <wx/tooltip.h>
33#include <wx/gbsizer.h>
39#include "../widgets/MeterPanel.h"
41#if wxUSE_ACCESSIBILITY
43class MeterButtonAx :
public AButtonAx
45 wxWeakRef<MeterPanel> mAssociatedMeterPanel{
nullptr};
46 bool mAccSilent{
false};
51 , mAssociatedMeterPanel(&panel)
54 wxAccStatus GetName(
int childId, wxString*
name)
override
56 if(childId != wxACC_SELF)
57 return wxACC_NOT_IMPLEMENTED;
60 *
name = wxEmptyString;
63 const auto button =
static_cast<AButton*
>(GetWindow());
65 *
name = button->GetName();
67 if(
const auto panel = mAssociatedMeterPanel.get())
73 if(panel->IsMonitoring())
74 *
name +=
wxT(
" ") +
_(
" Monitoring ");
75 else if(panel->IsActive())
78 const auto dbRange = panel->GetDBRange();
80 *
name +=
wxT(
" ") + wxString::Format(
_(
" Peak %2.f dB"), panel->GetPeakHold() * dbRange - dbRange);
82 *
name +=
wxT(
" ") + wxString::Format(
_(
" Peak %.2f "), panel->GetPeakHold());
84 if(panel->IsClipping())
91 wxAccStatus GetRole(
int childId, wxAccRole* role)
override
93 if(childId != wxACC_SELF)
94 return wxACC_NOT_IMPLEMENTED;
99 *role = wxROLE_SYSTEM_PUSHBUTTON;
103 void SetSilent(
bool silent)
105 if(mAccSilent != silent)
111 wxACC_EVENT_OBJECT_FOCUS,
134 return wxT(
"CombinedMeter");
139 return wxT(
"PlayMeter");
144 return wxT(
"RecordMeter");
149 unsigned whichMeters,
152, mWhichMeters{ whichMeters }
179 const auto &toolBarID = forPlayMeterToolBar ?
PlayID() :
RecordID();
180 return *
static_cast<MeterToolBar*
>(toolManager.GetToolBar(toolBarID));
214 projectAudioIO.SetPlaybackMeter(
nullptr );
221 projectAudioIO.SetCaptureMeter(
nullptr );
227 if( playState.mSaved ){
231 if( recordState.mSaved ){
274#if wxUSE_ACCESSIBILITY
279#if wxUSE_ACCESSIBILITY
280 meterButtonAcc->SetSilent(
true);
287#
if wxUSE_ACCESSIBILITY
292 meterButtonAcc->SetSilent(
false);
329#if wxUSE_ACCESSIBILITY
334#if wxUSE_ACCESSIBILITY
335 meterButtonAcc->SetSilent(
true);
342#
if wxUSE_ACCESSIBILITY
343 meterButtonAcc->SetSilent(
false);
363 ?
XO(
"Recording Meter")
364 :
XO(
"Playback Meter");
384 const auto size = GetSize();
385 const auto isHorizontal =
size.x >
size.y;
390 ? (isHorizontal ? wxVERTICAL : wxHORIZONTAL)
391 : (isHorizontal ? wxHORIZONTAL : wxVERTICAL);
393 if(
mRootSizer->GetOrientation() == sizerOrientation)
403 std::unique_ptr<wxBoxSizer> playBarSizer;
404 std::unique_ptr<wxBoxSizer> recordBarSizer;
407 playBarSizer = std::make_unique<wxBoxSizer>(isHorizontal ? wxHORIZONTAL : wxVERTICAL);
413 recordBarSizer = std::make_unique<wxBoxSizer>(isHorizontal ? wxHORIZONTAL : wxVERTICAL);
418 if(playBarSizer && recordBarSizer)
420 Add(
mRootSizer =
safenew wxBoxSizer(isHorizontal ? wxVERTICAL : wxHORIZONTAL), 1, wxEXPAND | wxALL, 2);
424 else if(playBarSizer)
425 Add(
mRootSizer = playBarSizer.release(), 1, wxEXPAND | wxALL, 2);
426 else if(recordBarSizer)
427 Add(
mRootSizer = recordBarSizer.release(), 1, wxEXPAND | wxALL, 2);
454 projectAudioIO.SetPlaybackMeter(
nullptr );
459 projectAudioIO.SetCaptureMeter(
nullptr );
535 wxT(
"ShowRecordMeterTB"),
XXO(
"&Recording Meter Toolbar"),
542 wxT(
"ShowPlayMeterTB"),
XXO(
"&Playback Meter Toolbar"),
562 tb.ShowOutputGainDialog();
569 tb.AdjustOutputGain(1);
576 tb.AdjustOutputGain(-1);
583 tb.ShowInputGainDialog();
590 tb.AdjustInputGain(1);
597 tb.AdjustInputGain(-1);
603 static auto menu = std::shared_ptr{
605 Command(
wxT(
"OutputGain"),
XXO(
"Ad&just Playback Volume..."),
607 Command(
wxT(
"OutputGainInc"),
XXO(
"&Increase Playback Volume"),
609 Command(
wxT(
"OutputGainDec"),
XXO(
"&Decrease Playback Volume"),
611 Command(
wxT(
"InputGain"),
XXO(
"Adj&ust Recording Volume..."),
613 Command(
wxT(
"InputGainInc"),
XXO(
"I&ncrease Recording Volume"),
615 Command(
wxT(
"InputGainDec"),
XXO(
"D&ecrease Recording Volume"),
622 wxT(
"Optional/Extra/Part1")
AttachedItem sAttachment1
AttachedItem sAttachment2
constexpr CommandFlag AlwaysEnabledFlag
XXO("&Cut/Copy/Paste Toolbar")
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
AudacityProject & project
An explicitly nonlocalized string, not meant for the user to see.
std::shared_ptr< Meter > GetMeter() const
MeterPanel is a panel that paints the meter used for monitoring or playback.
void Decrease(float steps)
void Increase(float steps)
void UpdateSliderControl()
void ShowMenu(const wxPoint &pos)
void SetName(const TranslatableString &name)
void RestoreState(const State &state)
static ProjectAudioIO & Get(AudacityProject &project)
Generates classes whose instances register items at construction.
wxColour & Colour(int iIndex)
wxImage & Image(int iIndex)
Holds a msgid for the translation catalog; may also bind format arguments.
void SetLabel(const TranslatableString &label)
std::unique_ptr< detail::IndirectItem< Item > > Indirect(const std::shared_ptr< Item > &ptr)
A convenience function.