1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-23 15:50:05 +02:00

ControlToolBar uses idle events to update status message for itself

This commit is contained in:
Paul Licameli 2019-06-28 11:57:49 -04:00
parent ce7773b7ab
commit 7d504ba015
4 changed files with 10 additions and 20 deletions

View File

@ -822,7 +822,6 @@ void ProjectWindow::Init()
wxString msg = wxString::Format(_("Welcome to Audacity version %s"),
AUDACITY_VERSION_STRING);
statusBar->SetStatusText(msg, mainStatusBarField);
ControlToolBar::Get( project ).UpdateStatusBar( &project );
wxTheApp->Bind(EVT_THEME_CHANGE, &ProjectWindow::OnThemeChange, this);

View File

@ -99,6 +99,7 @@ BEGIN_EVENT_TABLE(ControlToolBar, ToolBar)
EVT_BUTTON(ID_REW_BUTTON, ControlToolBar::OnRewind)
EVT_BUTTON(ID_FF_BUTTON, ControlToolBar::OnFF)
EVT_BUTTON(ID_PAUSE_BUTTON, ControlToolBar::OnPause)
EVT_IDLE(ControlToolBar::OnIdle)
END_EVENT_TABLE()
//Standard constructor
@ -514,7 +515,6 @@ void ControlToolBar::SetPlay(bool down, PlayAppearance appearance)
mPlay->SetAlternateIdx(0);
}
EnableDisableButtons();
UpdateStatusBar( &mProject );
}
void ControlToolBar::SetStop(bool down)
@ -810,7 +810,6 @@ void ControlToolBar::OnPlay(wxCommandEvent & WXUNUSED(evt))
if (p)
ProjectWindow::Get( *p ).TP_DisplaySelection();
auto cleanup = finally( [&]{ UpdateStatusBar(p); } );
PlayDefault();
}
@ -818,7 +817,6 @@ void ControlToolBar::OnStop(wxCommandEvent & WXUNUSED(evt))
{
if (CanStopAudioStream()) {
StopPlaying();
UpdateStatusBar( &mProject );
}
}
@ -1104,9 +1102,6 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
SetStop(false);
SetRecord(false);
}
// Success or not:
UpdateStatusBar( &mProject );
});
auto transportTracks = tracks;
@ -1319,8 +1314,12 @@ void ControlToolBar::OnPause(wxCommandEvent & WXUNUSED(evt))
{
gAudioIO->SetPaused(mPaused);
}
}
UpdateStatusBar( &mProject );
void ControlToolBar::OnIdle(wxIdleEvent & event)
{
event.Skip();
UpdateStatusBar();
}
void ControlToolBar::OnRewind(wxCommandEvent & WXUNUSED(evt))
@ -1434,9 +1433,9 @@ wxString ControlToolBar::StateForStatusBar()
return state;
}
void ControlToolBar::UpdateStatusBar(AudacityProject *pProject)
void ControlToolBar::UpdateStatusBar()
{
GetProjectFrame( *pProject )
GetProjectFrame( mProject )
.GetStatusBar()->SetStatusText(StateForStatusBar(), stateStatusBarField);
}

View File

@ -84,6 +84,7 @@ class ControlToolBar final : public ToolBar {
const AudioIOStartStreamOptions &options);
void OnFF(wxCommandEvent & evt);
void OnPause(wxCommandEvent & evt);
void OnIdle(wxIdleEvent & event);
// Choice among the appearances of the play button:
enum class PlayAppearance {
@ -128,7 +129,6 @@ class ControlToolBar final : public ToolBar {
void RegenerateTooltips() override;
int WidthForStatusBar(wxStatusBar* const);
void UpdateStatusBar(AudacityProject *pProject);
// Starting and stopping of scrolling display
void StartScrollingIfPreferred();
@ -141,6 +141,7 @@ class ControlToolBar final : public ToolBar {
PlayMode GetLastPlayMode() const { return mLastPlayMode; }
private:
void UpdateStatusBar();
static AButton *MakeButton(
ControlToolBar *pBar,

View File

@ -337,7 +337,6 @@ void Scrubber::MarkScrubStart(
// : ControlToolBar::PlayAppearance::Scrub);
mScrubStartPosition = xx;
ctb.UpdateStatusBar(mProject);
mCancelled = false;
}
@ -674,8 +673,6 @@ void Scrubber::ContinueScrubbingUI()
// Show the correct status for seeking.
bool backup = mSeeking;
mSeeking = seek;
auto &ctb = ControlToolBar::Get( *mProject );
ctb.UpdateStatusBar(mProject);
mSeeking = backup;
}
@ -1107,12 +1104,6 @@ void Scrubber::OnScrubOrSeek(bool seek)
{
DoScrub(seek);
if (HasMark()) {
// Show the correct status.
auto &ctb = ControlToolBar::Get( *mProject );
ctb.UpdateStatusBar(mProject);
}
mSeeking = seek;
CheckMenuItems();