![]() |
Audacity 3.2.0
|
A ToolBar that has the main Transport buttons. More...
#include <ControlToolBar.h>
Public Types | |
enum class | PlayAppearance { Straight , Looped , CutPreview , Scrub , Seek } |
![]() | |
enum | DockID { TopDockID = 1 , BotDockID = 2 } |
Identifies one of the docking areas for toolbars. More... | |
using | Holder = wxWindowPtr< ToolBar > |
Public Member Functions | |
ControlToolBar (AudacityProject &project) | |
virtual | ~ControlToolBar () |
void | Create (wxWindow *parent) override |
void | UpdatePrefs () override |
void | OnKeyEvent (wxKeyEvent &event) |
void | OnRewind (wxCommandEvent &evt) |
void | OnPlay (wxCommandEvent &evt) |
void | OnStop (wxCommandEvent &evt) |
void | OnRecord (wxCommandEvent &evt) |
void | OnFF (wxCommandEvent &evt) |
void | OnPause (wxCommandEvent &evt) |
void | OnLoop (wxCommandEvent &evt) |
void | OnIdle (wxIdleEvent &event) |
void | SetPlay (bool down, PlayAppearance appearance=PlayAppearance::Straight) |
void | SetStop () |
void | PlayDefault () |
void | Populate () override |
void | Repaint (wxDC *dc) override |
void | EnableDisableButtons () override |
void | ReCreateButtons () override |
void | RegenerateTooltips () override |
void | StartScrollingIfPreferred () |
void | StartScrolling () |
void | StopScrolling () |
![]() | |
ToolBar (AudacityProject &project, const TranslatableString &label, const Identifier §ion, bool resizable=false) | |
virtual | ~ToolBar () |
virtual bool | ShownByDefault () const |
Whether the toolbar should be shown by default. Default implementation returns true. More... | |
virtual bool | HideAfterReset () const |
Default implementation returns false. More... | |
virtual DockID | DefaultDockID () const |
Which dock the toolbar defaults into. Default implementation chooses the top dock. More... | |
bool | AcceptsFocus () const override |
bool | AcceptsFocusFromKeyboard () const override |
virtual void | SetToDefaultSize () |
virtual void | Create (wxWindow *parent) |
virtual void | EnableDisableButtons ()=0 |
virtual void | ReCreateButtons () |
void | UpdatePrefs () override |
virtual void | RegenerateTooltips ()=0 |
int | GetIndex () const |
Get a value used for computing cascading positions of undocked bars. More... | |
void | SetIndex (int index) |
Set a value used for computing cascading positions of undocked bars. More... | |
TranslatableString | GetTitle () |
TranslatableString | GetLabel () |
Identifier | GetSection () |
ToolDock * | GetDock () |
void | SetPreferredNeighbors (Identifier left, Identifier top={}) |
void | SetLabel (const TranslatableString &label) |
virtual void | SetDocked (ToolDock *dock, bool pushed) |
std::pair< Identifier, Identifier > | PreferredNeighbors () const noexcept |
Defaults to (NoBarID, NoBarId) More... | |
virtual bool | Expose (bool show=true) |
bool | IsResizable () const |
bool | IsVisible () const |
bool | IsDocked () const |
bool | IsPositioned () |
void | SetVisible (bool bVisible) |
void | SetPositioned () |
virtual int | GetInitialWidth () |
Resizable toolbars should implement these. More... | |
virtual int | GetMinToolbarWidth () |
virtual wxSize | GetDockedSize () |
wxSize | GetSmartDockedSize () |
virtual void | ResizingDone () |
![]() | |
wxPanelWrapper () | |
wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel")) | |
bool | Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel")) |
void | SetLabel (const TranslatableString &label) |
void | SetName (const TranslatableString &name) |
void | SetToolTip (const TranslatableString &toolTip) |
void | SetName () |
![]() | |
wxTabTraversalWrapper (Args &&... args) | |
wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete | |
wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete | |
wxTabTraversalWrapper & | operator= (const wxTabTraversalWrapper &)=delete |
wxTabTraversalWrapper & | operator= (wxTabTraversalWrapper &&)=delete |
Static Public Member Functions | |
static Identifier | ID () |
static ControlToolBar * | Find (AudacityProject &project) |
static ControlToolBar & | Get (AudacityProject &project) |
static const ControlToolBar & | Get (const AudacityProject &project) |
![]() | |
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) |
static AButton * | MakeButton (ToolBar *parent, teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled, int id, bool processdownevents, const TranslatableString &label) |
static void | MakeAlternateImages (AButton &button, int idx, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxSize size) |
static void | SetButtonToolTip (AudacityProject &project, AButton &button, const ComponentInterfaceSymbol commands[], size_t nCommands) |
static void | MakeButtonBackgroundsSmall () |
static void | MakeButtonBackgroundsLarge () |
Private Types | |
enum | { ID_PAUSE_BUTTON = 11000 , ID_PLAY_BUTTON , ID_STOP_BUTTON , ID_FF_BUTTON , ID_REW_BUTTON , ID_RECORD_BUTTON , ID_LOOP_BUTTON , BUTTON_COUNT } |
Private Member Functions | |
void | UpdateStatusBar () |
void | ArrangeButtons () |
TranslatableString | StateForStatusBar () |
Static Private Member Functions | |
static void | MakeAlternateImages (AButton &button, int idx, teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled) |
Private Attributes | |
AButton * | mRewind |
AButton * | mPlay |
AButton * | mRecord |
AButton * | mPause |
AButton * | mStop |
AButton * | mFF |
AButton * | mLoop |
wxString | mStrLocale |
wxBoxSizer * | mSizer |
Additional Inherited Members | |
![]() | |
void | SetButton (bool down, AButton *button) |
wxBoxSizer * | GetSizer () |
void | Add (wxWindow *window, int proportion=0, int flag=wxALIGN_TOP, int border=0, wxObject *userData=NULL) |
void | Add (wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
void | Add (int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
void | AddSpacer (int size=14) |
void | AddStretchSpacer (int prop=1) |
void | Detach (wxWindow *window) |
void | Detach (wxSizer *sizer) |
void | Updated () |
int | GetResizeGrabberWidth () |
Returns the width in pixels of the resizer element. More... | |
virtual void | Populate ()=0 |
virtual void | Repaint (wxDC *dc)=0 |
void | OnErase (wxEraseEvent &event) |
void | OnPaint (wxPaintEvent &event) |
void | OnMouseEvents (wxMouseEvent &event) |
![]() | |
virtual void | UpdateSelectedPrefs (int id) |
PrefsListener () | |
virtual | ~PrefsListener () |
virtual void | UpdatePrefs ()=0 |
![]() | |
static void | MakeMacRecoloredImage (teBmps eBmpOut, teBmps eBmpIn) |
static void | MakeMacRecoloredImageSize (teBmps eBmpOut, teBmps eBmpIn, const wxSize &size) |
static void | MakeRecoloredImage (teBmps eBmpOut, teBmps eBmpIn) |
static void | MakeRecoloredImageSize (teBmps eBmpOut, teBmps eBmpIn, const wxSize &size) |
![]() | |
static void | Broadcast (int id=0) |
Call this static function to notify all PrefsListener objects. More... | |
![]() | |
AudacityProject & | mProject |
TranslatableString | mLabel |
Identifier | mSection |
int | mIndex {0} |
A ToolBar that has the main Transport buttons.
In the GUI, this is referred to as "Transport Toolbar", as it corresponds to commands in the Transport menu. "Control Toolbar" is historic. This class, which is a child of Toolbar, creates the window containing the Transport (rewind/play/stop/record/ff) buttons. The window can be embedded within a normal project window, or within a ToolBarFrame.
All of the controls in this window were custom-written for Audacity - they are not native controls on any platform - however, it is intended that the images could be easily replaced to allow "skinning" or just customization to match the look and feel of each platform.
Definition at line 32 of file ControlToolBar.h.
|
private |
Enumerator | |
---|---|
ID_PAUSE_BUTTON | |
ID_PLAY_BUTTON | |
ID_STOP_BUTTON | |
ID_FF_BUTTON | |
ID_REW_BUTTON | |
ID_RECORD_BUTTON | |
ID_LOOP_BUTTON | |
BUTTON_COUNT |
Definition at line 97 of file ControlToolBar.h.
|
strong |
Enumerator | |
---|---|
Straight | |
Looped | |
CutPreview | |
Scrub | |
Seek |
Definition at line 61 of file ControlToolBar.h.
ControlToolBar::ControlToolBar | ( | AudacityProject & | project | ) |
Definition at line 116 of file ControlToolBar.cpp.
References gPrefs, mSizer, mStrLocale, and wxT().
|
virtual |
Definition at line 124 of file ControlToolBar.cpp.
|
private |
Definition at line 333 of file ControlToolBar.cpp.
References ToolBar::Add(), ToolBar::Detach(), ToolBar::GetSizer(), mFF, mLoop, mPause, mPlay, mRecord, mRewind, mSizer, mStop, and safenew.
Referenced by Populate().
|
overridevirtual |
Reimplemented from ToolBar.
Definition at line 148 of file ControlToolBar.cpp.
References ToolBar::Create(), and UpdatePrefs().
|
overridevirtual |
Implements ToolBar.
Definition at line 441 of file ControlToolBar.cpp.
References TrackList::Any(), AudioIO::Get(), TrackList::Get(), ProjectAudioManager::Get(), AButton::IsDown(), mFF, mLoop, mPause, mPlay, ToolBar::mProject, mRecord, mRewind, mStop, and AButton::SetEnabled().
Referenced by OnIdle(), ReCreateButtons(), SetPlay(), and SetStop().
|
static |
Definition at line 129 of file ControlToolBar.cpp.
References ToolManager::Get(), and ID().
|
static |
Definition at line 136 of file ControlToolBar.cpp.
References ToolManager::Get(), and ID().
Referenced by TransportUtilities::DoStopPlaying(), Get(), anonymous_namespace{TransportMenus.cpp}::MakeReadyToPlay(), SelectActions::Handler::OnSkipEnd(), and SelectActions::Handler::OnSkipStart().
|
static |
Definition at line 143 of file ControlToolBar.cpp.
References Get().
|
static |
|
staticprivate |
Definition at line 155 of file ControlToolBar.cpp.
References ThemeBase::ImageSize(), ToolBar::MakeAlternateImages(), and theTheme.
Referenced by Populate().
void ControlToolBar::OnFF | ( | wxCommandEvent & | evt | ) |
Definition at line 663 of file ControlToolBar.cpp.
References ProjectAudioManager::Get(), ProjectWindow::Get(), mFF, ToolBar::mProject, AButton::PopUp(), AButton::PushDown(), ProjectWindow::SkipEnd(), ProjectAudioManager::StopIfPaused(), and AButton::WasShiftDown().
void ControlToolBar::OnIdle | ( | wxIdleEvent & | event | ) |
Definition at line 584 of file ControlToolBar.cpp.
References EnableDisableButtons(), ViewInfo::Get(), ProjectAudioManager::Get(), Scrubber::Get(), mLoop, mPause, mPlay, ToolBar::mProject, mRecord, mStop, AButton::PopUp(), AButton::PushDown(), AButton::SetAlternateIdx(), StartScrollingIfPreferred(), StopScrolling(), and UpdateStatusBar().
void ControlToolBar::OnKeyEvent | ( | wxKeyEvent & | event | ) |
Definition at line 492 of file ControlToolBar.cpp.
References AudioIOBase::Get(), ProjectAudioManager::Get(), ToolBar::mProject, and SetStop().
void ControlToolBar::OnLoop | ( | wxCommandEvent & | evt | ) |
Definition at line 574 of file ControlToolBar.cpp.
References SelectUtilities::ActivatePlayRegion(), ViewInfo::Get(), SelectUtilities::InactivatePlayRegion(), ToolBar::mProject, and ViewInfo::playRegion.
void ControlToolBar::OnPause | ( | wxCommandEvent & | evt | ) |
Definition at line 569 of file ControlToolBar.cpp.
References ProjectAudioManager::Get(), ToolBar::mProject, and ProjectAudioManager::OnPause().
void ControlToolBar::OnPlay | ( | wxCommandEvent & | evt | ) |
Definition at line 523 of file ControlToolBar.cpp.
References ProjectAudioManager::Get(), ToolBar::mProject, and PlayDefault().
void ControlToolBar::OnRecord | ( | wxCommandEvent & | evt | ) |
Definition at line 558 of file ControlToolBar.cpp.
References ProjectAudioManager::Get(), ToolBar::mProject, mRecord, ProjectAudioManager::OnRecord(), and AButton::WasShiftDown().
void ControlToolBar::OnRewind | ( | wxCommandEvent & | evt | ) |
Definition at line 651 of file ControlToolBar.cpp.
References ProjectAudioManager::Get(), ProjectWindow::Get(), ToolBar::mProject, mRewind, AButton::PopUp(), AButton::PushDown(), ProjectWindow::Rewind(), ProjectAudioManager::StopIfPaused(), and AButton::WasShiftDown().
void ControlToolBar::OnStop | ( | wxCommandEvent & | evt | ) |
Definition at line 537 of file ControlToolBar.cpp.
References ProjectAudioManager::Get(), and ToolBar::mProject.
void ControlToolBar::PlayDefault | ( | ) |
Definition at line 547 of file ControlToolBar.cpp.
References ProjectAudioManager::Get(), mPlay, ToolBar::mProject, ProjectAudioManager::PlayCurrentRegion(), AButton::WasControlDown(), and AButton::WasShiftDown().
Referenced by OnPlay().
|
overridevirtual |
Implements ToolBar.
Definition at line 166 of file ControlToolBar.cpp.
References ArrangeButtons(), ThemeBase::Colour(), AButton::FollowModifierKeys(), gPrefs, ID_FF_BUTTON, ID_LOOP_BUTTON, ID_PAUSE_BUTTON, ID_PLAY_BUTTON, ID_RECORD_BUTTON, ID_REW_BUTTON, ID_STOP_BUTTON, LoopToggleText, MakeAlternateImages(), ToolBar::MakeButton(), ToolBar::MakeButtonBackgroundsLarge(), mFF, mLoop, mPause, mPlay, mRecord, mRewind, mStop, RegenerateTooltips(), TranslatableString::Stripped(), theTheme, and XO().
|
overridevirtual |
Reimplemented from ToolBar.
Definition at line 375 of file ControlToolBar.cpp.
References ToolBar::Detach(), EnableDisableButtons(), AButton::IsDown(), Looped, mLoop, mPause, mPlay, mRecord, mSizer, AButton::PushDown(), ToolBar::ReCreateButtons(), RegenerateTooltips(), AButton::SetAlternateIdx(), SetPlay(), Straight, and AButton::WasShiftDown().
Referenced by UpdatePrefs().
|
overridevirtual |
Implements ToolBar.
Definition at line 224 of file ControlToolBar.cpp.
References BUTTON_COUNT, gPrefs, ID_FF_BUTTON, ID_LOOP_BUTTON, ID_PAUSE_BUTTON, ID_PLAY_BUTTON, ID_RECORD_BUTTON, ID_REW_BUTTON, ID_STOP_BUTTON, ToolBar::mProject, name, ToolBar::SetButtonToolTip(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size(), Verbatim(), wxT(), and XO().
Referenced by Populate(), ReCreateButtons(), and UpdatePrefs().
|
overridevirtual |
Implements ToolBar.
Definition at line 430 of file ControlToolBar.cpp.
References AColor::Bevel(), and mSizer.
void ControlToolBar::SetPlay | ( | bool | down, |
PlayAppearance | appearance = PlayAppearance::Straight |
||
) |
Definition at line 471 of file ControlToolBar.cpp.
References CutPreview, EnableDisableButtons(), Looped, mPlay, AButton::PopUp(), AButton::PushDown(), AButton::SetAlternateIdx(), AButton::SetControl(), and AButton::SetShift().
Referenced by ReCreateButtons().
void ControlToolBar::SetStop | ( | ) |
Definition at line 486 of file ControlToolBar.cpp.
References EnableDisableButtons(), mStop, and AButton::PushDown().
Referenced by OnKeyEvent().
void ControlToolBar::StartScrolling | ( | ) |
Definition at line 747 of file ControlToolBar.cpp.
References ProjectWindow::PlaybackScroller::Activate(), AudioIO::Get(), ProjectWindow::Get(), ProjectWindow::GetPlaybackScroller(), gPrefs, ToolBar::mProject, and wxT().
Referenced by StartScrollingIfPreferred().
void ControlToolBar::StartScrollingIfPreferred | ( | ) |
Definition at line 729 of file ControlToolBar.cpp.
References ProjectWindow::PlaybackScroller::Activate(), ProjectWindow::Get(), Scrubber::Get(), ProjectWindow::GetPlaybackScroller(), ToolBar::mProject, ProjectWindow::PlaybackScroller::Refresh, StartScrolling(), and StopScrolling().
Referenced by OnIdle().
|
private |
Definition at line 700 of file ControlToolBar.cpp.
References TranslatableString::Format(), ProjectAudioManager::Get(), Scrubber::Get(), Scrubber::GetUntranslatedStateString(), AButton::IsDown(), mPause, mPlay, ToolBar::mProject, sStatePlay, sStateRecord, sStateStop, and XO().
Referenced by UpdateStatusBar().
void ControlToolBar::StopScrolling | ( | ) |
Definition at line 786 of file ControlToolBar.cpp.
References ProjectWindow::PlaybackScroller::Activate(), ProjectWindow::Get(), ProjectWindow::GetPlaybackScroller(), ToolBar::mProject, and ProjectWindow::PlaybackScroller::Off.
Referenced by OnIdle(), and StartScrollingIfPreferred().
|
overridevirtual |
Implements PrefsListener.
Definition at line 302 of file ControlToolBar.cpp.
References gPrefs, mStrLocale, ReCreateButtons(), RegenerateTooltips(), ToolBar::SetLabel(), ToolBar::Updated(), ToolBar::UpdatePrefs(), wxT(), and XO().
Referenced by Create().
|
private |
Definition at line 722 of file ControlToolBar.cpp.
References ProjectStatus::Get(), ToolBar::mProject, ProjectStatus::Set(), StateForStatusBar(), and stateStatusBarField.
Referenced by OnIdle().
|
private |
Definition at line 114 of file ControlToolBar.h.
Referenced by ArrangeButtons(), EnableDisableButtons(), OnFF(), and Populate().
|
private |
Definition at line 115 of file ControlToolBar.h.
Referenced by ArrangeButtons(), EnableDisableButtons(), OnIdle(), Populate(), and ReCreateButtons().
|
private |
Definition at line 112 of file ControlToolBar.h.
Referenced by ArrangeButtons(), EnableDisableButtons(), OnIdle(), Populate(), ReCreateButtons(), and StateForStatusBar().
|
private |
Definition at line 110 of file ControlToolBar.h.
Referenced by ArrangeButtons(), EnableDisableButtons(), OnIdle(), PlayDefault(), Populate(), ReCreateButtons(), SetPlay(), and StateForStatusBar().
|
private |
Definition at line 111 of file ControlToolBar.h.
Referenced by ArrangeButtons(), EnableDisableButtons(), OnIdle(), OnRecord(), Populate(), and ReCreateButtons().
|
private |
Definition at line 109 of file ControlToolBar.h.
Referenced by ArrangeButtons(), EnableDisableButtons(), OnRewind(), and Populate().
|
private |
Definition at line 119 of file ControlToolBar.h.
Referenced by ArrangeButtons(), ControlToolBar(), ReCreateButtons(), and Repaint().
|
private |
Definition at line 113 of file ControlToolBar.h.
Referenced by ArrangeButtons(), EnableDisableButtons(), OnIdle(), Populate(), and SetStop().
|
private |
Definition at line 117 of file ControlToolBar.h.
Referenced by ControlToolBar(), and UpdatePrefs().