Audacity  2.2.2
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:
PrefsPanel wxPanelWrapper wxTabTraversalWrapper< wxPanel >

Public Member Functions

 ThemePrefs (wxWindow *parent, wxWindowID winid)
 
 ~ThemePrefs (void)
 
bool Commit () override
 Update the preferences stored on disk. More...
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const wxString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual wxString HelpPageName ()
 
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 wxString &name=_("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&...args)
 

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 Theme to 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...
 

Detailed Description

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

Provides:

See Also
Themability of Audacity

Definition at line 24 of file ThemePrefs.h.

Constructor & Destructor Documentation

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

Definition at line 59 of file ThemePrefs.cpp.

64 : PrefsPanel(parent, winid, _("Theme"))
65 {
66  Populate();
67 }
void Populate()
Creates the dialog and its contents.
Definition: ThemePrefs.cpp:74
PrefsPanel(wxWindow *parent, wxWindowID winid, const wxString &title)
Definition: PrefsPanel.h:48
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
ThemePrefs::~ThemePrefs ( void  )

Definition at line 69 of file ThemePrefs.cpp.

70 {
71 }

Member Function Documentation

bool ThemePrefs::Commit ( )
overridevirtual

Update the preferences stored on disk.

Implements PrefsPanel.

Definition at line 196 of file ThemePrefs.cpp.

References eIsSavingToPrefs, and PopulateOrExchange().

197 {
198  ShuttleGui S(this, eIsSavingToPrefs);
200 
201  return true;
202 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void PopulateOrExchange(ShuttleGui &S) override
Create the dialog contents, or exchange data with it.
Definition: ThemePrefs.cpp:88
void ThemePrefs::OnLoadThemeCache ( wxCommandEvent &  e)
private

Load Theme from single png file.

Definition at line 168 of file ThemePrefs.cpp.

References Theme::ApplyUpdatedImages(), ThemeBase::ReadImageCache(), and theTheme.

169 {
172 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
void ApplyUpdatedImages() override
Definition: Theme.cpp:250
bool ReadImageCache(teThemeType type=themeFromFile, bool bOkIfNotFound=false)
Definition: Theme.cpp:953
void ThemePrefs::OnLoadThemeComponents ( wxCommandEvent &  e)
private

Load Theme from multiple png files.

Definition at line 155 of file ThemePrefs.cpp.

References Theme::ApplyUpdatedImages(), ThemeBase::LoadComponents(), and theTheme.

156 {
159 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
void ApplyUpdatedImages() override
Definition: Theme.cpp:250
void LoadComponents(bool bOkIfNotFound=false)
Definition: Theme.cpp:1085
void ThemePrefs::OnReadThemeInternal ( wxCommandEvent &  e)
private

Read Theme from internal storage.

Definition at line 182 of file ThemePrefs.cpp.

References Theme::ApplyUpdatedImages(), ThemeBase::GetFallbackThemeType(), ThemeBase::ReadImageCache(), and theTheme.

183 {
186 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
void ApplyUpdatedImages() override
Definition: Theme.cpp:250
teThemeType GetFallbackThemeType()
Definition: Theme.cpp:922
bool ReadImageCache(teThemeType type=themeFromFile, bool bOkIfNotFound=false)
Definition: Theme.cpp:953
void ThemePrefs::OnSaveThemeAsCode ( wxCommandEvent &  e)
private

Save Theme as C source code.

Definition at line 189 of file ThemePrefs.cpp.

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

190 {
192  theTheme.WriteImageDefs();// bonus - give them the Defs too.
193 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
void SaveThemeAsCode()
Definition: Theme.cpp:1212
void WriteImageDefs()
Writes a series of Macro definitions that can be used in the include file.
Definition: Theme.cpp:882
void ThemePrefs::OnSaveThemeCache ( wxCommandEvent &  e)
private

Save Theme to single png file.

Definition at line 175 of file ThemePrefs.cpp.

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

176 {
178  theTheme.WriteImageMap();// bonus - give them the html version.
179 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
void CreateImageCache(bool bBinarySave=true)
Definition: Theme.cpp:660
void WriteImageMap()
Definition: Theme.cpp:829
void ThemePrefs::OnSaveThemeComponents ( wxCommandEvent &  e)
private

Save Theme to multiple png files.

Definition at line 162 of file ThemePrefs.cpp.

References ThemeBase::SaveComponents(), and theTheme.

163 {
165 }
void SaveComponents()
Definition: Theme.cpp:1135
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
void ThemePrefs::Populate ( )
private

Creates the dialog and its contents.

Definition at line 74 of file ThemePrefs.cpp.

References eIsCreatingFromPrefs, and PopulateOrExchange().

75 {
76  // First any pre-processing for constructing the GUI.
77 
78  //------------------------- Main section --------------------
79  // Now construct the GUI itself.
80  // Use 'eIsCreatingFromPrefs' so that the GUI is
81  // initialised with values from gPrefs.
84  // ----------------------- End of main section --------------
85 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void PopulateOrExchange(ShuttleGui &S) override
Create the dialog contents, or exchange data with it.
Definition: ThemePrefs.cpp:88
void ThemePrefs::PopulateOrExchange ( ShuttleGui S)
overrideprivate

Create the dialog contents, or exchange data with it.

Definition at line 88 of file ThemePrefs.cpp.

References _(), ShuttleGuiBase::AddButton(), ShuttleGuiBase::AddFixedText(), ShuttleGuiBase::EndHorizontalLay(), ShuttleGuiBase::EndScroller(), ShuttleGuiBase::EndStatic(), ShuttleGui::Id(), idLoadThemeCache, idLoadThemeComponents, idReadThemeInternal, idSaveThemeAsCode, idSaveThemeCache, idSaveThemeComponents, ShuttleGuiBase::SetBorder(), ShuttleGuiBase::StartHorizontalLay(), ShuttleGuiBase::StartScroller(), and ShuttleGuiBase::StartStatic().

Referenced by Commit(), and Populate().

89 {
90  S.SetBorder(2);
91  S.StartScroller();
92 
93  S.StartStatic(_("Info"));
94  {
95  S.AddFixedText(
96  _("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.\n\n(Only the Transport Toolbar and the colors on the wavetrack are currently affected, even\nthough the image file shows other icons too.)")
97  );
98 
99 #ifdef __WXDEBUG__
100  S.AddFixedText(
101  _("This is a debug version of Audacity, with an extra button, 'Output Sourcery'. This will save a\nC version of the image cache that can be compiled in as a default.")
102  );
103 #endif
104 
105  S.AddFixedText(
106  _("Saving and loading individual theme files uses a separate file for each image, but is\notherwise the same idea.")
107  );
108  }
109  S.EndStatic();
110 
111  /* i18n-hint: && in here is an escape character to get a single & on screen,
112  * so keep it as is */
113  S.StartStatic( _("Theme Cache - Images && Color"));
114  {
115  S.StartHorizontalLay(wxALIGN_LEFT);
116  {
117  S.Id(idSaveThemeCache).AddButton(_("Save Theme Cache"));
118  S.Id(idLoadThemeCache).AddButton(_("Load Theme Cache"));
119 
120  // This next button is only provided in Debug mode.
121  // It is for developers who are compiling Audacity themselves
122  // and who who wish to generate a NEW ThemeAsCeeCode.h and compile it in.
123 #ifdef __WXDEBUG__
124  S.Id(idSaveThemeAsCode).AddButton(wxT("Output Sourcery"));
125 #endif
126 
127  S.Id(idReadThemeInternal).AddButton(_("&Defaults"));
128  }
129  S.EndHorizontalLay();
130  }
131  S.EndStatic();
132 
133  // JKC: 'Ergonomic' details:
134  // Theme components are used much less frequently than
135  // the ImageCache. Yet it's easy to click them 'by mistake'.
136  //
137  // To reduce that risk, we use a separate box to separate them off.
138  // And choose text on the buttons that is shorter, making the
139  // buttons smaller and less tempting to click.
140  S.StartStatic( _("Individual Theme Files"),1);
141  {
142  S.StartHorizontalLay(wxALIGN_LEFT);
143  {
144  S.Id(idSaveThemeComponents).AddButton( _("Save Files"));
145  S.Id(idLoadThemeComponents).AddButton( _("Load Files"));
146  }
147  S.EndHorizontalLay();
148  }
149  S.EndStatic();
150  S.EndScroller();
151 
152 }
void EndScroller()
Definition: ShuttleGui.cpp:828
void EndHorizontalLay()
wxScrolledWindow * StartScroller(int iStyle=0)
Definition: ShuttleGui.cpp:795
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
ShuttleGui & Id(int id)
void AddFixedText(const wxString &Str, bool bCenter=false)
Definition: ShuttleGui.cpp:397
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:763
void SetBorder(int Border)
Definition: ShuttleGui.h:286
wxButton * AddButton(const wxString &Text, int PositionFlags=wxALIGN_CENTRE)
Definition: ShuttleGui.cpp:341

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