mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-26 17:18:41 +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()
|
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,
|
: wxDialogWrapper(parent, -1, XO("Audacity Timer Record"), wxDefaultPosition,
|
||||||
wxDefaultSize, wxCAPTION)
|
wxDefaultSize, wxCAPTION)
|
||||||
|
, mProject{ project }
|
||||||
{
|
{
|
||||||
SetName();
|
SetName();
|
||||||
|
|
||||||
@ -329,7 +331,7 @@ void TimerRecordDialog::OnAutoSavePathButton_Click(wxCommandEvent& WXUNUSED(even
|
|||||||
if (fName.empty())
|
if (fName.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AudacityProject* pProject = GetActiveProject();
|
AudacityProject* pProject = &mProject;
|
||||||
|
|
||||||
// If project already exists then abort - we do not allow users to overwrite an existing project
|
// If project already exists then abort - we do not allow users to overwrite an existing project
|
||||||
// unless it is the current 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))
|
void TimerRecordDialog::OnAutoExportPathButton_Click(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
AudacityProject* pProject = GetActiveProject();
|
AudacityProject* pProject = &mProject;
|
||||||
Exporter eExporter;
|
Exporter eExporter;
|
||||||
|
|
||||||
// Call the Exporter to set the options required
|
// 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
|
// We don't stop the user from starting the recording
|
||||||
// as its possible that they plan to free up some
|
// as its possible that they plan to free up some
|
||||||
// space before the recording begins
|
// space before the recording begins
|
||||||
AudacityProject* pProject = GetActiveProject();
|
AudacityProject* pProject = &mProject;
|
||||||
auto &projectManager = ProjectManager::Get( *pProject );
|
auto &projectManager = ProjectManager::Get( *pProject );
|
||||||
|
|
||||||
// How many minutes do we have left on the disc?
|
// How many minutes do we have left on the disc?
|
||||||
@ -539,7 +541,7 @@ bool TimerRecordDialog::RemoveAllAutoSaveFiles()
|
|||||||
/// or if the post recording actions fail.
|
/// or if the post recording actions fail.
|
||||||
int TimerRecordDialog::RunWaitDialog()
|
int TimerRecordDialog::RunWaitDialog()
|
||||||
{
|
{
|
||||||
AudacityProject* pProject = GetActiveProject();
|
AudacityProject* pProject = &mProject;
|
||||||
|
|
||||||
auto updateResult = ProgressResult::Success;
|
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
|
// Finally, if there is no post-record action selected then we output
|
||||||
// a dialog detailing what has been carried out instead.
|
// a dialog detailing what has been carried out instead.
|
||||||
|
|
||||||
AudacityProject* pProject = GetActiveProject();
|
AudacityProject* pProject = &mProject;
|
||||||
|
|
||||||
bool bSaveOK = false;
|
bool bSaveOK = false;
|
||||||
bool bExportOK = false;
|
bool bExportOK = false;
|
||||||
@ -930,7 +932,7 @@ void TimerRecordDialog::PopulateOrExchange(ShuttleGui& S)
|
|||||||
S.StartMultiColumn(3, wxEXPAND);
|
S.StartMultiColumn(3, wxEXPAND);
|
||||||
{
|
{
|
||||||
TranslatableString sInitialValue;
|
TranslatableString sInitialValue;
|
||||||
AudacityProject* pProject = GetActiveProject();
|
AudacityProject* pProject = &mProject;
|
||||||
auto sSaveValue = pProject->GetFileName();
|
auto sSaveValue = pProject->GetFileName();
|
||||||
if (!sSaveValue.empty()) {
|
if (!sSaveValue.empty()) {
|
||||||
m_fnAutoSaveFile.Assign(sSaveValue);
|
m_fnAutoSaveFile.Assign(sSaveValue);
|
||||||
|
@ -38,6 +38,8 @@ enum TimerRecordCompletedActions {
|
|||||||
TR_ACTION_EXPORTED = 0x00000002
|
TR_ACTION_EXPORTED = 0x00000002
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class AudacityProject;
|
||||||
|
|
||||||
class TimerRecordPathCtrl final : public wxTextCtrl
|
class TimerRecordPathCtrl final : public wxTextCtrl
|
||||||
{
|
{
|
||||||
// MY: Class that inherits from the wxTextCtrl class.
|
// MY: Class that inherits from the wxTextCtrl class.
|
||||||
@ -64,7 +66,8 @@ public:
|
|||||||
class TimerRecordDialog final : public wxDialogWrapper
|
class TimerRecordDialog final : public wxDialogWrapper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TimerRecordDialog(wxWindow* parent, bool bAlreadySaved);
|
TimerRecordDialog(
|
||||||
|
wxWindow* parent, AudacityProject &project, bool bAlreadySaved);
|
||||||
~TimerRecordDialog();
|
~TimerRecordDialog();
|
||||||
|
|
||||||
void OnTimer(wxTimerEvent& event);
|
void OnTimer(wxTimerEvent& event);
|
||||||
@ -114,6 +117,8 @@ private:
|
|||||||
ProgressResult PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions);
|
ProgressResult PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
AudacityProject &mProject;
|
||||||
|
|
||||||
wxDateTime m_DateTime_Start;
|
wxDateTime m_DateTime_Start;
|
||||||
wxDateTime m_DateTime_End;
|
wxDateTime m_DateTime_End;
|
||||||
wxTimeSpan m_TimeSpan_Duration;
|
wxTimeSpan m_TimeSpan_Duration;
|
||||||
|
@ -326,7 +326,7 @@ void OnTimerRecord(const CommandContext &context)
|
|||||||
//and therefore remove the newly inserted track.
|
//and therefore remove the newly inserted track.
|
||||||
|
|
||||||
TimerRecordDialog dialog(
|
TimerRecordDialog dialog(
|
||||||
&window, bProjectSaved); /* parent, project saved? */
|
&window, project, bProjectSaved); /* parent, project, project saved? */
|
||||||
int modalResult = dialog.ShowModal();
|
int modalResult = dialog.ShowModal();
|
||||||
if (modalResult == wxID_CANCEL)
|
if (modalResult == wxID_CANCEL)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user