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  PrefsItem
 
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 72 of file PrefsPanel.h.

◆ Factory

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

Definition at line 80 of file PrefsPanel.h.

Constructor & Destructor Documentation

◆ PrefsPanel()

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

Definition at line 94 of file PrefsPanel.h.

96 : wxPanelWrapper(parent, winid)
97 {
98 SetLabel(title); // Provide visual label
99 SetName(title); // Provide audible label
100 }
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 79 of file PrefsPanel.cpp.

80{
81}

Member Function Documentation

◆ Cancel()

void PrefsPanel::Cancel ( )
virtual

Reimplemented in KeyConfigPrefs, and ThemePrefs.

Definition at line 83 of file PrefsPanel.cpp.

84{
85}

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 98 of file PrefsPanel.cpp.

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

References flag, PathStart, PrefsPanel::PrefsItem::Registry(), Registry::Visit(), and wxT().

Here is the call graph for this function:

◆ GetPath()

PluginPath PrefsPanel::GetPath ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 62 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 65 of file PrefsPanel.cpp.

66{ return XO("Audacity");}
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetVersion()

wxString PrefsPanel::GetVersion ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 68 of file PrefsPanel.cpp.

69{ 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 92 of file PrefsPanel.cpp.

93{
94 return {};
95}

◆ PopulateOrExchange()

virtual void PrefsPanel::PopulateOrExchange ( ShuttleGui WXUNUSEDS)
inlinevirtual

Definition at line 120 of file PrefsPanel.h.

120{};

Referenced by PrefsDialog::ShuttleAll().

Here is the caller graph for this function:

◆ Preview()

virtual void PrefsPanel::Preview ( )
inlinevirtual

Reimplemented in SpectrumPrefs.

Definition at line 105 of file PrefsPanel.h.

105{} // Make tentative changes

Referenced by PrefsDialog::OnOK().

Here is the caller graph for this function:

◆ ShowsPreviewButton()

bool PrefsPanel::ShowsPreviewButton ( )
virtual

Reimplemented in SpectrumPrefs, and WaveformPrefs.

Definition at line 87 of file PrefsPanel.cpp.

88{
89 return false;
90}

Referenced by PrefsDialog::PrefsDialog().

Here is the caller graph for this function:

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