Audacity  3.0.3
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 ()
 
virtual VendorSymbol GetVendor ()
 
virtual wxString GetVersion ()
 
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 ComponentInterfaceSymbol GetSymbol ()=0
 
virtual TranslatableString GetDescription ()=0
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 

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  }

References title.

◆ ~PrefsPanel()

PrefsPanel::~PrefsPanel ( )
virtual

Definition at line 85 of file PrefsPanel.cpp.

86 {
87 }

Member Function Documentation

◆ Cancel()

void PrefsPanel::Cancel ( )
virtual

Reimplemented in ThemePrefs, and KeyConfigPrefs.

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 WaveformPrefs, WarningsPrefs, TracksPrefs, TracksBehaviorsPrefs, ThemePrefs, SpectrumPrefs, RecordingPrefs, QualityPrefs, PlaybackPrefs, MousePrefs, ModulePrefs, LibraryPrefs, KeyConfigPrefs, ImportExportPrefs, GUIPrefs, ExtImportPrefs, EffectsPrefs, DirectoriesPrefs, DevicePrefs, BatchPrefs, and ApplicationPrefs.

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 }

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

Here is the call graph for this function:

◆ GetPath()

PluginPath PrefsPanel::GetPath ( )
virtual

Implements ComponentInterface.

Definition at line 68 of file PrefsPanel.cpp.

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

Here is the call graph for this function:

◆ GetVendor()

VendorSymbol PrefsPanel::GetVendor ( )
virtual

Implements ComponentInterface.

Definition at line 71 of file PrefsPanel.cpp.

72 { return XO("Audacity");}

References XO.

◆ GetVersion()

wxString PrefsPanel::GetVersion ( )
virtual

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 WaveformPrefs, WarningsPrefs, TracksPrefs, TracksBehaviorsPrefs, ThemePrefs, SpectrumPrefs, RecordingPrefs, QualityPrefs, PlaybackPrefs, MousePrefs, ModulePrefs, LibraryPrefs, KeyConfigPrefs, ImportExportPrefs, GUIPrefs, ExtImportPrefs, EffectsPrefs, DirectoriesPrefs, DevicePrefs, BatchPrefs, and ApplicationPrefs.

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 WaveformPrefs, and SpectrumPrefs.

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:
Registry::TransparentGroupItem
Definition: Registry.h:210
ComponentInterface::GetSymbol
virtual ComponentInterfaceSymbol GetSymbol()=0
flag
static std::once_flag flag
Definition: WaveformView.cpp:1119
wxPanelWrapper::SetLabel
void SetLabel(const TranslatableString &label)
Definition: wxPanelWrapper.cpp:46
XO
#define XO(s)
Definition: Internat.h:31
BUILTIN_PREFS_PANEL_PREFIX
#define BUILTIN_PREFS_PANEL_PREFIX
Definition: PrefsPanel.h:38
wxPanelWrapper::SetName
void SetName()
Definition: wxPanelWrapper.cpp:61
title
static const auto title
Definition: NoUpdatesAvailableDialog.cpp:22
Registry::Visit
void Visit(Visitor &visitor, BaseItem *pTopItem, const GroupItem *pRegistry)
Definition: Registry.cpp:713
anonymous_namespace{PrefsPanel.cpp}::PathStart
const auto PathStart
Definition: PrefsPanel.cpp:15
wxPanelWrapper::wxPanelWrapper
wxPanelWrapper()
Definition: wxPanelWrapper.h:44
ComponentInterfaceSymbol::Internal
const wxString & Internal() const
Definition: ComponentInterfaceSymbol.h:55
PrefsPanel::Factories
std::vector< PrefsPanel::PrefsNode > Factories
Definition: PrefsPanel.h:69
anonymous_namespace{PrefsPanel.cpp}::sRegistry
static Registry::GroupItem & sRegistry()
Definition: PrefsPanel.cpp:17
Registry::OrderingPreferenceInitializer
Definition: Registry.h:273