mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-17 17:17:40 +02:00
Recolour Classic theme to wxSYS_COLOUR_3DFACE
This is mainly for Linux which can have a much darker main bar in Classic theme.
This commit is contained in:
parent
221b0271ca
commit
f508439a42
@ -73,6 +73,7 @@ and use it for toolbar and window layouts too.
|
|||||||
#include "FileNames.h"
|
#include "FileNames.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "AColor.h"
|
#include "AColor.h"
|
||||||
|
#include "ImageManipulation.h"
|
||||||
|
|
||||||
#include <wx/arrimpl.cpp>
|
#include <wx/arrimpl.cpp>
|
||||||
|
|
||||||
@ -276,6 +277,7 @@ void Theme::RegisterColours()
|
|||||||
|
|
||||||
ThemeBase::ThemeBase(void)
|
ThemeBase::ThemeBase(void)
|
||||||
{
|
{
|
||||||
|
bRecolourOnLoad = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeBase::~ThemeBase(void)
|
ThemeBase::~ThemeBase(void)
|
||||||
@ -315,12 +317,52 @@ void ThemeBase::LoadTheme( teThemeType Theme )
|
|||||||
CreateImageCache();
|
CreateImageCache();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if( bRecolourOnLoad )
|
||||||
|
RecolourTheme();
|
||||||
|
bRecolourOnLoad = false;
|
||||||
|
|
||||||
// Next line is not required as we haven't yet built the GUI
|
// Next line is not required as we haven't yet built the GUI
|
||||||
// when this function is (or should be) called.
|
// when this function is (or should be) called.
|
||||||
// ApplyUpdatedImages();
|
// ApplyUpdatedImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ThemeBase::RecolourBitmap( int iIndex, wxColour From, wxColour To )
|
||||||
|
{
|
||||||
|
wxImage Image( Bitmap( iIndex ).ConvertToImage() );
|
||||||
|
|
||||||
|
std::unique_ptr<wxImage> pResult = ChangeImageColour(
|
||||||
|
&Image, From, To );
|
||||||
|
ReplaceImage( iIndex, pResult.get() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function coerces a theme to be more like the system colours.
|
||||||
|
void ThemeBase::RecolourTheme()
|
||||||
|
{
|
||||||
|
wxColour From = Colour( clrMedium );
|
||||||
|
wxColour To = wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE );
|
||||||
|
// only recolour if recolouring is slight.
|
||||||
|
int d =
|
||||||
|
abs( From.Red() - To.Red() )
|
||||||
|
+ abs( From.Green() - To.Green() )
|
||||||
|
+ abs( From.Blue() - To.Blue() );
|
||||||
|
|
||||||
|
// Don't recolour if difference is too big, or no difference.
|
||||||
|
if( d > 120 )
|
||||||
|
return;
|
||||||
|
if( d== 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Colour( clrMedium ) = To;
|
||||||
|
|
||||||
|
RecolourBitmap( bmpUpButtonLarge, From, To );
|
||||||
|
RecolourBitmap( bmpDownButtonLarge, From, To );
|
||||||
|
RecolourBitmap( bmpHiliteButtonLarge, From, To );
|
||||||
|
RecolourBitmap( bmpUpButtonSmall, From, To );
|
||||||
|
RecolourBitmap( bmpDownButtonSmall, From, To );
|
||||||
|
RecolourBitmap( bmpHiliteButtonSmall, From, To );
|
||||||
|
// Colour( clrTrackInfo ) = To;
|
||||||
|
// RecolourBitmap( bmpUpButtonExpand, From, To );
|
||||||
|
}
|
||||||
|
|
||||||
wxImage ThemeBase::MaskedImage( char const ** pXpm, char const ** pMask )
|
wxImage ThemeBase::MaskedImage( char const ** pXpm, char const ** pMask )
|
||||||
{
|
{
|
||||||
@ -825,6 +867,7 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
|
|||||||
// ImageCache.InitAlpha();
|
// ImageCache.InitAlpha();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
bRecolourOnLoad = false;
|
||||||
if( type == themeFromFile )
|
if( type == themeFromFile )
|
||||||
{
|
{
|
||||||
const wxString &FileName = FileNames::ThemeCachePng();
|
const wxString &FileName = FileNames::ThemeCachePng();
|
||||||
@ -855,6 +898,7 @@ bool ThemeBase::ReadImageCache( teThemeType type, bool bOkIfNotFound)
|
|||||||
char * pImage = NULL;
|
char * pImage = NULL;
|
||||||
switch( type ){
|
switch( type ){
|
||||||
case themeClassic :
|
case themeClassic :
|
||||||
|
bRecolourOnLoad = true;
|
||||||
ImageSize = sizeof(ClassicImageCacheAsData);
|
ImageSize = sizeof(ClassicImageCacheAsData);
|
||||||
pImage = (char *)ClassicImageCacheAsData;
|
pImage = (char *)ClassicImageCacheAsData;
|
||||||
break;
|
break;
|
||||||
|
@ -116,6 +116,8 @@ public:
|
|||||||
void WriteImageDefs( );
|
void WriteImageDefs( );
|
||||||
void WriteImageMap( );
|
void WriteImageMap( );
|
||||||
static bool LoadPreferredTheme();
|
static bool LoadPreferredTheme();
|
||||||
|
void RecolourBitmap( int iIndex, wxColour From, wxColour To );
|
||||||
|
void RecolourTheme();
|
||||||
|
|
||||||
|
|
||||||
wxColour & Colour( int iIndex );
|
wxColour & Colour( int iIndex );
|
||||||
@ -124,6 +126,7 @@ public:
|
|||||||
wxCursor & Cursor( int iIndex );
|
wxCursor & Cursor( int iIndex );
|
||||||
wxFont & Font( int iIndex );
|
wxFont & Font( int iIndex );
|
||||||
wxSize ImageSize( int iIndex );
|
wxSize ImageSize( int iIndex );
|
||||||
|
bool bRecolourOnLoad;
|
||||||
|
|
||||||
void ReplaceImage( int iIndex, wxImage * pImage );
|
void ReplaceImage( int iIndex, wxImage * pImage );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user