1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 07:43:54 +02:00

Theme.cpp has fewer dependencies...

It remains in a cycle with ImageManipulation, but the two are free from
other cycles
This commit is contained in:
Paul Licameli
2019-05-11 08:40:38 -04:00
parent 82f4948360
commit 4bdcf3152f
5 changed files with 26 additions and 27 deletions

View File

@@ -815,7 +815,7 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
// Reads preference /GUI/Theme
theTheme.LoadPreferredTheme();
theTheme.ApplyUpdatedImages();
ThemePrefs::ApplyUpdatedImages();
SavePreferredPage();

View File

@@ -170,7 +170,7 @@ void ThemePrefs::PopulateOrExchange(ShuttleGui & S)
void ThemePrefs::OnLoadThemeComponents(wxCommandEvent & WXUNUSED(event))
{
theTheme.LoadComponents();
theTheme.ApplyUpdatedImages();
ApplyUpdatedImages();
}
/// Save Theme to multiple png files.
@@ -183,7 +183,7 @@ void ThemePrefs::OnSaveThemeComponents(wxCommandEvent & WXUNUSED(event))
void ThemePrefs::OnLoadThemeCache(wxCommandEvent & WXUNUSED(event))
{
theTheme.ReadImageCache();
theTheme.ApplyUpdatedImages();
ApplyUpdatedImages();
}
/// Save Theme to single png file.
@@ -197,7 +197,7 @@ void ThemePrefs::OnSaveThemeCache(wxCommandEvent & WXUNUSED(event))
void ThemePrefs::OnReadThemeInternal(wxCommandEvent & WXUNUSED(event))
{
theTheme.ReadImageCache( theTheme.GetFallbackThemeType() );
theTheme.ApplyUpdatedImages();
ApplyUpdatedImages();
}
/// Save Theme as C source code.
@@ -207,6 +207,26 @@ void ThemePrefs::OnSaveThemeAsCode(wxCommandEvent & WXUNUSED(event))
theTheme.WriteImageDefs();// bonus - give them the Defs too.
}
#include "../AdornedRulerPanel.h"
#include "../toolbars/ToolManager.h"
void ThemePrefs::ApplyUpdatedImages()
{
AColor::ReInit();
for (size_t i = 0; i < gAudacityProjects.size(); i++) {
AudacityProject *p = gAudacityProjects[i].get();
p->ApplyUpdatedTheme();
for( int ii = 0; ii < ToolBarCount; ++ii )
{
ToolBar *pToolBar = p->GetToolManager()->GetToolBar(ii);
if( pToolBar )
pToolBar->ReCreateButtons();
}
p->GetRulerPanel()->ReCreateButtons();
}
}
/// Update the preferences stored on disk.
bool ThemePrefs::Commit()
{

View File

@@ -33,6 +33,8 @@ class ThemePrefs final : public PrefsPanel
bool Commit() override;
wxString HelpPageName() override;
static void ApplyUpdatedImages();
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S) override;