Audacity 3.2.0
EffectUIServices.h
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file EffectUIServices.h
6
7 Paul Licameli split from EffectPlugin.h
8
9**********************************************************************/
10#ifndef __AUDACITY_EFFECT_UI_SERVICES__
11#define __AUDACITY_EFFECT_UI_SERVICES__
12
13#include "EffectInterface.h"
14#include <memory>
15#include <optional>
16
17class EffectBase;
18class EffectEditor;
19class EffectInstance;
20class EffectPlugin;
21class EffectSettings;
22class EffectOutputs;
24class ShuttleGui;
25class wxWindow;
26class wxDialog;
27
29 std::optional<std::unique_ptr<EffectSettingsAccess::Message>>;
30
32 wxDialog *pDialog{};
34 std::shared_ptr<EffectInstance> pInstance{};
36};
37
39
41 wxWindow &parent, EffectBase &, EffectUIServices &,
43
46class AUDACITY_DLL_API EffectUIServices /* not final */
47{
48public:
49 // Display a message box, using effect's (translated) name as the prefix
50 // for the title.
51 enum : long { DefaultMessageBoxStyle = wxOK | wxCENTRE };
52 static int DoMessageBox(const EffectPlugin &plugin,
53 const TranslatableString& message,
54 long style = DefaultMessageBoxStyle,
55 const TranslatableString &titleStr = {});
56
58
61
75 virtual int ShowHostInterface(EffectBase &plugin,
76 wxWindow &parent, const EffectDialogFactory &factory,
77 std::shared_ptr<EffectInstance> &pInstance, EffectSettingsAccess &access,
78 bool forceModal = false);
79
84 virtual int ShowClientInterface(const EffectPlugin &plugin,
85 wxWindow &parent, wxDialog &dialog,
86 EffectEditor *pEditor, bool forceModal = false) const = 0;
87
89
102 virtual std::unique_ptr<EffectEditor> PopulateUI(
103 const EffectPlugin &plugin, ShuttleGui &S,
104 EffectInstance &instance, EffectSettingsAccess &access,
105 const EffectOutputs *pOutputs) const = 0;
106
107 virtual void ExportPresets(
108 const EffectPlugin &plugin, const EffectSettings &settings) const = 0;
110 [[nodiscard]] virtual OptionalMessage ImportPresets(
111 const EffectPlugin &plugin, EffectSettings &settings) const = 0;
112
113 virtual void ShowOptions(const EffectPlugin &plugin) const = 0;
114
115 virtual bool ValidateUI(
116 const EffectPlugin &context, EffectSettings &settings) const = 0;
117 virtual bool CloseUI() const = 0;
118};
119
120#endif
std::optional< std::unique_ptr< EffectSettingsAccess::Message > > OptionalMessage
std::function< DialogFactoryResults(wxWindow &parent, EffectBase &, EffectUIServices &, EffectSettingsAccess &) > EffectDialogFactory
Type of function that creates a dialog for an effect.
static BasicUI::MessageBoxResult DoMessageBox(const TranslatableString &msg)
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:69
Base class for many of the effects in Audacity.
Definition: EffectBase.h:28
Performs effect computation.
Hold values to send to effect output meters.
Factory of instances of an effect.
Definition: EffectPlugin.h:36
virtual void ShowOptions(const EffectPlugin &plugin) const =0
virtual bool ValidateUI(const EffectPlugin &context, EffectSettings &settings) const =0
virtual bool CloseUI() const =0
virtual std::unique_ptr< EffectEditor > PopulateUI(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
virtual OptionalMessage ImportPresets(const EffectPlugin &plugin, EffectSettings &settings) const =0
virtual void ExportPresets(const EffectPlugin &plugin, const EffectSettings &settings) const =0
virtual ~EffectUIServices()
virtual int ShowClientInterface(const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal=false) const =0
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:630
Holds a msgid for the translation catalog; may also bind format arguments.
static RegisteredToolbarFactory factory
std::shared_ptr< EffectInstance > pInstance
constructed and successfully Init()-ed; or null for failure
EffectEditor * pEditor
Externalized state of a plug-in.