1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-16 16:47:41 +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,
double projectRate,
bool Effect::DoEffect(double projectRate,
TrackList *list,
TrackFactory *factory,
NotifyingSelectedRegion &selectedRegion,
wxWindow *pParent,
const EffectDialogFactory &dialogFactory)
{
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
// been configured, e.g. repeating the last effect on a different selection.
// Prompting may call Effect::Preview
if ( dialogFactory &&
if ( pParent && dialogFactory &&
IsInteractive() &&
!ShowInterface(parent, dialogFactory, IsBatchProcessing()) )
!ShowInterface( *pParent, dialogFactory, IsBatchProcessing() ) )
{
return false;
}
@ -1224,8 +1224,8 @@ bool Effect::Delegate(
NotifyingSelectedRegion region;
region.setTimes( mT0, mT1 );
return delegate.DoEffect( parent, mProjectRate, mTracks, mFactory,
region, factory );
return delegate.DoEffect( mProjectRate, mTracks, mFactory,
region, &parent, factory );
}
// 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
// Audacity's standard UI.
// 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,
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,
wxWindow &parent, const EffectDialogFactory &factory );

View File

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