mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Remove many calls to GetActiveProject
This commit is contained in:
commit
ba5ce23668
@ -61,11 +61,12 @@ BEGIN_EVENT_TABLE(MacroCommandDialog, wxDialogWrapper)
|
|||||||
EVT_LIST_ITEM_SELECTED(CommandsListID, MacroCommandDialog::OnItemSelected)
|
EVT_LIST_ITEM_SELECTED(CommandsListID, MacroCommandDialog::OnItemSelected)
|
||||||
END_EVENT_TABLE();
|
END_EVENT_TABLE();
|
||||||
|
|
||||||
MacroCommandDialog::MacroCommandDialog(wxWindow * parent, wxWindowID id):
|
MacroCommandDialog::MacroCommandDialog(
|
||||||
|
wxWindow * parent, wxWindowID id, AudacityProject &project):
|
||||||
wxDialogWrapper(parent, id, XO("Select Command"),
|
wxDialogWrapper(parent, id, XO("Select Command"),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxCAPTION | wxRESIZE_BORDER)
|
wxCAPTION | wxRESIZE_BORDER)
|
||||||
, mCatalog( GetActiveProject() )
|
, mCatalog{ &project }
|
||||||
{
|
{
|
||||||
SetLabel(XO("Select Command")); // Provide visual label
|
SetLabel(XO("Select Command")); // Provide visual label
|
||||||
SetName(XO("Select Command")); // Provide audible label
|
SetName(XO("Select Command")); // Provide audible label
|
||||||
|
@ -21,12 +21,13 @@ class wxTextCtrl;
|
|||||||
class wxListCtrl;
|
class wxListCtrl;
|
||||||
class wxListEvent;
|
class wxListEvent;
|
||||||
class wxButton;
|
class wxButton;
|
||||||
|
class AudacityProject;
|
||||||
class ShuttleGui;
|
class ShuttleGui;
|
||||||
|
|
||||||
class MacroCommandDialog final : public wxDialogWrapper {
|
class MacroCommandDialog final : public wxDialogWrapper {
|
||||||
public:
|
public:
|
||||||
// constructors and destructors
|
// constructors and destructors
|
||||||
MacroCommandDialog(wxWindow *parent, wxWindowID id);
|
MacroCommandDialog(wxWindow *parent, wxWindowID id, AudacityProject &project);
|
||||||
void SetCommandAndParams(const CommandID &Command, const wxString &Params);
|
void SetCommandAndParams(const CommandID &Command, const wxString &Params);
|
||||||
public:
|
public:
|
||||||
CommandID mSelectedCommand;
|
CommandID mSelectedCommand;
|
||||||
|
@ -86,7 +86,9 @@ static const std::pair<TranslatableString, CommandID> SpecialCommands[] = {
|
|||||||
};
|
};
|
||||||
// end CLEANSPEECH remnant
|
// end CLEANSPEECH remnant
|
||||||
|
|
||||||
MacroCommands::MacroCommands()
|
MacroCommands::MacroCommands( AudacityProject &project )
|
||||||
|
: mProject{ project }
|
||||||
|
, mExporter{ project }
|
||||||
{
|
{
|
||||||
ResetMacro();
|
ResetMacro();
|
||||||
|
|
||||||
@ -482,7 +484,7 @@ wxString MacroCommands::PromptForPresetFor(const CommandID & command, const wxSt
|
|||||||
|
|
||||||
double MacroCommands::GetEndTime()
|
double MacroCommands::GetEndTime()
|
||||||
{
|
{
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = &mProject;
|
||||||
if( project == NULL )
|
if( project == NULL )
|
||||||
{
|
{
|
||||||
//AudacityMessageBox( XO("No project to process!") );
|
//AudacityMessageBox( XO("No project to process!") );
|
||||||
@ -494,9 +496,8 @@ double MacroCommands::GetEndTime()
|
|||||||
return endTime;
|
return endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroCommands::IsMono()
|
bool MacroCommands::IsMono( AudacityProject *project )
|
||||||
{
|
{
|
||||||
AudacityProject *project = GetActiveProject();
|
|
||||||
if( project == NULL )
|
if( project == NULL )
|
||||||
{
|
{
|
||||||
//AudacityMessageBox( XO("No project and no Audio to process!") );
|
//AudacityMessageBox( XO("No project and no Audio to process!") );
|
||||||
@ -567,19 +568,18 @@ wxString MacroCommands::BuildCleanFileName(const FilePath &fileName,
|
|||||||
bool MacroCommands::WriteMp3File( const wxString & Name, int bitrate )
|
bool MacroCommands::WriteMp3File( const wxString & Name, int bitrate )
|
||||||
{ //check if current project is mono or stereo
|
{ //check if current project is mono or stereo
|
||||||
unsigned numChannels = 2;
|
unsigned numChannels = 2;
|
||||||
if (IsMono()) {
|
if (IsMono( &mProject )) {
|
||||||
numChannels = 1;
|
numChannels = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
double endTime = GetEndTime();
|
double endTime = GetEndTime();
|
||||||
if( endTime <= 0.0f )
|
if( endTime <= 0.0f )
|
||||||
return false;
|
return false;
|
||||||
AudacityProject *project = GetActiveProject();
|
|
||||||
if( bitrate <=0 )
|
if( bitrate <=0 )
|
||||||
{
|
{
|
||||||
// 'No' bitrate given, use the current default.
|
// 'No' bitrate given, use the current default.
|
||||||
// Use Mp3Stereo to control if export is to a stereo or mono file
|
// Use Mp3Stereo to control if export is to a stereo or mono file
|
||||||
return mExporter.Process(project, numChannels, wxT("MP3"), Name, false, 0.0, endTime);
|
return mExporter.Process(numChannels, wxT("MP3"), Name, false, 0.0, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -596,7 +596,7 @@ bool MacroCommands::WriteMp3File( const wxString & Name, int bitrate )
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
// Use Mp3Stereo to control if export is to a stereo or mono file
|
// Use Mp3Stereo to control if export is to a stereo or mono file
|
||||||
rc = mExporter.Process(project, numChannels, wxT("MP3"), Name, false, 0.0, endTime);
|
rc = mExporter.Process(numChannels, wxT("MP3"), Name, false, 0.0, endTime);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,10 +622,10 @@ bool MacroCommands::ApplySpecialCommand(
|
|||||||
if (ReportAndSkip(friendlyCommand, params))
|
if (ReportAndSkip(friendlyCommand, params))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = &mProject;
|
||||||
|
|
||||||
unsigned numChannels = 1; //used to switch between mono and stereo export
|
unsigned numChannels = 1; //used to switch between mono and stereo export
|
||||||
if (IsMono()) {
|
if (IsMono( &mProject )) {
|
||||||
numChannels = 1; //export in mono
|
numChannels = 1; //export in mono
|
||||||
} else {
|
} else {
|
||||||
numChannels = 2; //export in stereo
|
numChannels = 2; //export in stereo
|
||||||
@ -679,7 +679,7 @@ bool MacroCommands::ApplySpecialCommand(
|
|||||||
if (endTime <= 0.0f) {
|
if (endTime <= 0.0f) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return mExporter.Process(project, numChannels, wxT("WAV"), filename, false, 0.0, endTime);
|
return mExporter.Process(numChannels, wxT("WAV"), filename, false, 0.0, endTime);
|
||||||
} else if (command == wxT("ExportOgg")) {
|
} else if (command == wxT("ExportOgg")) {
|
||||||
#ifdef USE_LIBVORBIS
|
#ifdef USE_LIBVORBIS
|
||||||
filename.Replace(wxT(".mp3"), wxT(".ogg"), false);
|
filename.Replace(wxT(".mp3"), wxT(".ogg"), false);
|
||||||
@ -687,7 +687,7 @@ bool MacroCommands::ApplySpecialCommand(
|
|||||||
if (endTime <= 0.0f) {
|
if (endTime <= 0.0f) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return mExporter.Process(project, numChannels, wxT("OGG"), filename, false, 0.0, endTime);
|
return mExporter.Process(numChannels, wxT("OGG"), filename, false, 0.0, endTime);
|
||||||
#else
|
#else
|
||||||
AudacityMessageBox( XO(
|
AudacityMessageBox( XO(
|
||||||
"Ogg Vorbis support is not included in this build of Audacity"));
|
"Ogg Vorbis support is not included in this build of Audacity"));
|
||||||
@ -700,7 +700,7 @@ bool MacroCommands::ApplySpecialCommand(
|
|||||||
if (endTime <= 0.0f) {
|
if (endTime <= 0.0f) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return mExporter.Process(project, numChannels, wxT("FLAC"), filename, false, 0.0, endTime);
|
return mExporter.Process(numChannels, wxT("FLAC"), filename, false, 0.0, endTime);
|
||||||
#else
|
#else
|
||||||
AudacityMessageBox(XO(
|
AudacityMessageBox(XO(
|
||||||
"FLAC support is not included in this build of Audacity"));
|
"FLAC support is not included in this build of Audacity"));
|
||||||
@ -771,7 +771,7 @@ bool MacroCommands::ApplyEffectCommand(
|
|||||||
if (!plug)
|
if (!plug)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = &mProject;
|
||||||
|
|
||||||
// FIXME: for later versions may want to not select-all in batch mode.
|
// FIXME: for later versions may want to not select-all in batch mode.
|
||||||
// IF nothing selected, THEN select everything
|
// IF nothing selected, THEN select everything
|
||||||
@ -861,12 +861,12 @@ bool MacroCommands::ApplyCommand( const TranslatableString &friendlyCommand,
|
|||||||
if( pContext )
|
if( pContext )
|
||||||
return ApplyEffectCommand(
|
return ApplyEffectCommand(
|
||||||
ID, friendlyCommand, command, params, *pContext);
|
ID, friendlyCommand, command, params, *pContext);
|
||||||
const CommandContext context( *GetActiveProject() );
|
const CommandContext context( mProject );
|
||||||
return ApplyEffectCommand(
|
return ApplyEffectCommand(
|
||||||
ID, friendlyCommand, command, params, context);
|
ID, friendlyCommand, command, params, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = &mProject;
|
||||||
auto &manager = CommandManager::Get( *project );
|
auto &manager = CommandManager::Get( *project );
|
||||||
if( pContext ){
|
if( pContext ){
|
||||||
if( HandleTextualCommand(
|
if( HandleTextualCommand(
|
||||||
@ -878,7 +878,7 @@ bool MacroCommands::ApplyCommand( const TranslatableString &friendlyCommand,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const CommandContext context( *GetActiveProject() );
|
const CommandContext context( mProject );
|
||||||
if( HandleTextualCommand(
|
if( HandleTextualCommand(
|
||||||
manager, command, context, AlwaysEnabledFlag, true ) )
|
manager, command, context, AlwaysEnabledFlag, true ) )
|
||||||
return true;
|
return true;
|
||||||
@ -896,7 +896,7 @@ bool MacroCommands::ApplyCommandInBatchMode(
|
|||||||
const CommandID & command, const wxString ¶ms,
|
const CommandID & command, const wxString ¶ms,
|
||||||
CommandContext const * pContext)
|
CommandContext const * pContext)
|
||||||
{
|
{
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = &mProject;
|
||||||
auto &settings = ProjectSettings::Get( *project );
|
auto &settings = ProjectSettings::Get( *project );
|
||||||
// Recalc flags and enable items that may have become enabled.
|
// Recalc flags and enable items that may have become enabled.
|
||||||
MenuManager::Get(*project).UpdateMenus(false);
|
MenuManager::Get(*project).UpdateMenus(false);
|
||||||
@ -931,7 +931,7 @@ bool MacroCommands::ApplyMacro(
|
|||||||
|
|
||||||
mFileName = filename;
|
mFileName = filename;
|
||||||
|
|
||||||
AudacityProject *proj = GetActiveProject();
|
AudacityProject *proj = &mProject;
|
||||||
bool res = false;
|
bool res = false;
|
||||||
auto cleanup2 = finally( [&] {
|
auto cleanup2 = finally( [&] {
|
||||||
if (!res) {
|
if (!res) {
|
||||||
|
@ -59,7 +59,7 @@ class MacroCommands final {
|
|||||||
const PluginID & ID, const CommandContext & context, unsigned flags );
|
const PluginID & ID, const CommandContext & context, unsigned flags );
|
||||||
|
|
||||||
// constructors and destructors
|
// constructors and destructors
|
||||||
MacroCommands();
|
MacroCommands( AudacityProject &project );
|
||||||
public:
|
public:
|
||||||
bool ApplyMacro( const MacroCommandsCatalog &catalog,
|
bool ApplyMacro( const MacroCommandsCatalog &catalog,
|
||||||
const wxString & filename = {});
|
const wxString & filename = {});
|
||||||
@ -87,7 +87,7 @@ class MacroCommands final {
|
|||||||
const FileExtension &extension);
|
const FileExtension &extension);
|
||||||
bool WriteMp3File( const wxString & Name, int bitrate );
|
bool WriteMp3File( const wxString & Name, int bitrate );
|
||||||
double GetEndTime();
|
double GetEndTime();
|
||||||
static bool IsMono();
|
static bool IsMono( AudacityProject *project );
|
||||||
|
|
||||||
// These commands do not depend on the command list.
|
// These commands do not depend on the command list.
|
||||||
static void MigrateLegacyChains();
|
static void MigrateLegacyChains();
|
||||||
@ -123,6 +123,9 @@ class MacroCommands final {
|
|||||||
void Split(const wxString & str, wxString & command, wxString & param);
|
void Split(const wxString & str, wxString & command, wxString & param);
|
||||||
wxString Join(const wxString & command, const wxString & param);
|
wxString Join(const wxString & command, const wxString & param);
|
||||||
|
|
||||||
|
private:
|
||||||
|
AudacityProject &mProject;
|
||||||
|
|
||||||
CommandIDs mCommandMacro;
|
CommandIDs mCommandMacro;
|
||||||
wxArrayString mParamsMacro;
|
wxArrayString mParamsMacro;
|
||||||
bool mAbort;
|
bool mAbort;
|
||||||
|
@ -80,13 +80,15 @@ BEGIN_EVENT_TABLE(ApplyMacroDialog, wxDialogWrapper)
|
|||||||
EVT_BUTTON(wxID_HELP, ApplyMacroDialog::OnHelp)
|
EVT_BUTTON(wxID_HELP, ApplyMacroDialog::OnHelp)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
ApplyMacroDialog::ApplyMacroDialog(wxWindow * parent, bool bInherited):
|
ApplyMacroDialog::ApplyMacroDialog(
|
||||||
|
wxWindow * parent, AudacityProject &project, bool bInherited):
|
||||||
wxDialogWrapper(parent, wxID_ANY, XO("Macros Palette"),
|
wxDialogWrapper(parent, wxID_ANY, XO("Macros Palette"),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
, mCatalog( GetActiveProject() )
|
, mMacroCommands{ project }
|
||||||
|
, mProject{ project }
|
||||||
|
, mCatalog( &project )
|
||||||
{
|
{
|
||||||
//AudacityProject * p = GetActiveProject();
|
|
||||||
mAbort = false;
|
mAbort = false;
|
||||||
mbExpanded = false;
|
mbExpanded = false;
|
||||||
if( bInherited )
|
if( bInherited )
|
||||||
@ -330,7 +332,7 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
|
|||||||
gPrefs->Write(wxT("/Batch/ActiveMacro"), name);
|
gPrefs->Write(wxT("/Batch/ActiveMacro"), name);
|
||||||
gPrefs->Flush();
|
gPrefs->Flush();
|
||||||
|
|
||||||
AudacityProject *project = GetActiveProject();
|
AudacityProject *project = &mProject;
|
||||||
if (!TrackList::Get( *project ).empty()) {
|
if (!TrackList::Get( *project ).empty()) {
|
||||||
AudacityMessageBox(
|
AudacityMessageBox(
|
||||||
XO("Please save and close the current project first.") );
|
XO("Please save and close the current project first.") );
|
||||||
@ -518,8 +520,10 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
MacrosWindow::MacrosWindow(wxWindow * parent, bool bExpanded):
|
MacrosWindow::MacrosWindow(
|
||||||
ApplyMacroDialog(parent, true)
|
wxWindow * parent, AudacityProject &project, bool bExpanded):
|
||||||
|
ApplyMacroDialog(parent, project, true)
|
||||||
|
, mProject{ project }
|
||||||
{
|
{
|
||||||
mbExpanded = bExpanded;
|
mbExpanded = bExpanded;
|
||||||
auto Title = WindowTitle();
|
auto Title = WindowTitle();
|
||||||
@ -726,7 +730,7 @@ void MacrosWindow::AddItem(const CommandID &Action, const wxString &Params)
|
|||||||
void MacrosWindow::UpdateMenus()
|
void MacrosWindow::UpdateMenus()
|
||||||
{
|
{
|
||||||
// OK even on mac, as dialog is modal.
|
// OK even on mac, as dialog is modal.
|
||||||
auto p = GetActiveProject();
|
auto p = &mProject;
|
||||||
MenuManager::Get(*p).RebuildMenuBar(*p);
|
MenuManager::Get(*p).RebuildMenuBar(*p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1060,7 +1064,7 @@ void MacrosWindow::InsertCommandAt(int item)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroCommandDialog d(this, wxID_ANY);
|
MacroCommandDialog d(this, wxID_ANY, mProject);
|
||||||
|
|
||||||
if (!d.ShowModal()) {
|
if (!d.ShowModal()) {
|
||||||
Raise();
|
Raise();
|
||||||
|
@ -22,12 +22,14 @@ class wxListCtrl;
|
|||||||
class wxListEvent;
|
class wxListEvent;
|
||||||
class wxButton;
|
class wxButton;
|
||||||
class wxTextCtrl;
|
class wxTextCtrl;
|
||||||
|
class AudacityProject;
|
||||||
class ShuttleGui;
|
class ShuttleGui;
|
||||||
|
|
||||||
class ApplyMacroDialog : public wxDialogWrapper {
|
class ApplyMacroDialog : public wxDialogWrapper {
|
||||||
public:
|
public:
|
||||||
// constructors and destructors
|
// constructors and destructors
|
||||||
ApplyMacroDialog(wxWindow * parent, bool bInherited=false);
|
ApplyMacroDialog(
|
||||||
|
wxWindow * parent, AudacityProject &project, bool bInherited=false);
|
||||||
virtual ~ApplyMacroDialog();
|
virtual ~ApplyMacroDialog();
|
||||||
public:
|
public:
|
||||||
// Populate methods NOT virtual.
|
// Populate methods NOT virtual.
|
||||||
@ -61,6 +63,7 @@ class ApplyMacroDialog : public wxDialogWrapper {
|
|||||||
wxString mMacroBeingRenamed;
|
wxString mMacroBeingRenamed;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
AudacityProject &mProject;
|
||||||
const MacroCommandsCatalog mCatalog;
|
const MacroCommandsCatalog mCatalog;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
@ -69,7 +72,8 @@ protected:
|
|||||||
class MacrosWindow final : public ApplyMacroDialog
|
class MacrosWindow final : public ApplyMacroDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MacrosWindow(wxWindow * parent, bool bExpanded=true);
|
MacrosWindow(
|
||||||
|
wxWindow * parent, AudacityProject &project, bool bExpanded=true);
|
||||||
~MacrosWindow();
|
~MacrosWindow();
|
||||||
void UpdateDisplay( bool bExpanded );
|
void UpdateDisplay( bool bExpanded );
|
||||||
|
|
||||||
@ -118,6 +122,8 @@ private:
|
|||||||
void InsertCommandAt(int item);
|
void InsertCommandAt(int item);
|
||||||
bool SaveChanges();
|
bool SaveChanges();
|
||||||
|
|
||||||
|
AudacityProject &mProject;
|
||||||
|
|
||||||
wxButton *mRemove;
|
wxButton *mRemove;
|
||||||
wxButton *mRename;
|
wxButton *mRename;
|
||||||
wxButton *mRestore;
|
wxButton *mRestore;
|
||||||
|
@ -697,7 +697,7 @@ bool ProjectFileManager::SaveCopyWaveTracks(const FilePath & strProjectPathName,
|
|||||||
// Export all WaveTracks to OGG.
|
// Export all WaveTracks to OGG.
|
||||||
bool bSuccess = true;
|
bool bSuccess = true;
|
||||||
|
|
||||||
Exporter theExporter;
|
Exporter theExporter{ project };
|
||||||
wxFileName uniqueTrackFileName;
|
wxFileName uniqueTrackFileName;
|
||||||
for (auto pTrack : (trackRange + &Track::IsLeader))
|
for (auto pTrack : (trackRange + &Track::IsLeader))
|
||||||
{
|
{
|
||||||
@ -711,7 +711,7 @@ bool ProjectFileManager::SaveCopyWaveTracks(const FilePath & strProjectPathName,
|
|||||||
const auto startTime = channels.min( &Track::GetStartTime );
|
const auto startTime = channels.min( &Track::GetStartTime );
|
||||||
const auto endTime = channels.max( &Track::GetEndTime );
|
const auto endTime = channels.max( &Track::GetEndTime );
|
||||||
bSuccess =
|
bSuccess =
|
||||||
theExporter.Process(&project, channels.size(),
|
theExporter.Process(channels.size(),
|
||||||
fileFormat, uniqueTrackFileName.GetFullPath(), true,
|
fileFormat, uniqueTrackFileName.GetFullPath(), true,
|
||||||
startTime, endTime);
|
startTime, endTime);
|
||||||
|
|
||||||
@ -1620,7 +1620,7 @@ bool ProjectFileManager::Import(
|
|||||||
auto newTags = oldTags->Duplicate();
|
auto newTags = oldTags->Duplicate();
|
||||||
Tags::Set( project, newTags );
|
Tags::Set( project, newTags );
|
||||||
|
|
||||||
bool success = Importer::Get().Import(fileName,
|
bool success = Importer::Get().Import(project, fileName,
|
||||||
&TrackFactory::Get( project ),
|
&TrackFactory::Get( project ),
|
||||||
newTracks,
|
newTracks,
|
||||||
newTags.get(),
|
newTags.get(),
|
||||||
|
@ -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,11 +357,10 @@ 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();
|
Exporter eExporter{ mProject };
|
||||||
Exporter eExporter;
|
|
||||||
|
|
||||||
// Call the Exporter to set the options required
|
// Call the Exporter to set the options required
|
||||||
if (eExporter.SetAutoExportOptions(pProject)) {
|
if (eExporter.SetAutoExportOptions()) {
|
||||||
// Populate the options so that we can destroy this instance of the Exporter
|
// Populate the options so that we can destroy this instance of the Exporter
|
||||||
m_fnAutoExportFile = eExporter.GetAutoExportFileName();
|
m_fnAutoExportFile = eExporter.GetAutoExportFileName();
|
||||||
m_iAutoExportFormat = eExporter.GetAutoExportFormat();
|
m_iAutoExportFormat = eExporter.GetAutoExportFormat();
|
||||||
@ -424,7 +425,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 +540,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 +621,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;
|
||||||
@ -642,10 +643,10 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) {
|
|||||||
|
|
||||||
// Do Automatic Export?
|
// Do Automatic Export?
|
||||||
if (m_bAutoExportEnabled) {
|
if (m_bAutoExportEnabled) {
|
||||||
Exporter e;
|
Exporter e{ mProject };
|
||||||
MissingAliasFilesDialog::SetShouldShow(true);
|
MissingAliasFilesDialog::SetShouldShow(true);
|
||||||
bExportOK = e.ProcessFromTimerRecording(
|
bExportOK = e.ProcessFromTimerRecording(
|
||||||
pProject, false, 0.0, TrackList::Get( *pProject ).GetEndTime(),
|
false, 0.0, TrackList::Get( *pProject ).GetEndTime(),
|
||||||
m_fnAutoExportFile, m_iAutoExportFormat,
|
m_fnAutoExportFile, m_iAutoExportFormat,
|
||||||
m_iAutoExportSubFormat, m_iAutoExportFilterIndex);
|
m_iAutoExportSubFormat, m_iAutoExportFilterIndex);
|
||||||
}
|
}
|
||||||
@ -930,7 +931,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;
|
||||||
|
@ -1098,11 +1098,8 @@ void WaveTrack::SyncLockAdjust(double oldT1, double newT1)
|
|||||||
else {
|
else {
|
||||||
// AWD: Could just use InsertSilence() on its own here, but it doesn't
|
// AWD: Could just use InsertSilence() on its own here, but it doesn't
|
||||||
// follow EditClipCanMove rules (Paste() does it right)
|
// follow EditClipCanMove rules (Paste() does it right)
|
||||||
AudacityProject *p = GetActiveProject();
|
auto tmp = std::make_shared<WaveTrack>(
|
||||||
if (!p)
|
mDirManager, GetSampleFormat(), GetRate() );
|
||||||
THROW_INCONSISTENCY_EXCEPTION;
|
|
||||||
auto &factory = TrackFactory::Get( *p );
|
|
||||||
auto tmp = factory.NewWaveTrack( GetSampleFormat(), GetRate() );
|
|
||||||
|
|
||||||
tmp->InsertSilence(0.0, newT1 - oldT1);
|
tmp->InsertSilence(0.0, newT1 - oldT1);
|
||||||
tmp->Flush();
|
tmp->Flush();
|
||||||
|
@ -55,7 +55,7 @@ bool BatchEvalCommand::Apply(const CommandContext & context)
|
|||||||
wxString macroName = GetString(wxT("MacroName"));
|
wxString macroName = GetString(wxT("MacroName"));
|
||||||
if (!macroName.empty())
|
if (!macroName.empty())
|
||||||
{
|
{
|
||||||
MacroCommands batch;
|
MacroCommands batch{ context.project };
|
||||||
batch.ReadMacro(macroName);
|
batch.ReadMacro(macroName);
|
||||||
return batch.ApplyMacro(catalog);
|
return batch.ApplyMacro(catalog);
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ bool BatchEvalCommand::Apply(const CommandContext & context)
|
|||||||
: iter->name.Msgid().Stripped();
|
: iter->name.Msgid().Stripped();
|
||||||
|
|
||||||
// Create a Batch that will have just one command in it...
|
// Create a Batch that will have just one command in it...
|
||||||
MacroCommands Batch;
|
MacroCommands Batch{ context.project };
|
||||||
bool bResult = Batch.ApplyCommandInBatchMode(friendly, cmdName, cmdParams, &context);
|
bool bResult = Batch.ApplyCommandInBatchMode(friendly, cmdName, cmdParams, &context);
|
||||||
// Relay messages, if any.
|
// Relay messages, if any.
|
||||||
wxString Message = Batch.GetMessage();
|
wxString Message = Batch.GetMessage();
|
||||||
|
@ -80,10 +80,9 @@ bool ExportCommand::Apply(const CommandContext & context)
|
|||||||
}
|
}
|
||||||
wxString extension = mFileName.Mid(splitAt+1).MakeUpper();
|
wxString extension = mFileName.Mid(splitAt+1).MakeUpper();
|
||||||
|
|
||||||
Exporter exporter;
|
Exporter exporter{ context.project };
|
||||||
|
|
||||||
bool exportSuccess = exporter.Process(&context.project,
|
bool exportSuccess = exporter.Process(std::max(0, mnChannels),
|
||||||
std::max(0, mnChannels),
|
|
||||||
extension, mFileName,
|
extension, mFileName,
|
||||||
true, t0, t1);
|
true, t0, t1);
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ bool SetTrackVisualsCommand::ApplyInner(const CommandContext & context, Track *
|
|||||||
mVZoomTop = c + ZOOMLIMIT / 2.0;
|
mVZoomTop = c + ZOOMLIMIT / 2.0;
|
||||||
}
|
}
|
||||||
wt->SetDisplayBounds(mVZoomBottom, mVZoomTop);
|
wt->SetDisplayBounds(mVZoomBottom, mVZoomTop);
|
||||||
auto &tp = TrackPanel::Get( *::GetActiveProject() );
|
auto &tp = TrackPanel::Get( context.project );
|
||||||
tp.UpdateVRulers();
|
tp.UpdateVRulers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1262,8 +1262,7 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t,
|
|||||||
sampleCount start, sampleCount len)
|
sampleCount start, sampleCount len)
|
||||||
{
|
{
|
||||||
// create a NEW WaveTrack to hold all of the output, including 'tails' each end
|
// create a NEW WaveTrack to hold all of the output, including 'tails' each end
|
||||||
AudacityProject *p = GetActiveProject();
|
auto output = mFactory->NewWaveTrack(floatSample, t->GetRate());
|
||||||
auto output = TrackFactory::Get( *p ).NewWaveTrack(floatSample, t->GetRate());
|
|
||||||
|
|
||||||
wxASSERT(mM - 1 < windowSize);
|
wxASSERT(mM - 1 < windowSize);
|
||||||
size_t L = windowSize - (mM - 1); //Process L samples at a go
|
size_t L = windowSize - (mM - 1); //Process L samples at a go
|
||||||
|
@ -410,8 +410,7 @@ bool EffectEqualization48x::DeltaTrack(
|
|||||||
Floats buffer1{ trackBlockSize };
|
Floats buffer1{ trackBlockSize };
|
||||||
Floats buffer2{ trackBlockSize };
|
Floats buffer2{ trackBlockSize };
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
auto output = mEffectEqualization->mFactory->NewWaveTrack(floatSample, t->GetRate());
|
||||||
auto output = TrackFactory::Get( *p ).NewWaveTrack(floatSample, t->GetRate());
|
|
||||||
auto originalLen = len;
|
auto originalLen = len;
|
||||||
auto currentSample = start;
|
auto currentSample = start;
|
||||||
|
|
||||||
@ -633,8 +632,7 @@ bool EffectEqualization48x::ProcessOne1x(int count, WaveTrack * t,
|
|||||||
|
|
||||||
auto trackBlockSize = t->GetMaxBlockSize();
|
auto trackBlockSize = t->GetMaxBlockSize();
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
auto output = mEffectEqualization->mFactory->NewWaveTrack(floatSample, t->GetRate());
|
||||||
auto output = TrackFactory::Get( *p ).NewWaveTrack(floatSample, t->GetRate());
|
|
||||||
|
|
||||||
mEffectEqualization->TrackProgress(count, 0.0);
|
mEffectEqualization->TrackProgress(count, 0.0);
|
||||||
int subBufferSize=mBufferCount==8?(mSubBufferSize>>1):mSubBufferSize; // half the buffers if avx is active
|
int subBufferSize=mBufferCount==8?(mSubBufferSize>>1):mSubBufferSize; // half the buffers if avx is active
|
||||||
@ -820,8 +818,7 @@ bool EffectEqualization48x::ProcessOne4x(int count, WaveTrack * t,
|
|||||||
|
|
||||||
auto trackBlockSize = t->GetMaxBlockSize();
|
auto trackBlockSize = t->GetMaxBlockSize();
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
auto output = mEffectEqualization->mFactory->NewWaveTrack(floatSample, t->GetRate());
|
||||||
auto output = TrackFactory::Get( *p ).NewWaveTrack(floatSample, t->GetRate());
|
|
||||||
|
|
||||||
mEffectEqualization->TrackProgress(count, 0.0);
|
mEffectEqualization->TrackProgress(count, 0.0);
|
||||||
auto bigRuns = len/(subBufferSize-mBlockSize);
|
auto bigRuns = len/(subBufferSize-mBlockSize);
|
||||||
@ -910,8 +907,7 @@ bool EffectEqualization48x::ProcessOne1x4xThreaded(int count, WaveTrack * t,
|
|||||||
for(int i=0;i<mThreadCount;i++)
|
for(int i=0;i<mThreadCount;i++)
|
||||||
mEQWorkers[i].mProcessingType=processingType;
|
mEQWorkers[i].mProcessingType=processingType;
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
auto output = mEffectEqualization->mFactory->NewWaveTrack(floatSample, t->GetRate());
|
||||||
auto output = TrackFactory::Get( *p ).NewWaveTrack(floatSample, t->GetRate());
|
|
||||||
|
|
||||||
auto trackBlockSize = t->GetMaxBlockSize();
|
auto trackBlockSize = t->GetMaxBlockSize();
|
||||||
mEffectEqualization->TrackProgress(count, 0.0);
|
mEffectEqualization->TrackProgress(count, 0.0);
|
||||||
@ -1156,8 +1152,7 @@ bool EffectEqualization48x::ProcessOne8x(int count, WaveTrack * t,
|
|||||||
|
|
||||||
auto trackBlockSize = t->GetMaxBlockSize();
|
auto trackBlockSize = t->GetMaxBlockSize();
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
auto output = mEffectEqualization->mFactory->NewWaveTrack(floatSample, t->GetRate());
|
||||||
auto output = TrackFactory::Get( *p ).NewWaveTrack(floatSample, t->GetRate());
|
|
||||||
|
|
||||||
mEffectEqualization->TrackProgress(count, 0.0);
|
mEffectEqualization->TrackProgress(count, 0.0);
|
||||||
int bigRuns=len/(mSubBufferSize-mBlockSize);
|
int bigRuns=len/(mSubBufferSize-mBlockSize);
|
||||||
@ -1208,8 +1203,7 @@ bool EffectEqualization48x::ProcessOne8xThreaded(int count, WaveTrack * t,
|
|||||||
if(mThreadCount<=0 || blockCount<256) // dont do it without cores or big data
|
if(mThreadCount<=0 || blockCount<256) // dont do it without cores or big data
|
||||||
return ProcessOne4x(count, t, start, len);
|
return ProcessOne4x(count, t, start, len);
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
auto output = mEffectEqualization->mFactory->NewWaveTrack(floatSample, t->GetRate());
|
||||||
auto output = TrackFactory::Get( *p ).NewWaveTrack(floatSample, t->GetRate());
|
|
||||||
|
|
||||||
auto trackBlockSize = t->GetMaxBlockSize();
|
auto trackBlockSize = t->GetMaxBlockSize();
|
||||||
mEffectEqualization->TrackProgress(count, 0.0);
|
mEffectEqualization->TrackProgress(count, 0.0);
|
||||||
|
@ -133,9 +133,8 @@ bool EffectStereoToMono::ProcessOne(int count)
|
|||||||
Floats rightBuffer{ idealBlockLen };
|
Floats rightBuffer{ idealBlockLen };
|
||||||
bool bResult = true;
|
bool bResult = true;
|
||||||
|
|
||||||
AudacityProject *p = GetActiveProject();
|
|
||||||
auto outTrack =
|
auto outTrack =
|
||||||
TrackFactory::Get( *p ).NewWaveTrack(floatSample, mLeftTrack->GetRate());
|
mFactory->NewWaveTrack(floatSample, mLeftTrack->GetRate());
|
||||||
|
|
||||||
while (index < mEnd) {
|
while (index < mEnd) {
|
||||||
bResult &= mLeftTrack->Get((samplePtr)leftBuffer.get(), floatSample, index, idealBlockLen);
|
bResult &= mLeftTrack->Get((samplePtr)leftBuffer.get(), floatSample, index, idealBlockLen);
|
||||||
|
@ -297,7 +297,8 @@ Exporter::RegisteredExportPlugin::RegisteredExportPlugin(
|
|||||||
sFactories().emplace_back( factory );
|
sFactories().emplace_back( factory );
|
||||||
}
|
}
|
||||||
|
|
||||||
Exporter::Exporter()
|
Exporter::Exporter( AudacityProject &project )
|
||||||
|
: mProject{ &project }
|
||||||
{
|
{
|
||||||
mMixerSpec = NULL;
|
mMixerSpec = NULL;
|
||||||
mBook = NULL;
|
mBook = NULL;
|
||||||
@ -342,7 +343,7 @@ void Exporter::OnExtensionChanged(wxCommandEvent &evt) {
|
|||||||
|
|
||||||
void Exporter::OnHelp(wxCommandEvent& WXUNUSED(evt))
|
void Exporter::OnHelp(wxCommandEvent& WXUNUSED(evt))
|
||||||
{
|
{
|
||||||
wxWindow * pWin = FindProjectFrame( GetActiveProject() );
|
wxWindow * pWin = FindProjectFrame( mProject );
|
||||||
HelpSystem::ShowHelp(pWin, wxT("File_Export_Dialog"), true);
|
HelpSystem::ShowHelp(pWin, wxT("File_Export_Dialog"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,10 +401,9 @@ bool Exporter::DoEditMetadata(AudacityProject &project,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, double t1)
|
bool Exporter::Process(bool selectedOnly, double t0, double t1)
|
||||||
{
|
{
|
||||||
// Save parms
|
// Save parms
|
||||||
mProject = project;
|
|
||||||
mSelectedOnly = selectedOnly;
|
mSelectedOnly = selectedOnly;
|
||||||
mT0 = t0;
|
mT0 = t0;
|
||||||
mT1 = t1;
|
mT1 = t1;
|
||||||
@ -425,7 +425,7 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d
|
|||||||
|
|
||||||
// Let user edit MetaData
|
// Let user edit MetaData
|
||||||
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
|
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
|
||||||
if (!DoEditMetadata( *project,
|
if (!DoEditMetadata( *mProject,
|
||||||
XO("Edit Metadata Tags"), XO("Exported Tags"),
|
XO("Edit Metadata Tags"), XO("Exported Tags"),
|
||||||
ProjectSettings::Get( *mProject ).GetShowId3Dialog())) {
|
ProjectSettings::Get( *mProject ).GetShowId3Dialog())) {
|
||||||
return false;
|
return false;
|
||||||
@ -446,12 +446,11 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Exporter::Process(AudacityProject *project, unsigned numChannels,
|
bool Exporter::Process(unsigned numChannels,
|
||||||
const FileExtension &type, const wxString & filename,
|
const FileExtension &type, const wxString & filename,
|
||||||
bool selectedOnly, double t0, double t1)
|
bool selectedOnly, double t0, double t1)
|
||||||
{
|
{
|
||||||
// Save parms
|
// Save parms
|
||||||
mProject = project;
|
|
||||||
mChannels = numChannels;
|
mChannels = numChannels;
|
||||||
mFilename = filename;
|
mFilename = filename;
|
||||||
mSelectedOnly = selectedOnly;
|
mSelectedOnly = selectedOnly;
|
||||||
@ -1018,8 +1017,7 @@ void Exporter::OnFilterChanged(wxFileCtrlEvent & evt)
|
|||||||
mBook->ChangeSelection(index);
|
mBook->ChangeSelection(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Exporter::ProcessFromTimerRecording(AudacityProject *project,
|
bool Exporter::ProcessFromTimerRecording(bool selectedOnly,
|
||||||
bool selectedOnly,
|
|
||||||
double t0,
|
double t0,
|
||||||
double t1,
|
double t1,
|
||||||
wxFileName fnFile,
|
wxFileName fnFile,
|
||||||
@ -1028,7 +1026,6 @@ bool Exporter::ProcessFromTimerRecording(AudacityProject *project,
|
|||||||
int iFilterIndex)
|
int iFilterIndex)
|
||||||
{
|
{
|
||||||
// Save parms
|
// Save parms
|
||||||
mProject = project;
|
|
||||||
mSelectedOnly = selectedOnly;
|
mSelectedOnly = selectedOnly;
|
||||||
mT0 = t0;
|
mT0 = t0;
|
||||||
mT1 = t1;
|
mT1 = t1;
|
||||||
@ -1079,16 +1076,15 @@ wxFileName Exporter::GetAutoExportFileName() {
|
|||||||
return mFilename;
|
return mFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Exporter::SetAutoExportOptions(AudacityProject *project) {
|
bool Exporter::SetAutoExportOptions() {
|
||||||
mFormat = -1;
|
mFormat = -1;
|
||||||
mProject = project;
|
|
||||||
|
|
||||||
if( GetFilename()==false )
|
if( GetFilename()==false )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Let user edit MetaData
|
// Let user edit MetaData
|
||||||
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
|
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
|
||||||
if (!DoEditMetadata( *project,
|
if (!DoEditMetadata( *mProject,
|
||||||
XO("Edit Metadata Tags"),
|
XO("Edit Metadata Tags"),
|
||||||
XO("Exported Tags"),
|
XO("Exported Tags"),
|
||||||
ProjectSettings::Get(*mProject).GetShowId3Dialog())) {
|
ProjectSettings::Get(*mProject).GetShowId3Dialog())) {
|
||||||
|
@ -181,15 +181,15 @@ public:
|
|||||||
const TranslatableString &title,
|
const TranslatableString &title,
|
||||||
const TranslatableString &shortUndoDescription, bool force);
|
const TranslatableString &shortUndoDescription, bool force);
|
||||||
|
|
||||||
Exporter();
|
Exporter( AudacityProject &project );
|
||||||
virtual ~Exporter();
|
virtual ~Exporter();
|
||||||
|
|
||||||
void SetFileDialogTitle( const TranslatableString & DialogTitle );
|
void SetFileDialogTitle( const TranslatableString & DialogTitle );
|
||||||
void SetDefaultFormat( const FileExtension & Format ){ mFormatName = Format;};
|
void SetDefaultFormat( const FileExtension & Format ){ mFormatName = Format;};
|
||||||
|
|
||||||
bool Process(AudacityProject *project, bool selectedOnly,
|
bool Process(bool selectedOnly,
|
||||||
double t0, double t1);
|
double t0, double t1);
|
||||||
bool Process(AudacityProject *project, unsigned numChannels,
|
bool Process(unsigned numChannels,
|
||||||
const FileExtension &type, const wxString & filename,
|
const FileExtension &type, const wxString & filename,
|
||||||
bool selectedOnly, double t0, double t1);
|
bool selectedOnly, double t0, double t1);
|
||||||
|
|
||||||
@ -199,15 +199,14 @@ public:
|
|||||||
const ExportPluginArray &GetPlugins();
|
const ExportPluginArray &GetPlugins();
|
||||||
|
|
||||||
// Auto Export from Timer Recording
|
// Auto Export from Timer Recording
|
||||||
bool ProcessFromTimerRecording(AudacityProject *project,
|
bool ProcessFromTimerRecording(bool selectedOnly,
|
||||||
bool selectedOnly,
|
|
||||||
double t0,
|
double t0,
|
||||||
double t1,
|
double t1,
|
||||||
wxFileName fnFile,
|
wxFileName fnFile,
|
||||||
int iFormat,
|
int iFormat,
|
||||||
int iSubFormat,
|
int iSubFormat,
|
||||||
int iFilterIndex);
|
int iFilterIndex);
|
||||||
bool SetAutoExportOptions(AudacityProject *project);
|
bool SetAutoExportOptions();
|
||||||
int GetAutoExportFormat();
|
int GetAutoExportFormat();
|
||||||
int GetAutoExportSubFormat();
|
int GetAutoExportSubFormat();
|
||||||
int GetAutoExportFilterIndex();
|
int GetAutoExportFilterIndex();
|
||||||
|
@ -131,6 +131,7 @@ END_EVENT_TABLE()
|
|||||||
ExportMultipleDialog::ExportMultipleDialog(AudacityProject *project)
|
ExportMultipleDialog::ExportMultipleDialog(AudacityProject *project)
|
||||||
: wxDialogWrapper( &GetProjectFrame( *project ),
|
: wxDialogWrapper( &GetProjectFrame( *project ),
|
||||||
wxID_ANY, XO("Export Multiple") )
|
wxID_ANY, XO("Export Multiple") )
|
||||||
|
, mExporter{ *project }
|
||||||
, mSelectionState{ SelectionState::Get( *project ) }
|
, mSelectionState{ SelectionState::Get( *project ) }
|
||||||
{
|
{
|
||||||
SetName();
|
SetName();
|
||||||
|
@ -409,13 +409,14 @@ std::unique_ptr<ExtImportItem> Importer::CreateDefaultImportItem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns number of tracks imported
|
// returns number of tracks imported
|
||||||
bool Importer::Import(const FilePath &fName,
|
bool Importer::Import( AudacityProject &project,
|
||||||
|
const FilePath &fName,
|
||||||
TrackFactory *trackFactory,
|
TrackFactory *trackFactory,
|
||||||
TrackHolders &tracks,
|
TrackHolders &tracks,
|
||||||
Tags *tags,
|
Tags *tags,
|
||||||
TranslatableString &errorMessage)
|
TranslatableString &errorMessage)
|
||||||
{
|
{
|
||||||
AudacityProject *pProj = GetActiveProject();
|
AudacityProject *pProj = &project;
|
||||||
auto cleanup = valueRestorer( pProj->mbBusyImporting, true );
|
auto cleanup = valueRestorer( pProj->mbBusyImporting, true );
|
||||||
|
|
||||||
const FileExtension extension{ fName.AfterLast(wxT('.')) };
|
const FileExtension extension{ fName.AfterLast(wxT('.')) };
|
||||||
@ -589,7 +590,7 @@ bool Importer::Import(const FilePath &fName,
|
|||||||
{
|
{
|
||||||
// Try to open the file with this plugin (probe it)
|
// Try to open the file with this plugin (probe it)
|
||||||
wxLogMessage(wxT("Opening with %s"),plugin->GetPluginStringID());
|
wxLogMessage(wxT("Opening with %s"),plugin->GetPluginStringID());
|
||||||
auto inFile = plugin->Open(fName);
|
auto inFile = plugin->Open(fName, pProj);
|
||||||
if ( (inFile != NULL) && (inFile->GetStreamCount() > 0) )
|
if ( (inFile != NULL) && (inFile->GetStreamCount() > 0) )
|
||||||
{
|
{
|
||||||
wxLogMessage(wxT("Open(%s) succeeded"), fName);
|
wxLogMessage(wxT("Open(%s) succeeded"), fName);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
class wxArrayString;
|
class wxArrayString;
|
||||||
class wxListBox;
|
class wxListBox;
|
||||||
|
class AudacityProject;
|
||||||
class Tags;
|
class Tags;
|
||||||
class TrackFactory;
|
class TrackFactory;
|
||||||
class Track;
|
class Track;
|
||||||
@ -158,7 +159,8 @@ public:
|
|||||||
std::unique_ptr<ExtImportItem> CreateDefaultImportItem();
|
std::unique_ptr<ExtImportItem> CreateDefaultImportItem();
|
||||||
|
|
||||||
// if false, the import failed and errorMessage will be set.
|
// if false, the import failed and errorMessage will be set.
|
||||||
bool Import(const FilePath &fName,
|
bool Import( AudacityProject &project,
|
||||||
|
const FilePath &fName,
|
||||||
TrackFactory *trackFactory,
|
TrackFactory *trackFactory,
|
||||||
TrackHolders &tracks,
|
TrackHolders &tracks,
|
||||||
Tags *tags,
|
Tags *tags,
|
||||||
|
@ -183,7 +183,8 @@ public:
|
|||||||
TranslatableString GetPluginFormatDescription() override;
|
TranslatableString GetPluginFormatDescription() override;
|
||||||
|
|
||||||
///! Probes the file and opens it if appropriate
|
///! Probes the file and opens it if appropriate
|
||||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
std::unique_ptr<ImportFileHandle> Open(
|
||||||
|
const FilePath &Filename, AudacityProject*) override;
|
||||||
|
|
||||||
unsigned SequenceNumber() const override;
|
unsigned SequenceNumber() const override;
|
||||||
};
|
};
|
||||||
@ -291,7 +292,8 @@ TranslatableString FFmpegImportPlugin::GetPluginFormatDescription()
|
|||||||
return DESC;
|
return DESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ImportFileHandle> FFmpegImportPlugin::Open(const FilePath &filename)
|
std::unique_ptr<ImportFileHandle> FFmpegImportPlugin::Open(
|
||||||
|
const FilePath &filename, AudacityProject*)
|
||||||
{
|
{
|
||||||
auto handle = std::make_unique<FFmpegImportFileHandle>(filename);
|
auto handle = std::make_unique<FFmpegImportFileHandle>(filename);
|
||||||
|
|
||||||
|
@ -135,7 +135,8 @@ class FLACImportPlugin final : public ImportPlugin
|
|||||||
|
|
||||||
wxString GetPluginStringID() override { return wxT("libflac"); }
|
wxString GetPluginStringID() override { return wxT("libflac"); }
|
||||||
TranslatableString GetPluginFormatDescription() override;
|
TranslatableString GetPluginFormatDescription() override;
|
||||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
std::unique_ptr<ImportFileHandle> Open(
|
||||||
|
const FilePath &Filename, AudacityProject*) override;
|
||||||
|
|
||||||
unsigned SequenceNumber() const override;
|
unsigned SequenceNumber() const override;
|
||||||
};
|
};
|
||||||
@ -291,7 +292,8 @@ TranslatableString FLACImportPlugin::GetPluginFormatDescription()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<ImportFileHandle> FLACImportPlugin::Open(const FilePath &filename)
|
std::unique_ptr<ImportFileHandle> FLACImportPlugin::Open(
|
||||||
|
const FilePath &filename, AudacityProject*)
|
||||||
{
|
{
|
||||||
// First check if it really is a FLAC file
|
// First check if it really is a FLAC file
|
||||||
|
|
||||||
|
@ -247,7 +247,8 @@ public:
|
|||||||
FileExtensions GetSupportedExtensions() override;
|
FileExtensions GetSupportedExtensions() override;
|
||||||
|
|
||||||
///! Probes the file and opens it if appropriate
|
///! Probes the file and opens it if appropriate
|
||||||
std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) override;
|
std::unique_ptr<ImportFileHandle> Open(
|
||||||
|
const wxString &Filename, AudacityProject*) override;
|
||||||
|
|
||||||
unsigned SequenceNumber() const override;
|
unsigned SequenceNumber() const override;
|
||||||
};
|
};
|
||||||
@ -409,7 +410,8 @@ GStreamerImportPlugin::GetSupportedExtensions()
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Open the file and return an importer "file handle"
|
// Open the file and return an importer "file handle"
|
||||||
std::unique_ptr<ImportFileHandle> GStreamerImportPlugin::Open(const wxString &filename)
|
std::unique_ptr<ImportFileHandle> GStreamerImportPlugin::Open(
|
||||||
|
const wxString &filename, AudacityProject*)
|
||||||
{
|
{
|
||||||
auto handle = std::make_unique<GStreamerImportFileHandle>(filename);
|
auto handle = std::make_unique<GStreamerImportFileHandle>(filename);
|
||||||
|
|
||||||
|
@ -114,7 +114,8 @@ public:
|
|||||||
|
|
||||||
wxString GetPluginStringID() override { return wxT("lof"); }
|
wxString GetPluginStringID() override { return wxT("lof"); }
|
||||||
TranslatableString GetPluginFormatDescription() override;
|
TranslatableString GetPluginFormatDescription() override;
|
||||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
std::unique_ptr<ImportFileHandle> Open(
|
||||||
|
const FilePath &Filename, AudacityProject *pProject) override;
|
||||||
|
|
||||||
unsigned SequenceNumber() const override;
|
unsigned SequenceNumber() const override;
|
||||||
};
|
};
|
||||||
@ -123,7 +124,8 @@ public:
|
|||||||
class LOFImportFileHandle final : public ImportFileHandle
|
class LOFImportFileHandle final : public ImportFileHandle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LOFImportFileHandle(const FilePath & name, std::unique_ptr<wxTextFile> &&file);
|
LOFImportFileHandle( AudacityProject *pProject,
|
||||||
|
const FilePath & name, std::unique_ptr<wxTextFile> &&file);
|
||||||
~LOFImportFileHandle();
|
~LOFImportFileHandle();
|
||||||
|
|
||||||
TranslatableString GetFileDescription() override;
|
TranslatableString GetFileDescription() override;
|
||||||
@ -150,7 +152,7 @@ private:
|
|||||||
std::unique_ptr<wxTextFile> mTextFile;
|
std::unique_ptr<wxTextFile> mTextFile;
|
||||||
wxFileName mLOFFileName; /**< The name of the LOF file, which is used to
|
wxFileName mLOFFileName; /**< The name of the LOF file, which is used to
|
||||||
interpret relative paths in it */
|
interpret relative paths in it */
|
||||||
AudacityProject *mProject{ GetActiveProject() };
|
AudacityProject *mProject{};
|
||||||
|
|
||||||
// In order to know whether or not to create a NEW window
|
// In order to know whether or not to create a NEW window
|
||||||
bool windowCalledOnce{ false };
|
bool windowCalledOnce{ false };
|
||||||
@ -164,11 +166,12 @@ private:
|
|||||||
double scrollOffset{ 0 };
|
double scrollOffset{ 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
LOFImportFileHandle::LOFImportFileHandle
|
LOFImportFileHandle::LOFImportFileHandle( AudacityProject *pProject,
|
||||||
(const FilePath & name, std::unique_ptr<wxTextFile> &&file)
|
const FilePath & name, std::unique_ptr<wxTextFile> &&file)
|
||||||
: ImportFileHandle(name),
|
: ImportFileHandle(name)
|
||||||
mTextFile(std::move(file))
|
, mTextFile(std::move(file))
|
||||||
, mLOFFileName{name}
|
, mLOFFileName{name}
|
||||||
|
, mProject{ pProject }
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +180,8 @@ TranslatableString LOFImportPlugin::GetPluginFormatDescription()
|
|||||||
return DESC;
|
return DESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ImportFileHandle> LOFImportPlugin::Open(const FilePath &filename)
|
std::unique_ptr<ImportFileHandle> LOFImportPlugin::Open(
|
||||||
|
const FilePath &filename, AudacityProject *pProject)
|
||||||
{
|
{
|
||||||
// Check if it is a binary file
|
// Check if it is a binary file
|
||||||
{
|
{
|
||||||
@ -208,7 +212,8 @@ std::unique_ptr<ImportFileHandle> LOFImportPlugin::Open(const FilePath &filename
|
|||||||
if (!file->IsOpened())
|
if (!file->IsOpened())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return std::make_unique<LOFImportFileHandle>(filename, std::move(file));
|
return std::make_unique<LOFImportFileHandle>(
|
||||||
|
pProject, filename, std::move(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslatableString LOFImportFileHandle::GetFileDescription()
|
TranslatableString LOFImportFileHandle::GetFileDescription()
|
||||||
|
@ -115,7 +115,8 @@ public:
|
|||||||
|
|
||||||
wxString GetPluginStringID() override { return wxT("libmad"); }
|
wxString GetPluginStringID() override { return wxT("libmad"); }
|
||||||
TranslatableString GetPluginFormatDescription() override;
|
TranslatableString GetPluginFormatDescription() override;
|
||||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
std::unique_ptr<ImportFileHandle> Open(
|
||||||
|
const FilePath &Filename, AudacityProject*) override;
|
||||||
|
|
||||||
unsigned SequenceNumber() const override;
|
unsigned SequenceNumber() const override;
|
||||||
};
|
};
|
||||||
@ -177,7 +178,8 @@ TranslatableString MP3ImportPlugin::GetPluginFormatDescription()
|
|||||||
return DESC;
|
return DESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ImportFileHandle> MP3ImportPlugin::Open(const FilePath &Filename)
|
std::unique_ptr<ImportFileHandle> MP3ImportPlugin::Open(
|
||||||
|
const FilePath &Filename, AudacityProject*)
|
||||||
{
|
{
|
||||||
auto file = std::make_unique<wxFile>(Filename);
|
auto file = std::make_unique<wxFile>(Filename);
|
||||||
|
|
||||||
|
@ -89,7 +89,8 @@ public:
|
|||||||
|
|
||||||
wxString GetPluginStringID() override { return wxT("liboggvorbis"); }
|
wxString GetPluginStringID() override { return wxT("liboggvorbis"); }
|
||||||
TranslatableString GetPluginFormatDescription() override;
|
TranslatableString GetPluginFormatDescription() override;
|
||||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
std::unique_ptr<ImportFileHandle> Open(
|
||||||
|
const FilePath &Filename, AudacityProject*) override;
|
||||||
|
|
||||||
unsigned SequenceNumber() const override;
|
unsigned SequenceNumber() const override;
|
||||||
};
|
};
|
||||||
@ -167,7 +168,8 @@ TranslatableString OggImportPlugin::GetPluginFormatDescription()
|
|||||||
return DESC;
|
return DESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ImportFileHandle> OggImportPlugin::Open(const FilePath &filename)
|
std::unique_ptr<ImportFileHandle> OggImportPlugin::Open(
|
||||||
|
const FilePath &filename, AudacityProject*)
|
||||||
{
|
{
|
||||||
// Suppress some compiler warnings about unused global variables in the library header
|
// Suppress some compiler warnings about unused global variables in the library header
|
||||||
wxUnusedVar(OV_CALLBACKS_DEFAULT);
|
wxUnusedVar(OV_CALLBACKS_DEFAULT);
|
||||||
|
@ -87,7 +87,8 @@ public:
|
|||||||
|
|
||||||
wxString GetPluginStringID() override { return wxT("libsndfile"); }
|
wxString GetPluginStringID() override { return wxT("libsndfile"); }
|
||||||
TranslatableString GetPluginFormatDescription() override;
|
TranslatableString GetPluginFormatDescription() override;
|
||||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
std::unique_ptr<ImportFileHandle> Open(
|
||||||
|
const FilePath &Filename, AudacityProject*) override;
|
||||||
|
|
||||||
unsigned SequenceNumber() const override;
|
unsigned SequenceNumber() const override;
|
||||||
};
|
};
|
||||||
@ -126,7 +127,8 @@ TranslatableString PCMImportPlugin::GetPluginFormatDescription()
|
|||||||
return DESC;
|
return DESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ImportFileHandle> PCMImportPlugin::Open(const FilePath &filename)
|
std::unique_ptr<ImportFileHandle> PCMImportPlugin::Open(
|
||||||
|
const FilePath &filename, AudacityProject*)
|
||||||
{
|
{
|
||||||
SF_INFO info;
|
SF_INFO info;
|
||||||
wxFile f; // will be closed when it goes out of scope
|
wxFile f; // will be closed when it goes out of scope
|
||||||
|
@ -52,6 +52,7 @@ but little else.
|
|||||||
|
|
||||||
#include "ImportRaw.h" // defines TrackHolders
|
#include "ImportRaw.h" // defines TrackHolders
|
||||||
|
|
||||||
|
class AudacityProject;
|
||||||
class wxArrayString;
|
class wxArrayString;
|
||||||
class ProgressDialog;
|
class ProgressDialog;
|
||||||
enum class ProgressResult : unsigned;
|
enum class ProgressResult : unsigned;
|
||||||
@ -92,7 +93,8 @@ public:
|
|||||||
// Open the given file, returning true if it is in a recognized
|
// Open the given file, returning true if it is in a recognized
|
||||||
// format, false otherwise. This puts the importer into the open
|
// format, false otherwise. This puts the importer into the open
|
||||||
// state.
|
// state.
|
||||||
virtual std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) = 0;
|
virtual std::unique_ptr<ImportFileHandle> Open(
|
||||||
|
const FilePath &Filename, AudacityProject*) = 0;
|
||||||
|
|
||||||
virtual unsigned SequenceNumber() const = 0;
|
virtual unsigned SequenceNumber() const = 0;
|
||||||
|
|
||||||
|
@ -122,7 +122,8 @@ class QTImportPlugin final : public ImportPlugin
|
|||||||
wxString GetPluginStringID() override { return wxT("quicktime"); }
|
wxString GetPluginStringID() override { return wxT("quicktime"); }
|
||||||
|
|
||||||
TranslatableString GetPluginFormatDescription() override;
|
TranslatableString GetPluginFormatDescription() override;
|
||||||
std::unique_ptr<ImportFileHandle> Open(const wxString & Filename) override;
|
std::unique_ptr<ImportFileHandle> Open(
|
||||||
|
const wxString & Filename, AudacityProject*) override;
|
||||||
|
|
||||||
unsigned SequenceNumber() const override;
|
unsigned SequenceNumber() const override;
|
||||||
|
|
||||||
@ -180,7 +181,8 @@ TranslatableString QTImportPlugin::GetPluginFormatDescription()
|
|||||||
return DESC;
|
return DESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ImportFileHandle> QTImportPlugin::Open(const wxString & Filename)
|
std::unique_ptr<ImportFileHandle> QTImportPlugin::Open(
|
||||||
|
const wxString & Filename, AudacityProject*)
|
||||||
{
|
{
|
||||||
OSErr err;
|
OSErr err;
|
||||||
FSRef inRef;
|
FSRef inRef;
|
||||||
|
@ -40,7 +40,7 @@ void DoExport( AudacityProject &project, const FileExtension & Format )
|
|||||||
{
|
{
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
|
|
||||||
Exporter e;
|
Exporter e{ project };
|
||||||
|
|
||||||
MissingAliasFilesDialog::SetShouldShow(true);
|
MissingAliasFilesDialog::SetShouldShow(true);
|
||||||
double t0 = 0.0;
|
double t0 = 0.0;
|
||||||
@ -85,16 +85,15 @@ void DoExport( AudacityProject &project, const FileExtension & Format )
|
|||||||
{
|
{
|
||||||
// Do export with prompting.
|
// Do export with prompting.
|
||||||
e.SetDefaultFormat(Format);
|
e.SetDefaultFormat(Format);
|
||||||
e.Process(&project, false, t0, t1);
|
e.Process(false, t0, t1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FileHistory::Global().AddFileToHistory(filename);
|
FileHistory::Global().AddFileToHistory(filename);
|
||||||
// We're in batch mode, the file does not exist already.
|
// We're in batch mode, the file does not exist already.
|
||||||
// We really can proceed without prompting.
|
// We really can proceed without prompting.
|
||||||
int nChannels = MacroCommands::IsMono() ? 1 : 2;
|
int nChannels = MacroCommands::IsMono( &project ) ? 1 : 2;
|
||||||
e.Process(
|
e.Process(
|
||||||
&project, // AudacityProject
|
|
||||||
nChannels, // numChannels,
|
nChannels, // numChannels,
|
||||||
Format, // type,
|
Format, // type,
|
||||||
filename, // filename,
|
filename, // filename,
|
||||||
@ -201,11 +200,11 @@ void OnExportSelection(const CommandContext &context)
|
|||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||||
Exporter e;
|
Exporter e{ project };
|
||||||
|
|
||||||
MissingAliasFilesDialog::SetShouldShow(true);
|
MissingAliasFilesDialog::SetShouldShow(true);
|
||||||
e.SetFileDialogTitle( XO("Export Selected Audio") );
|
e.SetFileDialogTitle( XO("Export Selected Audio") );
|
||||||
e.Process(&project, true, selectedRegion.t0(),
|
e.Process(true, selectedRegion.t0(),
|
||||||
selectedRegion.t1());
|
selectedRegion.t1());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ AudacityProject::AttachedWindows::RegisteredFactory sMacrosWindowKey{
|
|||||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||||
auto &window = ProjectWindow::Get( parent );
|
auto &window = ProjectWindow::Get( parent );
|
||||||
return safenew MacrosWindow(
|
return safenew MacrosWindow(
|
||||||
&window, true
|
&window, parent, true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -543,7 +543,7 @@ void OnApplyMacroDirectly(const CommandContext &context )
|
|||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
|
|
||||||
//wxLogDebug( "Macro was: %s", context.parameter);
|
//wxLogDebug( "Macro was: %s", context.parameter);
|
||||||
ApplyMacroDialog dlg( &window );
|
ApplyMacroDialog dlg( &window, project );
|
||||||
const auto &Name = context.parameter;
|
const auto &Name = context.parameter;
|
||||||
|
|
||||||
// We used numbers previously, but macros could get renumbered, making
|
// We used numbers previously, but macros could get renumbered, making
|
||||||
|
@ -1029,10 +1029,10 @@ void OnScoreAlign(const CommandContext &context)
|
|||||||
params.mAudioStart, params.mAudioEnd) );
|
params.mAudioStart, params.mAudioEnd) );
|
||||||
} else if (result == SA_CANCEL) {
|
} else if (result == SA_CANCEL) {
|
||||||
// wrong way to recover...
|
// wrong way to recover...
|
||||||
//GetActiveProject()->OnUndo(); // recover any changes to note track
|
//project.OnUndo(); // recover any changes to note track
|
||||||
return; // no message when user cancels alignment
|
return; // no message when user cancels alignment
|
||||||
} else {
|
} else {
|
||||||
//GetActiveProject()->OnUndo(); // recover any changes to note track
|
//project.OnUndo(); // recover any changes to note track
|
||||||
AudacityMessageBox( XO("Internal error reported by alignment process.") );
|
AudacityMessageBox( XO("Internal error reported by alignment process.") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,6 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../../include/audacity/Types.h"
|
#include "../../../include/audacity/Types.h"
|
||||||
|
|
||||||
class AudacityProject;
|
class AudacityProject;
|
||||||
extern AudacityProject *GetActiveProject();
|
|
||||||
class TranslatableString;
|
class TranslatableString;
|
||||||
|
|
||||||
// Conditionally compile either a separate thead, or else use a timer in the main
|
// Conditionally compile either a separate thead, or else use a timer in the main
|
||||||
@ -127,7 +126,7 @@ public:
|
|||||||
// Convenience wrapper for the above
|
// Convenience wrapper for the above
|
||||||
template<void (Scrubber::*pfn)(const CommandContext&)>
|
template<void (Scrubber::*pfn)(const CommandContext&)>
|
||||||
void Thunk(wxCommandEvent &)
|
void Thunk(wxCommandEvent &)
|
||||||
{ (this->*pfn)(*GetActiveProject()); }
|
{ (this->*pfn)(*mProject); }
|
||||||
|
|
||||||
// A string to put in the leftmost part of the status bar
|
// A string to put in the leftmost part of the status bar
|
||||||
// when scrub or seek is in progress, or else empty.
|
// when scrub or seek is in progress, or else empty.
|
||||||
|
@ -96,7 +96,7 @@ UIHandle::Result TrackSelectHandle::Click
|
|||||||
result |= Cancelled;
|
result |= Cancelled;
|
||||||
else {
|
else {
|
||||||
mRearrangeCount = 0;
|
mRearrangeCount = 0;
|
||||||
CalculateRearrangingThresholds(event);
|
CalculateRearrangingThresholds(event, pProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectUtilities::DoListSelection(*pProject,
|
SelectUtilities::DoListSelection(*pProject,
|
||||||
@ -135,7 +135,7 @@ UIHandle::Result TrackSelectHandle::Drag
|
|||||||
|
|
||||||
// JH: if we moved up or down, recalculate the thresholds and make sure the
|
// JH: if we moved up or down, recalculate the thresholds and make sure the
|
||||||
// track is fully on-screen.
|
// track is fully on-screen.
|
||||||
CalculateRearrangingThresholds(event);
|
CalculateRearrangingThresholds(event, pProject);
|
||||||
|
|
||||||
result |= EnsureVisible | RefreshAll;
|
result |= EnsureVisible | RefreshAll;
|
||||||
return result;
|
return result;
|
||||||
@ -154,7 +154,7 @@ HitTestPreview TrackSelectHandle::Preview
|
|||||||
::MakeCursor(wxCURSOR_HAND, RearrangeCursorXpm, 16, 16);
|
::MakeCursor(wxCURSOR_HAND, RearrangeCursorXpm, 16, 16);
|
||||||
|
|
||||||
const bool unsafe =
|
const bool unsafe =
|
||||||
ProjectAudioIO::Get( *GetActiveProject() ).IsAudioActive();
|
ProjectAudioIO::Get( *project ).IsAudioActive();
|
||||||
return {
|
return {
|
||||||
message,
|
message,
|
||||||
(unsafe
|
(unsafe
|
||||||
@ -176,12 +176,11 @@ HitTestPreview TrackSelectHandle::Preview
|
|||||||
}
|
}
|
||||||
|
|
||||||
UIHandle::Result TrackSelectHandle::Release
|
UIHandle::Result TrackSelectHandle::Release
|
||||||
(const TrackPanelMouseEvent &, AudacityProject *, wxWindow *)
|
(const TrackPanelMouseEvent &, AudacityProject *project, wxWindow *)
|
||||||
{
|
{
|
||||||
// If we're releasing, surely we are dragging a track?
|
// If we're releasing, surely we are dragging a track?
|
||||||
wxASSERT( mpTrack );
|
wxASSERT( mpTrack );
|
||||||
if (mRearrangeCount != 0) {
|
if (mRearrangeCount != 0) {
|
||||||
AudacityProject *const project = ::GetActiveProject();
|
|
||||||
ProjectHistory::Get( *project ).PushState(
|
ProjectHistory::Get( *project ).PushState(
|
||||||
/* i18n-hint: will substitute name of track for %s */
|
/* i18n-hint: will substitute name of track for %s */
|
||||||
( mRearrangeCount < 0 ? XO("Moved '%s' up") : XO("Moved '%s' down") )
|
( mRearrangeCount < 0 ? XO("Moved '%s' up") : XO("Moved '%s' down") )
|
||||||
@ -207,13 +206,13 @@ UIHandle::Result TrackSelectHandle::Cancel(AudacityProject *pProject)
|
|||||||
|
|
||||||
/// Figure out how far the user must drag the mouse up or down
|
/// Figure out how far the user must drag the mouse up or down
|
||||||
/// before the track will swap with the one above or below
|
/// before the track will swap with the one above or below
|
||||||
void TrackSelectHandle::CalculateRearrangingThresholds(const wxMouseEvent & event)
|
void TrackSelectHandle::CalculateRearrangingThresholds(
|
||||||
|
const wxMouseEvent & event, AudacityProject *project)
|
||||||
{
|
{
|
||||||
// JH: this will probably need to be tweaked a bit, I'm just
|
// JH: this will probably need to be tweaked a bit, I'm just
|
||||||
// not sure what formula will have the best feel for the
|
// not sure what formula will have the best feel for the
|
||||||
// user.
|
// user.
|
||||||
|
|
||||||
AudacityProject *const project = ::GetActiveProject();
|
|
||||||
auto &tracks = TrackList::Get( *project );
|
auto &tracks = TrackList::Get( *project );
|
||||||
|
|
||||||
if (tracks.CanMoveUp(mpTrack.get()))
|
if (tracks.CanMoveUp(mpTrack.get()))
|
||||||
|
@ -59,7 +59,8 @@ private:
|
|||||||
int mMoveDownThreshold {};
|
int mMoveDownThreshold {};
|
||||||
int mRearrangeCount {};
|
int mRearrangeCount {};
|
||||||
|
|
||||||
void CalculateRearrangingThresholds(const wxMouseEvent & event);
|
void CalculateRearrangingThresholds(
|
||||||
|
const wxMouseEvent & event, AudacityProject *project);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user