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 
19 class wxBoxSizer;
20 class wxCommandEvent;
21 class wxDC;
22 class wxKeyEvent;
23 class wxTimer;
24 class wxTimerEvent;
25 class wxWindow;
26 class wxStatusBar;
27 
28 class AButton;
29 class AudacityProject;
30 
31 // In the GUI, ControlToolBar appears as the "Transport Toolbar". "Control Toolbar" is historic.
32 class AUDACITY_DLL_API ControlToolBar final : public ToolBar {
33 
34  public:
35 
36  ControlToolBar( AudacityProject &project );
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 AButton *MakeButton(
88  ControlToolBar *pBar,
89  teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
90  int id,
91  bool processdownevents,
92  const TranslatableString &label);
93 
94  static
95  void MakeAlternateImages(AButton &button, int idx,
96  teBmps eEnabledUp,
97  teBmps eEnabledDown,
98  teBmps eDisabled);
99 
100  void ArrangeButtons();
101  TranslatableString StateForStatusBar();
102 
103  enum
104  {
105  ID_PAUSE_BUTTON = 11000,
113  };
114 
122 
123  wxString mStrLocale; // standard locale abbreviation
124 
125  wxBoxSizer *mSizer;
126 
127  public:
128 
129  DECLARE_CLASS(ControlToolBar)
130  DECLARE_EVENT_TABLE()
131 };
132 
133 #endif
134 
ToolBar::Populate
virtual void Populate()=0
ControlToolBar::mPlay
AButton * mPlay
Definition: ControlToolBar.h:116
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
ToolBar.h
label
TranslatableString label
Definition: TagsEditor.cpp:163
teBmps
int teBmps
Definition: ImageManipulation.h:48
ControlToolBar::ID_FF_BUTTON
@ ID_FF_BUTTON
Definition: ControlToolBar.h:108
ToolBar::MakeAlternateImages
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:873
ControlToolBar::mPause
AButton * mPause
Definition: ControlToolBar.h:118
ControlToolBar::PlayAppearance
PlayAppearance
Definition: ControlToolBar.h:60
AButton
A wxButton with mouse-over behaviour.
Definition: AButton.h:25
ControlToolBar::mRecord
AButton * mRecord
Definition: ControlToolBar.h:117
ToolBar::EnableDisableButtons
virtual void EnableDisableButtons()=0
ToolBar::ReCreateButtons
virtual void ReCreateButtons()
Definition: ToolBar.cpp:516
ControlToolBar::ID_LOOP_BUTTON
@ ID_LOOP_BUTTON
Definition: ControlToolBar.h:111
ControlToolBar::mStrLocale
wxString mStrLocale
Definition: ControlToolBar.h:123
ControlToolBar::ID_PLAY_BUTTON
@ ID_PLAY_BUTTON
Definition: ControlToolBar.h:106
ControlToolBar::ID_STOP_BUTTON
@ ID_STOP_BUTTON
Definition: ControlToolBar.h:107
BasicUI::Get
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:26
ToolBar::Repaint
virtual void Repaint(wxDC *dc)=0
ToolBar::UpdatePrefs
void UpdatePrefs() override
Definition: ToolBar.cpp:605
ControlToolBar::ID_REW_BUTTON
@ ID_REW_BUTTON
Definition: ControlToolBar.h:109
ToolBar::Create
virtual void Create(wxWindow *parent)
Definition: ToolBar.cpp:475
ActiveProjects::Find
wxString Find(const FilePath &path)
ControlToolBar::mRewind
AButton * mRewind
Definition: ControlToolBar.h:115
ControlToolBar
A ToolBar that has the main Transport buttons.
Definition: ControlToolBar.h:32
ControlToolBar::mSizer
wxBoxSizer * mSizer
Definition: ControlToolBar.h:125
ControlToolBar::mFF
AButton * mFF
Definition: ControlToolBar.h:120
ControlToolBar::BUTTON_COUNT
@ BUTTON_COUNT
Definition: ControlToolBar.h:112
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
ControlToolBar::mStop
AButton * mStop
Definition: ControlToolBar.h:119
ToolBar
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:98
ControlToolBar::ID_RECORD_BUTTON
@ ID_RECORD_BUTTON
Definition: ControlToolBar.h:110
ToolBar::MakeButton
static AButton * MakeButton(wxWindow *parent, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxWindowID id, wxPoint placement, bool processdownevents, wxSize size)
Definition: ToolBar.cpp:840
ToolBar::RegenerateTooltips
virtual void RegenerateTooltips()=0
ControlToolBar::mLoop
AButton * mLoop
Definition: ControlToolBar.h:121