1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-09 08:53:23 +02:00

Parent and dialog factory arguments of Effect::DoEffect are optional

This commit is contained in:
Paul Licameli 2020-01-08 16:33:09 -05:00
parent 04a9ce8ba6
commit e8c8db8b33
3 changed files with 12 additions and 9 deletions

View File

@ -1096,11 +1096,11 @@ void Effect::SetBatchProcessing(bool start)
} }
} }
bool Effect::DoEffect(wxWindow &parent, bool Effect::DoEffect(double projectRate,
double projectRate,
TrackList *list, TrackList *list,
TrackFactory *factory, TrackFactory *factory,
NotifyingSelectedRegion &selectedRegion, NotifyingSelectedRegion &selectedRegion,
wxWindow *pParent,
const EffectDialogFactory &dialogFactory) const EffectDialogFactory &dialogFactory)
{ {
wxASSERT(selectedRegion.duration() >= 0.0); wxASSERT(selectedRegion.duration() >= 0.0);
@ -1187,9 +1187,9 @@ bool Effect::DoEffect(wxWindow &parent,
// Prompting will be bypassed when applying an effect that has already // Prompting will be bypassed when applying an effect that has already
// been configured, e.g. repeating the last effect on a different selection. // been configured, e.g. repeating the last effect on a different selection.
// Prompting may call Effect::Preview // Prompting may call Effect::Preview
if ( dialogFactory && if ( pParent && dialogFactory &&
IsInteractive() && IsInteractive() &&
!ShowInterface(parent, dialogFactory, IsBatchProcessing()) ) !ShowInterface( *pParent, dialogFactory, IsBatchProcessing() ) )
{ {
return false; return false;
} }
@ -1224,8 +1224,8 @@ bool Effect::Delegate(
NotifyingSelectedRegion region; NotifyingSelectedRegion region;
region.setTimes( mT0, mT1 ); region.setTimes( mT0, mT1 );
return delegate.DoEffect( parent, mProjectRate, mTracks, mFactory, return delegate.DoEffect( mProjectRate, mTracks, mFactory,
region, factory ); region, &parent, factory );
} }
// All legacy effects should have this overridden // All legacy effects should have this overridden

View File

@ -255,9 +255,11 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
// have the "selected" flag set to true, which is consistent with // have the "selected" flag set to true, which is consistent with
// Audacity's standard UI. // Audacity's standard UI.
// Create a user interface only if the supplied function is not null. // Create a user interface only if the supplied function is not null.
/* not virtual */ bool DoEffect(wxWindow &parent, double projectRate, TrackList *list, /* not virtual */ bool DoEffect( double projectRate, TrackList *list,
TrackFactory *factory, NotifyingSelectedRegion &selectedRegion, TrackFactory *factory, NotifyingSelectedRegion &selectedRegion,
const EffectDialogFactory &dialogFactory ); // Prompt the user for input only if these arguments are both not null.
wxWindow *pParent = nullptr,
const EffectDialogFactory &dialogFactory = {} );
bool Delegate( Effect &delegate, bool Delegate( Effect &delegate,
wxWindow &parent, const EffectDialogFactory &factory ); wxWindow &parent, const EffectDialogFactory &factory );

View File

@ -1924,11 +1924,12 @@ wxDialog *EffectUI::DialogFactory( wxWindow &parent, EffectHostInterface *pHost,
EffectRack::Get( context.project ).Add(effect); EffectRack::Get( context.project ).Add(effect);
} }
#endif #endif
success = effect->DoEffect(window, success = effect->DoEffect(
rate, rate,
&tracks, &tracks,
&trackFactory, &trackFactory,
selectedRegion, selectedRegion,
&window,
(flags & EffectManager::kConfigured) == 0 (flags & EffectManager::kConfigured) == 0
? DialogFactory ? DialogFactory
: nullptr : nullptr