Audacity 3.2.0
Public Member Functions | Private Member Functions | List of all members
ThemePrefs Class Referencefinal

A PrefsPanel that configures dynamic loading of Theme icons and colours. More...

#include <ThemePrefs.h>

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

Public Member Functions

 ThemePrefs (wxWindow *parent, wxWindowID winid)
 
 ~ThemePrefs (void)
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
bool Commit () override
 Update the preferences stored on disk. More...
 
void Cancel () override
 
ManualPageID HelpPageName () override
 If not empty string, the Help button is added below the panel. More...
 
- Public Member Functions inherited from PrefsPanel
 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
 

Private Member Functions

void Populate ()
 Creates the dialog and its contents. More...
 
void PopulateOrExchange (ShuttleGui &S) override
 Create the dialog contents, or exchange data with it. More...
 
void OnLoadThemeComponents (wxCommandEvent &e)
 Load Theme from multiple png files. More...
 
void OnSaveThemeComponents (wxCommandEvent &e)
 Save Theme to multiple png files. More...
 
void OnLoadThemeCache (wxCommandEvent &e)
 Load Theme from single png file. More...
 
void OnSaveThemeCache (wxCommandEvent &e)
 Save Themes, each to a single png file. More...
 
void OnReadThemeInternal (wxCommandEvent &e)
 Read Theme from internal storage. More...
 
void OnSaveThemeAsCode (wxCommandEvent &e)
 Save Theme as C source code. More...
 

Additional Inherited Members

- Public Types inherited from PrefsPanel
using Factories = std::vector< PrefsPanel::PrefsNode >
 
using Factory = std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) >
 
- Static Public Member Functions inherited from PrefsPanel
static FactoriesDefaultFactories ()
 

Detailed Description

A PrefsPanel that configures dynamic loading of Theme icons and colours.

Provides:

See also
Themability of Audacity

Definition at line 25 of file ThemePrefs.h.

Constructor & Destructor Documentation

◆ ThemePrefs()

ThemePrefs::ThemePrefs ( wxWindow *  parent,
wxWindowID  winid 
)

Definition at line 60 of file ThemePrefs.cpp.

65: PrefsPanel(parent, winid, XO("Theme"))
66{
67 Populate();
68}
XO("Cut/Copy/Paste")
PrefsPanel(wxWindow *parent, wxWindowID winid, const TranslatableString &title)
Definition: PrefsPanel.h:94
void Populate()
Creates the dialog and its contents.
Definition: ThemePrefs.cpp:90

◆ ~ThemePrefs()

ThemePrefs::~ThemePrefs ( void  )

Definition at line 70 of file ThemePrefs.cpp.

71{
72}

Member Function Documentation

◆ Cancel()

void ThemePrefs::Cancel ( )
overridevirtual

Reimplemented from PrefsPanel.

Definition at line 232 of file ThemePrefs.cpp.

233{
237}
THEME_API Theme theTheme
Definition: Theme.cpp:82
static void ApplyUpdatedImages()
Definition: AColor.cpp:841
void DeleteUnusedThemes()
static bool LoadPreferredTheme()
Definition: Theme.cpp:162

References AColor::ApplyUpdatedImages(), ThemeBase::DeleteUnusedThemes(), ThemeBase::LoadPreferredTheme(), and theTheme.

Here is the call graph for this function:

◆ Commit()

bool ThemePrefs::Commit ( )
overridevirtual

Update the preferences stored on disk.

Implements PrefsPanel.

Definition at line 221 of file ThemePrefs.cpp.

222{
225
229 return true;
230}
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
#define S(N)
Definition: ToChars.cpp:64
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
void PopulateOrExchange(ShuttleGui &S) override
Create the dialog contents, or exchange data with it.
Definition: ThemePrefs.cpp:104

References AColor::ApplyUpdatedImages(), ThemeBase::DeleteUnusedThemes(), eIsSavingToPrefs, ThemeBase::LoadPreferredTheme(), PopulateOrExchange(), S, and theTheme.

Here is the call graph for this function:

◆ GetDescription()

TranslatableString ThemePrefs::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 79 of file ThemePrefs.cpp.

80{
81 return XO("Preferences for Theme");
82}

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol ThemePrefs::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 74 of file ThemePrefs.cpp.

75{
77}
#define THEME_PREFS_PLUGIN_SYMBOL
Definition: ThemePrefs.h:23

References THEME_PREFS_PLUGIN_SYMBOL.

◆ HelpPageName()

ManualPageID ThemePrefs::HelpPageName ( )
overridevirtual

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

Default returns empty string.

Reimplemented from PrefsPanel.

Definition at line 84 of file ThemePrefs.cpp.

85{
86 return "Theme_Preferences";
87}

◆ OnLoadThemeCache()

void ThemePrefs::OnLoadThemeCache ( wxCommandEvent &  e)
private

Load Theme from single png file.

Definition at line 189 of file ThemePrefs.cpp.

190{
191 wxBusyCursor busy;
194}
void SwitchTheme(teThemeType Theme)
Definition: Theme.cpp:217

References AColor::ApplyUpdatedImages(), ThemeBase::SwitchTheme(), and theTheme.

Here is the call graph for this function:

◆ OnLoadThemeComponents()

void ThemePrefs::OnLoadThemeComponents ( wxCommandEvent &  e)
private

Load Theme from multiple png files.

Definition at line 174 of file ThemePrefs.cpp.

175{
176 wxBusyCursor busy;
179}
void LoadThemeComponents(bool bOkIfNotFound=false)
Definition: Theme.cpp:972

References AColor::ApplyUpdatedImages(), ThemeBase::LoadThemeComponents(), and theTheme.

Here is the call graph for this function:

◆ OnReadThemeInternal()

void ThemePrefs::OnReadThemeInternal ( wxCommandEvent &  e)
private

Read Theme from internal storage.

Definition at line 205 of file ThemePrefs.cpp.

206{
207 wxBusyCursor busy;
210}
teThemeType GetFallbackThemeType()
Definition: Theme.cpp:831

References AColor::ApplyUpdatedImages(), ThemeBase::GetFallbackThemeType(), ThemeBase::SwitchTheme(), and theTheme.

Here is the call graph for this function:

◆ OnSaveThemeAsCode()

void ThemePrefs::OnSaveThemeAsCode ( wxCommandEvent &  e)
private

Save Theme as C source code.

Definition at line 213 of file ThemePrefs.cpp.

214{
215 wxBusyCursor busy;
217 theTheme.WriteImageDefs();// bonus - give them the Defs too.
218}
void SaveThemeAsCode()
void WriteImageDefs()
Writes a series of Macro definitions that can be used in the include file.
Definition: Theme.cpp:789

References ThemeBase::SaveThemeAsCode(), theTheme, and ThemeBase::WriteImageDefs().

Here is the call graph for this function:

◆ OnSaveThemeCache()

void ThemePrefs::OnSaveThemeCache ( wxCommandEvent &  e)
private

Save Themes, each to a single png file.

Definition at line 197 of file ThemePrefs.cpp.

198{
199 wxBusyCursor busy;
201 theTheme.WriteImageMap();// bonus - give them the html version.
202}
void WriteImageMap()
Definition: Theme.cpp:728
void CreateImageCache()
Definition: Theme.cpp:556

References ThemeBase::CreateImageCache(), theTheme, and ThemeBase::WriteImageMap().

Here is the call graph for this function:

◆ OnSaveThemeComponents()

void ThemePrefs::OnSaveThemeComponents ( wxCommandEvent &  e)
private

Save Theme to multiple png files.

Definition at line 182 of file ThemePrefs.cpp.

183{
184 wxBusyCursor busy;
186}
void SaveThemeComponents()

References ThemeBase::SaveThemeComponents(), and theTheme.

Here is the call graph for this function:

◆ Populate()

void ThemePrefs::Populate ( )
private

Creates the dialog and its contents.

Definition at line 90 of file ThemePrefs.cpp.

91{
92 // First any pre-processing for constructing the GUI.
93
94 //------------------------- Main section --------------------
95 // Now construct the GUI itself.
96 // Use 'eIsCreatingFromPrefs' so that the GUI is
97 // initialised with values from gPrefs.
100 // ----------------------- End of main section --------------
101}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46

References eIsCreatingFromPrefs, PopulateOrExchange(), and S.

Here is the call graph for this function:

◆ PopulateOrExchange()

void ThemePrefs::PopulateOrExchange ( ShuttleGui S)
overrideprivate

Create the dialog contents, or exchange data with it.

Definition at line 104 of file ThemePrefs.cpp.

105{
106 S.SetBorder(2);
107 S.StartScroller();
108
109 S.StartStatic(XO("Info"));
110 {
111 S.AddFixedText(
112 XO(
113"Themability is an experimental feature.\n\nTo try it out, click \"Save Theme Cache\" then find and modify the images and colors in\nImageCacheVxx.png using an image editor such as the Gimp.\n\nClick \"Load Theme Cache\" to load the changed images and colors back into Audacity.")
114 );
115
116#ifdef _DEBUG
117 S.AddFixedText(
118 Verbatim(
119"This is a debug version of Audacity, with an extra button, 'Output Sourcery'. This will save\nC versions of the image caches that can be compiled in as defaults.")
120 );
121#endif
122
123 S.AddFixedText(
124 XO(
125"Saving and loading individual theme files uses a separate file for each image, but is\notherwise the same idea.")
126 );
127 }
128 S.EndStatic();
129
130 /* i18n-hint: && in here is an escape character to get a single & on screen,
131 * so keep it as is */
132 S.StartStatic( XO("Theme Cache - Images && Color"));
133 {
134 S.StartHorizontalLay(wxALIGN_LEFT);
135 {
136 S.Id(idSaveThemeCache).AddButton(XXO("Save Theme Cache"));
137 S.Id(idLoadThemeCache).AddButton(XXO("Load Theme Cache"));
138
139 // This next button is only provided in Debug mode.
140 // It is for developers who are compiling Audacity themselves
141 // and who wish to generate NEW *ThemeAsCeeCode.h and compile them in.
142#ifdef _DEBUG
143 S.Id(idSaveThemeAsCode).AddButton(Verbatim("Output Sourcery"));
144#endif
145
146 S.Id(idReadThemeInternal).AddButton(XXO("&Defaults"));
147 }
148 S.EndHorizontalLay();
149 }
150 S.EndStatic();
151
152 // JKC: 'Ergonomic' details:
153 // Theme components are used much less frequently than
154 // the ImageCache. Yet it's easy to click them 'by mistake'.
155 //
156 // To reduce that risk, we use a separate box to separate them off.
157 // And choose text on the buttons that is shorter, making the
158 // buttons smaller and less tempting to click.
159 S.StartStatic( XO("Individual Theme Files"),1);
160 {
161 S.StartHorizontalLay(wxALIGN_LEFT);
162 {
163 S.Id(idSaveThemeComponents).AddButton( XXO("Save Files"));
164 S.Id(idLoadThemeComponents).AddButton( XXO("Load Files"));
165 }
166 S.EndHorizontalLay();
167 }
168 S.EndStatic();
169 S.EndScroller();
170
171}
XXO("&Cut/Copy/Paste Toolbar")
@ idLoadThemeComponents
Definition: ThemePrefs.cpp:45
@ idSaveThemeAsCode
Definition: ThemePrefs.cpp:48
@ idSaveThemeCache
Definition: ThemePrefs.cpp:44
@ idReadThemeInternal
Definition: ThemePrefs.cpp:47
@ idSaveThemeComponents
Definition: ThemePrefs.cpp:46
@ idLoadThemeCache
Definition: ThemePrefs.cpp:43
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.

References idLoadThemeCache, idLoadThemeComponents, idReadThemeInternal, idSaveThemeAsCode, idSaveThemeCache, idSaveThemeComponents, S, Verbatim(), XO(), and XXO().

Referenced by Commit(), and Populate().

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

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