Audacity 3.2.0
|
Theme management - Image loading and saving. More...
#include <Theme.h>
Classes | |
struct | RegisteredTheme |
Public Types | |
using | NameSet = std::unordered_set< wxString > |
Public Types inherited from Observer::Publisher< ThemeChangeMessage > | |
using | message_type = ThemeChangeMessage |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const ThemeChangeMessage &) > |
Type of functions that can be connected to the Publisher. More... | |
Public Member Functions | |
ThemeBase (void) | |
ThemeBase (const ThemeBase &)=delete | |
ThemeBase & | operator= (const ThemeBase &)=delete |
virtual | ~ThemeBase (void) |
virtual void | EnsureInitialised ()=0 |
FilePath | GetFilePath () |
void | SetFilePath (const FilePath &path) |
void | SwitchTheme (teThemeType Theme) |
void | LoadTheme (teThemeType Theme) |
void | RegisterImage (NameSet &allNames, int &flags, int &iIndex, char const **pXpm, const wxString &Name) |
void | RegisterImage (NameSet &allNames, int &flags, int &iIndex, const wxImage &Image, const wxString &Name) |
void | RegisterColour (NameSet &allNames, int &iIndex, const wxColour &Clr, const wxString &Name) |
teThemeType | GetFallbackThemeType () |
void | CreateImageCache () |
bool | CreateOneImageCache (teThemeType id, bool bBinarySave) |
bool | ReadImageCache (teThemeType type={}, bool bOkIfNotFound=false) |
void | LoadThemeComponents (bool bOkIfNotFound=false) |
void | LoadOneThemeComponents (teThemeType id, bool bOkIfNotFound=false) |
void | SaveThemeComponents () |
bool | SaveOneThemeComponents (teThemeType id) |
void | SaveThemeAsCode () |
void | WriteImageDefs () |
Writes a series of Macro definitions that can be used in the include file. More... | |
void | WriteImageMap () |
void | WriteOneImageMap (teThemeType id) |
void | RecolourBitmap (int iIndex, wxColour From, wxColour To) |
int | ColourDistance (wxColour &From, wxColour &To) |
wxColour & | Colour (int iIndex) |
wxBitmap & | Bitmap (int iIndex) |
wxImage & | Image (int iIndex) |
wxSize | ImageSize (int iIndex) |
void | ReplaceImage (int iIndex, wxImage *pImage) |
void | RotateImageInto (int iTo, int iFrom, bool bClockwise) |
void | SetBrushColour (wxBrush &Brush, int iIndex) |
void | SetPenColour (wxPen &Pen, int iIndex) |
wxImage | MaskedImage (char const **pXpm, char const **pMask) |
wxImage | MakeImageWithAlpha (wxBitmap &Bmp) |
void | DeleteUnusedThemes () |
Public Member Functions inherited from Observer::Publisher< ThemeChangeMessage > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Static Public Member Functions | |
static bool | LoadPreferredTheme () |
Protected Attributes | |
FilePath | mThemeDir |
wxArrayString | mBitmapNames |
std::vector< int > | mBitmapFlags |
wxArrayString | mColourNames |
PreferredSystemAppearance | mPreferredSystemAppearance { PreferredSystemAppearance::Light } |
std::map< Identifier, ThemeSet > | mSets |
ThemeSet * | mpSet = nullptr |
Additional Inherited Members | |
Static Public Attributes inherited from Observer::Publisher< ThemeChangeMessage > | |
static constexpr bool | notifies_all |
Protected Member Functions inherited from Observer::Publisher< ThemeChangeMessage > | |
CallbackReturn | Publish (const ThemeChangeMessage &message) |
Send a message to connected callbacks. More... | |
Theme management - Image loading and saving.
Base for the Theme class. ThemeBase is a generic non-Audacity specific class.
using ThemeBase::NameSet = std::unordered_set<wxString> |
|
delete |
wxBitmap & ThemeBase::Bitmap | ( | int | iIndex | ) |
Referenced by anonymous_namespace{HelpMenus.cpp}::QuickFixDialog::AddStuck(), AColor::Bevel2(), AColor::ButtonStretch(), CommonTrackInfo::CloseTitleDrawFunction(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::Create(), CreateStdButtonSizer(), CommonTrackInfo::DrawCloseButton(), ClipButtonSpecializations< ClipButtonId::Pitch >::DrawOnClip(), ClipButtonSpecializations< ClipButtonId::Speed >::DrawOnClip(), LWSlider::DrawToBitmap(), anonymous_namespace{CommonTrackInfo.cpp}::DrawToolButtonBackground(), ErrorReportDialog::ErrorReportDialog(), LabelTrackView::GetGlyph(), anonymous_namespace{PlayIndicatorOverlay.cpp}::GetIndicatorBitmap(), InitProjectWindow(), MultiDialog::MultiDialog(), ThemedButtonWrapper< ButtonBase >::OnThemeChange(), DeviceToolBar::Populate(), DevicePrefs::PopulateOrExchange(), RecolourBitmap(), audacity::cloud::audiocom::UserPanel::SetAnonymousState(), ThemedButtonWrapper< ButtonBase >::SetBitmapCurrentIndex(), ThemedButtonWrapper< ButtonBase >::SetBitmapFocusIndex(), ThemedButtonWrapper< ButtonBase >::SetBitmapIndex(), ThemedButtonWrapper< ButtonBase >::SetBitmapLabelIndex(), ThemedButtonWrapper< ButtonBase >::SetBitmapPressedIndex(), LogWindow::Show(), HelpSystem::ShowHtmlText(), audacity::cloud::audiocom::sync::CloudSyncStatusField::StatusWidget::UpdatePrefs(), and audacity::cloud::audiocom::UserPanel::UpdateUserData().
wxColour & ThemeBase::Colour | ( | int | iIndex | ) |
Referenced by AboutDialog::AboutDialog(), SelectionBar::AddTitle(), TimeSignatureToolBar::AddTitle(), AlphaBlend(), ProjectWindow::ApplyUpdatedTheme(), ASlider::ASlider(), auStaticText::auStaticText(), CommonTrackInfo::CloseTitleDrawFunction(), CursorColour(), WaveChannelVRulerControls::DoDraw(), AdornedRulerPanel::DoDrawMarks(), AdornedRulerPanel::DoDrawPlayRegion(), AdornedRulerPanel::DoDrawPlayRegionLimits(), LabelTrackView::Draw(), NoteTrackAffordanceControls::Draw(), WaveTrackAffordanceControls::Draw(), TimeTrackVRulerControls::Draw(), RulerUpdater::Label::Draw(), Grabber::DrawGrabber(), anonymous_namespace{TimeTrackView.cpp}::DrawHorzRulerAndCurve(), CommonTrackInfo::DrawItems(), anonymous_namespace{NoteTrackControls.cpp}::DrawLabelControls(), MeterPanel::DrawMeterBar(), anonymous_namespace{NoteTrackView.cpp}::DrawNoteTrack(), ClipButtonSpecializations< ClipButtonId::Overflow >::DrawOnClip(), FrequencyPlotDialog::DrawPlot(), LWSlider::DrawToBitmap(), HighlitClipButtonHandle::Highlight(), HtmlColourOfIndex(), AColor::Init(), AButton::Init(), NumericTextCtrl::Layout(), LoginDialog::LoginDialog(), AudioSetupToolBar::MakeAudioSetupButton(), MixerBoard::MakeButtonBitmap(), anonymous_namespace{LoginDialog.cpp}::MakeLabel(), anonymous_namespace{LoginDialog.cpp}::MakeLoginButton(), anonymous_namespace{DynamicRangeProcessorEditor.cpp}::MakeRulerPanel(), audacity::cloud::ShareAudioToolbar::MakeShareAudioButton(), WaveTrackAffordanceControls::MakeTextEditHelper(), MixerBoard::MixerBoard(), ToolManager::OnIndicatorPaint(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::OnPaint(), EqualizationPanel::OnPaint(), ToolBarResizer::OnPaint(), ToolBar::OnPaint(), ToolDock::OnPaint(), NumericTextCtrl::OnPaint(), EffectAutoDuck::Panel::OnPaint(), EffectLegacyCompressorPanel::OnPaint(), EffectScienFilterPanel::OnPaint(), MixerTrackCluster::OnPaint(), MeterPanel::OnPaint(), ToolFrame::OnPaint(), ThemedWindowWrapper< WindowBase >::OnThemeChange(), ThemedButtonWrapper< ButtonBase >::OnThemeChange(), ThemedAButtonWrapper< AButtonBase >::OnThemeChange(), OverlayImage(), FrequencyPlotDialog::Populate(), audacity::cloud::ShareAudioToolbar::Populate(), AudioSetupToolBar::Populate(), ControlToolBar::Populate(), CutCopyPasteToolBar::Populate(), DeviceToolBar::Populate(), EditToolBar::Populate(), MeterToolBar::Populate(), SelectionBar::Populate(), SnappingToolBar::Populate(), SpectralSelectionBar::Populate(), TimeSignatureToolBar::Populate(), ToolsToolBar::Populate(), TranscriptionToolBar::Populate(), AColor::PreComputeGradient(), Ruler::Ruler(), ThemedWindowWrapper< WindowBase >::SetBackgroundColorIndex(), ThemedButtonWrapper< ButtonBase >::SetBackgroundColorIndex(), ThemedAButtonWrapper< AButtonBase >::SetBackgroundColorIndex(), ThemedWindowWrapper< WindowBase >::SetForegroundColorIndex(), ThemedAButtonWrapper< AButtonBase >::SetForegroundColorIndex(), ToolDock::ToolDock(), MixerBoard::UpdatePrefs(), AColor::UseThemeColour(), and WhatsNewDialog::WhatsNewDialog().
int ThemeBase::ColourDistance | ( | wxColour & | From, |
wxColour & | To | ||
) |
Definition at line 285 of file Theme.cpp.
Referenced by CursorColour(), and MeterPanel::OnPaint().
void ThemeBase::CreateImageCache | ( | ) |
Definition at line 556 of file Theme.cpp.
References CreateOneImageCache(), GetFilePath(), GetThemeCacheLookup(), anonymous_namespace{Theme.cpp}::ImageCacheFileName, key, mpSet, BasicUI::ShowMessageBox(), and XO().
Referenced by ThemePrefs::OnSaveThemeCache(), and SwitchTheme().
bool ThemeBase::CreateOneImageCache | ( | teThemeType | id, |
bool | bBinarySave | ||
) |
Definition at line 572 of file Theme.cpp.
References GetFilePath(), anonymous_namespace{Theme.cpp}::iColSize, anonymous_namespace{Theme.cpp}::ImageCacheFileName, ImageCacheHeight, ImageCacheWidth, mBitmapFlags, mBitmapNames, mColourNames, mpSet, name, SourceOutputStream::OpenFile(), PasteSubImage(), resFlagInternal, resFlagSkip, BasicUI::ShowMessageBox(), SwitchTheme(), anonymous_namespace{Theme.cpp}::ThemeCacheFileName, anonymous_namespace{Theme.cpp}::ThemeFilePrefix(), anonymous_namespace{Theme.cpp}::ThemeSubdir(), wxImage(), wxT(), and XO().
Referenced by CreateImageCache().
void ThemeBase::DeleteUnusedThemes | ( | ) |
Referenced by ThemePrefs::Cancel(), GUIPrefs::Commit(), and ThemePrefs::Commit().
|
pure virtual |
Implemented in Theme.
Referenced by ReadImageCache(), SwitchTheme(), and WriteImageDefs().
teThemeType ThemeBase::GetFallbackThemeType | ( | ) |
Definition at line 831 of file Theme.cpp.
Referenced by ThemePrefs::OnReadThemeInternal(), and SwitchTheme().
FilePath ThemeBase::GetFilePath | ( | ) |
Definition at line 149 of file Theme.cpp.
References FileNames::DataDir(), mThemeDir, SetFilePath(), and wxT().
Referenced by CreateImageCache(), CreateOneImageCache(), LoadOneThemeComponents(), ReadImageCache(), WriteImageDefs(), and WriteOneImageMap().
wxImage & ThemeBase::Image | ( | int | iIndex | ) |
Referenced by EffectUIHost::BuildTopBar(), ToolBarButtons::CreateButton(), TrackArt::DrawSyncLockTiles(), EVT_COMMAND_RANGE(), ToolBar::MakeAlternateImages(), AudioSetupToolBar::MakeAudioSetupButton(), ToolBar::MakeButton(), anonymous_namespace{ControlToolBar.cpp}::MakeControlToolBarButton(), anonymous_namespace{LoginDialog.cpp}::MakeLoginButton(), ToolBar::MakeMacRecoloredImage(), ToolBar::MakeMacRecoloredImageSize(), ToolBar::MakeRecoloredImageSize(), SelectionBar::MakeSetupButton(), audacity::cloud::ShareAudioToolbar::MakeShareAudioButton(), ThemedAButtonWrapper< AButtonBase >::OnThemeChange(), OverlayImage(), ControlToolBar::Populate(), MeterToolBar::Populate(), ToolsToolBar::Populate(), ReadImageCache(), RecolourBitmap(), RegisterImage(), ThemedAButtonWrapper< AButtonBase >::SetImageIndices(), CommonTrackInfo::SyncLockDrawFunction(), and ToolBarGrabber::ToolBarGrabber().
wxSize ThemeBase::ImageSize | ( | int | iIndex | ) |
Referenced by TranscriptionToolBar::AddButton(), TranscriptionToolBar::MakeAlternateImages(), ToolBar::MakeButton(), ReadImageCache(), and AdornedRulerPanel::ReCreateButtons().
void ThemeBase::LoadOneThemeComponents | ( | teThemeType | id, |
bool | bOkIfNotFound = false |
||
) |
JKC:
Definition at line 979 of file Theme.cpp.
References details::begin(), anonymous_namespace{Theme.cpp}::ColorFileName, details::end(), TranslatableString::Format(), GetFilePath(), mBitmapFlags, mBitmapNames, mColourNames, mpSet, name, names, resFlagInternal, BasicUI::ShowMessageBox(), str, SwitchTheme(), anonymous_namespace{Theme.cpp}::ThemeComponent(), anonymous_namespace{Theme.cpp}::ThemeComponentsDir(), Verbatim(), and XO().
Referenced by LoadThemeComponents().
|
static |
Definition at line 162 of file Theme.cpp.
References GUITheme(), LoadTheme(), ChoiceSetting::Read(), theme, and theTheme.
Referenced by ThemePrefs::Cancel(), GUIPrefs::Commit(), ThemePrefs::Commit(), and AudacityApp::OnInit().
void ThemeBase::LoadTheme | ( | teThemeType | Theme | ) |
This function is called to load the initial Theme images. It does not though cause the GUI to refresh.
Definition at line 255 of file Theme.cpp.
References mPreferredSystemAppearance, Observer::Publisher< ThemeChangeMessage >::Publish(), RotateImageInto(), and SwitchTheme().
Referenced by LoadPreferredTheme().
void ThemeBase::LoadThemeComponents | ( | bool | bOkIfNotFound = false | ) |
Definition at line 972 of file Theme.cpp.
References GetThemeCacheLookup(), key, LoadOneThemeComponents(), and mpSet.
Referenced by App::OnInit(), and ThemePrefs::OnLoadThemeComponents().
wxImage ThemeBase::MakeImageWithAlpha | ( | wxBitmap & | Bmp | ) |
wxImage ThemeBase::MaskedImage | ( | char const ** | pXpm, |
char const ** | pMask | ||
) |
Definition at line 292 of file Theme.cpp.
References wxImage().
bool ThemeBase::ReadImageCache | ( | teThemeType | type = {} , |
bool | bOkIfNotFound = false |
||
) |
Reads an image cache including images, cursors and colours.
type | if empty means read from an external binary file. otherwise the data is taken from a block of memory. |
bOkIfNotFound | if true means do not report absent file. |
Definition at line 842 of file Theme.cpp.
References Identifier::empty(), details::end(), EnsureInitialised(), GetFilePath(), GetSubImageWithAlpha(), GetThemeCacheLookup(), GUITheme(), anonymous_namespace{Theme.cpp}::iColSize, Image(), anonymous_namespace{Theme.cpp}::ImageCacheFileName, ImageCacheWidth, ImageSize(), Light, mBitmapFlags, mPreferredSystemAppearance, mpSet, resFlagInternal, BasicUI::ShowMessageBox(), anonymous_namespace{Theme.cpp}::ThemeSubdir(), wxImage(), and XO().
Referenced by SwitchTheme().
void ThemeBase::RecolourBitmap | ( | int | iIndex, |
wxColour | From, | ||
wxColour | To | ||
) |
Definition at line 276 of file Theme.cpp.
References Bitmap(), ChangeImageColour(), Image(), ReplaceImage(), and wxImage().
void ThemeBase::RegisterColour | ( | NameSet & | allNames, |
int & | iIndex, | ||
const wxColour & | Clr, | ||
const wxString & | Name | ||
) |
Definition at line 391 of file Theme.cpp.
References mColourNames, ThemeSet::mColours, and mpSet.
void ThemeBase::RegisterImage | ( | NameSet & | allNames, |
int & | flags, | ||
int & | iIndex, | ||
char const ** | pXpm, | ||
const wxString & | Name | ||
) |
Definition at line 338 of file Theme.cpp.
References RegisterImage(), and wxImage().
Referenced by RegisterImage().
void ThemeBase::RegisterImage | ( | NameSet & | allNames, |
int & | flags, | ||
int & | iIndex, | ||
const wxImage & | Image, | ||
const wxString & | Name | ||
) |
Definition at line 354 of file Theme.cpp.
References Image(), mBitmapFlags, mBitmapNames, ThemeSet::mImages, mpSet, and wxImage().
void ThemeBase::ReplaceImage | ( | int | iIndex, |
wxImage * | pImage | ||
) |
Referenced by ToolBar::MakeMacRecoloredImage(), and RecolourBitmap().
void ThemeBase::RotateImageInto | ( | int | iTo, |
int | iFrom, | ||
bool | bClockwise | ||
) |
bool ThemeBase::SaveOneThemeComponents | ( | teThemeType | id | ) |
void ThemeBase::SaveThemeAsCode | ( | ) |
Referenced by App::OnInit(), and ThemePrefs::OnSaveThemeAsCode().
void ThemeBase::SaveThemeComponents | ( | ) |
void ThemeBase::SetBrushColour | ( | wxBrush & | Brush, |
int | iIndex | ||
) |
Referenced by AColor::Init(), NumericTextCtrl::Layout(), NumericTextCtrl::OnPaint(), and TrackArtist::SetColours().
void ThemeBase::SetFilePath | ( | const FilePath & | path | ) |
void ThemeBase::SetPenColour | ( | wxPen & | Pen, |
int | iIndex | ||
) |
Referenced by AColor::Init(), NumericTextCtrl::Layout(), NumericTextCtrl::OnPaint(), and TrackArtist::SetColours().
void ThemeBase::SwitchTheme | ( | teThemeType | Theme | ) |
Definition at line 217 of file Theme.cpp.
References CreateImageCache(), EnsureInitialised(), GetFallbackThemeType(), GUITheme(), mpSet, mSets, ChoiceSetting::Read(), and ReadImageCache().
Referenced by CreateOneImageCache(), LoadOneThemeComponents(), LoadTheme(), ThemePrefs::OnLoadThemeCache(), ThemePrefs::OnReadThemeInternal(), and WriteOneImageMap().
void ThemeBase::WriteImageDefs | ( | ) |
Writes a series of Macro definitions that can be used in the include file.
Definition at line 789 of file Theme.cpp.
References EnsureInitialised(), GetFilePath(), mBitmapFlags, mBitmapNames, mpSet, resFlagCursor, resFlagInternal, resFlagNewLine, resFlagPaired, anonymous_namespace{Theme.cpp}::ThemeImageDefsAsCee(), wxImage(), and wxT().
Referenced by ThemePrefs::OnSaveThemeAsCode().
void ThemeBase::WriteImageMap | ( | ) |
Definition at line 728 of file Theme.cpp.
References GetThemeCacheLookup(), key, mpSet, and WriteOneImageMap().
Referenced by ThemePrefs::OnSaveThemeCache().
void ThemeBase::WriteOneImageMap | ( | teThemeType | id | ) |
Writes an html file with an image map of the ImageCache Very handy for seeing what each part is for.
Definition at line 737 of file Theme.cpp.
References GetFilePath(), anonymous_namespace{Theme.cpp}::iColSize, ImageCacheWidth, anonymous_namespace{Theme.cpp}::ImageMapFileName, mBitmapFlags, mBitmapNames, mColourNames, mpSet, resFlagInternal, SwitchTheme(), anonymous_namespace{Theme.cpp}::ThemeSubdir(), wxImage(), and wxT().
Referenced by WriteImageMap().
|
protected |
Definition at line 199 of file Theme.h.
Referenced by CreateOneImageCache(), LoadOneThemeComponents(), ReadImageCache(), RegisterImage(), WriteImageDefs(), and WriteOneImageMap().
|
protected |
Definition at line 198 of file Theme.h.
Referenced by CreateOneImageCache(), LoadOneThemeComponents(), RegisterImage(), WriteImageDefs(), and WriteOneImageMap().
|
protected |
Definition at line 200 of file Theme.h.
Referenced by CreateOneImageCache(), LoadOneThemeComponents(), RegisterColour(), and WriteOneImageMap().
|
protected |
Definition at line 202 of file Theme.h.
Referenced by LoadTheme(), and ReadImageCache().
|
protected |
Definition at line 205 of file Theme.h.
Referenced by CreateImageCache(), CreateOneImageCache(), Theme::EnsureInitialised(), LoadOneThemeComponents(), LoadThemeComponents(), ReadImageCache(), RegisterColour(), RegisterImage(), Theme::RegisterImagesAndColours(), SwitchTheme(), WriteImageDefs(), WriteImageMap(), and WriteOneImageMap().
|
protected |
Definition at line 204 of file Theme.h.
Referenced by SwitchTheme().
|
protected |
Definition at line 196 of file Theme.h.
Referenced by GetFilePath(), and SetFilePath().