Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
MeterToolBar Class Referencefinal

A ToolBar that holds the VU Meter. More...

#include <MeterToolBar.h>

Inheritance diagram for MeterToolBar:
[legend]
Collaboration diagram for MeterToolBar:
[legend]

Public Member Functions

 MeterToolBar (AudacityProject &project, int type)
 Methods for MeterToolBar. More...
 
virtual ~MeterToolBar ()
 
void Create (wxWindow *parent) override
 
void Populate () override
 
void ReCreateButtons () override
 
void Repaint (wxDC *WXUNUSED(dc)) override
 
void EnableDisableButtons () override
 
void UpdatePrefs () override
 
void UpdateControls ()
 
void OnSize (wxSizeEvent &event)
 
bool Expose (bool show) override
 
int GetInitialWidth () override
 Resizable toolbars should implement these. More...
 
int GetMinToolbarWidth () override
 
wxSize GetDockedSize () override
 
virtual void SetDocked (ToolDock *dock, bool pushed) override
 
void ShowOutputGainDialog ()
 
void ShowInputGainDialog ()
 
void AdjustOutputGain (int adj)
 
void AdjustInputGain (int adj)
 
- Public Member Functions inherited from ToolBar
 ToolBar (AudacityProject &project, int type, const TranslatableString &label, const wxString &section, bool resizable=false)
 
virtual ~ToolBar ()
 
bool AcceptsFocus () const override
 
bool AcceptsFocusFromKeyboard () const override
 
virtual void SetToDefaultSize ()
 
virtual void Create (wxWindow *parent)
 
virtual void EnableDisableButtons ()=0
 
virtual void ReCreateButtons ()
 
void UpdatePrefs () override
 
virtual void RegenerateTooltips ()=0
 
int GetType ()
 
TranslatableString GetTitle ()
 
TranslatableString GetLabel ()
 
wxString GetSection ()
 
ToolDockGetDock ()
 
void SetLabel (const TranslatableString &label)
 
virtual void SetDocked (ToolDock *dock, bool pushed)
 
virtual bool Expose (bool show=true)
 
bool IsResizable () const
 
bool IsVisible () const
 
bool IsDocked () const
 
bool IsPositioned ()
 
void SetVisible (bool bVisible)
 
void SetPositioned ()
 
virtual int GetInitialWidth ()
 Resizable toolbars should implement these. More...
 
virtual int GetMinToolbarWidth ()
 
virtual wxSize GetDockedSize ()
 
wxSize GetSmartDockedSize ()
 
virtual void ResizingDone ()
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Static Public Member Functions

static MeterToolBars GetToolBars (AudacityProject &project)
 
static ConstMeterToolBars GetToolBars (const AudacityProject &project)
 
static MeterToolBarGet (AudacityProject &project, bool forPlayMeterToolBar)
 
static const MeterToolBarGet (const AudacityProject &project, bool forPlayMeterToolBar)
 
- Static Public Member Functions inherited from ToolBar
static AButtonMakeButton (wxWindow *parent, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxWindowID id, wxPoint placement, bool processdownevents, wxSize size)
 
static AButtonMakeButton (ToolBar *parent, teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, int id, bool processdownevents, const TranslatableString &label)
 
static void MakeAlternateImages (AButton &button, int idx, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxSize size)
 
static void SetButtonToolTip (AudacityProject &project, AButton &button, const ComponentInterfaceSymbol commands[], size_t nCommands)
 
static void MakeButtonBackgroundsSmall ()
 
static void MakeButtonBackgroundsLarge ()
 

Private Member Functions

void RegenerateTooltips () override
 
void RebuildLayout (bool force)
 

Private Attributes

int mWhichMeters
 
wxBoxSizer * mRootSizer {nullptr}
 
AButtonmPlaySetupButton {nullptr}
 
MeterPanelmPlayMeter {nullptr}
 
AButtonmRecordSetupButton {nullptr}
 
MeterPanelmRecordMeter {nullptr}
 

Additional Inherited Members

- Public Types inherited from ToolBar
using Holder = wxWindowPtr< ToolBar >
 
- Protected Member Functions inherited from ToolBar
void SetButton (bool down, AButton *button)
 
wxBoxSizer * GetSizer ()
 
void Add (wxWindow *window, int proportion=0, int flag=wxALIGN_TOP, int border=0, wxObject *userData=NULL)
 
void Add (wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
 
void Add (int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
 
void AddSpacer (int size=14)
 
void AddStretchSpacer (int prop=1)
 
void Detach (wxWindow *window)
 
void Detach (wxSizer *sizer)
 
void Updated ()
 
int GetResizeGrabberWidth ()
 Returns the width in pixels of the resizer element. More...
 
virtual void Populate ()=0
 
virtual void Repaint (wxDC *dc)=0
 
void OnErase (wxEraseEvent &event)
 
void OnPaint (wxPaintEvent &event)
 
void OnMouseEvents (wxMouseEvent &event)
 
- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
- Static Protected Member Functions inherited from ToolBar
static void MakeMacRecoloredImage (teBmps eBmpOut, teBmps eBmpIn)
 
static void MakeMacRecoloredImageSize (teBmps eBmpOut, teBmps eBmpIn, const wxSize &size)
 
static void MakeRecoloredImage (teBmps eBmpOut, teBmps eBmpIn)
 
static void MakeRecoloredImageSize (teBmps eBmpOut, teBmps eBmpIn, const wxSize &size)
 
- Static Protected Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 
- Protected Attributes inherited from ToolBar
AudacityProjectmProject
 
TranslatableString mLabel
 
wxString mSection
 
int mType
 

Detailed Description

A ToolBar that holds the VU Meter.

Definition at line 38 of file MeterToolBar.h.

Constructor & Destructor Documentation

◆ MeterToolBar()

MeterToolBar::MeterToolBar ( AudacityProject project,
int  type 
)

Methods for MeterToolBar.

Definition at line 135 of file MeterToolBar.cpp.

136: ToolBar(project, type, XO("Combined Meter"), wxT("CombinedMeter"), true)
137{
138 if( mType == RecordMeterBarID ){
140 mLabel = XO("Recording Meter");
141 mSection = wxT("RecordMeter");
142 } else if( mType == PlayMeterBarID ){
144 mLabel = XO("Playback Meter");
145 mSection = wxT("PlayMeter");
146 } else {
148 }
149}
wxT("CloseDown"))
#define XO(s)
Definition: Internat.h:31
constexpr int kWithPlayMeter
Definition: MeterToolBar.h:35
constexpr int kWithRecordMeter
Definition: MeterToolBar.h:34
@ RecordMeterBarID
Definition: ToolBar.h:75
@ PlayMeterBarID
Definition: ToolBar.h:76
int mType
Definition: ToolBar.h:254
TranslatableString mLabel
Definition: ToolBar.h:252
ToolBar(AudacityProject &project, int type, const TranslatableString &label, const wxString &section, bool resizable=false)
Definition: ToolBar.cpp:330
wxString mSection
Definition: ToolBar.h:253

References kWithPlayMeter, kWithRecordMeter, PlayMeterBarID, RecordMeterBarID, wxT(), and XO.

Here is the call graph for this function:

◆ ~MeterToolBar()

MeterToolBar::~MeterToolBar ( )
virtual

Definition at line 151 of file MeterToolBar.cpp.

152{
153}

Member Function Documentation

◆ AdjustInputGain()

void MeterToolBar::AdjustInputGain ( int  adj)

Definition at line 488 of file MeterToolBar.cpp.

489{
490 if (adj < 0) {
491 mRecordMeter->Decrease(-adj);
492 }
493 else {
495 }
496
498}
void Decrease(float steps)
Definition: MeterPanel.cpp:890
void Increase(float steps)
Definition: MeterPanel.cpp:879
void UpdateSliderControl()
Definition: MeterPanel.cpp:476
MeterPanel * mRecordMeter
Definition: MeterToolBar.h:85

References MeterPanel::Decrease(), MeterPanel::Increase(), mRecordMeter, and MeterPanel::UpdateSliderControl().

Here is the call graph for this function:

◆ AdjustOutputGain()

void MeterToolBar::AdjustOutputGain ( int  adj)

Definition at line 476 of file MeterToolBar.cpp.

477{
478 if (adj < 0) {
479 mPlayMeter->Decrease(-adj);
480 }
481 else {
482 mPlayMeter->Increase(adj);
483 }
484
486}
MeterPanel * mPlayMeter
Definition: MeterToolBar.h:83

References MeterPanel::Decrease(), MeterPanel::Increase(), mPlayMeter, and MeterPanel::UpdateSliderControl().

Here is the call graph for this function:

◆ Create()

void MeterToolBar::Create ( wxWindow *  parent)
overridevirtual

Reimplemented from ToolBar.

Definition at line 184 of file MeterToolBar.cpp.

185{
186 ToolBar::Create(parent);
187
188 UpdatePrefs();
189
190 // Simulate a size event to set initial meter placement/size
191 wxSizeEvent dummy;
192 OnSize(dummy);
193}
void UpdatePrefs() override
void OnSize(wxSizeEvent &event)
virtual void Create(wxWindow *parent)
Definition: ToolBar.cpp:484

References ToolBar::Create(), OnSize(), and UpdatePrefs().

Here is the call graph for this function:

◆ EnableDisableButtons()

void MeterToolBar::EnableDisableButtons ( )
inlineoverridevirtual

Implements ToolBar.

Definition at line 56 of file MeterToolBar.h.

56{};

◆ Expose()

bool MeterToolBar::Expose ( bool  show)
overridevirtual

Reimplemented from ToolBar.

Definition at line 424 of file MeterToolBar.cpp.

425{
426 auto &projectAudioIO = ProjectAudioIO::Get( mProject );
427 if( show ) {
428 if( mPlayMeter ) {
429 projectAudioIO.SetPlaybackMeter( mPlayMeter->GetMeter() );
430 }
431
432 if( mRecordMeter ) {
433 projectAudioIO.SetCaptureMeter( mRecordMeter->GetMeter() );
434 }
435 } else {
436 if( mPlayMeter &&
437 projectAudioIO.GetPlaybackMeter() == mPlayMeter->GetMeter() ) {
438 projectAudioIO.SetPlaybackMeter( nullptr );
439 }
440
441 if( mRecordMeter &&
442 projectAudioIO.GetCaptureMeter() == mRecordMeter->GetMeter() ) {
443 projectAudioIO.SetCaptureMeter( nullptr );
444 }
445 }
446
447 return ToolBar::Expose( show );
448}
std::shared_ptr< Meter > GetMeter() const
static ProjectAudioIO & Get(AudacityProject &project)
AudacityProject & mProject
Definition: ToolBar.h:251
virtual bool Expose(bool show=true)
Definition: ToolBar.cpp:453

References ToolBar::Expose(), ProjectAudioIO::Get(), MeterPanelBase::GetMeter(), mPlayMeter, ToolBar::mProject, and mRecordMeter.

Here is the call graph for this function:

◆ Get() [1/2]

MeterToolBar & MeterToolBar::Get ( AudacityProject project,
bool  forPlayMeterToolBar 
)
static

Definition at line 171 of file MeterToolBar.cpp.

172{
173 auto& toolManager = ToolManager::Get(project);
174 auto toolBarID = forPlayMeterToolBar ? PlayMeterBarID : RecordMeterBarID;
175
176 return *static_cast<MeterToolBar*>(toolManager.GetToolBar(toolBarID));
177}
A ToolBar that holds the VU Meter.
Definition: MeterToolBar.h:38
static ToolManager & Get(AudacityProject &project)

References ToolManager::Get(), PlayMeterBarID, and RecordMeterBarID.

Referenced by Get(), GetToolBars(), ExtraActions::Handler::OnInputGain(), ExtraActions::Handler::OnInputGainDec(), ExtraActions::Handler::OnInputGainInc(), ExtraActions::Handler::OnOutputGain(), ExtraActions::Handler::OnOutputGainDec(), and ExtraActions::Handler::OnOutputGainInc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get() [2/2]

const MeterToolBar & MeterToolBar::Get ( const AudacityProject project,
bool  forPlayMeterToolBar 
)
static

Definition at line 179 of file MeterToolBar.cpp.

180{
181 return Get( const_cast<AudacityProject&>( project ), forPlayMeterToolBar );
182}
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
static MeterToolBar & Get(AudacityProject &project, bool forPlayMeterToolBar)

References Get().

Here is the call graph for this function:

◆ GetDockedSize()

wxSize MeterToolBar::GetDockedSize ( )
inlineoverridevirtual

Reimplemented from ToolBar.

Definition at line 65 of file MeterToolBar.h.

65 {
66 return GetSmartDockedSize();
67 };
wxSize GetSmartDockedSize()
Definition: ToolBar.cpp:512

References ToolBar::GetSmartDockedSize().

Here is the call graph for this function:

◆ GetInitialWidth()

int MeterToolBar::GetInitialWidth ( )
overridevirtual

Resizable toolbars should implement these.

Reimplemented from ToolBar.

Definition at line 450 of file MeterToolBar.cpp.

451{
452 return (mWhichMeters ==
453 (kWithRecordMeter + kWithPlayMeter)) ? 338 : 290;
454}

References kWithPlayMeter, kWithRecordMeter, and mWhichMeters.

◆ GetMinToolbarWidth()

int MeterToolBar::GetMinToolbarWidth ( )
inlineoverridevirtual

Reimplemented from ToolBar.

Definition at line 64 of file MeterToolBar.h.

64{ return 150; }

◆ GetToolBars() [1/2]

MeterToolBars MeterToolBar::GetToolBars ( AudacityProject project)
static

Definition at line 155 of file MeterToolBar.cpp.

156{
157 return MeterToolBars{
158 Get(project, true),
159 Get(project, false)
160 };
161}
std::vector< std::reference_wrapper< MeterToolBar > > MeterToolBars
Definition: MeterToolBar.h:30

References Get().

Referenced by ProjectManager::OnTimer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetToolBars() [2/2]

ConstMeterToolBars MeterToolBar::GetToolBars ( const AudacityProject project)
static

Definition at line 163 of file MeterToolBar.cpp.

164{
165 return ConstMeterToolBars{
166 Get(project, true),
167 Get(project, false)
168 };
169}
std::vector< std::reference_wrapper< const MeterToolBar > > ConstMeterToolBars
Definition: MeterToolBar.h:31

References Get().

Here is the call graph for this function:

◆ OnSize()

void MeterToolBar::OnSize ( wxSizeEvent &  event)

Definition at line 415 of file MeterToolBar.cpp.

416{
417 event.Skip();
418
419 if(mRootSizer == nullptr)
420 return;// We can be resized before populating...protect against it
421 RebuildLayout(false);
422}
void RebuildLayout(bool force)
wxBoxSizer * mRootSizer
Definition: MeterToolBar.h:81

References mRootSizer, and RebuildLayout().

Referenced by Create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Populate()

void MeterToolBar::Populate ( )
overridevirtual

Implements ToolBar.

Definition at line 226 of file MeterToolBar.cpp.

227{
229 SetBackgroundColour( theTheme.Colour( clrMedium ) );
230
232 //JKC: Record on left, playback on right. Left to right flow
233 //(maybe we should do it differently for Arabic language :-) )
236 mRecordSetupButton->SetName(_("Record Meter"));
237 mRecordSetupButton->SetToolTip(XO("Record Meter"));
239 theTheme.Image(bmpRecoloredUpSmall),
240 theTheme.Image(bmpRecoloredUpHiliteSmall),
241 theTheme.Image(bmpRecoloredDownSmall),
242 theTheme.Image(bmpRecoloredHiliteSmall),
243 theTheme.Image(bmpRecoloredUpSmall));
245 mRecordSetupButton->SetButtonType(AButton::Type::FrameButton);
247
249 this,
250 wxID_ANY,
251 true,
252 wxDefaultPosition,
253 wxSize( 260, toolbarSingle) );
254 /* i18n-hint: (noun) The meter that shows the loudness of the audio being recorded.*/
255 mRecordMeter->SetName( XO("Recording Level"));
256 /* i18n-hint: (noun) The meter that shows the loudness of the audio being recorded.
257 This is the name used in screen reader software, where having 'Meter' first
258 apparently is helpful to partially sighted people. */
259 mRecordMeter->SetLabel( XO("Meter-Record") );
260
261#if wxUSE_ACCESSIBILITY
262 auto meterButtonAcc = safenew MeterButtonAx(*mRecordSetupButton, *mRecordMeter);
263#endif
264 mRecordSetupButton->Bind(wxEVT_BUTTON, [=](wxCommandEvent&)
265 {
266#if wxUSE_ACCESSIBILITY
267 meterButtonAcc->SetSilent(true);
268#endif
270 mRecordMeter->ScreenToClient(
271 ClientToScreen(mRecordSetupButton->GetClientRect().GetBottomLeft())
272 )
273 );
274#if wxUSE_ACCESSIBILITY
275 /* if stop/start monitoring was chosen in the menu, then by this point
276 OnMonitoring has been called and variables which affect the accessibility
277 name have been updated so it's now ok for screen readers to read the name of
278 the button */
279 meterButtonAcc->SetSilent(false);
280#endif
281 });
282 }
283
287 mPlaySetupButton->SetName(_("Playback Meter"));
288 mPlaySetupButton->SetToolTip(XO("Playback Meter"));
290 theTheme.Image(bmpRecoloredUpSmall),
291 theTheme.Image(bmpRecoloredUpHiliteSmall),
292 theTheme.Image(bmpRecoloredDownSmall),
293 theTheme.Image(bmpRecoloredHiliteSmall),
294 theTheme.Image(bmpRecoloredUpSmall));
296 mPlaySetupButton->SetButtonType(AButton::Type::FrameButton);
298
299
301 this,
302 wxID_ANY,
303 false,
304 wxDefaultPosition,
305 wxSize( 260, toolbarSingle ) );
306 /* i18n-hint: (noun) The meter that shows the loudness of the audio playing.*/
307 mPlayMeter->SetName( XO("Playback Level"));
308 /* i18n-hint: (noun) The meter that shows the loudness of the audio playing.
309 This is the name used in screen reader software, where having 'Meter' first
310 apparently is helpful to partially sighted people. */
311 mPlayMeter->SetLabel( XO("Meter-Play"));
312
313#if wxUSE_ACCESSIBILITY
314 auto meterButtonAcc = safenew MeterButtonAx(*mPlaySetupButton, *mPlayMeter);
315#endif
316 mPlaySetupButton->Bind(wxEVT_BUTTON, [=](wxCommandEvent&)
317 {
318#if wxUSE_ACCESSIBILITY
319 meterButtonAcc->SetSilent(true);
320#endif
322 mPlayMeter->ScreenToClient(
323 ClientToScreen(mPlaySetupButton->GetClientRect().GetBottomLeft())
324 )
325 );
326#if wxUSE_ACCESSIBILITY
327 meterButtonAcc->SetSilent(false);
328#endif
329 });
330 }
331
332 RebuildLayout(true);
333
335
336 Layout();
337}
#define _(s)
Definition: Internat.h:75
#define safenew
Definition: MemoryX.h:10
THEME_API Theme theTheme
Definition: Theme.cpp:82
#define toolbarSingle
Definition: ToolBar.h:59
A wxButton with mouse-over behaviour.
Definition: AButton.h:104
void SetButtonType(Type type)
Definition: AButton.cpp:150
void SetImages(const wxImage &up, const wxImage &over, const wxImage &down, const wxImage &overDown, const wxImage &dis)
Definition: AButton.cpp:208
void SetToolTip(const TranslatableString &toolTip)
Definition: AButton.cpp:187
void SetIcon(const wxImage &icon)
Definition: AButton.cpp:229
void SetLabel(const TranslatableString &label)
Definition: AButton.cpp:192
MeterPanel is a panel that paints the meter used for monitoring or playback.
Definition: MeterPanel.h:104
void ShowMenu(const wxPoint &pos)
void SetName(const TranslatableString &name)
AButton * mRecordSetupButton
Definition: MeterToolBar.h:84
void RegenerateTooltips() override
Definition: MeterToolBar.h:77
AButton * mPlaySetupButton
Definition: MeterToolBar.h:82
wxColour & Colour(int iIndex)
wxImage & Image(int iIndex)
static void MakeButtonBackgroundsSmall()
Definition: ToolBar.cpp:823
void SetLabel(const TranslatableString &label)

References _, ThemeBase::Colour(), ThemeBase::Image(), kWithPlayMeter, kWithRecordMeter, ToolBar::MakeButtonBackgroundsSmall(), mPlayMeter, mPlaySetupButton, ToolBar::mProject, mRecordMeter, mRecordSetupButton, mWhichMeters, RebuildLayout(), RegenerateTooltips(), safenew, AButton::SetButtonType(), AButton::SetIcon(), AButton::SetImages(), AButton::SetLabel(), wxPanelWrapper::SetLabel(), MeterPanel::SetName(), AButton::SetToolTip(), MeterPanel::ShowMenu(), theTheme, toolbarSingle, and XO.

Here is the call graph for this function:

◆ RebuildLayout()

void MeterToolBar::RebuildLayout ( bool  force)
private

Definition at line 366 of file MeterToolBar.cpp.

367{
368 const auto size = GetSize();
369 const auto isHorizontal = size.x > size.y;
370
371 if(!force)
372 {
373 const auto sizerOrientation = mWhichMeters == kCombinedMeter
374 ? (isHorizontal ? wxVERTICAL : wxHORIZONTAL)
375 : (isHorizontal ? wxHORIZONTAL : wxVERTICAL);
376
377 if(mRootSizer->GetOrientation() == sizerOrientation)
378 {
379 Layout();
380 return;
381 }
382 }
383
384 if(mRootSizer != nullptr)
385 GetSizer()->Remove(mRootSizer);
386
387 std::unique_ptr<wxBoxSizer> playBarSizer;
388 std::unique_ptr<wxBoxSizer> recordBarSizer;
390 {
391 playBarSizer = std::make_unique<wxBoxSizer>(isHorizontal ? wxHORIZONTAL : wxVERTICAL);
392 playBarSizer->Add(mPlaySetupButton, 0, wxEXPAND);
393 playBarSizer->Add(mPlayMeter, 1, wxEXPAND);
394 }
396 {
397 recordBarSizer = std::make_unique<wxBoxSizer>(isHorizontal ? wxHORIZONTAL : wxVERTICAL);
398 recordBarSizer->Add(mRecordSetupButton, 0, wxEXPAND);
399 recordBarSizer->Add(mRecordMeter, 1, wxEXPAND);
400 }
401
402 if(playBarSizer && recordBarSizer)
403 {
404 Add(mRootSizer = safenew wxBoxSizer(isHorizontal ? wxVERTICAL : wxHORIZONTAL), 1, wxEXPAND);
405 mRootSizer->Add(playBarSizer.release());
406 mRootSizer->Add(recordBarSizer.release());
407 }
408 else if(playBarSizer)
409 Add(mRootSizer = playBarSizer.release(), 1, wxEXPAND);
410 else if(recordBarSizer)
411 Add(mRootSizer = recordBarSizer.release(), 1, wxEXPAND);
412}
constexpr int kCombinedMeter
Definition: MeterToolBar.h:36
void Add(wxWindow *window, int proportion=0, int flag=wxALIGN_TOP, int border=0, wxObject *userData=NULL)
Definition: ToolBar.cpp:695
wxBoxSizer * GetSizer()
Definition: ToolBar.cpp:687

References ToolBar::Add(), ToolBar::GetSizer(), kCombinedMeter, kWithPlayMeter, kWithRecordMeter, mPlayMeter, mPlaySetupButton, mRecordMeter, mRecordSetupButton, mRootSizer, mWhichMeters, safenew, and size.

Referenced by OnSize(), and Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReCreateButtons()

void MeterToolBar::ReCreateButtons ( )
overridevirtual

Reimplemented from ToolBar.

Definition at line 195 of file MeterToolBar.cpp.

196{
197 MeterPanel::State playState{ false }, recordState{ false };
198
199 auto &projectAudioIO = ProjectAudioIO::Get( mProject );
200 if (mPlayMeter &&
201 projectAudioIO.GetPlaybackMeter() == mPlayMeter->GetMeter())
202 {
203 playState = mPlayMeter->SaveState();
204 projectAudioIO.SetPlaybackMeter( nullptr );
205 }
206
207 if (mRecordMeter &&
208 projectAudioIO.GetCaptureMeter() == mRecordMeter->GetMeter())
209 {
210 recordState = mRecordMeter->SaveState();
211 projectAudioIO.SetCaptureMeter( nullptr );
212 }
213
215
216 mPlayMeter->RestoreState(playState);
217 if( playState.mSaved ){
218 projectAudioIO.SetPlaybackMeter( mPlayMeter->GetMeter() );
219 }
220 mRecordMeter->RestoreState(recordState);
221 if( recordState.mSaved ){
222 projectAudioIO.SetCaptureMeter( mRecordMeter->GetMeter() );
223 }
224}
State SaveState()
void RestoreState(const State &state)
virtual void ReCreateButtons()
Definition: ToolBar.cpp:525

References ProjectAudioIO::Get(), MeterPanelBase::GetMeter(), mPlayMeter, ToolBar::mProject, mRecordMeter, ToolBar::ReCreateButtons(), MeterPanel::RestoreState(), and MeterPanel::SaveState().

Here is the call graph for this function:

◆ RegenerateTooltips()

void MeterToolBar::RegenerateTooltips ( )
inlineoverrideprivatevirtual

Implements ToolBar.

Definition at line 77 of file MeterToolBar.h.

77{}

Referenced by Populate(), and UpdatePrefs().

Here is the caller graph for this function:

◆ Repaint()

void MeterToolBar::Repaint ( wxDC *  WXUNUSEDdc)
inlineoverride

Definition at line 55 of file MeterToolBar.h.

55{};

◆ SetDocked()

void MeterToolBar::SetDocked ( ToolDock dock,
bool  pushed 
)
overridevirtual

Reimplemented from ToolBar.

Definition at line 459 of file MeterToolBar.cpp.

459 {
460 ToolBar::SetDocked(dock, pushed);
461 Fit();
462}
virtual void SetDocked(ToolDock *dock, bool pushed)
Definition: ToolBar.cpp:647

References ToolBar::SetDocked().

Here is the call graph for this function:

◆ ShowInputGainDialog()

void MeterToolBar::ShowInputGainDialog ( )

Definition at line 470 of file MeterToolBar.cpp.

References mRecordMeter, MeterPanel::ShowDialog(), and MeterPanel::UpdateSliderControl().

Here is the call graph for this function:

◆ ShowOutputGainDialog()

void MeterToolBar::ShowOutputGainDialog ( )

Definition at line 464 of file MeterToolBar.cpp.

References mPlayMeter, MeterPanel::ShowDialog(), and MeterPanel::UpdateSliderControl().

Here is the call graph for this function:

◆ UpdateControls()

void MeterToolBar::UpdateControls ( )

Definition at line 357 of file MeterToolBar.cpp.

358{
359 if ( mPlayMeter )
361
362 if ( mRecordMeter )
364}

References mPlayMeter, mRecordMeter, and MeterPanel::UpdateSliderControl().

Here is the call graph for this function:

◆ UpdatePrefs()

void MeterToolBar::UpdatePrefs ( )
overridevirtual

Implements PrefsListener.

Definition at line 339 of file MeterToolBar.cpp.

340{
342
343 // Since the same widget is provides both the Recording Meter as
344 // well as the Playback Meter, we choose an appropriate label
345 // based on which it is
347 ? XO("Recording Meter")
348 : XO("Playback Meter");
349
350 // Set label to pull in language change
352
353 // Give base class a chance
355}
TranslatableString label
Definition: TagsEditor.cpp:163
void SetLabel(const wxString &label) override
Definition: ToolBar.cpp:407
void UpdatePrefs() override
Definition: ToolBar.cpp:614

References kWithRecordMeter, label, mWhichMeters, RegenerateTooltips(), ToolBar::SetLabel(), ToolBar::UpdatePrefs(), and XO.

Referenced by Create().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mPlayMeter

MeterPanel* MeterToolBar::mPlayMeter {nullptr}
private

◆ mPlaySetupButton

AButton* MeterToolBar::mPlaySetupButton {nullptr}
private

Definition at line 82 of file MeterToolBar.h.

Referenced by Populate(), and RebuildLayout().

◆ mRecordMeter

MeterPanel* MeterToolBar::mRecordMeter {nullptr}
private

◆ mRecordSetupButton

AButton* MeterToolBar::mRecordSetupButton {nullptr}
private

Definition at line 84 of file MeterToolBar.h.

Referenced by Populate(), and RebuildLayout().

◆ mRootSizer

wxBoxSizer* MeterToolBar::mRootSizer {nullptr}
private

Definition at line 81 of file MeterToolBar.h.

Referenced by OnSize(), and RebuildLayout().

◆ mWhichMeters

int MeterToolBar::mWhichMeters
private

Definition at line 80 of file MeterToolBar.h.

Referenced by GetInitialWidth(), Populate(), RebuildLayout(), and UpdatePrefs().


The documentation for this class was generated from the following files: