mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-02 08:59:28 +02:00
Add a field to the status bar to show the state of Audacity, eg play/record/play pause. This is useful so that screen readers can easily read audacitys state.
This commit is contained in:
parent
981bdbb949
commit
5c67bc38b3
@ -781,9 +781,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||||||
mMenuClose(false)
|
mMenuClose(false)
|
||||||
, mbInitializingScrollbar(false)
|
, mbInitializingScrollbar(false)
|
||||||
{
|
{
|
||||||
int widths[] = {-2, -1};
|
mStatusBar = CreateStatusBar(3);
|
||||||
mStatusBar = CreateStatusBar(2);
|
|
||||||
mStatusBar->SetStatusWidths(2, widths);
|
|
||||||
|
|
||||||
wxGetApp().SetMissingAliasedFileWarningShouldShow(true);
|
wxGetApp().SetMissingAliasedFileWarningShouldShow(true);
|
||||||
|
|
||||||
@ -1016,9 +1014,11 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||||||
|
|
||||||
mTrackFactory = new TrackFactory(mDirManager);
|
mTrackFactory = new TrackFactory(mDirManager);
|
||||||
|
|
||||||
|
int widths[] = {GetControlToolBar()->WidthForStatusBar(), -2, -1};
|
||||||
|
mStatusBar->SetStatusWidths(3, widths);
|
||||||
wxString msg = wxString::Format(_("Welcome to Audacity version %s"),
|
wxString msg = wxString::Format(_("Welcome to Audacity version %s"),
|
||||||
AUDACITY_VERSION_STRING);
|
AUDACITY_VERSION_STRING);
|
||||||
mStatusBar->SetStatusText(msg);
|
mStatusBar->SetStatusText(msg, 1);
|
||||||
mLastStatusUpdateTime = ::wxGetUTCTime();
|
mLastStatusUpdateTime = ::wxGetUTCTime();
|
||||||
|
|
||||||
mTimer = new wxTimer(this, AudacityProjectTimerID);
|
mTimer = new wxTimer(this, AudacityProjectTimerID);
|
||||||
@ -3503,7 +3503,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
|
|||||||
wxRemoveFile(safetyFileName);
|
wxRemoveFile(safetyFileName);
|
||||||
|
|
||||||
mStatusBar->SetStatusText(wxString::Format(_("Saved %s"),
|
mStatusBar->SetStatusText(wxString::Format(_("Saved %s"),
|
||||||
mFileName.c_str()));
|
mFileName.c_str()), 1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -4321,7 +4321,7 @@ void AudacityProject::OnTimer(wxTimerEvent& WXUNUSED(event))
|
|||||||
else
|
else
|
||||||
msg.Printf(_("Out of disk space"));
|
msg.Printf(_("Out of disk space"));
|
||||||
|
|
||||||
mStatusBar->SetStatusText(msg);
|
mStatusBar->SetStatusText(msg, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ODManager::IsInstanceCreated())
|
else if(ODManager::IsInstanceCreated())
|
||||||
@ -4342,7 +4342,7 @@ void AudacityProject::OnTimer(wxTimerEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
|
|
||||||
msg.Printf(_("On-demand import and waveform calculation complete."));
|
msg.Printf(_("On-demand import and waveform calculation complete."));
|
||||||
mStatusBar->SetStatusText(msg);
|
mStatusBar->SetStatusText(msg, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(numTasks>1)
|
else if(numTasks>1)
|
||||||
@ -4353,7 +4353,7 @@ void AudacityProject::OnTimer(wxTimerEvent& WXUNUSED(event))
|
|||||||
ratioComplete*100.0);
|
ratioComplete*100.0);
|
||||||
|
|
||||||
|
|
||||||
mStatusBar->SetStatusText(msg);
|
mStatusBar->SetStatusText(msg, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4542,7 +4542,7 @@ void AudacityProject::EditClipboardByLabel( WaveTrack::EditDestFunction action )
|
|||||||
// TrackPanel callback method
|
// TrackPanel callback method
|
||||||
void AudacityProject::TP_DisplayStatusMessage(wxString msg)
|
void AudacityProject::TP_DisplayStatusMessage(wxString msg)
|
||||||
{
|
{
|
||||||
mStatusBar->SetStatusText(msg);
|
mStatusBar->SetStatusText(msg, 1);
|
||||||
mLastStatusUpdateTime = ::wxGetUTCTime();
|
mLastStatusUpdateTime = ::wxGetUTCTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4789,9 +4789,9 @@ void AudacityProject::OnAudioIORate(int rate)
|
|||||||
display = wxString::Format(_("Actual Rate: %d"), rate);
|
display = wxString::Format(_("Actual Rate: %d"), rate);
|
||||||
int x, y;
|
int x, y;
|
||||||
mStatusBar->GetTextExtent(display, &x, &y);
|
mStatusBar->GetTextExtent(display, &x, &y);
|
||||||
int widths[] = {-1, x+50};
|
int widths[] = {GetControlToolBar()->WidthForStatusBar(), -1, x+50};
|
||||||
mStatusBar->SetStatusWidths(2, widths);
|
mStatusBar->SetStatusWidths(3, widths);
|
||||||
mStatusBar->SetStatusText(display, 1);
|
mStatusBar->SetStatusText(display, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::OnAudioIOStartRecording()
|
void AudacityProject::OnAudioIOStartRecording()
|
||||||
|
@ -397,6 +397,8 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||||||
LyricsWindow* GetLyricsWindow() { return mLyricsWindow; }
|
LyricsWindow* GetLyricsWindow() { return mLyricsWindow; }
|
||||||
MixerBoard* GetMixerBoard() { return mMixerBoard; }
|
MixerBoard* GetMixerBoard() { return mMixerBoard; }
|
||||||
|
|
||||||
|
wxStatusBar* GetStatusBar() { return mStatusBar; }
|
||||||
|
|
||||||
// SelectionBarListener callback methods
|
// SelectionBarListener callback methods
|
||||||
|
|
||||||
virtual double AS_GetRate();
|
virtual double AS_GetRate();
|
||||||
|
@ -563,7 +563,7 @@ void ScreenFrame::DoCapture(wxString captureMode)
|
|||||||
|
|
||||||
mCommand->SetParameter(wxT("CaptureMode"), captureMode);
|
mCommand->SetParameter(wxT("CaptureMode"), captureMode);
|
||||||
if (!mCommand->Apply(mContext))
|
if (!mCommand->Apply(mContext))
|
||||||
mStatus->SetStatusText(wxT("Capture failed!"));
|
mStatus->SetStatusText(wxT("Capture failed!"), 1);
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
virtual void Update(wxString message)
|
virtual void Update(wxString message)
|
||||||
{
|
{
|
||||||
mStatus.SetStatusText(message);
|
mStatus.SetStatusText(message, 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,6 +99,12 @@ ControlToolBar::ControlToolBar()
|
|||||||
|
|
||||||
mSizer = NULL;
|
mSizer = NULL;
|
||||||
mCutPreviewTracks = NULL;
|
mCutPreviewTracks = NULL;
|
||||||
|
|
||||||
|
// strings for status bar
|
||||||
|
mStatePlay = _("Play");
|
||||||
|
mStateStop = _("Stop");
|
||||||
|
mStateRecord = _("Record");
|
||||||
|
mStatePause = _("Pause");
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlToolBar::~ControlToolBar()
|
ControlToolBar::~ControlToolBar()
|
||||||
@ -433,6 +439,7 @@ void ControlToolBar::SetPlay(bool down, bool looped, bool cutPreview)
|
|||||||
mPlay->SetAlternateIdx(0);
|
mPlay->SetAlternateIdx(0);
|
||||||
}
|
}
|
||||||
EnableDisableButtons();
|
EnableDisableButtons();
|
||||||
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlToolBar::SetStop(bool down)
|
void ControlToolBar::SetStop(bool down)
|
||||||
@ -714,11 +721,13 @@ void ControlToolBar::OnPlay(wxCommandEvent & WXUNUSED(evt))
|
|||||||
if (p) p->TP_DisplaySelection();
|
if (p) p->TP_DisplaySelection();
|
||||||
|
|
||||||
PlayDefault();
|
PlayDefault();
|
||||||
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlToolBar::OnStop(wxCommandEvent & WXUNUSED(evt))
|
void ControlToolBar::OnStop(wxCommandEvent & WXUNUSED(evt))
|
||||||
{
|
{
|
||||||
StopPlaying();
|
StopPlaying();
|
||||||
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlToolBar::PlayDefault()
|
void ControlToolBar::PlayDefault()
|
||||||
@ -972,6 +981,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||||||
SetRecord(false);
|
SetRecord(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -996,6 +1006,7 @@ void ControlToolBar::OnPause(wxCommandEvent & WXUNUSED(evt))
|
|||||||
}
|
}
|
||||||
|
|
||||||
gAudioIO->SetPaused(mPaused);
|
gAudioIO->SetPaused(mPaused);
|
||||||
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlToolBar::OnRewind(wxCommandEvent & WXUNUSED(evt))
|
void ControlToolBar::OnRewind(wxCommandEvent & WXUNUSED(evt))
|
||||||
@ -1069,3 +1080,45 @@ void ControlToolBar::ClearCutPreviewTracks()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// works out the width of the field in the status bar needed for the state (eg play, record pause)
|
||||||
|
int ControlToolBar::WidthForStatusBar()
|
||||||
|
{
|
||||||
|
wxStatusBar* sb = GetActiveProject()->GetStatusBar();
|
||||||
|
int xMax = 0;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
sb->GetTextExtent(mStatePlay + wxT(" ") + mStatePause, &x, &y);
|
||||||
|
if (x > xMax)
|
||||||
|
xMax = x;
|
||||||
|
|
||||||
|
sb->GetTextExtent(mStateStop + wxT(" ") + mStatePause, &x, &y);
|
||||||
|
if (x > xMax)
|
||||||
|
xMax = x;
|
||||||
|
|
||||||
|
sb->GetTextExtent(mStateRecord + wxT(" ") + mStatePause, &x, &y);
|
||||||
|
if (x > xMax)
|
||||||
|
xMax = x;
|
||||||
|
|
||||||
|
return xMax + 30; // added constant needed because xMax isn't large enough for some reason, plus some space.
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlToolBar::UpdateStatusBar()
|
||||||
|
{
|
||||||
|
wxString state;
|
||||||
|
|
||||||
|
if (mPlay->IsDown())
|
||||||
|
state = mStatePlay;
|
||||||
|
else if (mRecord->IsDown())
|
||||||
|
state = mStateRecord;
|
||||||
|
else
|
||||||
|
state = mStateStop;
|
||||||
|
|
||||||
|
if (mPause->IsDown())
|
||||||
|
{
|
||||||
|
state.Append(wxT(" "));
|
||||||
|
state.Append(mStatePause);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetActiveProject()->GetStatusBar()->SetStatusText(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -85,6 +85,8 @@ class ControlToolBar:public ToolBar {
|
|||||||
virtual void ReCreateButtons();
|
virtual void ReCreateButtons();
|
||||||
void RegenerateToolsTooltips();
|
void RegenerateToolsTooltips();
|
||||||
|
|
||||||
|
int WidthForStatusBar();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
AButton *MakeButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
AButton *MakeButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
||||||
@ -102,6 +104,7 @@ class ControlToolBar:public ToolBar {
|
|||||||
void SetupCutPreviewTracks(double playStart, double cutStart,
|
void SetupCutPreviewTracks(double playStart, double cutStart,
|
||||||
double cutEnd, double playEnd);
|
double cutEnd, double playEnd);
|
||||||
void ClearCutPreviewTracks();
|
void ClearCutPreviewTracks();
|
||||||
|
void UpdateStatusBar();
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -135,6 +138,12 @@ class ControlToolBar:public ToolBar {
|
|||||||
|
|
||||||
TrackList* mCutPreviewTracks;
|
TrackList* mCutPreviewTracks;
|
||||||
|
|
||||||
|
// strings for status bar
|
||||||
|
wxString mStatePlay;
|
||||||
|
wxString mStateStop;
|
||||||
|
wxString mStateRecord;
|
||||||
|
wxString mStatePause;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DECLARE_CLASS(ControlToolBar);
|
DECLARE_CLASS(ControlToolBar);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user