1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 16:09:28 +02:00

ProjectFileIO, ProjectFileManager don't use ProjectWindow...

... or SelectionBar, after lifting some steps of file opening into
ProjectManager

see also commit 0a109d2
This commit is contained in:
Paul Licameli 2019-06-09 08:18:53 -04:00
parent 4bf3365af4
commit 43b1afc679
2 changed files with 9 additions and 8 deletions

View File

@ -12,7 +12,8 @@ Paul Licameli split from AudacityProject.cpp
#include "Experimental.h"
#include <wx/crt.h>
#include <wx/crt.h> // for wxPrintf
#include <wx/frame.h>
#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 "<untitled>" 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() };

View File

@ -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() );