1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 16:37:12 +01:00

Eliminate GetActiveProject in TimerRecordDialog

This commit is contained in:
Paul Licameli
2020-01-01 23:41:04 -05:00
parent 7592227f14
commit ece7bd888d
3 changed files with 16 additions and 9 deletions

View File

@@ -165,9 +165,11 @@ BEGIN_EVENT_TABLE(TimerRecordDialog, wxDialogWrapper)
END_EVENT_TABLE()
TimerRecordDialog::TimerRecordDialog(wxWindow* parent, bool bAlreadySaved)
TimerRecordDialog::TimerRecordDialog(
wxWindow* parent, AudacityProject &project, bool bAlreadySaved)
: wxDialogWrapper(parent, -1, XO("Audacity Timer Record"), wxDefaultPosition,
wxDefaultSize, wxCAPTION)
, mProject{ project }
{
SetName();
@@ -329,7 +331,7 @@ void TimerRecordDialog::OnAutoSavePathButton_Click(wxCommandEvent& WXUNUSED(even
if (fName.empty())
return;
AudacityProject* pProject = GetActiveProject();
AudacityProject* pProject = &mProject;
// If project already exists then abort - we do not allow users to overwrite an existing project
// unless it is the current project.
@@ -355,7 +357,7 @@ would overwrite another project.\nPlease try again and select an original name."
void TimerRecordDialog::OnAutoExportPathButton_Click(wxCommandEvent& WXUNUSED(event))
{
AudacityProject* pProject = GetActiveProject();
AudacityProject* pProject = &mProject;
Exporter eExporter;
// Call the Exporter to set the options required
@@ -424,7 +426,7 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event))
// We don't stop the user from starting the recording
// as its possible that they plan to free up some
// space before the recording begins
AudacityProject* pProject = GetActiveProject();
AudacityProject* pProject = &mProject;
auto &projectManager = ProjectManager::Get( *pProject );
// How many minutes do we have left on the disc?
@@ -539,7 +541,7 @@ bool TimerRecordDialog::RemoveAllAutoSaveFiles()
/// or if the post recording actions fail.
int TimerRecordDialog::RunWaitDialog()
{
AudacityProject* pProject = GetActiveProject();
AudacityProject* pProject = &mProject;
auto updateResult = ProgressResult::Success;
@@ -620,7 +622,7 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) {
// Finally, if there is no post-record action selected then we output
// a dialog detailing what has been carried out instead.
AudacityProject* pProject = GetActiveProject();
AudacityProject* pProject = &mProject;
bool bSaveOK = false;
bool bExportOK = false;
@@ -930,7 +932,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
S.StartMultiColumn(3, wxEXPAND);
{
TranslatableString sInitialValue;
AudacityProject* pProject = GetActiveProject();
AudacityProject* pProject = &mProject;
auto sSaveValue = pProject->GetFileName();
if (!sSaveValue.empty()) {
m_fnAutoSaveFile.Assign(sSaveValue);