mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-03 17:19:43 +02:00
Bug1053: Meaningful status bar messages for scrubbing
This commit is contained in:
parent
353051493b
commit
4fc4f529a0
@ -1052,7 +1052,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||
wxString msg = wxString::Format(_("Welcome to Audacity version %s"),
|
||||
AUDACITY_VERSION_STRING);
|
||||
mStatusBar->SetStatusText(msg, mainStatusBarField);
|
||||
mStatusBar->SetStatusText(GetControlToolBar()->StateForStatusBar(), stateStatusBarField);
|
||||
GetControlToolBar()->UpdateStatusBar(this);
|
||||
mLastStatusUpdateTime = ::wxGetUTCTime();
|
||||
|
||||
mTimer = new wxTimer(this, AudacityProjectTimerID);
|
||||
|
@ -1703,11 +1703,18 @@ void TrackPanel::HandleCursor(wxMouseEvent & event)
|
||||
|
||||
tip = ttb->GetMessageForTool(tool);
|
||||
|
||||
// We don't include the select tool in
|
||||
// SetCursorAndTipByTool() because it's more complex than
|
||||
// the other tool cases.
|
||||
if( tool != selectTool )
|
||||
const auto &scrubber = GetProject()->GetScrubber();
|
||||
if (scrubber.IsScrubbing()) {
|
||||
if (scrubber.IsScrollScrubbing())
|
||||
tip = _("Move to adjust speed, click to skip, ESC to stop.");
|
||||
else
|
||||
tip = _("Move to scrub, click to seek, ESC to stop.");
|
||||
}
|
||||
else if( tool != selectTool )
|
||||
{
|
||||
// We don't include the select tool in
|
||||
// SetCursorAndTipByTool() because it's more complex than
|
||||
// the other tool cases.
|
||||
SetCursorAndTipByTool( tool, event, tip);
|
||||
}
|
||||
else
|
||||
|
@ -105,6 +105,7 @@ ControlToolBar::ControlToolBar()
|
||||
/* i18n-hint: These are strings for the status bar, and indicate whether Audacity
|
||||
is playing or recording or stopped, and whether it is paused. */
|
||||
mStatePlay = XO("Playing");
|
||||
mStateScrub = XO("Scrubbing");
|
||||
mStateStop = XO("Stopped");
|
||||
mStateRecord = XO("Recording");
|
||||
mStatePause = XO("Paused");
|
||||
@ -438,7 +439,7 @@ void ControlToolBar::SetPlay(bool down, bool looped, bool cutPreview)
|
||||
mPlay->SetAlternateIdx(0);
|
||||
}
|
||||
EnableDisableButtons();
|
||||
UpdateStatusBar();
|
||||
UpdateStatusBar(GetActiveProject());
|
||||
}
|
||||
|
||||
void ControlToolBar::SetStop(bool down)
|
||||
@ -727,14 +728,14 @@ void ControlToolBar::OnPlay(wxCommandEvent & WXUNUSED(evt))
|
||||
if (p) p->TP_DisplaySelection();
|
||||
|
||||
PlayDefault();
|
||||
UpdateStatusBar();
|
||||
UpdateStatusBar(GetActiveProject());
|
||||
}
|
||||
|
||||
void ControlToolBar::OnStop(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
if (CanStopAudioStream()) {
|
||||
StopPlaying();
|
||||
UpdateStatusBar();
|
||||
UpdateStatusBar(GetActiveProject());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1045,7 +1046,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
||||
SetRecord(false);
|
||||
}
|
||||
}
|
||||
UpdateStatusBar();
|
||||
UpdateStatusBar(GetActiveProject());
|
||||
}
|
||||
|
||||
|
||||
@ -1074,7 +1075,7 @@ void ControlToolBar::OnPause(wxCommandEvent & WXUNUSED(evt))
|
||||
}
|
||||
|
||||
gAudioIO->SetPaused(mPaused);
|
||||
UpdateStatusBar();
|
||||
UpdateStatusBar(GetActiveProject());
|
||||
}
|
||||
|
||||
void ControlToolBar::OnRewind(wxCommandEvent & WXUNUSED(evt))
|
||||
@ -1170,6 +1171,12 @@ int ControlToolBar::WidthForStatusBar(wxStatusBar* const sb)
|
||||
if (x > xMax)
|
||||
xMax = x;
|
||||
|
||||
// Note that Scrubbing + Paused is not allowed.
|
||||
sb->GetTextExtent(wxString(wxGetTranslation(mStateScrub)) +
|
||||
wxT("."), &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.
|
||||
}
|
||||
|
||||
@ -1177,7 +1184,9 @@ wxString ControlToolBar::StateForStatusBar()
|
||||
{
|
||||
wxString state;
|
||||
|
||||
if (mPlay->IsDown())
|
||||
if (gAudioIO->IsScrubbing())
|
||||
state = wxGetTranslation(mStateScrub);
|
||||
else if (mPlay->IsDown())
|
||||
state = wxGetTranslation(mStatePlay);
|
||||
else if (mRecord->IsDown())
|
||||
state = wxGetTranslation(mStateRecord);
|
||||
@ -1195,8 +1204,8 @@ wxString ControlToolBar::StateForStatusBar()
|
||||
return state;
|
||||
}
|
||||
|
||||
void ControlToolBar::UpdateStatusBar()
|
||||
void ControlToolBar::UpdateStatusBar(AudacityProject *pProject)
|
||||
{
|
||||
GetActiveProject()->GetStatusBar()->SetStatusText(StateForStatusBar(), stateStatusBarField);
|
||||
pProject->GetStatusBar()->SetStatusText(StateForStatusBar(), stateStatusBarField);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class ControlToolBar final : public ToolBar {
|
||||
void RegenerateToolsTooltips();
|
||||
|
||||
int WidthForStatusBar(wxStatusBar* const);
|
||||
wxString StateForStatusBar();
|
||||
void UpdateStatusBar(AudacityProject *pProject);
|
||||
|
||||
private:
|
||||
|
||||
@ -116,7 +116,7 @@ class ControlToolBar final : public ToolBar {
|
||||
void SetupCutPreviewTracks(double playStart, double cutStart,
|
||||
double cutEnd, double playEnd);
|
||||
void ClearCutPreviewTracks();
|
||||
void UpdateStatusBar();
|
||||
wxString StateForStatusBar();
|
||||
|
||||
enum
|
||||
{
|
||||
@ -152,6 +152,7 @@ class ControlToolBar final : public ToolBar {
|
||||
|
||||
// strings for status bar
|
||||
wxString mStatePlay;
|
||||
wxString mStateScrub;
|
||||
wxString mStateStop;
|
||||
wxString mStateRecord;
|
||||
wxString mStatePause;
|
||||
|
@ -218,6 +218,7 @@ bool Scrubber::MaybeStartScrubbing(const wxMouseEvent &event)
|
||||
mScrubToken =
|
||||
ctb->PlayPlayRegion(SelectedRegion(time0, time1), options,
|
||||
PlayMode::normalPlay, cutPreview, backwards);
|
||||
ctb->UpdateStatusBar(mProject);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user