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

Move UpdatePrefs() later in ctor of AudacityProject...

... and assume non-null for certain sub-windows
This commit is contained in:
Paul Licameli 2019-05-01 13:03:03 -04:00
parent b3257c56da
commit 24259413be
2 changed files with 14 additions and 25 deletions

View File

@ -920,6 +920,14 @@ namespace {
void AdornedRulerPanel::UpdatePrefs()
{
if (mNeedButtonUpdate) {
// Visit this block once only in the lifetime of this panel
mNeedButtonUpdate = false;
// Do this first time setting of button status texts
// when we are sure the CommandManager is initialized.
ReCreateButtons();
}
// Update button texts for language change
UpdateButtonStates();
@ -1102,16 +1110,6 @@ void AdornedRulerPanel::OnRecordStartStop(wxCommandEvent & evt)
void AdornedRulerPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
{
if (mNeedButtonUpdate) {
// Visit this block once only in the lifetime of this panel
mNeedButtonUpdate = false;
// Do this first time setting of button status texts
// when we are sure the CommandManager is initialized.
ReCreateButtons();
// Sends a resize event, which will cause a second paint.
UpdatePrefs();
}
wxPaintDC dc(this);
auto &backDC = GetBackingDCForRepaint();

View File

@ -1174,8 +1174,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mMenuManager = std::make_unique<MenuManager>();
UpdatePrefs();
mLockPlayRegion = false;
// Make sure valgrind sees mIsSyncLocked is initialized, even
@ -1303,8 +1301,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
this,
mRuler);
}
mTrackPanel->UpdatePrefs();
mCursorOverlay = std::make_shared<EditCursorOverlay>(this);
mBackgroundCell = std::make_shared<BackgroundCell>(this);
@ -1441,6 +1438,8 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mTimer = std::make_unique<wxTimer>(this, AudacityProjectTimerID);
RestartTimer();
UpdatePrefs();
#if wxUSE_DRAG_AND_DROP
// We can import now, so become a drag target
// SetDropTarget(safenew AudacityDropTarget(this));
@ -1541,19 +1540,11 @@ void AudacityProject::UpdatePrefs()
GetMenuManager(*this).UpdatePrefs();
if (mTrackPanel) {
mTrackPanel->UpdatePrefs();
}
mTrackPanel->UpdatePrefs();
mToolManager->UpdatePrefs();
mRuler->UpdatePrefs();
if (mMixerBoard)
mMixerBoard->UpdatePrefs();
if (mToolManager) {
mToolManager->UpdatePrefs();
}
if (mRuler) {
mRuler->UpdatePrefs();
}
}
void AudacityProject::RedrawProject(const bool bForceWaveTracks /*= false*/)