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 ()
 
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, int type, const TranslatableString &label, const wxString &section, bool resizable=false)
 
virtual ~ToolBar ()
 
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 GetType ()
 
TranslatableString GetTitle ()
 
TranslatableString GetLabel ()
 
wxString GetSection ()
 
ToolDockGetDock ()
 
void SetLabel (const TranslatableString &label)
 
virtual void SetDocked (ToolDock *dock, bool pushed)
 
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 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
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
 
wxString mSection
 
int mType
 

Detailed Description

Definition at line 23 of file TimeToolBar.h.

Constructor & Destructor Documentation

◆ TimeToolBar()

TimeToolBar::TimeToolBar ( AudacityProject project)

Definition at line 52 of file TimeToolBar.cpp.

53: ToolBar(project, TimeBarID, XO("Time"), wxT("Time"), true),
54 mListener(NULL),
55 mAudioTime(NULL)
56{
59}
wxT("CloseDown"))
#define XO(s)
Definition: Internat.h:31
@ TimeBarID
Definition: ToolBar.h:89
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:55
void OnRateChanged(double)
NumericTextCtrl * mAudioTime
Definition: TimeToolBar.h:56
Observer::Subscription mSubscription
Definition: TimeToolBar.h:63
ToolBar(AudacityProject &project, int type, const TranslatableString &label, const wxString &section, bool resizable=false)
Definition: ToolBar.cpp:330

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

Here is the call graph for this function:

◆ ~TimeToolBar()

TimeToolBar::~TimeToolBar ( )
virtual

Definition at line 61 of file TimeToolBar.cpp.

62{
63}

Member Function Documentation

◆ ComputeSizing()

wxSize TimeToolBar::ComputeSizing ( int  digitH)
inlineprivate

Definition at line 71 of file TimeToolBar.h.

72{
73 return mAudioTime->ComputeSizing(false, digitH * mDigitRatio, digitH);
74}
wxSize ComputeSizing(bool update=true, wxCoord digitW=0, wxCoord digitH=0)
float mDigitRatio
Definition: TimeToolBar.h:57

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:

◆ EnableDisableButtons()

void TimeToolBar::EnableDisableButtons ( )
inlineoverridevirtual

Implements ToolBar.

Definition at line 34 of file TimeToolBar.h.

34{};

◆ Get() [1/2]

TimeToolBar & TimeToolBar::Get ( AudacityProject project)
static

Definition at line 65 of file TimeToolBar.cpp.

66{
67 auto &toolManager = ToolManager::Get(project);
68 return *static_cast<TimeToolBar*>(toolManager.GetToolBar(TimeBarID));
69}
static ToolManager & Get(AudacityProject &project)

References ToolManager::Get(), and TimeBarID.

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 71 of file TimeToolBar.cpp.

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

References Get().

Here is the call graph for this function:

◆ GetDockedSize()

wxSize TimeToolBar::GetDockedSize ( )
overridevirtual

Reimplemented from ToolBar.

Definition at line 138 of file TimeToolBar.cpp.

139{
140 wxSize sz = GetSize();
141
142 // Anything less than a single height bar becomes single height
143 if (sz.y <= toolbarSingle) {
144 sz.y = toolbarSingle;
145 }
146 // Otherwise it will be a double height bar
147 else {
148 sz.y = 2 * toolbarSingle + toolbarGap;
149 }
150
151 return sz;
152}
#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 37 of file TimeToolBar.h.

37{return 250;}

Referenced by SetToDefaultSize().

Here is the caller graph for this function:

◆ GetMinToolbarWidth()

int TimeToolBar::GetMinToolbarWidth ( )
inlineoverridevirtual

Reimplemented from ToolBar.

Definition at line 38 of file TimeToolBar.h.

38{return 50;}

◆ OnIdle()

void TimeToolBar::OnIdle ( wxIdleEvent &  evt)
private

Definition at line 354 of file TimeToolBar.cpp.

355{
356 evt.Skip();
357
358 double audioTime;
359
360 auto &projectAudioIO = ProjectAudioIO::Get(mProject);
361 if (projectAudioIO.IsAudioActive()) {
362 auto gAudioIO = AudioIO::Get();
363 audioTime = gAudioIO->GetStreamTime();
364 }
365 else {
366 const auto &playRegion = ViewInfo::Get(mProject).playRegion;
367 audioTime = playRegion.GetStart();
368 }
369
370 mAudioTime->SetValue(wxMax(0.0, audioTime));
371}
static AudioIO * Get()
Definition: AudioIO.cpp:133
void SetValue(double newValue)
double GetStart() const
Definition: ViewInfo.h:127
static ProjectAudioIO & Get(AudacityProject &project)
AudacityProject & mProject
Definition: ToolBar.h:251
PlayRegion playRegion
Definition: ViewInfo.h:217
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References AudioIO::Get(), ViewInfo::Get(), ProjectAudioIO::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 267 of file TimeToolBar.cpp.

268{
269 if (mAudioTime)
271}
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 308 of file TimeToolBar.cpp.

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

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 275 of file TimeToolBar.cpp.

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

References NumericConverter::GetBuiltinName(), mAudioTime, mListener, mSettingInitialSize, 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 76 of file TimeToolBar.cpp.

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

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

Here is the call graph for this function:

◆ RegenerateTooltips()

void TimeToolBar::RegenerateTooltips ( )
inlineoverridevirtual

Implements ToolBar.

Definition at line 36 of file TimeToolBar.h.

36{};

◆ Repaint()

void TimeToolBar::Repaint ( wxDC *  WXUNUSEDdc)
inlineoverride

Definition at line 33 of file TimeToolBar.h.

33{};

◆ ResizingDone()

void TimeToolBar::ResizingDone ( )
overridevirtual

Reimplemented from ToolBar.

Definition at line 209 of file TimeToolBar.cpp.

210{
211 // Fit() while retaining height
212 SetSize(GetBestSize().x, GetSize().y);
213
214 // Inform others the toobar has changed
215 Updated();
216}

References ToolBar::Updated().

Here is the call graph for this function:

◆ SetAudioTimeFormat()

void TimeToolBar::SetAudioTimeFormat ( const NumericFormatSymbol format)

Definition at line 196 of file TimeToolBar.cpp.

197{
198 // Set the format if it's different from previous
200 // Simulate an update since the format has changed.
201 wxCommandEvent e;
202 e.SetInt(mAudioTime->GetFormatIndex());
203 OnUpdate(e);
204 }
205}
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 154 of file TimeToolBar.cpp.

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

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 179 of file TimeToolBar.cpp.

180{
181 // Remember the listener
182 mListener = l;
183
184 // Get (and set) the saved time format
186
187 // During initialization, if the saved format is the same as the default,
188 // OnUpdate() will not be called and need it to set the initial size.
190 wxCommandEvent e;
191 e.SetInt(mAudioTime->GetFormatIndex());
192 OnUpdate(e);
193 }
194}
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 218 of file TimeToolBar.cpp.

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

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 122 of file TimeToolBar.cpp.

123{
124 // Reset
125 SetMaxSize(wxDefaultSize);
126 SetMinSize(wxDefaultSize);
127
128 // Set the default time format
130
131 // Set the default size
132 SetSize(GetInitialWidth(), 48);
133
134 // Inform others the toobar has changed
135 Updated();
136}
static NumericFormatSymbol HoursMinsSecondsFormat()
int GetInitialWidth() override
Resizable toolbars should implement these.
Definition: TimeToolBar.h:37

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 107 of file TimeToolBar.cpp.

108{
109 // Since the language may have changed, we need to force an update to accommodate
110 // different length text
111 wxCommandEvent e;
112 e.SetInt(mAudioTime->GetFormatIndex());
113 OnUpdate(e);
114
115 // Language may have changed so reset label
116 SetLabel(XO("Time"));
117
118 // Give the toolbar a chance
120}
void SetLabel(const wxString &label) override
Definition: ToolBar.cpp:407
void UpdatePrefs() override
Definition: ToolBar.cpp:614

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 61 of file TimeToolBar.h.

Referenced by SetResizingLimits().

◆ mDigitRatio

float TimeToolBar::mDigitRatio
private

Definition at line 57 of file TimeToolBar.h.

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

◆ minDigitH

const int TimeToolBar::minDigitH = 17
staticprivate

Definition at line 60 of file TimeToolBar.h.

Referenced by OnSize(), and SetResizingLimits().

◆ mListener

TimeToolBarListener* TimeToolBar::mListener
private

Definition at line 55 of file TimeToolBar.h.

Referenced by OnUpdate(), and SetListener().

◆ mSettingInitialSize

bool TimeToolBar::mSettingInitialSize
private

Definition at line 58 of file TimeToolBar.h.

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

◆ mSubscription

Observer::Subscription TimeToolBar::mSubscription
private

Definition at line 63 of file TimeToolBar.h.


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