Audacity  2.2.2
Themability of Audacity


Audacity is Themable. That means the images, colours and fonts can be changed at run time, and pre-built combinations can be loaded when the program starts.

A sample of the saved ImageCache is shown here, hover over any part to see its name (if there is no image shown here, you will need to add the image ImageCache.png into the html directory):

ThemeBase provides most of the implementation of Themes. It is destined for Migration of Generic Code To wxWidgets. Theme is Audacity's variant of a class derived from ThemeBase. It contains the Audacity specific list of icons and images and overloads for the required virtual functions. A singleton instance, theTheme is created by Audacity.

Another class, ThemePrefs, provides the GUI for loading and saving theme information.

The Different Ways Theme Images are Stored

Audacity includes a system for loading and saving different icons and colours.

There are three formats:

The first form is the one usually used. It is useful for designers making systematic changes of the images, particularly systematic colour changes. It is also convenient for archives containing many themes and for sharing of themes. However it is inconvenient when there are additions to and removals from the image set used in Audacity, as can happen between versions. A combined PNG made for one version of Audacity may no longer be suitable for the next version.

Storing as individual images solves that problem and makes it easier for a designer to change just one image. In SVN we check in the individual images.

The third form allows Audacity to store the combined PNG in 'C' format for use in the exe. It is only ever used by developers. It is this third form that provides the built in defaults in Audacity.

The button to save a theme in the 'C' format is only provided in debug builds.

How Audacity Chooses Which Version Of The images To Use?

At the time of writing this document, Audacity also has a deprecated system for its images where they initially start out with contents determined by XPMs built into the program.

The current algorithm for determining which image to use is:

This is handled in function ThemeBase::LoadThemeAtStartUp(). Once the deprecated XPMs have been removed, we wil switch over to using the built in 'ThemeAsCeeCode.h' defualts where we currently use the XPM defaults.

Changing The Colour Scheme

To change the colour scheme:

Adding New Images

To add a new image to Audacity, add a blank place holder for the image into the program like so:

IMAGE( bmpSomeNewImage, wxBitmap(64,64), wxT("SomeNewImage") )

This reserves a 64 x 64 pixel bitmap. You can now refer to it from within the program using bmpSomeNewImage. If you add images on to the end of the list you will generally have the least problems with compatability of versions. If you are adding many images, the most efficient packing of images occurs when the images are added in tallest-first order since Audacity starts a new row whenever the height increases.

Having defined the new image, follow these steps:

Audacity will now be using the image.

Rescuing Default Images

It is possible to completely screw up the built in default images through using an incorrect ThemeAsCeeCode.h. A correct ThemeAsCeeCode.h can be regenerated as follows: