Audacity 3.2.0
ControlToolBar.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5
6 ControlToolbar.h
7
8 Dominic Mazzoni
9 Shane T. Mueller
10 Leland Lucius
11
12**********************************************************************/
13
14#ifndef __AUDACITY_CONTROL_TOOLBAR__
15#define __AUDACITY_CONTROL_TOOLBAR__
16
17#include "ToolBar.h"
18
19class wxBoxSizer;
20class wxCommandEvent;
21class wxDC;
22class wxKeyEvent;
23class wxTimer;
24class wxTimerEvent;
25class wxWindow;
26class wxStatusBar;
27
28class AButton;
29class AudacityProject;
30
31// In the GUI, ControlToolBar appears as the "Transport Toolbar". "Control Toolbar" is historic.
32class AUDACITY_DLL_API ControlToolBar final : public ToolBar {
33
34 public:
35
37 virtual ~ControlToolBar();
38
39 static ControlToolBar *Find( AudacityProject &project );
40 static ControlToolBar &Get( AudacityProject &project );
41 static const ControlToolBar &Get( const AudacityProject &project );
42
43 void Create(wxWindow *parent) override;
44
45 void UpdatePrefs() override;
46 void OnKeyEvent(wxKeyEvent & event);
47
48 // msmeyer: These are public, but it's far better to
49 // call the "real" interface functions below.
50 void OnRewind(wxCommandEvent & evt);
51 void OnPlay(wxCommandEvent & evt);
52 void OnStop(wxCommandEvent & evt);
53 void OnRecord(wxCommandEvent & evt);
54 void OnFF(wxCommandEvent & evt);
55 void OnPause(wxCommandEvent & evt);
56 void OnLoop(wxCommandEvent & evt);
57 void OnIdle(wxIdleEvent & event);
58
59 // Choice among the appearances of the play button:
60 enum class PlayAppearance {
61 Straight, Looped, CutPreview, Scrub, Seek
62 };
63
64 //These allow buttons to be controlled externally:
65 void SetPlay(bool down, PlayAppearance appearance = PlayAppearance::Straight);
66 void SetStop();
67
68 // Play the region [t0,t1]
69 // Return the Audio IO token or -1 for failure
70 void PlayDefault();
71
72 void Populate() override;
73 void Repaint(wxDC *dc) override;
74 void EnableDisableButtons() override;
75
76 void ReCreateButtons() override;
77 void RegenerateTooltips() override;
78
79 // Starting and stopping of scrolling display
80 void StartScrollingIfPreferred();
81 void StartScrolling();
82 void StopScrolling();
83
84 private:
85 void UpdateStatusBar();
86
87 static
88 void MakeAlternateImages(AButton &button, int idx,
89 teBmps eEnabledUp,
90 teBmps eEnabledDown,
91 teBmps eDisabled);
92
93 void ArrangeButtons();
94 TranslatableString StateForStatusBar();
95
96 enum
97 {
98 ID_PAUSE_BUTTON = 11000,
106 };
107
115
116 wxString mStrLocale; // standard locale abbreviation
117
118 wxBoxSizer *mSizer;
119
120 public:
121
122 DECLARE_CLASS(ControlToolBar)
123 DECLARE_EVENT_TABLE()
124};
125
126#endif
127
int teBmps
A wxButton with mouse-over behaviour.
Definition: AButton.h:25
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
A ToolBar that has the main Transport buttons.
AButton * mRecord
wxString mStrLocale
AButton * mPause
AButton * mRewind
wxBoxSizer * mSizer
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:98
static void MakeAlternateImages(AButton &button, int idx, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxSize size)
Definition: ToolBar.cpp:922
virtual void EnableDisableButtons()=0
virtual void Populate()=0
virtual void ReCreateButtons()
Definition: ToolBar.cpp:516
virtual void RegenerateTooltips()=0
void UpdatePrefs() override
Definition: ToolBar.cpp:605
virtual void Repaint(wxDC *dc)=0
virtual void Create(wxWindow *parent)
Definition: ToolBar.cpp:475
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Find(const FilePath &path)
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:26