1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Remove CommandContext::GetProject() ...

... which called ::GetActiveProject(), but one purpose of the CommandContext
class was to eliminate many uses of that global function, because a
CommandContext must always be constructed from a reference to a project
(which was always in fact the active one), then passed around to where it is
needed!

Also, just use the project member directly -- because CommandContext was
intended as just a P.O.D (plain-old-data) structure.

This also eliminates a dependency of CommandContext.cpp on Project.cpp.

This is not enough by itself to break any dependency cycles.
This commit is contained in:
Paul Licameli
2019-05-11 16:19:43 -04:00
parent 1c0453106d
commit 9eb9104859
16 changed files with 86 additions and 90 deletions

View File

@@ -40,7 +40,7 @@ void ImportCommand::PopulateOrExchange(ShuttleGui & S)
}
bool ImportCommand::Apply(const CommandContext & context){
return context.GetProject()->Import(mFileName);
return context.project.Import(mFileName);
}
@@ -66,8 +66,8 @@ void ExportCommand::PopulateOrExchange(ShuttleGui & S)
bool ExportCommand::Apply(const CommandContext & context)
{
double t0, t1;
t0 = context.GetProject()->mViewInfo.selectedRegion.t0();
t1 = context.GetProject()->mViewInfo.selectedRegion.t1();
t0 = context.project.mViewInfo.selectedRegion.t0();
t1 = context.project.mViewInfo.selectedRegion.t1();
// Find the extension and check it's valid
int splitAt = mFileName.Find(wxUniChar('.'), true);
@@ -80,7 +80,7 @@ bool ExportCommand::Apply(const CommandContext & context)
Exporter exporter;
bool exportSuccess = exporter.Process(context.GetProject(),
bool exportSuccess = exporter.Process(&context.project,
std::max(0, mnChannels),
extension, mFileName,
true, t0, t1);