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 MeterToolBar(AudacityProject &project, int type);
43 virtual ~MeterToolBar();
44
46 static ConstMeterToolBars GetToolBars(const AudacityProject &project);
47
48 static MeterToolBar & Get(AudacityProject &project, bool forPlayMeterToolBar);
49 static const MeterToolBar & Get(const AudacityProject &project, bool forPlayMeterToolBar);
50
51 void Create(wxWindow *parent) override;
52
53 void Populate() override;
54 void ReCreateButtons() override;
55 void Repaint(wxDC * WXUNUSED(dc)) override {};
56 void EnableDisableButtons() override {};
57 void UpdatePrefs() override;
58 void UpdateControls();
59
60 void OnSize(wxSizeEvent & event);
61 bool Expose(bool show) override;
62
63 int GetInitialWidth() override;
64 int GetMinToolbarWidth() override { return 150; }
65 wxSize GetDockedSize() override {
66 return GetSmartDockedSize();
67 };
68 virtual void SetDocked(ToolDock *dock, bool pushed)override;
69
72
73 void AdjustOutputGain(int adj);
74 void AdjustInputGain(int adj);
75
76 private:
77 void RegenerateTooltips() override {}
78 void RebuildLayout(bool force);
79
81 wxBoxSizer *mRootSizer{nullptr};
86
87 public:
88
89 DECLARE_CLASS(MeterToolBar)
90 DECLARE_EVENT_TABLE()
91
92};
93
94#endif
95
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
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:89
MeterPanel is a panel that paints the meter used for monitoring or playback.
Definition: MeterPanel.h:104
A ToolBar that holds the VU Meter.
Definition: MeterToolBar.h:38
AButton * mRecordSetupButton
Definition: MeterToolBar.h:84
virtual ~MeterToolBar()
void UpdatePrefs() override
void AdjustOutputGain(int adj)
void RegenerateTooltips() override
Definition: MeterToolBar.h:77
MeterToolBar(AudacityProject &project, int type)
Methods for MeterToolBar.
void ShowInputGainDialog()
void EnableDisableButtons() override
Definition: MeterToolBar.h:56
int GetMinToolbarWidth() override
Definition: MeterToolBar.h:64
static MeterToolBars GetToolBars(AudacityProject &project)
void ShowOutputGainDialog()
wxSize GetDockedSize() override
Definition: MeterToolBar.h:65
void OnSize(wxSizeEvent &event)
void AdjustInputGain(int adj)
void ReCreateButtons() override
void Create(wxWindow *parent) override
void Populate() override
void Repaint(wxDC *WXUNUSED(dc)) override
Definition: MeterToolBar.h:55
MeterPanel * mPlayMeter
Definition: MeterToolBar.h:83
void RebuildLayout(bool force)
AButton * mPlaySetupButton
Definition: MeterToolBar.h:82
MeterPanel * mRecordMeter
Definition: MeterToolBar.h:85
void UpdateControls()
static MeterToolBar & Get(AudacityProject &project, bool forPlayMeterToolBar)
wxBoxSizer * mRootSizer
Definition: MeterToolBar.h:81
int GetInitialWidth() override
Resizable toolbars should implement these.
virtual void SetDocked(ToolDock *dock, bool pushed) override
bool Expose(bool show) override
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:101
wxSize GetSmartDockedSize()
Definition: ToolBar.cpp:512
A dynamic panel where a ToolBar can be docked.
Definition: ToolDock.h:290