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 static Identifier ID();
36
38 virtual ~ControlToolBar();
39
42 static const ControlToolBar &Get( const AudacityProject &project );
43
44 void Create(wxWindow *parent) override;
45
46 void UpdatePrefs() override;
47 void OnKeyEvent(wxKeyEvent & event);
48
49 // msmeyer: These are public, but it's far better to
50 // call the "real" interface functions below.
51 void OnRewind(wxCommandEvent & evt);
52 void OnPlay(wxCommandEvent & evt);
53 void OnStop(wxCommandEvent & evt);
54 void OnRecord(wxCommandEvent & evt);
55 void OnFF(wxCommandEvent & evt);
56 void OnPause(wxCommandEvent & evt);
57 void OnLoop(wxCommandEvent & evt);
58 void OnIdle(wxIdleEvent & event);
59
60 // Choice among the appearances of the play button:
61 enum class PlayAppearance {
62 Straight, Looped, CutPreview, Scrub, Seek
63 };
64
65 //These allow buttons to be controlled externally:
66 void SetPlay(bool down, PlayAppearance appearance = PlayAppearance::Straight);
67 void SetStop();
68
69 // Play the region [t0,t1]
70 // Return the Audio IO token or -1 for failure
71 void PlayDefault();
72
73 void Populate() override;
74 void Repaint(wxDC *dc) override;
75 void EnableDisableButtons() override;
76
77 void ReCreateButtons() override;
78 void RegenerateTooltips() override;
79
80 // Starting and stopping of scrolling display
81 void StartScrollingIfPreferred();
82 void StartScrolling();
83 void StopScrolling();
84
85 private:
86 void UpdateStatusBar();
87
88 void ArrangeButtons();
89 TranslatableString StateForStatusBar();
90
91 enum
92 {
93 ID_PAUSE_BUTTON = 11000,
101 };
102
110
111 wxString mStrLocale; // standard locale abbreviation
112
113 wxBoxSizer *mSizer;
114
115 public:
116
117 DECLARE_CLASS(ControlToolBar)
118 DECLARE_EVENT_TABLE()
119};
120
121#endif
122
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
A ToolBar that has the main Transport buttons.
AButton * mRecord
wxString mStrLocale
AButton * mPause
AButton * mRewind
wxBoxSizer * mSizer
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:73
virtual void EnableDisableButtons()=0
virtual void Populate()=0
virtual void ReCreateButtons()
Definition: ToolBar.cpp:533
virtual void RegenerateTooltips()=0
void UpdatePrefs() override
Definition: ToolBar.cpp:622
virtual void Repaint(wxDC *dc)=0
virtual void Create(wxWindow *parent)
Definition: ToolBar.cpp:492
Holds a msgid for the translation catalog; may also bind format arguments.
PROJECT_FILE_IO_API wxString Find(const FilePath &path)
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202
void OnRecord(const CommandContext &context)
void OnPause(const CommandContext &context)
void OnStop(const CommandContext &context)