libraries/lib-theme/Theme.cpp
/// This function is called to load the initial Theme images.
/// It does not though cause the GUI to refresh.
This function is called to load the initial Theme images.
It does not though cause the GUI to refresh.
This function is called to load the initial Theme images . It does not though cause the GUI to refresh .
void ThemeBase::LoadTheme( teThemeType Theme )
{
   EnsureInitialised();
   const bool cbOkIfNotFound = true;
   if( !ReadImageCache( Theme, cbOkIfNotFound ) )
   {
      ReadImageCache( GetFallbackThemeType(), !cbOkIfNotFound );
       However, I think it is better to get the user to
       build a NEW image cache, which they can do easily
       from the Theme preferences tab.
#if 0
       and now add any available component images.
      LoadComponents( cbOkIfNotFound );
       JKC: I'm usure about doing this next step automatically.
       Suppose the disk is write protected?
       Is having the image cache created automatically
       going to confuse users?  Do we need version specific names?
       and now save the combined image as a cache for later use.
       We should load the images a little faster in future as a result.
      CreateImageCache();
#endif
   }
   RotateImageInto( bmpRecordBeside, bmpRecordBelow, false );
   RotateImageInto( bmpRecordBesideDisabled, bmpRecordBelowDisabled, false );
   if( bRecolourOnLoad )
      RecolourTheme();
   wxColor Back        = theTheme.Colour( clrTrackInfo );
   wxColor CurrentText = theTheme.Colour( clrTrackPanelText );
   wxColor DesiredText = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
   int TextColourDifference =  ColourDistance( CurrentText, DesiredText );
   bIsUsingSystemTextColour = ( TextColourDifference == 0 );
    Theming is very accepting of alternative text colours.  They just need to 
    have decent contrast to the background colour, if we're blending themes. 
   if( !bIsUsingSystemTextColour ){
      int ContrastLevel        =  ColourDistance( Back, DesiredText );
      bIsUsingSystemTextColour = bRecolourOnLoad && (ContrastLevel > 250);
      if( bIsUsingSystemTextColour )
         Colour( clrTrackPanelText ) = DesiredText;
   }
   bRecolourOnLoad = false;
    Next line is not required as we haven't yet built the GUI
    when this function is (or should be) called.
    ApplyUpdatedImages();
   if(mOnPreferredSystemAppearanceChanged)
      mOnPreferredSystemAppearanceChanged(mPreferredSystemAppearance);
}
void ThemeBase :: LoadTheme ( teThemeType Theme ) { EnsureInitialised ( ) ; const bool cbOkIfNotFound = true ; if ( ! ReadImageCache ( Theme , cbOkIfNotFound ) ) { ReadImageCache ( GetFallbackThemeType ( ) , ! cbOkIfNotFound ) ; #if 0 LoadComponents ( cbOkIfNotFound ) ; CreateImageCache ( ) ; #endif } RotateImageInto ( bmpRecordBeside , bmpRecordBelow , false ) ; RotateImageInto ( bmpRecordBesideDisabled , bmpRecordBelowDisabled , false ) ; if ( bRecolourOnLoad ) RecolourTheme ( ) ; wxColor Back = theTheme . Colour ( clrTrackInfo ) ; wxColor CurrentText = theTheme . Colour ( clrTrackPanelText ) ; wxColor DesiredText = wxSystemSettings :: GetColour ( wxSYS_COLOUR_WINDOWTEXT ) ; int TextColourDifference = ColourDistance ( CurrentText , DesiredText ) ; bIsUsingSystemTextColour = ( TextColourDifference == 0 ) ; if ( ! bIsUsingSystemTextColour ) { int ContrastLevel = ColourDistance ( Back , DesiredText ) ; bIsUsingSystemTextColour = bRecolourOnLoad && ( ContrastLevel > 250 ) ; if ( bIsUsingSystemTextColour ) Colour ( clrTrackPanelText ) = DesiredText ; } bRecolourOnLoad = false ; if ( mOnPreferredSystemAppearanceChanged ) mOnPreferredSystemAppearanceChanged ( mPreferredSystemAppearance ) ; }
This function is called to load the initial Theme images.
This function is called to load the initial Theme images .
// THEN get the default set. // JKC: Now we could go on and load the individual images // on top of the default images using the commented out // code that follows... // // However, I think it is better to get the user to // build a NEW image cache, which they can do easily // from the Theme preferences tab. // and now add any available component images. // JKC: I'm usure about doing this next step automatically. // Suppose the disk is write protected? // Is having the image cache created automatically // going to confuse users?  Do we need version specific names? // and now save the combined image as a cache for later use. // We should load the images a little faster in future as a result. // Theming is very accepting of alternative text colours.  They just need to  // have decent contrast to the background colour, if we're blending themes.  // Next line is not required as we haven't yet built the GUI // when this function is (or should be) called. // ApplyUpdatedImages();