diff --git a/src/ProjectFileIO.cpp b/src/ProjectFileIO.cpp index cee342d73..7ea230bac 100644 --- a/src/ProjectFileIO.cpp +++ b/src/ProjectFileIO.cpp @@ -12,7 +12,8 @@ Paul Licameli split from AudacityProject.cpp #include "Experimental.h" -#include +#include // for wxPrintf +#include #include "AutoRecovery.h" #include "Dependencies.h" @@ -21,7 +22,6 @@ Paul Licameli split from AudacityProject.cpp #include "Project.h" #include "ProjectFileIORegistry.h" #include "ProjectSettings.h" -#include "ProjectWindow.h" #include "SelectionState.h" #include "Tags.h" #include "UndoManager.h" @@ -32,7 +32,6 @@ Paul Licameli split from AudacityProject.cpp #include "ondemand/ODComputeSummaryTask.h" #include "ondemand/ODManager.h" #include "ondemand/ODTask.h" -#include "toolbars/SelectionBar.h" #include "widgets/AudacityMessageBox.h" #include "widgets/ErrorDialog.h" #include "widgets/FileHistory.h" @@ -144,7 +143,7 @@ void ProjectFileIO::UpdatePrefs() void ProjectFileIO::SetProjectTitle( int number) { auto &project = mProject; - auto &window = ProjectWindow::Get( project ); + auto &window = GetProjectFrame( project ); wxString name = project.GetProjectName(); // If we are showing project numbers, then we also explicitly show "" if there @@ -348,7 +347,7 @@ void ProjectFileManager::EnqueueODTasks() bool ProjectFileIO::HandleXMLTag(const wxChar *tag, const wxChar **attrs) { auto &project = mProject; - auto &window = ProjectWindow::Get( project ); + auto &window = GetProjectFrame( project ); auto &viewInfo = ViewInfo::Get( project ); auto &dirManager = DirManager::Get( project ); auto &settings = ProjectSettings::Get( project ); @@ -477,7 +476,6 @@ bool ProjectFileIO::HandleXMLTag(const wxChar *tag, const wxChar **attrs) double rate; Internat::CompatibleToDouble(value, &rate); settings.SetRate( rate ); - SelectionBar::Get( project ).SetRate( rate ); } else if (!wxStrcmp(attr, wxT("snapto"))) { @@ -500,7 +498,6 @@ bool ProjectFileIO::HandleXMLTag(const wxChar *tag, const wxChar **attrs) if (longVpos != 0) { // PRL: It seems this must happen after SetSnapTo viewInfo.vpos = longVpos; - window.mbInitializingScrollbar = true; } // Specifically detect newer versions of Audacity @@ -1179,7 +1176,7 @@ bool ProjectFileManager::SaveAs(bool bWantSaveCopy /*= false*/, bool bLossless / { auto &project = mProject; auto &projectFileIO = ProjectFileIO::Get( project ); - auto &window = ProjectWindow::Get( project ); + auto &window = GetProjectFrame( project ); TitleRestorer Restorer( window, project ); // RAII bool bHasPath = true; wxFileName filename{ project.GetFileName() }; diff --git a/src/ProjectManager.cpp b/src/ProjectManager.cpp index 3a0475537..687ad8614 100644 --- a/src/ProjectManager.cpp +++ b/src/ProjectManager.cpp @@ -1102,6 +1102,9 @@ void ProjectManager::OpenFile(const FilePath &fileNameArg, bool addtohistory) if (bParseSuccess) { auto &settings = ProjectSettings::Get( project ); + window.mbInitializingScrollbar = true; // this must precede AS_SetSnapTo + // to make persistence of the vertical scrollbar position work + auto &selectionManager = ProjectSelectionManager::Get( project ); selectionManager.AS_SetSnapTo(settings.GetSnapTo()); selectionManager.AS_SetSelectionFormat(settings.GetSelectionFormat()); @@ -1109,6 +1112,7 @@ void ProjectManager::OpenFile(const FilePath &fileNameArg, bool addtohistory) settings.GetFrequencySelectionFormatName()); selectionManager.SSBL_SetBandwidthSelectionFormatName( settings.GetBandwidthSelectionFormatName()); + SelectionBar::Get( project ).SetRate( settings.GetRate() ); ProjectHistory::Get( project ).InitialState(); trackPanel.SetFocusedTrack( *tracks.Any().begin() );