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

Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs, DirectoriesPrefs, GUIPrefs, KeyConfigPrefs, MousePrefs, QualityPrefs, SpectrumPrefs and ThemePrefs. More...

#include <PrefsPanel.h>

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

Classes

struct  PrefsNode
 
struct  Registration
 

Public Types

using Factories = std::vector< PrefsPanel::PrefsNode >
 
using Factory = std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) >
 

Public Member Functions

 PrefsPanel (wxWindow *parent, wxWindowID winid, const TranslatableString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool Commit ()=0
 
virtual PluginPath GetPath () const override
 
virtual VendorSymbol GetVendor () const override
 
virtual wxString GetVersion () const override
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual ManualPageID HelpPageName ()
 If not empty string, the Help button is added below the panel. More...
 
virtual void Cancel ()
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Static Public Member Functions

static FactoriesDefaultFactories ()
 

Additional Inherited Members

- Private Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

Detailed Description

Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs, DirectoriesPrefs, GUIPrefs, KeyConfigPrefs, MousePrefs, QualityPrefs, SpectrumPrefs and ThemePrefs.

The interface works like this: Each panel in the preferences dialog must derive from PrefsPanel. You must override Apply() with code to validate fields (returning false if any are bad), updating the global preferences object gPrefs, and instructing the applicable parts of the program to re-read the preference options.

To actually add the new panel, edit the PrefsDialog constructor to append the panel to its list of panels.

Definition at line 49 of file PrefsPanel.h.

Member Typedef Documentation

◆ Factories

Definition at line 69 of file PrefsPanel.h.

◆ Factory

using PrefsPanel::Factory = std::function< PrefsPanel * ( wxWindow *parent, wxWindowID winid, AudacityProject *) >

Definition at line 77 of file PrefsPanel.h.

Constructor & Destructor Documentation

◆ PrefsPanel()

PrefsPanel::PrefsPanel ( wxWindow *  parent,
wxWindowID  winid,
const TranslatableString title 
)
inline

Definition at line 90 of file PrefsPanel.h.

92 : wxPanelWrapper(parent, winid)
93 {
94 SetLabel(title); // Provide visual label
95 SetName(title); // Provide audible label
96 }
static const auto title
void SetLabel(const TranslatableString &label)

References wxPanelWrapper::SetLabel(), wxPanelWrapper::SetName(), and title.

Here is the call graph for this function:

◆ ~PrefsPanel()

PrefsPanel::~PrefsPanel ( )
virtual

Definition at line 85 of file PrefsPanel.cpp.

86{
87}

Member Function Documentation

◆ Cancel()

void PrefsPanel::Cancel ( )
virtual

Reimplemented in KeyConfigPrefs, and ThemePrefs.

Definition at line 89 of file PrefsPanel.cpp.

90{
91}

Referenced by PrefsDialog::OnCancel().

Here is the caller graph for this function:

◆ Commit()

virtual bool PrefsPanel::Commit ( )
pure virtual

Implemented in ApplicationPrefs, BatchPrefs, DevicePrefs, DirectoriesPrefs, EffectsPrefs, ExtImportPrefs, GUIPrefs, ImportExportPrefs, KeyConfigPrefs, LibraryPrefs, ModulePrefs, MousePrefs, PlaybackPrefs, QualityPrefs, RecordingPrefs, SpectrumPrefs, ThemePrefs, TracksBehaviorsPrefs, TracksPrefs, WarningsPrefs, and WaveformPrefs.

Referenced by PrefsDialog::OnOK().

Here is the caller graph for this function:

◆ DefaultFactories()

PrefsPanel::Factories & PrefsPanel::DefaultFactories ( )
static

Definition at line 104 of file PrefsPanel.cpp.

105{
106 // Once only, cause initial population of preferences for the ordering
107 // of some preference pages that used to be given in a table but are now
108 // separately registered in several .cpp files; the sequence of registration
109 // depends on unspecified accidents of static initialization order across
110 // compilation units, so we need something specific here to preserve old
111 // default appearance of the preference dialog.
112 // But this needs only to mention some strings -- there is no compilation or
113 // link dependency of this source file on those other implementation files.
115 PathStart,
116 {
117 {wxT(""),
118 wxT("Device,Playback,Recording,Quality,GUI,Tracks,ImportExport,Directories,Warnings,Effects,KeyConfig,Mouse")
119 },
120 {wxT("/Tracks"), wxT("TracksBehaviors,Spectrum")},
121 }
122 };
123
124 static Factories factories;
125 static std::once_flag flag;
126
127 std::call_once( flag, []{
128 PrefsItemVisitor visitor{ factories };
130 Registry::Visit( visitor, &top, &sRegistry() );
131 } );
132 return factories;
133}
wxT("CloseDown"))
static std::once_flag flag
std::vector< PrefsPanel::PrefsNode > Factories
Definition: PrefsPanel.h:69
void Visit(Visitor &visitor, BaseItem *pTopItem, const GroupItem *pRegistry)
Definition: Registry.cpp:713
static Registry::GroupItem & sRegistry()
Definition: PrefsPanel.cpp:17

References flag, anonymous_namespace{PrefsPanel.cpp}::PathStart, anonymous_namespace{PrefsPanel.cpp}::sRegistry(), Registry::Visit(), and wxT().

Here is the call graph for this function:

◆ GetPath()

PluginPath PrefsPanel::GetPath ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 68 of file PrefsPanel.cpp.

#define BUILTIN_PREFS_PANEL_PREFIX
Definition: PrefsPanel.h:38
virtual ComponentInterfaceSymbol GetSymbol() const =0
const wxString & Internal() const

References BUILTIN_PREFS_PANEL_PREFIX, ComponentInterface::GetSymbol(), and ComponentInterfaceSymbol::Internal().

Here is the call graph for this function:

◆ GetVendor()

VendorSymbol PrefsPanel::GetVendor ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 71 of file PrefsPanel.cpp.

72{ return XO("Audacity");}
#define XO(s)
Definition: Internat.h:31

References XO.

◆ GetVersion()

wxString PrefsPanel::GetVersion ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 74 of file PrefsPanel.cpp.

75{ return AUDACITY_VERSION_STRING;}

◆ HelpPageName()

ManualPageID PrefsPanel::HelpPageName ( )
virtual

If not empty string, the Help button is added below the panel.

Default returns empty string.

Reimplemented in ApplicationPrefs, BatchPrefs, DevicePrefs, DirectoriesPrefs, EffectsPrefs, ExtImportPrefs, GUIPrefs, ImportExportPrefs, KeyConfigPrefs, LibraryPrefs, ModulePrefs, MousePrefs, PlaybackPrefs, QualityPrefs, RecordingPrefs, SpectrumPrefs, ThemePrefs, TracksBehaviorsPrefs, TracksPrefs, WarningsPrefs, and WaveformPrefs.

Definition at line 98 of file PrefsPanel.cpp.

99{
100 return {};
101}

Referenced by PrefsDialog::OnHelp().

Here is the caller graph for this function:

◆ PopulateOrExchange()

virtual void PrefsPanel::PopulateOrExchange ( ShuttleGui WXUNUSEDS)
inlinevirtual

Definition at line 116 of file PrefsPanel.h.

116{};

Referenced by PrefsDialog::ShuttleAll().

Here is the caller graph for this function:

◆ Preview()

virtual void PrefsPanel::Preview ( )
inlinevirtual

Reimplemented in SpectrumPrefs.

Definition at line 101 of file PrefsPanel.h.

101{} // Make tentative changes

Referenced by PrefsDialog::OnOK(), and PrefsDialog::OnPreview().

Here is the caller graph for this function:

◆ ShowsPreviewButton()

bool PrefsPanel::ShowsPreviewButton ( )
virtual

Reimplemented in SpectrumPrefs, and WaveformPrefs.

Definition at line 93 of file PrefsPanel.cpp.

94{
95 return false;
96}

Referenced by PrefsDialog::PrefsDialog().

Here is the caller graph for this function:

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