Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
EffectUIValidator Class Referenceabstract

Interface for transferring values from a panel of effect controls. More...

#include <EffectPlugin.h>

Inheritance diagram for EffectUIValidator:
[legend]
Collaboration diagram for EffectUIValidator:
[legend]

Public Member Functions

 EffectUIValidator (EffectUIClientInterface &effect, EffectSettingsAccess &access)
 
virtual ~EffectUIValidator ()
 
virtual bool ValidateUI ()=0
 Get settings data from the panel; may make error dialogs and return false. More...
 
virtual bool UpdateUI ()
 Update appearance of the panel for changes in settings. More...
 
virtual bool IsGraphicalUI ()
 
virtual void Disconnect ()
 On the first call only, may disconnect from further event handling. More...
 
virtual void OnClose ()
 
- Public Member Functions inherited from Observer::Publisher< EffectSettingChanged >
 Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={})
 Constructor supporting type-erased custom allocation/deletion. More...
 
 Publisher (Publisher &&)=default
 
Publisheroperator= (Publisher &&)=default
 
Subscription Subscribe (Callback callback)
 Connect a callback to the Publisher; later-connected are called earlier. More...
 
Subscription Subscribe (Object &obj, Return(Object::*callback)(Args...))
 Overload of Subscribe takes an object and pointer-to-member-function. More...
 

Static Public Member Functions

static bool EnableApply (wxWindow *parent, bool enable=true)
 Enable or disable the Apply button of the dialog that contains parent. More...
 
static bool EnablePreview (wxWindow *parent, bool enable=true)
 

Static Public Attributes

static constexpr int kPlayID = 20102
 
- Static Public Attributes inherited from Observer::Publisher< EffectSettingChanged >
static constexpr bool notifies_all
 

Protected Member Functions

template<typename EventTag , typename Class , typename Event >
void BindTo (wxEvtHandler &src, const EventTag &eventType, void(Class::*pmf)(Event &))
 
- Protected Member Functions inherited from Observer::Publisher< EffectSettingChanged >
CallbackReturn Publish (const EffectSettingChanged &message)
 Send a message to connected callbacks. More...
 

Protected Attributes

EffectUIClientInterfacemEffect
 
EffectSettingsAccessmAccess
 
bool mUIClosed { false }
 

Additional Inherited Members

- Public Types inherited from Observer::Publisher< EffectSettingChanged >
using message_type = EffectSettingChanged
 
using CallbackReturn = std::conditional_t< true, void, bool >
 
using Callback = std::function< CallbackReturn(const EffectSettingChanged &) >
 Type of functions that can be connected to the Publisher. More...
 

Detailed Description

Interface for transferring values from a panel of effect controls.

Definition at line 237 of file EffectPlugin.h.

Constructor & Destructor Documentation

◆ EffectUIValidator()

EffectUIValidator::EffectUIValidator ( EffectUIClientInterface effect,
EffectSettingsAccess access 
)

Definition at line 27 of file EffectPlugin.cpp.

29 : mEffect{effect}
30 , mAccess{access}
31{}
EffectSettingsAccess & mAccess
Definition: EffectPlugin.h:297
EffectUIClientInterface & mEffect
Definition: EffectPlugin.h:296

◆ ~EffectUIValidator()

EffectUIValidator::~EffectUIValidator ( )
virtualdefault

Member Function Documentation

◆ BindTo()

template<typename EventTag , typename Class , typename Event >
void EffectUIValidator::BindTo ( wxEvtHandler &  src,
const EventTag &  eventType,
void(Class::*)(Event &)  pmf 
)
inlineprotected

Definition at line 290 of file EffectPlugin.h.

292 {
293 src.Bind(eventType, pmf, static_cast<Class *>(this));
294 }

Referenced by VSTEffectValidator::BuildFancy(), and VSTEffectValidator::BuildPlain().

Here is the caller graph for this function:

◆ Disconnect()

void EffectUIValidator::Disconnect ( )
virtual

On the first call only, may disconnect from further event handling.

Default implemantation does nothing

Reimplemented in DefaultEffectUIValidator, LadspaEffect::Validator, and LV2Validator.

Definition at line 45 of file EffectPlugin.cpp.

46{
47}

◆ EnableApply()

bool EffectUIValidator::EnableApply ( wxWindow *  parent,
bool  enable = true 
)
static

Enable or disable the Apply button of the dialog that contains parent.

Definition at line 58 of file EffectPlugin.cpp.

59{
60 // May be called during initialization, so try to find the dialog
61 if (auto dlg = wxGetTopLevelParent(parent)) {
62 wxWindow *apply = dlg->FindWindow(wxID_APPLY);
63
64 // Don't allow focus to get trapped
65 if (!enable)
66 {
67 wxWindow *focus = dlg->FindFocus();
68 if (focus == apply)
69 {
70 dlg->FindWindow(wxID_CLOSE)->SetFocus();
71 }
72 }
73
74 if (apply)
75 apply->Enable(enable);
76 }
77
78 EnablePreview(parent, enable);
79
80 return enable;
81}
static bool EnablePreview(wxWindow *parent, bool enable=true)

References EnablePreview().

Referenced by EffectAmplify::CheckClip(), EffectRepeat::DisplayNewTime(), EffectBassTreble::Validator::EnableApplyFromTransferDataFromWindow(), EffectPhaser::Validator::EnableApplyFromTransferDataFromWindow(), EffectWahwah::Validator::EnableApplyFromTransferDataToWindow(), EffectBassTreble::Validator::EnableApplyFromValidate(), EffectPhaser::Validator::EnableApplyFromValidate(), EffectWahwah::Validator::EnableApplyFromValidate(), EffectAmplify::OnAmpText(), EffectTruncSilence::OnControlChange(), EffectToneGen::OnControlUpdate(), EffectScienFilter::OnCutoff(), EffectAmplify::OnPeakText(), EffectScienFilter::OnRipple(), EffectScienFilter::OnStopbandRipple(), EffectPaulstretch::OnText(), EffectTimeScale::OnText_PitchHalfStepsEnd(), EffectTimeScale::OnText_PitchHalfStepsStart(), EffectTimeScale::OnText_PitchPercentChangeEnd(), EffectTimeScale::OnText_PitchPercentChangeStart(), EffectTimeScale::OnText_RatePercentChangeEnd(), EffectTimeScale::OnText_RatePercentChangeStart(), EffectChangeSpeed::UpdateUI(), EffectLoudness::UpdateUI(), and EffectNormalize::UpdateUI().

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

◆ EnablePreview()

bool EffectUIValidator::EnablePreview ( wxWindow *  parent,
bool  enable = true 
)
static

Enable or disable the preview play button of the dialog that contains parent

Definition at line 83 of file EffectPlugin.cpp.

84{
85 // May be called during initialization, so try to find the dialog
86 if (auto dlg = wxGetTopLevelParent(parent)) {
87 wxWindow *play = dlg->FindWindow(kPlayID);
88 if (play)
89 {
90 // Don't allow focus to get trapped
91 if (!enable)
92 {
93 wxWindow *focus = dlg->FindFocus();
94 if (focus == play)
95 {
96 dlg->FindWindow(wxID_CLOSE)->SetFocus();
97 }
98 }
99
100 play->Enable(enable);
101 }
102 }
103
104 return enable;
105}
static constexpr int kPlayID
Definition: EffectPlugin.h:281

References kPlayID.

Referenced by EnableApply(), and NyquistEffect::TransferDataToWindow().

Here is the caller graph for this function:

◆ IsGraphicalUI()

bool EffectUIValidator::IsGraphicalUI ( )
virtual

Default implementation returns false

Returns
true if using a native plug-in UI, not widgets

Reimplemented in AudioUnitValidator, DefaultEffectUIValidator, LV2Validator, VSTEffectValidator, and VST3UIValidator.

Definition at line 40 of file EffectPlugin.cpp.

41{
42 return false;
43}

Referenced by VST3Effect::ShowClientInterface().

Here is the caller graph for this function:

◆ OnClose()

void EffectUIValidator::OnClose ( )
virtual

Handle the UI OnClose event. Default implementation calls mEffect.CloseUI()

Reimplemented in VSTEffectValidator, and VST3UIValidator.

Definition at line 49 of file EffectPlugin.cpp.

50{
51 if (!mUIClosed)
52 {
54 mUIClosed = true;
55 }
56}
virtual bool CloseUI()=0

References EffectUIClientInterface::CloseUI(), mEffect, and mUIClosed.

Referenced by VST3UIValidator::OnClose().

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

◆ UpdateUI()

bool EffectUIValidator::UpdateUI ( )
virtual

Update appearance of the panel for changes in settings.

Default implementation does nothing, returns true

Returns
true if successful

Reimplemented in AudioUnitValidator, EffectBassTreble::Validator, EffectDistortion::Validator, EffectDtmf::Validator, EffectEcho::Validator, LadspaEffect::Validator, LV2Validator, EffectPhaser::Validator, EffectReverb::Validator, VSTEffectValidator, VST3UIValidator, and EffectWahwah::Validator.

Definition at line 35 of file EffectPlugin.cpp.

36{
37 return true;
38}

◆ ValidateUI()

virtual bool EffectUIValidator::ValidateUI ( )
pure virtual

Member Data Documentation

◆ kPlayID

constexpr int EffectUIValidator::kPlayID = 20102
staticconstexpr

Definition at line 281 of file EffectPlugin.h.

Referenced by EnablePreview().

◆ mAccess

EffectSettingsAccess& EffectUIValidator::mAccess
protected

◆ mEffect

EffectUIClientInterface& EffectUIValidator::mEffect
protected

◆ mUIClosed

bool EffectUIValidator::mUIClosed { false }
protected

Definition at line 299 of file EffectPlugin.h.

Referenced by OnClose().


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