1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 08:30:06 +02:00

Rename TimerToolBar to TimeToolBar

This commit is contained in:
Leland Lucius 2020-05-30 16:00:24 -05:00
parent 56e78922ae
commit 7b9040c7e2
7 changed files with 44 additions and 44 deletions

View File

@ -791,8 +791,8 @@ list( APPEND SOURCES
toolbars/SpectralSelectionBar.cpp toolbars/SpectralSelectionBar.cpp
toolbars/SpectralSelectionBar.h toolbars/SpectralSelectionBar.h
toolbars/SpectralSelectionBarListener.h toolbars/SpectralSelectionBarListener.h
toolbars/TimerToolBar.cpp toolbars/TimeToolBar.cpp
toolbars/TimerToolBar.h toolbars/TimeToolBar.h
toolbars/ToolBar.cpp toolbars/ToolBar.cpp
toolbars/ToolBar.h toolbars/ToolBar.h
toolbars/ToolDock.cpp toolbars/ToolDock.cpp

View File

@ -45,7 +45,7 @@ Paul Licameli split from AudacityProject.cpp
#include "toolbars/MixerToolBar.h" #include "toolbars/MixerToolBar.h"
#include "toolbars/SelectionBar.h" #include "toolbars/SelectionBar.h"
#include "toolbars/SpectralSelectionBar.h" #include "toolbars/SpectralSelectionBar.h"
#include "toolbars/TimerToolBar.h" #include "toolbars/TimeToolBar.h"
#include "toolbars/ToolManager.h" #include "toolbars/ToolManager.h"
#include "widgets/AudacityMessageBox.h" #include "widgets/AudacityMessageBox.h"
#include "widgets/FileHistory.h" #include "widgets/FileHistory.h"
@ -571,7 +571,7 @@ AudacityProject *ProjectManager::New()
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
SpectralSelectionBar::Get( project ).SetListener( &projectSelectionManager ); SpectralSelectionBar::Get( project ).SetListener( &projectSelectionManager );
#endif #endif
TimerToolBar::Get( project ).SetListener( &projectSelectionManager ); TimeToolBar::Get( project ).SetListener( &projectSelectionManager );
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
// We can import now, so become a drag target // We can import now, so become a drag target

View File

@ -22,7 +22,7 @@ Paul Licameli split from ProjectManager.cpp
#include "WaveTrack.h" #include "WaveTrack.h"
#include "toolbars/SelectionBar.h" #include "toolbars/SelectionBar.h"
#include "toolbars/SpectralSelectionBar.h" #include "toolbars/SpectralSelectionBar.h"
#include "toolbars/TimerToolBar.h" #include "toolbars/TimeToolBar.h"
static AudacityProject::AttachedObjects::RegisteredFactory static AudacityProject::AttachedObjects::RegisteredFactory
sProjectSelectionManagerKey { sProjectSelectionManagerKey {
@ -167,7 +167,7 @@ void ProjectSelectionManager::TT_SetAudioTimeFormat(
gPrefs->Write(wxT("/AudioTimeFormat"), format.Internal()); gPrefs->Write(wxT("/AudioTimeFormat"), format.Internal());
gPrefs->Flush(); gPrefs->Flush();
TimerToolBar::Get( project ).SetAudioTimeFormat(format); TimeToolBar::Get( project ).SetAudioTimeFormat(format);
} }
void ProjectSelectionManager::AS_ModifySelection( void ProjectSelectionManager::AS_ModifySelection(

View File

@ -21,7 +21,7 @@ class ProjectSelectionManager final
: public ClientData::Base : public ClientData::Base
, public SelectionBarListener , public SelectionBarListener
, public SpectralSelectionBarListener , public SpectralSelectionBarListener
, public TimerToolBarListener , public TimeToolBarListener
{ {
public: public:
static ProjectSelectionManager &Get( AudacityProject &project ); static ProjectSelectionManager &Get( AudacityProject &project );

View File

@ -31,12 +31,12 @@ class AUDACITY_DLL_API SelectionBarListener /* not final */ {
virtual void AS_ModifySelection(double &start, double &end, bool done) = 0; virtual void AS_ModifySelection(double &start, double &end, bool done) = 0;
}; };
class AUDACITY_DLL_API TimerToolBarListener /* not final */ { class AUDACITY_DLL_API TimeToolBarListener /* not final */ {
public: public:
TimerToolBarListener(){}; TimeToolBarListener(){};
virtual ~TimerToolBarListener(){}; virtual ~TimeToolBarListener(){};
virtual const NumericFormatSymbol & TT_GetAudioTimeFormat() = 0; virtual const NumericFormatSymbol & TT_GetAudioTimeFormat() = 0;
virtual void TT_SetAudioTimeFormat(const NumericFormatSymbol & format) = 0; virtual void TT_SetAudioTimeFormat(const NumericFormatSymbol & format) = 0;

View File

@ -23,7 +23,7 @@
#include <wx/sizer.h> #include <wx/sizer.h>
#endif #endif
#include "TimerToolBar.h" #include "TimeToolBar.h"
#include "ToolManager.h" #include "ToolManager.h"
#include "SelectionBarListener.h" #include "SelectionBarListener.h"
@ -31,7 +31,7 @@
#include "../ProjectAudioIO.h" #include "../ProjectAudioIO.h"
#include "../ViewInfo.h" #include "../ViewInfo.h"
IMPLEMENT_CLASS(TimerToolBar, ToolBar); IMPLEMENT_CLASS(TimeToolBar, ToolBar);
// Having a fixed ID for the Audio Position is helpful for // Having a fixed ID for the Audio Position is helpful for
// the Jaws screen reader script for Audacity. // the Jaws screen reader script for Audacity.
@ -40,35 +40,35 @@ enum {
AudioPositionID AudioPositionID
}; };
BEGIN_EVENT_TABLE(TimerToolBar, ToolBar) BEGIN_EVENT_TABLE(TimeToolBar, ToolBar)
EVT_COMMAND(AudioPositionID, EVT_TIMETEXTCTRL_UPDATED, TimerToolBar::OnUpdate) EVT_COMMAND(AudioPositionID, EVT_TIMETEXTCTRL_UPDATED, TimeToolBar::OnUpdate)
EVT_SIZE(TimerToolBar::OnSize) EVT_SIZE(TimeToolBar::OnSize)
EVT_IDLE(TimerToolBar::OnIdle) EVT_IDLE(TimeToolBar::OnIdle)
END_EVENT_TABLE() END_EVENT_TABLE()
TimerToolBar::TimerToolBar(AudacityProject &project) TimeToolBar::TimeToolBar(AudacityProject &project)
: ToolBar(project, TimeBarID, XO("Time"), wxT("Time"), true), : ToolBar(project, TimeBarID, XO("Time"), wxT("Time"), true),
mListener(NULL), mListener(NULL),
mAudioTime(NULL) mAudioTime(NULL)
{ {
} }
TimerToolBar::~TimerToolBar() TimeToolBar::~TimeToolBar()
{ {
} }
TimerToolBar &TimerToolBar::Get(AudacityProject &project) TimeToolBar &TimeToolBar::Get(AudacityProject &project)
{ {
auto &toolManager = ToolManager::Get(project); auto &toolManager = ToolManager::Get(project);
return *static_cast<TimerToolBar*>(toolManager.GetToolBar(TimeBarID)); return *static_cast<TimeToolBar*>(toolManager.GetToolBar(TimeBarID));
} }
const TimerToolBar &TimerToolBar::Get(const AudacityProject &project) const TimeToolBar &TimeToolBar::Get(const AudacityProject &project)
{ {
return Get(const_cast<AudacityProject&>(project)) ; return Get(const_cast<AudacityProject&>(project)) ;
} }
void TimerToolBar::Populate() void TimeToolBar::Populate()
{ {
// Get the default sample rate // Get the default sample rate
auto rate = gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), auto rate = gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"),
@ -98,7 +98,7 @@ void TimerToolBar::Populate()
// SetResizingLimits(); // SetResizingLimits();
} }
void TimerToolBar::UpdatePrefs() void TimeToolBar::UpdatePrefs()
{ {
// Since the language may have changed, we need to force an update to accommodate // Since the language may have changed, we need to force an update to accommodate
// different length text // different length text
@ -113,7 +113,7 @@ void TimerToolBar::UpdatePrefs()
ToolBar::UpdatePrefs(); ToolBar::UpdatePrefs();
} }
void TimerToolBar::SetToDefaultSize() void TimeToolBar::SetToDefaultSize()
{ {
// Reset // Reset
SetMaxSize(wxDefaultSize); SetMaxSize(wxDefaultSize);
@ -129,7 +129,7 @@ void TimerToolBar::SetToDefaultSize()
Updated(); Updated();
} }
wxSize TimerToolBar::GetDockedSize() wxSize TimeToolBar::GetDockedSize()
{ {
wxSize sz = GetSize(); wxSize sz = GetSize();
@ -145,7 +145,7 @@ wxSize TimerToolBar::GetDockedSize()
return sz; return sz;
} }
void TimerToolBar::SetDocked(ToolDock *dock, bool pushed) void TimeToolBar::SetDocked(ToolDock *dock, bool pushed)
{ {
// It's important to call this FIRST since it unhides the resizer control. // It's important to call this FIRST since it unhides the resizer control.
// Not doing so causes the calculated best size to be off by the width // Not doing so causes the calculated best size to be off by the width
@ -170,7 +170,7 @@ void TimerToolBar::SetDocked(ToolDock *dock, bool pushed)
} }
} }
void TimerToolBar::SetListener(TimerToolBarListener *l) void TimeToolBar::SetListener(TimeToolBarListener *l)
{ {
// Remember the listener // Remember the listener
mListener = l; mListener = l;
@ -187,7 +187,7 @@ void TimerToolBar::SetListener(TimerToolBarListener *l)
} }
} }
void TimerToolBar::SetAudioTimeFormat(const NumericFormatSymbol & format) void TimeToolBar::SetAudioTimeFormat(const NumericFormatSymbol & format)
{ {
// Set the format if it's different from previous // Set the format if it's different from previous
if (mAudioTime->SetFormatString(mAudioTime->GetBuiltinFormat(format))) { if (mAudioTime->SetFormatString(mAudioTime->GetBuiltinFormat(format))) {
@ -200,7 +200,7 @@ void TimerToolBar::SetAudioTimeFormat(const NumericFormatSymbol & format)
// The intention of this is to get the resize handle in the // The intention of this is to get the resize handle in the
// correct position, after we've let go in dragging. // correct position, after we've let go in dragging.
void TimerToolBar::ResizingDone() void TimeToolBar::ResizingDone()
{ {
// Fit() while retaining height // Fit() while retaining height
SetSize(GetBestSize().x, GetSize().y); SetSize(GetBestSize().x, GetSize().y);
@ -209,7 +209,7 @@ void TimerToolBar::ResizingDone()
Updated(); Updated();
} }
void TimerToolBar::SetResizingLimits() void TimeToolBar::SetResizingLimits()
{ {
// Reset limits // Reset limits
SetMinSize(wxDefaultSize); SetMinSize(wxDefaultSize);
@ -259,7 +259,7 @@ void TimerToolBar::SetResizingLimits()
// Called when the format drop downs is changed. // Called when the format drop downs is changed.
// This causes recreation of the toolbar contents. // This causes recreation of the toolbar contents.
void TimerToolBar::OnUpdate(wxCommandEvent &evt) void TimeToolBar::OnUpdate(wxCommandEvent &evt)
{ {
evt.Skip(false); evt.Skip(false);
@ -292,7 +292,7 @@ void TimerToolBar::OnUpdate(wxCommandEvent &evt)
Updated(); Updated();
} }
void TimerToolBar::OnSize(wxSizeEvent &evt) void TimeToolBar::OnSize(wxSizeEvent &evt)
{ {
evt.Skip(); evt.Skip();
@ -338,7 +338,7 @@ void TimerToolBar::OnSize(wxSizeEvent &evt)
Update(); Update();
} }
void TimerToolBar::OnIdle(wxIdleEvent &evt) void TimeToolBar::OnIdle(wxIdleEvent &evt)
{ {
evt.Skip(); evt.Skip();
@ -362,7 +362,7 @@ static RegisteredToolbarFactory factory
TimeBarID, TimeBarID,
[]( AudacityProject &project ) []( AudacityProject &project )
{ {
return ToolBar::Holder{ safenew TimerToolBar{ project } }; return ToolBar::Holder{ safenew TimeToolBar{ project } };
} }
}; };

View File

@ -17,16 +17,16 @@
#include "../widgets/NumericTextCtrl.h" #include "../widgets/NumericTextCtrl.h"
class NumericTextCtrl; class NumericTextCtrl;
class TimerToolBarListener; class TimeToolBarListener;
class TimerToolBar final : public ToolBar class TimeToolBar final : public ToolBar
{ {
public: public:
TimerToolBar(AudacityProject &project); TimeToolBar(AudacityProject &project);
virtual ~TimerToolBar(); virtual ~TimeToolBar();
static TimerToolBar &Get(AudacityProject &project); static TimeToolBar &Get(AudacityProject &project);
static const TimerToolBar &Get(const AudacityProject &project); static const TimeToolBar &Get(const AudacityProject &project);
void Populate() override; void Populate() override;
void Repaint(wxDC * WXUNUSED(dc)) override {}; void Repaint(wxDC * WXUNUSED(dc)) override {};
@ -38,7 +38,7 @@ public:
void SetToDefaultSize() override; void SetToDefaultSize() override;
wxSize GetDockedSize() override; wxSize GetDockedSize() override;
void SetDocked(ToolDock *dock, bool pushed) override; void SetDocked(ToolDock *dock, bool pushed) override;
void SetListener(TimerToolBarListener *l); void SetListener(TimeToolBarListener *l);
void SetAudioTimeFormat(const NumericFormatSymbol & format); void SetAudioTimeFormat(const NumericFormatSymbol & format);
void ResizingDone() override; void ResizingDone() override;
@ -50,7 +50,7 @@ private:
void OnSize(wxSizeEvent &evt); void OnSize(wxSizeEvent &evt);
void OnIdle(wxIdleEvent &evt); void OnIdle(wxIdleEvent &evt);
TimerToolBarListener *mListener; TimeToolBarListener *mListener;
NumericTextCtrl *mAudioTime; NumericTextCtrl *mAudioTime;
float mDigitRatio; float mDigitRatio;
bool mSettingInitialSize; bool mSettingInitialSize;
@ -60,11 +60,11 @@ private:
public: public:
DECLARE_CLASS(TimerToolBar) DECLARE_CLASS(TimeToolBar)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
inline wxSize TimerToolBar::ComputeSizing(int digitH) inline wxSize TimeToolBar::ComputeSizing(int digitH)
{ {
return mAudioTime->ComputeSizing(false, digitH * mDigitRatio, digitH); return mAudioTime->ComputeSizing(false, digitH * mDigitRatio, digitH);
} }