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, unsigned whichMeters, const TranslatableString &label, Identifier ID)
 
virtual ~MeterToolBar ()
 
bool ShownByDefault () const override
 Whether the toolbar should be shown by default. Default implementation returns true. More...
 
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
 
void ShowOutputGainDialog ()
 
void ShowInputGainDialog ()
 
void AdjustOutputGain (int adj)
 
void AdjustInputGain (int adj)
 
- Public Member Functions inherited from ToolBar
 ToolBar (AudacityProject &project, const TranslatableString &label, const Identifier &section, bool resizable=false)
 
virtual ~ToolBar ()
 
virtual bool ShownByDefault () const
 Whether the toolbar should be shown by default. Default implementation returns true. More...
 
virtual bool HideAfterReset () const
 Default implementation returns false. More...
 
virtual DockID DefaultDockID () const
 Which dock the toolbar defaults into. Default implementation chooses the top dock. More...
 
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 GetIndex () const
 Get a value used for computing cascading positions of undocked bars. More...
 
void SetIndex (int index)
 Set a value used for computing cascading positions of undocked bars. More...
 
TranslatableString GetTitle ()
 
TranslatableString GetLabel ()
 
Identifier GetSection ()
 
ToolDockGetDock ()
 
void SetPreferredNeighbors (Identifier left, Identifier top={})
 
void SetLabel (const TranslatableString &label)
 
virtual void SetDocked (ToolDock *dock, bool pushed)
 
std::pair< Identifier, IdentifierPreferredNeighbors () const noexcept
 Defaults to (NoBarID, NoBarId) More...
 
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 Identifier ID ()
 Methods for MeterToolBar. More...
 
static Identifier PlayID ()
 
static Identifier RecordID ()
 
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

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

Additional Inherited Members

- Public Types inherited from ToolBar
enum  DockID { TopDockID = 1 , BotDockID = 2 }
 Identifies one of the docking areas for toolbars. More...
 
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
 
Identifier mSection
 
int mIndex {0}
 

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,
unsigned  whichMeters,
const TranslatableString label,
Identifier  ID 
)

Definition at line 148 of file MeterToolBar.cpp.

151: ToolBar(project, label, ID, true)
152, mWhichMeters{ whichMeters }
153{
154}
TranslatableString label
Definition: TagsEditor.cpp:165
const auto project
static Identifier ID()
Methods for MeterToolBar.
unsigned mWhichMeters
Definition: MeterToolBar.h:87
ToolBar(AudacityProject &project, const TranslatableString &label, const Identifier &section, bool resizable=false)
Definition: ToolBar.cpp:328

◆ ~MeterToolBar()

MeterToolBar::~MeterToolBar ( )
virtual

Definition at line 156 of file MeterToolBar.cpp.

157{
158}

Member Function Documentation

◆ AdjustInputGain()

void MeterToolBar::AdjustInputGain ( int  adj)

Definition at line 496 of file MeterToolBar.cpp.

497{
498 if (adj < 0) {
499 mRecordMeter->Decrease(-adj);
500 }
501 else {
503 }
504
506}
void Decrease(float steps)
Definition: MeterPanel.cpp:826
void Increase(float steps)
Definition: MeterPanel.cpp:815
void UpdateSliderControl()
Definition: MeterPanel.cpp:410
MeterPanel * mRecordMeter
Definition: MeterToolBar.h:92

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 484 of file MeterToolBar.cpp.

485{
486 if (adj < 0) {
487 mPlayMeter->Decrease(-adj);
488 }
489 else {
490 mPlayMeter->Increase(adj);
491 }
492
494}
MeterPanel * mPlayMeter
Definition: MeterToolBar.h:90

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 194 of file MeterToolBar.cpp.

195{
196 ToolBar::Create(parent);
197
198 UpdatePrefs();
199
200 // Simulate a size event to set initial meter placement/size
201 wxSizeEvent dummy;
202 OnSize(dummy);
203}
void UpdatePrefs() override
void OnSize(wxSizeEvent &event)
virtual void Create(wxWindow *parent)
Definition: ToolBar.cpp:492

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

Here is the call graph for this function:

◆ EnableDisableButtons()

void MeterToolBar::EnableDisableButtons ( )
inlineoverridevirtual

Implements ToolBar.

Definition at line 64 of file MeterToolBar.h.

64{};

◆ Expose()

bool MeterToolBar::Expose ( bool  show)
overridevirtual

Reimplemented from ToolBar.

Definition at line 440 of file MeterToolBar.cpp.

441{
442 auto &projectAudioIO = ProjectAudioIO::Get( mProject );
443 if( show ) {
444 if( mPlayMeter ) {
445 projectAudioIO.SetPlaybackMeter( mPlayMeter->GetMeter() );
446 }
447
448 if( mRecordMeter ) {
449 projectAudioIO.SetCaptureMeter( mRecordMeter->GetMeter() );
450 }
451 } else {
452 if( mPlayMeter &&
453 projectAudioIO.GetPlaybackMeter() == mPlayMeter->GetMeter() ) {
454 projectAudioIO.SetPlaybackMeter( nullptr );
455 }
456
457 if( mRecordMeter &&
458 projectAudioIO.GetCaptureMeter() == mRecordMeter->GetMeter() ) {
459 projectAudioIO.SetCaptureMeter( nullptr );
460 }
461 }
462
463 return ToolBar::Expose( show );
464}
std::shared_ptr< Meter > GetMeter() const
static ProjectAudioIO & Get(AudacityProject &project)
AudacityProject & mProject
Definition: ToolBar.h:247
virtual bool Expose(bool show=true)
Definition: ToolBar.cpp:459

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 176 of file MeterToolBar.cpp.

177{
178 auto& toolManager = ToolManager::Get(project);
179 const auto &toolBarID = forPlayMeterToolBar ? PlayID() : RecordID();
180 return *static_cast<MeterToolBar*>(toolManager.GetToolBar(toolBarID));
181}
A ToolBar that holds the VU Meter.
Definition: MeterToolBar.h:38
static Identifier PlayID()
static Identifier RecordID()
static ToolManager & Get(AudacityProject &project)

References ToolManager::Get(), PlayID(), project, and RecordID().

Referenced by Get(), GetToolBars(), anonymous_namespace{MeterToolBar.cpp}::OnInputGain(), anonymous_namespace{MeterToolBar.cpp}::OnInputGainDec(), anonymous_namespace{MeterToolBar.cpp}::OnInputGainInc(), anonymous_namespace{MeterToolBar.cpp}::OnOutputGain(), anonymous_namespace{MeterToolBar.cpp}::OnOutputGainDec(), and anonymous_namespace{MeterToolBar.cpp}::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 183 of file MeterToolBar.cpp.

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

References Get(), and project.

Here is the call graph for this function:

◆ GetDockedSize()

wxSize MeterToolBar::GetDockedSize ( )
inlineoverridevirtual

Reimplemented from ToolBar.

Definition at line 73 of file MeterToolBar.h.

73 {
74 return GetSmartDockedSize();
75 };
wxSize GetSmartDockedSize()
Definition: ToolBar.cpp:520

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 466 of file MeterToolBar.cpp.

467{
468 return (mWhichMeters ==
469 (kWithRecordMeter + kWithPlayMeter)) ? 338 : 290;
470}
constexpr int kWithPlayMeter
Definition: MeterToolBar.h:35
constexpr int kWithRecordMeter
Definition: MeterToolBar.h:34

References kWithPlayMeter, kWithRecordMeter, and mWhichMeters.

◆ GetMinToolbarWidth()

int MeterToolBar::GetMinToolbarWidth ( )
inlineoverridevirtual

Reimplemented from ToolBar.

Definition at line 72 of file MeterToolBar.h.

72{ return 150; }

◆ GetToolBars() [1/2]

MeterToolBars MeterToolBar::GetToolBars ( AudacityProject project)
static

Definition at line 160 of file MeterToolBar.cpp.

161{
162 return MeterToolBars{
163 Get(project, true),
164 Get(project, false)
165 };
166}
std::vector< std::reference_wrapper< MeterToolBar > > MeterToolBars
Definition: MeterToolBar.h:30

References Get(), and project.

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 168 of file MeterToolBar.cpp.

169{
170 return ConstMeterToolBars{
171 Get(project, true),
172 Get(project, false)
173 };
174}
std::vector< std::reference_wrapper< const MeterToolBar > > ConstMeterToolBars
Definition: MeterToolBar.h:31

References Get(), and project.

Here is the call graph for this function:

◆ ID()

Identifier MeterToolBar::ID ( )
static

Methods for MeterToolBar.

Definition at line 132 of file MeterToolBar.cpp.

133{
134 return wxT("CombinedMeter");
135}
wxT("CloseDown"))

References wxT().

Here is the call graph for this function:

◆ OnSize()

void MeterToolBar::OnSize ( wxSizeEvent &  event)

Definition at line 431 of file MeterToolBar.cpp.

432{
433 event.Skip();
434
435 if(mRootSizer == nullptr)
436 return;// We can be resized before populating...protect against it
437 RebuildLayout(false);
438}
void RebuildLayout(bool force)
wxBoxSizer * mRootSizer
Definition: MeterToolBar.h:88

References mRootSizer, and RebuildLayout().

Referenced by Create().

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

◆ PlayID()

Identifier MeterToolBar::PlayID ( )
static

Definition at line 137 of file MeterToolBar.cpp.

138{
139 return wxT("PlayMeter");
140}

References wxT().

Referenced by Get().

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 236 of file MeterToolBar.cpp.

237{
239 SetBackgroundColour( theTheme.Colour( clrMedium ) );
240
242 //JKC: Record on left, playback on right. Left to right flow
243 //(maybe we should do it differently for Arabic language :-) )
248 mRecordSetupButton->SetName(_("Record Meter"));
249 mRecordSetupButton->SetToolTip(XO("Record Meter"));
251 theTheme.Image(bmpRecoloredUpSmall),
252 theTheme.Image(bmpRecoloredUpHiliteSmall),
253 theTheme.Image(bmpRecoloredDownSmall),
254 theTheme.Image(bmpRecoloredHiliteSmall),
255 theTheme.Image(bmpRecoloredUpSmall));
257 mRecordSetupButton->SetButtonType(AButton::Type::FrameButton);
258 mRecordSetupButton->SetMinSize({25, 25});
259 mRecordSetupButton->SetMaxSize({25, 25});
260
262 this,
263 wxID_ANY,
264 true,
265 wxDefaultPosition,
266 wxSize( 260, 25) );
267 /* i18n-hint: (noun) The meter that shows the loudness of the audio being recorded.*/
268 mRecordMeter->SetName( XO("Recording Level"));
269 /* i18n-hint: (noun) The meter that shows the loudness of the audio being recorded.
270 This is the name used in screen reader software, where having 'Meter' first
271 apparently is helpful to partially sighted people. */
272 mRecordMeter->SetLabel( XO("Meter-Record") );
273
274#if wxUSE_ACCESSIBILITY
275 auto meterButtonAcc = safenew MeterButtonAx(*mRecordSetupButton, *mRecordMeter);
276#endif
277 mRecordSetupButton->Bind(wxEVT_BUTTON, [=](wxCommandEvent&)
278 {
279#if wxUSE_ACCESSIBILITY
280 meterButtonAcc->SetSilent(true);
281#endif
283 mRecordMeter->ScreenToClient(
284 ClientToScreen(mRecordSetupButton->GetClientRect().GetBottomLeft())
285 )
286 );
287#if wxUSE_ACCESSIBILITY
288 /* if stop/start monitoring was chosen in the menu, then by this point
289 OnMonitoring has been called and variables which affect the accessibility
290 name have been updated so it's now ok for screen readers to read the name of
291 the button */
292 meterButtonAcc->SetSilent(false);
293#endif
294 });
295 }
296
302 mPlaySetupButton->SetName(_("Playback Meter"));
303 mPlaySetupButton->SetToolTip(XO("Playback Meter"));
305 theTheme.Image(bmpRecoloredUpSmall),
306 theTheme.Image(bmpRecoloredUpHiliteSmall),
307 theTheme.Image(bmpRecoloredDownSmall),
308 theTheme.Image(bmpRecoloredHiliteSmall),
309 theTheme.Image(bmpRecoloredUpSmall));
311 mPlaySetupButton->SetButtonType(AButton::Type::FrameButton);
312 mPlaySetupButton->SetMinSize({25, 25});
313 mPlaySetupButton->SetMaxSize({25, 25});
314
315
317 this,
318 wxID_ANY,
319 false,
320 wxDefaultPosition,
321 wxSize( 260, 25 ) );
322 /* i18n-hint: (noun) The meter that shows the loudness of the audio playing.*/
323 mPlayMeter->SetName( XO("Playback Level"));
324 /* i18n-hint: (noun) The meter that shows the loudness of the audio playing.
325 This is the name used in screen reader software, where having 'Meter' first
326 apparently is helpful to partially sighted people. */
327 mPlayMeter->SetLabel( XO("Meter-Play"));
328
329#if wxUSE_ACCESSIBILITY
330 auto meterButtonAcc = safenew MeterButtonAx(*mPlaySetupButton, *mPlayMeter);
331#endif
332 mPlaySetupButton->Bind(wxEVT_BUTTON, [=](wxCommandEvent&)
333 {
334#if wxUSE_ACCESSIBILITY
335 meterButtonAcc->SetSilent(true);
336#endif
338 mPlayMeter->ScreenToClient(
339 ClientToScreen(mPlaySetupButton->GetClientRect().GetBottomLeft())
340 )
341 );
342#if wxUSE_ACCESSIBILITY
343 meterButtonAcc->SetSilent(false);
344#endif
345 });
346 }
347
348 RebuildLayout(true);
349
351
352 Layout();
353}
XO("Cut/Copy/Paste")
#define _(s)
Definition: Internat.h:73
#define safenew
Definition: MemoryX.h:10
THEME_API Theme theTheme
Definition: Theme.cpp:82
A wxButton with mouse-over behaviour.
Definition: AButton.h:104
void SetButtonType(Type type)
Definition: AButton.cpp:148
void SetImages(const wxImage &up, const wxImage &over, const wxImage &down, const wxImage &overDown, const wxImage &dis)
Definition: AButton.cpp:221
void SetToolTip(const TranslatableString &toolTip)
Definition: AButton.cpp:200
@ FrameButton
Definition: AButton.h:114
void SetIcon(const wxImage &icon)
Definition: AButton.cpp:242
void SetLabel(const TranslatableString &label)
Definition: AButton.cpp:205
void SetFrameMid(int mid)
Definition: AButton.cpp:159
MeterPanel is a panel that paints the meter used for monitoring or playback.
Definition: MeterPanel.h:91
void ShowMenu(const wxPoint &pos)
void SetName(const TranslatableString &name)
AButton * mRecordSetupButton
Definition: MeterToolBar.h:91
void RegenerateTooltips() override
Definition: MeterToolBar.h:84
AButton * mPlaySetupButton
Definition: MeterToolBar.h:89
wxColour & Colour(int iIndex)
wxImage & Image(int iIndex)
static void MakeButtonBackgroundsSmall()
Definition: ToolBar.cpp:819
void SetLabel(const TranslatableString &label)

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

Here is the call graph for this function:

◆ RebuildLayout()

void MeterToolBar::RebuildLayout ( bool  force)
private

Definition at line 382 of file MeterToolBar.cpp.

383{
384 const auto size = GetSize();
385 const auto isHorizontal = size.x > size.y;
386
387 if(!force)
388 {
389 const auto sizerOrientation = mWhichMeters == kCombinedMeter
390 ? (isHorizontal ? wxVERTICAL : wxHORIZONTAL)
391 : (isHorizontal ? wxHORIZONTAL : wxVERTICAL);
392
393 if(mRootSizer->GetOrientation() == sizerOrientation)
394 {
395 Layout();
396 return;
397 }
398 }
399
400 if(mRootSizer != nullptr)
401 GetSizer()->Remove(mRootSizer);
402
403 std::unique_ptr<wxBoxSizer> playBarSizer;
404 std::unique_ptr<wxBoxSizer> recordBarSizer;
406 {
407 playBarSizer = std::make_unique<wxBoxSizer>(isHorizontal ? wxHORIZONTAL : wxVERTICAL);
408 playBarSizer->Add(mPlaySetupButton, 0, wxEXPAND | wxRIGHT, 2);
409 playBarSizer->Add(mPlayMeter, 1, wxEXPAND);
410 }
412 {
413 recordBarSizer = std::make_unique<wxBoxSizer>(isHorizontal ? wxHORIZONTAL : wxVERTICAL);
414 recordBarSizer->Add(mRecordSetupButton, 0, wxEXPAND | wxRIGHT, 2);
415 recordBarSizer->Add(mRecordMeter, 1, wxEXPAND);
416 }
417
418 if(playBarSizer && recordBarSizer)
419 {
420 Add(mRootSizer = safenew wxBoxSizer(isHorizontal ? wxVERTICAL : wxHORIZONTAL), 1, wxEXPAND | wxALL, 2);
421 mRootSizer->Add(playBarSizer.release());
422 mRootSizer->Add(recordBarSizer.release());
423 }
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);
428}
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:709
wxBoxSizer * GetSizer()
Definition: ToolBar.cpp:701

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:

◆ RecordID()

Identifier MeterToolBar::RecordID ( )
static

Definition at line 142 of file MeterToolBar.cpp.

143{
144 return wxT("RecordMeter");
145}

References wxT().

Referenced by Get().

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 205 of file MeterToolBar.cpp.

206{
207 MeterPanel::State playState{ false }, recordState{ false };
208
209 auto &projectAudioIO = ProjectAudioIO::Get( mProject );
210 if (mPlayMeter &&
211 projectAudioIO.GetPlaybackMeter() == mPlayMeter->GetMeter())
212 {
213 playState = mPlayMeter->SaveState();
214 projectAudioIO.SetPlaybackMeter( nullptr );
215 }
216
217 if (mRecordMeter &&
218 projectAudioIO.GetCaptureMeter() == mRecordMeter->GetMeter())
219 {
220 recordState = mRecordMeter->SaveState();
221 projectAudioIO.SetCaptureMeter( nullptr );
222 }
223
225
226 mPlayMeter->RestoreState(playState);
227 if( playState.mSaved ){
228 projectAudioIO.SetPlaybackMeter( mPlayMeter->GetMeter() );
229 }
230 mRecordMeter->RestoreState(recordState);
231 if( recordState.mSaved ){
232 projectAudioIO.SetCaptureMeter( mRecordMeter->GetMeter() );
233 }
234}
State SaveState()
void RestoreState(const State &state)
virtual void ReCreateButtons()
Definition: ToolBar.cpp:533

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 84 of file MeterToolBar.h.

84{}

Referenced by Populate(), and UpdatePrefs().

Here is the caller graph for this function:

◆ Repaint()

void MeterToolBar::Repaint ( wxDC *  WXUNUSEDdc)
inlineoverride

Definition at line 63 of file MeterToolBar.h.

63{};

◆ ShowInputGainDialog()

void MeterToolBar::ShowInputGainDialog ( )

Definition at line 478 of file MeterToolBar.cpp.

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

Here is the call graph for this function:

◆ ShownByDefault()

bool MeterToolBar::ShownByDefault ( ) const
overridevirtual

Whether the toolbar should be shown by default. Default implementation returns true.

Reimplemented from ToolBar.

Definition at line 188 of file MeterToolBar.cpp.

189{
190 // The combined meter hides by default
192}

References kWithPlayMeter, kWithRecordMeter, and mWhichMeters.

◆ ShowOutputGainDialog()

void MeterToolBar::ShowOutputGainDialog ( )

Definition at line 472 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 373 of file MeterToolBar.cpp.

374{
375 if ( mPlayMeter )
377
378 if ( mRecordMeter )
380}

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

Here is the call graph for this function:

◆ UpdatePrefs()

void MeterToolBar::UpdatePrefs ( )
overridevirtual

Implements PrefsListener.

Definition at line 355 of file MeterToolBar.cpp.

356{
358
359 // Since the same widget is provides both the Recording Meter as
360 // well as the Playback Meter, we choose an appropriate label
361 // based on which it is
363 ? XO("Recording Meter")
364 : XO("Playback Meter");
365
366 // Set label to pull in language change
368
369 // Give base class a chance
371}
void SetLabel(const wxString &label) override
Definition: ToolBar.cpp:408
void UpdatePrefs() override
Definition: ToolBar.cpp:622

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 89 of file MeterToolBar.h.

Referenced by Populate(), and RebuildLayout().

◆ mRecordMeter

MeterPanel* MeterToolBar::mRecordMeter {nullptr}
private

◆ mRecordSetupButton

AButton* MeterToolBar::mRecordSetupButton {nullptr}
private

Definition at line 91 of file MeterToolBar.h.

Referenced by Populate(), and RebuildLayout().

◆ mRootSizer

wxBoxSizer* MeterToolBar::mRootSizer {nullptr}
private

Definition at line 88 of file MeterToolBar.h.

Referenced by OnSize(), and RebuildLayout().

◆ mWhichMeters

unsigned MeterToolBar::mWhichMeters
private

Definition at line 87 of file MeterToolBar.h.

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


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