mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Eliminate GetActiveProject in TimerRecordDialog
This commit is contained in:
parent
7592227f14
commit
ece7bd888d
@ -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);
|
||||
|
@ -38,6 +38,8 @@ enum TimerRecordCompletedActions {
|
||||
TR_ACTION_EXPORTED = 0x00000002
|
||||
};
|
||||
|
||||
class AudacityProject;
|
||||
|
||||
class TimerRecordPathCtrl final : public wxTextCtrl
|
||||
{
|
||||
// MY: Class that inherits from the wxTextCtrl class.
|
||||
@ -64,7 +66,8 @@ public:
|
||||
class TimerRecordDialog final : public wxDialogWrapper
|
||||
{
|
||||
public:
|
||||
TimerRecordDialog(wxWindow* parent, bool bAlreadySaved);
|
||||
TimerRecordDialog(
|
||||
wxWindow* parent, AudacityProject &project, bool bAlreadySaved);
|
||||
~TimerRecordDialog();
|
||||
|
||||
void OnTimer(wxTimerEvent& event);
|
||||
@ -114,6 +117,8 @@ private:
|
||||
ProgressResult PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions);
|
||||
|
||||
private:
|
||||
AudacityProject &mProject;
|
||||
|
||||
wxDateTime m_DateTime_Start;
|
||||
wxDateTime m_DateTime_End;
|
||||
wxTimeSpan m_TimeSpan_Duration;
|
||||
|
@ -326,7 +326,7 @@ void OnTimerRecord(const CommandContext &context)
|
||||
//and therefore remove the newly inserted track.
|
||||
|
||||
TimerRecordDialog dialog(
|
||||
&window, bProjectSaved); /* parent, project saved? */
|
||||
&window, project, bProjectSaved); /* parent, project, project saved? */
|
||||
int modalResult = dialog.ShowModal();
|
||||
if (modalResult == wxID_CANCEL)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user