Audacity 3.2.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
EffectUIServices Class Referenceabstract

#include <EffectUIServices.h>

Inheritance diagram for EffectUIServices:
[legend]

Public Types

enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 

Public Member Functions

virtual ~EffectUIServices ()
 
virtual int ShowHostInterface (EffectBase &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)
 
virtual int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal=false) const =0
 
virtual std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const =0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const =0
 
virtual OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const =0
 
virtual void ShowOptions (const EffectPlugin &plugin) const =0
 
virtual bool ValidateUI (const EffectPlugin &context, EffectSettings &settings) const =0
 
virtual bool CloseUI () const =0
 

Static Public Member Functions

static int DoMessageBox (const EffectPlugin &plugin, const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 

Detailed Description

Abstract base class to populate a UI and validate UI values. It can import and export presets.

Definition at line 46 of file EffectUIServices.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : long
Enumerator
DefaultMessageBoxStyle 

Definition at line 51 of file EffectUIServices.h.

51: long { DefaultMessageBoxStyle = wxOK | wxCENTRE };

Constructor & Destructor Documentation

◆ ~EffectUIServices()

EffectUIServices::~EffectUIServices ( )
virtualdefault

Member Function Documentation

◆ CloseUI()

virtual bool EffectUIServices::CloseUI ( ) const
pure virtual

Implemented in AudioUnitEffect, BasicEffectUIServices, and LV2Effect.

Referenced by EffectEditor::OnClose().

Here is the caller graph for this function:

◆ DoMessageBox()

int EffectUIServices::DoMessageBox ( const EffectPlugin plugin,
const TranslatableString message,
long  style = DefaultMessageBoxStyle,
const TranslatableString titleStr = {} 
)
static

Definition at line 44 of file EffectUIServices.cpp.

47{
48 auto title = titleStr.empty()
49 ? plugin.GetName()
50 : XO("%s: %s").Format(plugin.GetName(), titleStr);
51 return AudacityMessageBox(message, title, style);
52}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
XO("Cut/Copy/Paste")
static const auto title
TranslatableString GetName() const

References AudacityMessageBox(), TranslatableString::empty(), ComponentInterface::GetName(), anonymous_namespace{AudacityDontAskAgainMessageDialog.cpp}::style, title, and XO().

Referenced by BasicEffectUIServices::ImportPresets(), VampEffect::Init(), NyquistEffect::OnLoad(), NyquistEffect::OnSave(), NyquistEffect::OnTime(), VampEffect::Process(), and NyquistEffect::TransferDataFromEffectWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExportPresets()

virtual void EffectUIServices::ExportPresets ( const EffectPlugin plugin,
const EffectSettings settings 
) const
pure virtual

Implemented in AudioUnitEffect, BasicEffectUIServices, LadspaEffect, LV2Effect, VSTEffect, and VST3Effect.

Referenced by EffectUIHost::OnExport().

Here is the caller graph for this function:

◆ ImportPresets()

virtual OptionalMessage EffectUIServices::ImportPresets ( const EffectPlugin plugin,
EffectSettings settings 
) const
pure virtual
Returns
nullopt for failure

Implemented in AudioUnitEffect, BasicEffectUIServices, LadspaEffect, LV2Effect, VSTEffect, and VST3Effect.

Referenced by EffectUIHost::OnImport().

Here is the caller graph for this function:

◆ PopulateUI()

virtual std::unique_ptr< EffectEditor > EffectUIServices::PopulateUI ( const EffectPlugin plugin,
ShuttleGui S,
EffectInstance instance,
EffectSettingsAccess access,
const EffectOutputs pOutputs 
) const
pure virtual

Adds controls to a panel that is given as the parent window of S

Parameters
Sinterface for adding controls to a panel in a dialog
instanceguaranteed to have a lifetime containing that of the returned object
accessguaranteed to have a lifetime containing that of the returned object
pOutputsnull, or else points to outputs with lifetime containing that of the returned object
Returns
null for failure; else an object invoked to retrieve values of UI controls; it might also hold some state needed to implement event handlers of the controls; it will exist only while the dialog continues to exist

Implemented in AudioUnitEffect, LV2Effect, StatefulEffectUIServices, StatelessEffectUIServices, VSTEffect, and VST3Effect.

Referenced by EffectUIHost::Initialize().

Here is the caller graph for this function:

◆ ShowClientInterface()

virtual int EffectUIServices::ShowClientInterface ( const EffectPlugin plugin,
wxWindow &  parent,
wxDialog &  dialog,
EffectEditor pEditor,
bool  forceModal = false 
) const
pure virtual
Returns
0 if destructive effect processing should not proceed (and there may be a non-modal dialog still opened); otherwise, modal dialog return code

Implemented in AudioUnitEffect, BasicEffectUIServices, LadspaEffect, LV2Effect, VSTEffect, and VST3Effect.

Referenced by ShowHostInterface().

Here is the caller graph for this function:

◆ ShowHostInterface()

int EffectUIServices::ShowHostInterface ( EffectBase plugin,
wxWindow &  parent,
const EffectDialogFactory factory,
std::shared_ptr< EffectInstance > &  pInstance,
EffectSettingsAccess access,
bool  forceModal = false 
)
virtual

The only non-const member function, it usually applies factory to plugin and self and given access

But there are a few unusual overrides for historical reasons that may ignore the factory.

Parameters
pInstancemay be passed to factory, and is only guaranteed to have lifetime suitable for a modal dialog, unless the dialog stores a copy of pInstance
accessis only guaranteed to have lifetime suitable for a modal dialog, unless the dialog stores access.shared_from_this()
Returns
0 if destructive effect processing should not proceed (and there may be a non-modal dialog still opened); otherwise, modal dialog return code

Reimplemented in EffectNoiseReduction, and NyquistEffect.

Definition at line 16 of file EffectUIServices.cpp.

21{
22 if (!plugin.IsInteractive())
23 // Effect without UI just proceeds quietly to apply it destructively.
24 return wxID_APPLY;
25
26 // Create the dialog
27 auto results = factory(parent, plugin, *this, access);
28 auto pDialog = results.pDialog;
29 pInstance = results.pInstance;
30 if (!pDialog)
31 return 0;
32
33 // Let the derived class show the dialog and decide whether to keep it open
34 auto result = ShowClientInterface(plugin, parent, *pDialog,
35 results.pEditor, forceModal);
36 if (pDialog && !pDialog->IsShown())
37 // Derived class didn't show it, or showed it modally and closed it
38 // So destroy it.
39 pDialog->Destroy();
40
41 return result;
42}
static RegisteredToolbarFactory factory
virtual bool IsInteractive() const =0
Whether the effect needs a dialog for entry of settings.
virtual int ShowClientInterface(const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal=false) const =0

References factory, EffectDefinitionInterface::IsInteractive(), and ShowClientInterface().

Referenced by EffectUI::DoEffect(), EVT_COMMAND_RANGE(), and MacroCommands::PromptForParamsFor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowOptions()

virtual void EffectUIServices::ShowOptions ( const EffectPlugin plugin) const
pure virtual

Implemented in AudioUnitEffect, BasicEffectUIServices, LadspaEffect, LV2Effect, VSTEffect, and VST3Effect.

Referenced by EffectUIHost::OnOptions().

Here is the caller graph for this function:

◆ ValidateUI()

virtual bool EffectUIServices::ValidateUI ( const EffectPlugin context,
EffectSettings settings 
) const
pure virtual

Implemented in BasicEffectUIServices, and EffectEqualization.

Referenced by anonymous_namespace{StatefulEffectUIServices.cpp}::DefaultEffectEditor::ValidateUI().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: