Audacity 3.2.0
MeterToolBar.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 MeterToolbar.h
6
7 Dominic Mazzoni
8 Leland Lucius
9
10 ToolBar to hold the VU Meter
11
12**********************************************************************/
13
14#ifndef __AUDACITY_METER_TOOLBAR__
15#define __AUDACITY_METER_TOOLBAR__
16
17#include <functional>
18#include <vector>
19#include "ToolBar.h"
20
21class wxDC;
22class wxGridBagSizer;
23class wxSizeEvent;
24class wxWindow;
25
26class AudacityProject;
27class MeterPanel;
28class MeterToolBar;
29
30using MeterToolBars = std::vector< std::reference_wrapper<MeterToolBar> >;
31using ConstMeterToolBars = std::vector< std::reference_wrapper<const MeterToolBar> >;
32
33// Constants used as bit pattern
34constexpr int kWithRecordMeter = 1;
35constexpr int kWithPlayMeter = 2;
37
38class MeterToolBar final : public ToolBar {
39
40 public:
41
42 static Identifier ID();
43 static Identifier PlayID();
44 static Identifier RecordID();
45
47 unsigned whichMeters,
49 virtual ~MeterToolBar();
50
53
54 static MeterToolBar & Get(AudacityProject &project, bool forPlayMeterToolBar);
55 static const MeterToolBar & Get(const AudacityProject &project, bool forPlayMeterToolBar);
56
57 bool ShownByDefault() const override;
58
59 void Create(wxWindow *parent) override;
60
61 void Populate() override;
62 void ReCreateButtons() override;
63 void Repaint(wxDC * WXUNUSED(dc)) override {};
64 void EnableDisableButtons() override {};
65 void UpdatePrefs() override;
66 void UpdateControls();
67
68 void OnSize(wxSizeEvent & event);
69 bool Expose(bool show) override;
70
71 int GetInitialWidth() override;
72 int GetMinToolbarWidth() override { return 150; }
73 wxSize GetDockedSize() override {
74 return GetSmartDockedSize();
75 };
76
79
80 void AdjustOutputGain(int adj);
81 void AdjustInputGain(int adj);
82
83 private:
84 void RegenerateTooltips() override {}
85 void RebuildLayout(bool force);
86
87 unsigned mWhichMeters;
88 wxBoxSizer *mRootSizer{nullptr};
93
94 public:
95
96 DECLARE_CLASS(MeterToolBar)
97 DECLARE_EVENT_TABLE()
98
99};
100
101#endif
102
std::vector< std::reference_wrapper< const MeterToolBar > > ConstMeterToolBars
Definition: MeterToolBar.h:31
constexpr int kWithPlayMeter
Definition: MeterToolBar.h:35
std::vector< std::reference_wrapper< MeterToolBar > > MeterToolBars
Definition: MeterToolBar.h:30
constexpr int kCombinedMeter
Definition: MeterToolBar.h:36
constexpr int kWithRecordMeter
Definition: MeterToolBar.h:34
TranslatableString label
Definition: TagsEditor.cpp:165
const auto project
A wxButton with mouse-over behaviour.
Definition: AButton.h:104
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
MeterPanel is a panel that paints the meter used for monitoring or playback.
Definition: MeterPanel.h:91
A ToolBar that holds the VU Meter.
Definition: MeterToolBar.h:38
AButton * mRecordSetupButton
Definition: MeterToolBar.h:91
static Identifier PlayID()
virtual ~MeterToolBar()
void UpdatePrefs() override
void AdjustOutputGain(int adj)
void RegenerateTooltips() override
Definition: MeterToolBar.h:84
void ShowInputGainDialog()
void EnableDisableButtons() override
Definition: MeterToolBar.h:64
int GetMinToolbarWidth() override
Definition: MeterToolBar.h:72
static MeterToolBars GetToolBars(AudacityProject &project)
MeterToolBar(AudacityProject &project, unsigned whichMeters, const TranslatableString &label, Identifier ID)
static Identifier ID()
Methods for MeterToolBar.
void ShowOutputGainDialog()
wxSize GetDockedSize() override
Definition: MeterToolBar.h:73
void OnSize(wxSizeEvent &event)
void AdjustInputGain(int adj)
void ReCreateButtons() override
void Create(wxWindow *parent) override
static Identifier RecordID()
void Populate() override
void Repaint(wxDC *WXUNUSED(dc)) override
Definition: MeterToolBar.h:63
MeterPanel * mPlayMeter
Definition: MeterToolBar.h:90
void RebuildLayout(bool force)
AButton * mPlaySetupButton
Definition: MeterToolBar.h:89
MeterPanel * mRecordMeter
Definition: MeterToolBar.h:92
void UpdateControls()
static MeterToolBar & Get(AudacityProject &project, bool forPlayMeterToolBar)
wxBoxSizer * mRootSizer
Definition: MeterToolBar.h:88
int GetInitialWidth() override
Resizable toolbars should implement these.
bool ShownByDefault() const override
Whether the toolbar should be shown by default. Default implementation returns true.
unsigned mWhichMeters
Definition: MeterToolBar.h:87
bool Expose(bool show) override
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:73
wxSize GetSmartDockedSize()
Definition: ToolBar.cpp:520
Holds a msgid for the translation catalog; may also bind format arguments.