Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
TimeToolBar Class Referencefinal

#include <TimeToolBar.h>

Inheritance diagram for TimeToolBar:
[legend]
Collaboration diagram for TimeToolBar:
[legend]

Public Member Functions

 TimeToolBar (AudacityProject &project)
 
virtual ~TimeToolBar ()
 
DockID DefaultDockID () const override
 Which dock the toolbar defaults into. Default implementation chooses the top dock. More...
 
void Populate () override
 
void Repaint (wxDC *WXUNUSED(dc)) override
 
void EnableDisableButtons () override
 
void UpdatePrefs () override
 
void RegenerateTooltips () override
 
int GetInitialWidth () override
 Resizable toolbars should implement these. More...
 
int GetMinToolbarWidth () override
 
void SetToDefaultSize () override
 
wxSize GetDockedSize () override
 
void SetDocked (ToolDock *dock, bool pushed) override
 
void SetListener (TimeToolBarListener *l)
 
void SetAudioTimeFormat (const NumericFormatSymbol &format)
 
void ResizingDone () override
 
- Public Member Functions inherited from ToolBar
 ToolBar (AudacityProject &project, const TranslatableString &label, const Identifier &section, 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 ()
 
ToolDockGetDock ()
 
void SetPreferredNeighbors (Identifier left, Identifier top={})
 
void SetLabel (const TranslatableString &label)
 
virtual void SetDocked (ToolDock *dock, bool pushed)
 
std::pair< Identifier, IdentifierPreferredNeighbors () 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 ()
 
- Public Member Functions inherited from wxPanelWrapper
 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 ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Static Public Member Functions

static Identifier ID ()
 
static TimeToolBarGet (AudacityProject &project)
 
static const TimeToolBarGet (const AudacityProject &project)
 
- Static Public Member Functions inherited from ToolBar
static AButtonMakeButton (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 AButtonMakeButton (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 Member Functions

void SetResizingLimits ()
 
wxSize ComputeSizing (int digitH)
 
void OnRateChanged (double)
 
void OnUpdate (wxCommandEvent &evt)
 
void OnSize (wxSizeEvent &evt)
 
void OnIdle (wxIdleEvent &evt)
 

Private Attributes

TimeToolBarListenermListener
 
NumericTextCtrlmAudioTime
 
float mDigitRatio
 
bool mSettingInitialSize
 
Observer::Subscription mSubscription
 

Static Private Attributes

static const int minDigitH = 17
 
static const int maxDigitH = 100
 

Additional Inherited Members

- Public Types inherited from ToolBar
enum  DockID { TopDockID = 1 , BotDockID = 2 }
 Identifies one of the docking areas for toolbars. More...
 
using Holder = wxWindowPtr< ToolBar >
 
- Protected Member Functions inherited from ToolBar
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)
 
- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
- Static Protected Member Functions inherited from ToolBar
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 Protected Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 
- Protected Attributes inherited from ToolBar
AudacityProjectmProject
 
TranslatableString mLabel
 
Identifier mSection
 
int mIndex {0}
 

Detailed Description

Definition at line 23 of file TimeToolBar.h.

Constructor & Destructor Documentation

◆ TimeToolBar()

TimeToolBar::TimeToolBar ( AudacityProject project)

Definition at line 56 of file TimeToolBar.cpp.

57: ToolBar(project, XO("Time"), ID(), true),
58 mListener(NULL),
59 mAudioTime(NULL)
60{
63}
XO("Cut/Copy/Paste")
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28
TimeToolBarListener * mListener
Definition: TimeToolBar.h:59
void OnRateChanged(double)
NumericTextCtrl * mAudioTime
Definition: TimeToolBar.h:60
static Identifier ID()
Definition: TimeToolBar.cpp:51
Observer::Subscription mSubscription
Definition: TimeToolBar.h:67
ToolBar(AudacityProject &project, const TranslatableString &label, const Identifier &section, bool resizable=false)
Definition: ToolBar.cpp:328

References ProjectRate::Get(), mSubscription, OnRateChanged(), and Observer::Publisher< Message, NotifyAll >::Subscribe().

Here is the call graph for this function:

◆ ~TimeToolBar()

TimeToolBar::~TimeToolBar ( )
virtual

Definition at line 65 of file TimeToolBar.cpp.

66{
67}

Member Function Documentation

◆ ComputeSizing()

wxSize TimeToolBar::ComputeSizing ( int  digitH)
inlineprivate

Definition at line 75 of file TimeToolBar.h.

76{
77 return mAudioTime->ComputeSizing(false, digitH * mDigitRatio, digitH);
78}
wxSize ComputeSizing(bool update=true, wxCoord digitW=0, wxCoord digitH=0)
float mDigitRatio
Definition: TimeToolBar.h:61

References NumericTextCtrl::ComputeSizing(), mAudioTime, and mDigitRatio.

Referenced by OnSize(), and SetResizingLimits().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DefaultDockID()

ToolBar::DockID TimeToolBar::DefaultDockID ( ) const
overridevirtual

Which dock the toolbar defaults into. Default implementation chooses the top dock.

Reimplemented from ToolBar.

Definition at line 69 of file TimeToolBar.cpp.

70{
71 return BotDockID;
72}
@ BotDockID
Definition: ToolBar.h:94

References ToolBar::BotDockID.

◆ EnableDisableButtons()

void TimeToolBar::EnableDisableButtons ( )
inlineoverridevirtual

Implements ToolBar.

Definition at line 38 of file TimeToolBar.h.

38{};

◆ Get() [1/2]

TimeToolBar & TimeToolBar::Get ( AudacityProject project)
static

Definition at line 74 of file TimeToolBar.cpp.

75{
76 auto &toolManager = ToolManager::Get(project);
77 return *static_cast<TimeToolBar*>(toolManager.GetToolBar(ID()));
78}
static ToolManager & Get(AudacityProject &project)

References ToolManager::Get(), and ID().

Referenced by Get(), ProjectManager::New(), and ProjectSelectionManager::TT_SetAudioTimeFormat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get() [2/2]

const TimeToolBar & TimeToolBar::Get ( const AudacityProject project)
static

Definition at line 80 of file TimeToolBar.cpp.

81{
82 return Get(const_cast<AudacityProject&>(project)) ;
83}
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
static TimeToolBar & Get(AudacityProject &project)
Definition: TimeToolBar.cpp:74

References Get().

Here is the call graph for this function:

◆ GetDockedSize()

wxSize TimeToolBar::GetDockedSize ( )
overridevirtual

Reimplemented from ToolBar.

Definition at line 147 of file TimeToolBar.cpp.

148{
149 wxSize sz = GetSize();
150
151 // Anything less than a single height bar becomes single height
152 if (sz.y <= toolbarSingle) {
153 sz.y = toolbarSingle;
154 }
155 // Otherwise it will be a double height bar
156 else {
157 sz.y = 2 * toolbarSingle + toolbarGap;
158 }
159
160 return sz;
161}
#define toolbarSingle
Definition: ToolBar.h:59
#define toolbarGap
Definition: ToolBar.h:64

References toolbarGap, and toolbarSingle.

◆ GetInitialWidth()

int TimeToolBar::GetInitialWidth ( )
inlineoverridevirtual

Resizable toolbars should implement these.

Reimplemented from ToolBar.

Definition at line 41 of file TimeToolBar.h.

41{return 250;}

Referenced by SetToDefaultSize().

Here is the caller graph for this function:

◆ GetMinToolbarWidth()

int TimeToolBar::GetMinToolbarWidth ( )
inlineoverridevirtual

Reimplemented from ToolBar.

Definition at line 42 of file TimeToolBar.h.

42{return 50;}

◆ ID()

Identifier TimeToolBar::ID ( )
static

Definition at line 51 of file TimeToolBar.cpp.

52{
53 return wxT("Time");
54}
wxT("CloseDown"))

References wxT().

Referenced by Get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnIdle()

void TimeToolBar::OnIdle ( wxIdleEvent &  evt)
private

Definition at line 365 of file TimeToolBar.cpp.

366{
367 evt.Skip();
368
369 double audioTime;
370
371 auto &projectAudioIO = ProjectAudioIO::Get(mProject);
372 if (projectAudioIO.IsAudioActive()) {
373 auto gAudioIO = AudioIO::Get();
374 audioTime = gAudioIO->GetStreamTime();
375 }
376 else {
377 const auto &playRegion = ViewInfo::Get(mProject).playRegion;
378 audioTime = playRegion.GetStart();
379 }
380
381 mAudioTime->SetValue(wxMax(0.0, audioTime));
382}
static AudioIO * Get()
Definition: AudioIO.cpp:147
void SetValue(double newValue)
double GetStart() const
Definition: ViewInfo.h:128
static ProjectAudioIO & Get(AudacityProject &project)
AudacityProject & mProject
Definition: ToolBar.h:248
PlayRegion playRegion
Definition: ViewInfo.h:220
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References AudioIO::Get(), ProjectAudioIO::Get(), ViewInfo::Get(), PlayRegion::GetStart(), mAudioTime, ToolBar::mProject, ViewInfo::playRegion, and NumericTextCtrl::SetValue().

Here is the call graph for this function:

◆ OnRateChanged()

void TimeToolBar::OnRateChanged ( double  rate)
private

Definition at line 276 of file TimeToolBar.cpp.

277{
278 if (mAudioTime)
280}
void SetSampleRate(double sampleRate)

References mAudioTime, and NumericTextCtrl::SetSampleRate().

Referenced by TimeToolBar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSize()

void TimeToolBar::OnSize ( wxSizeEvent &  evt)
private

Definition at line 319 of file TimeToolBar.cpp.

320{
321 evt.Skip();
322
323 // Can fire before we're ready
324 if (!mAudioTime) {
325 return;
326 }
327
328 // Make sure everything is where it's supposed to be
329 Layout();
330
331 // Get the sizer's size and remove any borders the time control might have.
332 wxSize sizerBR = GetSizer()->GetSize() - (mAudioTime->GetSize() - mAudioTime->GetClientSize());
333
334 // Get the content size of the time control. This can be different than the
335 // control itself due to borders and sizer enduced changes.
336 wxSize timeBR = mAudioTime->GetDimensions();
337
338 // Get the current digit box height
339 int h = mAudioTime->GetDigitSize().y;
340
341 // Increase current size to find the best fit within the new size
342 if (sizerBR.x >= timeBR.x && sizerBR.y >= timeBR.y) {
343 do {
344 h++;
345 timeBR = ComputeSizing(h);
346 } while (h < maxDigitH && sizerBR.x >= timeBR.x && sizerBR.y >= timeBR.y);
347 h--;
348 }
349 // In all other cases, we need to decrease current size to fit within new size
350 else if (sizerBR.x < timeBR.x || sizerBR.y < timeBR.y) {
351 do {
352 h--;
353 timeBR = ComputeSizing(h);
354 } while (h >= minDigitH && (sizerBR.x < timeBR.x || sizerBR.y < timeBR.y));
355 }
356
357 if (h != mAudioTime->GetDigitSize().y) {
359 }
360
361 // Redraw the display immediately to smooth out resizing
362 Update();
363}
wxSize GetDimensions()
wxSize GetDigitSize()
void SetDigitSize(int width, int height)
static const int minDigitH
Definition: TimeToolBar.h:64
wxSize ComputeSizing(int digitH)
Definition: TimeToolBar.h:75
wxBoxSizer * GetSizer()
Definition: ToolBar.cpp:701

References ComputeSizing(), NumericTextCtrl::GetDigitSize(), NumericTextCtrl::GetDimensions(), ToolBar::GetSizer(), mAudioTime, mDigitRatio, minDigitH, and NumericTextCtrl::SetDigitSize().

Here is the call graph for this function:

◆ OnUpdate()

void TimeToolBar::OnUpdate ( wxCommandEvent &  evt)
private

Definition at line 284 of file TimeToolBar.cpp.

285{
286 evt.Skip(false);
287
289
290 // Reset to allow resizing to work
291 SetMinSize(wxDefaultSize);
292 SetMaxSize(wxDefaultSize);
293
294 // Save format name before recreating the controls so they resize properly
295 if (mListener) {
297 }
298
299 // During initialization, the desired size will have already been set at this point
300 // and the "best" size" would override it, so we simply send a size event to force
301 // the content to fit inside the toolbar.
303 mSettingInitialSize = false;
304 SendSizeEvent();
305 }
306 // Otherwise we want the toolbar to resize to fit around the content
307 else {
308 // Fit() while retaining height
309 SetSize(GetBestSize().x, GetSize().y);
310 }
311
312 // Go set the new size limits
314
315 // Inform others the toobar has changed
316 Updated();
317}
NumericFormatSymbol GetBuiltinName(const int index)
void SetResizingLimits()
bool mSettingInitialSize
Definition: TimeToolBar.h:62
virtual void TT_SetAudioTimeFormat(const NumericFormatSymbol &format)=0
virtual void ReCreateButtons()
Definition: ToolBar.cpp:533
void Updated()
Definition: ToolBar.cpp:684

References NumericConverter::GetBuiltinName(), mAudioTime, mListener, mSettingInitialSize, ToolBar::ReCreateButtons(), SetResizingLimits(), TimeToolBarListener::TT_SetAudioTimeFormat(), and ToolBar::Updated().

Referenced by SetAudioTimeFormat(), SetListener(), and UpdatePrefs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Populate()

void TimeToolBar::Populate ( )
overridevirtual

Implements ToolBar.

Definition at line 85 of file TimeToolBar.cpp.

86{
87 const auto &formats = ProjectNumericFormats::Get(mProject);
88
89 // Get the default sample rate
90 auto rate = ProjectRate::Get(mProject).GetRate();
91
92 // Get the default time format
93 auto format = formats.GetAudioTimeFormat();
94
95 // Create the read-only time control
97 mAudioTime->SetName(XO("Audio Position"));
99
100 // Add it to the toolbar
101 Add(mAudioTime, 0, wxALIGN_CENTER, 0);
102
103 // Calculate the width to height ratio
104 wxSize digitSize = mAudioTime->GetDigitSize();
105 mDigitRatio = (float)digitSize.x / digitSize.y;
106
107 // During initialization, we need to bypass some resizing to prevent the "best size"
108 // from being used as we want to ensure the saved size is used instead. See SetDocked()
109 // and OnUpdate() for more info.
110 mSettingInitialSize = true;
111
112 // Establish initial resizing limits
113// SetResizingLimits();
114}
int format
Definition: ExportPCM.cpp:53
#define safenew
Definition: MemoryX.h:10
@ AudioPositionID
Definition: TimeToolBar.cpp:42
void SetReadOnly(bool readOnly=true)
void SetName(const TranslatableString &name)
static ProjectNumericFormats & Get(AudacityProject &project)
double GetRate() const
Definition: ProjectRate.cpp:53
void Add(wxWindow *window, int proportion=0, int flag=wxALIGN_TOP, int border=0, wxObject *userData=NULL)
Definition: ToolBar.cpp:709

References ToolBar::Add(), AudioPositionID, format, ProjectNumericFormats::Get(), ProjectRate::Get(), NumericTextCtrl::GetDigitSize(), ProjectRate::GetRate(), mAudioTime, mDigitRatio, ToolBar::mProject, mSettingInitialSize, safenew, NumericTextCtrl::SetName(), NumericTextCtrl::SetReadOnly(), NumericConverter::TIME, and XO().

Here is the call graph for this function:

◆ RegenerateTooltips()

void TimeToolBar::RegenerateTooltips ( )
inlineoverridevirtual

Implements ToolBar.

Definition at line 40 of file TimeToolBar.h.

40{};

◆ Repaint()

void TimeToolBar::Repaint ( wxDC *  WXUNUSEDdc)
inlineoverride

Definition at line 37 of file TimeToolBar.h.

37{};

◆ ResizingDone()

void TimeToolBar::ResizingDone ( )
overridevirtual

Reimplemented from ToolBar.

Definition at line 218 of file TimeToolBar.cpp.

219{
220 // Fit() while retaining height
221 SetSize(GetBestSize().x, GetSize().y);
222
223 // Inform others the toobar has changed
224 Updated();
225}

References ToolBar::Updated().

Here is the call graph for this function:

◆ SetAudioTimeFormat()

void TimeToolBar::SetAudioTimeFormat ( const NumericFormatSymbol format)

Definition at line 205 of file TimeToolBar.cpp.

206{
207 // Set the format if it's different from previous
209 // Simulate an update since the format has changed.
210 wxCommandEvent e;
211 e.SetInt(mAudioTime->GetFormatIndex());
212 OnUpdate(e);
213 }
214}
FormatStrings GetBuiltinFormat(const int index)
bool SetFormatString(const FormatStrings &formatString)
void OnUpdate(wxCommandEvent &evt)

References format, NumericConverter::GetBuiltinFormat(), NumericConverter::GetFormatIndex(), mAudioTime, OnUpdate(), and NumericTextCtrl::SetFormatString().

Referenced by SetListener(), SetToDefaultSize(), and ProjectSelectionManager::TT_SetAudioTimeFormat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetDocked()

void TimeToolBar::SetDocked ( ToolDock dock,
bool  pushed 
)
overridevirtual

Reimplemented from ToolBar.

Definition at line 163 of file TimeToolBar.cpp.

164{
165 // It's important to call this FIRST since it unhides the resizer control.
166 // Not doing so causes the calculated best size to be off by the width
167 // of the resizer.
168 ToolBar::SetDocked(dock, pushed);
169
170 // Recalculate the min and max limits
172
173 // When moving from floater to dock, fit to toolbar since the resizer will
174 // be mispositioned
175 if (dock) {
176 // During initialization, the desired size is already set, so do not
177 // override it with the "best size". See OnUpdate for further info.
178 if (!mSettingInitialSize) {
179 // Fit() while retaining height
180 SetSize(GetBestSize().x, GetSize().y);
181
182 // Inform others the toolbar has changed
183 Updated();
184 }
185 }
186}
virtual void SetDocked(ToolDock *dock, bool pushed)
Definition: ToolBar.cpp:661

References mSettingInitialSize, ToolBar::SetDocked(), SetResizingLimits(), and ToolBar::Updated().

Here is the call graph for this function:

◆ SetListener()

void TimeToolBar::SetListener ( TimeToolBarListener l)

Definition at line 188 of file TimeToolBar.cpp.

189{
190 // Remember the listener
191 mListener = l;
192
193 // Get (and set) the saved time format
195
196 // During initialization, if the saved format is the same as the default,
197 // OnUpdate() will not be called and need it to set the initial size.
199 wxCommandEvent e;
200 e.SetInt(mAudioTime->GetFormatIndex());
201 OnUpdate(e);
202 }
203}
void SetAudioTimeFormat(const NumericFormatSymbol &format)
virtual const NumericFormatSymbol & TT_GetAudioTimeFormat()=0

References NumericConverter::GetFormatIndex(), mAudioTime, mListener, mSettingInitialSize, OnUpdate(), SetAudioTimeFormat(), and TimeToolBarListener::TT_GetAudioTimeFormat().

Referenced by ProjectManager::New().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetResizingLimits()

void TimeToolBar::SetResizingLimits ( )
private

Definition at line 227 of file TimeToolBar.cpp.

228{
229 // Reset limits
230 SetMinSize(wxDefaultSize);
231 SetMaxSize(wxDefaultSize);
232
233 // If docked we use the current bar height since it's always a single or double height
234 // toolbar. For floaters, single height toolbar is the minimum height.
235 int minH = IsDocked() ? GetSize().y : toolbarSingle;
236
237 // Get the content size given the smallest digit height we allow
238 wxSize minSize = ComputeSizing(minDigitH);
239
240 // Account for any borders added by the window manager
241 minSize.x += (mAudioTime->GetSize().x - mAudioTime->GetClientSize().x);
242
243 // Calculate the space used by other controls and sizer borders with this toolbar
244 wxSize outer = (GetSize() - GetSizer()->GetSize());
245
246 // And account for them in the width
247 minSize.x += outer.x;
248
249 // Override the height
250 minSize.y = minH;
251
252 // Get the maximum digit height we can use. This is restricted to the toolbar's
253 // current height minus any control borders
254 int digH = minH - (mAudioTime->GetSize().y - mAudioTime->GetClientSize().y);
255
256 // Get the content size using the digit height, if docked. Otherwise use the
257 // maximum digit height we allow.
258 wxSize maxSize = ComputeSizing(IsDocked() ? digH : maxDigitH);
259
260 // Account for the other controls and sizer borders within this toolbar
261 maxSize.x += outer.x;
262
263 // Account for any borders added by the window manager and +1 to keep toolbar
264 // from dropping to next smaller size when grabbing the resizer.
265 maxSize.x += (mAudioTime->GetSize().x - mAudioTime->GetClientSize().x) + 1;
266
267 // Override the height
268 maxSize.y = IsDocked() ? minH : wxDefaultCoord;
269
270 // And finally set them both
271 SetMinSize(minSize);
272 SetMaxSize(maxSize);
273}
static const wxPoint2DDouble outer[]
Definition: ASlider.cpp:397
static const int maxDigitH
Definition: TimeToolBar.h:65
bool IsDocked() const
Definition: ToolBar.cpp:433

References ComputeSizing(), ToolBar::GetSizer(), ToolBar::IsDocked(), mAudioTime, maxDigitH, minDigitH, outer, and toolbarSingle.

Referenced by OnUpdate(), and SetDocked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetToDefaultSize()

void TimeToolBar::SetToDefaultSize ( )
overridevirtual

Reimplemented from ToolBar.

Definition at line 131 of file TimeToolBar.cpp.

132{
133 // Reset
134 SetMaxSize(wxDefaultSize);
135 SetMinSize(wxDefaultSize);
136
137 // Set the default time format
139
140 // Set the default size
141 SetSize(GetInitialWidth(), 48);
142
143 // Inform others the toobar has changed
144 Updated();
145}
static NumericFormatSymbol HoursMinsSecondsFormat()
int GetInitialWidth() override
Resizable toolbars should implement these.
Definition: TimeToolBar.h:41

References GetInitialWidth(), NumericConverter::HoursMinsSecondsFormat(), SetAudioTimeFormat(), and ToolBar::Updated().

Here is the call graph for this function:

◆ UpdatePrefs()

void TimeToolBar::UpdatePrefs ( )
overridevirtual

Implements PrefsListener.

Definition at line 116 of file TimeToolBar.cpp.

117{
118 // Since the language may have changed, we need to force an update to accommodate
119 // different length text
120 wxCommandEvent e;
121 e.SetInt(mAudioTime->GetFormatIndex());
122 OnUpdate(e);
123
124 // Language may have changed so reset label
125 SetLabel(XO("Time"));
126
127 // Give the toolbar a chance
129}
void SetLabel(const wxString &label) override
Definition: ToolBar.cpp:408
void UpdatePrefs() override
Definition: ToolBar.cpp:622

References NumericConverter::GetFormatIndex(), mAudioTime, OnUpdate(), ToolBar::SetLabel(), ToolBar::UpdatePrefs(), and XO().

Here is the call graph for this function:

Member Data Documentation

◆ mAudioTime

NumericTextCtrl* TimeToolBar::mAudioTime
private

◆ maxDigitH

const int TimeToolBar::maxDigitH = 100
staticprivate

Definition at line 65 of file TimeToolBar.h.

Referenced by SetResizingLimits().

◆ mDigitRatio

float TimeToolBar::mDigitRatio
private

Definition at line 61 of file TimeToolBar.h.

Referenced by ComputeSizing(), OnSize(), and Populate().

◆ minDigitH

const int TimeToolBar::minDigitH = 17
staticprivate

Definition at line 64 of file TimeToolBar.h.

Referenced by OnSize(), and SetResizingLimits().

◆ mListener

TimeToolBarListener* TimeToolBar::mListener
private

Definition at line 59 of file TimeToolBar.h.

Referenced by OnUpdate(), and SetListener().

◆ mSettingInitialSize

bool TimeToolBar::mSettingInitialSize
private

Definition at line 62 of file TimeToolBar.h.

Referenced by OnUpdate(), Populate(), SetDocked(), and SetListener().

◆ mSubscription

Observer::Subscription TimeToolBar::mSubscription
private

Definition at line 67 of file TimeToolBar.h.

Referenced by TimeToolBar().


The documentation for this class was generated from the following files: