libraries/lib-theme/Theme.cpp
/// Writes an html file with an image map of the ImageCache
/// Very handy for seeing what each part is for.
Writes an html file with an image map of the ImageCache
Very handy for seeing what each part is for.
Writes an html file with an image map of the ImageCache Very handy for seeing what each part is for .
void ThemeBase::WriteOneImageMap( teThemeType id )
{
   SwitchTheme( id );
   auto &resources = *mpSet;
   FlowPacker context{ ImageCacheWidth };
   auto dir = ThemeSubdir(id);
   auto FileName = wxFileName{ dir, ImageMapFileName }.GetFullPath();
   wxFFile File( FileName, wxT("wb") );
   if( !File.IsOpened() )
      return;
   File.Write( wxT("<html>\r\n"));
   File.Write( wxT("<body bgcolor=\"303030\">\r\n"));
   wxString Temp = wxString::Format( wxT("<img src=\"ImageCache.png\" width=\"%i\" usemap=\"#map1\">\r\n" ), ImageCacheWidth );
   File.Write( Temp );
   File.Write( wxT("<map name=\"map1\">\r\n") );
   for (size_t i = 0; i < resources.mImages.size(); ++i)
   {
      wxImage &SrcImage = resources.mImages[i];
      context.mFlags = resources.mBitmapFlags[i];
      if( !(resources.mBitmapFlags[i] & resFlagInternal) )
      {
         context.GetNextPosition( SrcImage.GetWidth(), SrcImage.GetHeight());
         wxRect R( context.RectInner() );
         File.Write( wxString::Format(
            wxT("<area title=\"Bitmap:%s\" shape=rect coords=\"%i,%i,%i,%i\">\r\n"),
            resources.mBitmapNames[i],
            R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom()) );
      }
   }
   context.SetColourGroup();
   const int iColSize = 10;
   for (size_t i = 0; i < resources.mColours.size(); ++i)
   {
      context.GetNextPosition( iColSize, iColSize );
      wxRect R( context.RectInner() );
      File.Write( wxString::Format( wxT("<area title=\"Colour:%s\" shape=rect coords=\"%i,%i,%i,%i\">\r\n"),
         resources.mColourNames[i],
         R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom()) );
   }
   File.Write( wxT("</map>\r\n") );
   File.Write( wxT("</body>\r\n"));
   File.Write( wxT("</html>\r\n"));
}
void ThemeBase :: WriteOneImageMap ( teThemeType id ) { SwitchTheme ( id ) ; auto & resources = * mpSet ; FlowPacker context { ImageCacheWidth } ; auto dir = ThemeSubdir ( id ) ; auto FileName = wxFileName { dir , ImageMapFileName } . GetFullPath ( ) ; wxFFile File ( FileName , wxT ( " " ) ) ; if ( ! File . IsOpened ( ) ) return ; File . Write ( wxT ( " \r \n " ) ) ; File . Write ( wxT ( " \" \" \r \n " ) ) ; wxString Temp = wxString :: Format ( wxT ( " \" \" \" \" \" \" \r \n " ) , ImageCacheWidth ) ; File . Write ( Temp ) ; File . Write ( wxT ( " \" \" \r \n " ) ) ; for ( size_t i = 0 ; i < resources . mImages . size ( ) ; ++ i ) { wxImage & SrcImage = resources . mImages [ i ] ; context . mFlags = resources . mBitmapFlags [ i ] ; if ( ! ( resources . mBitmapFlags [ i ] & resFlagInternal ) ) { context . GetNextPosition ( SrcImage . GetWidth ( ) , SrcImage . GetHeight ( ) ) ; wxRect R ( context . RectInner ( ) ) ; File . Write ( wxString :: Format ( wxT ( " \" \" \" \" \r \n " ) , resources . mBitmapNames [ i ] , R . GetLeft ( ) , R . GetTop ( ) , R . GetRight ( ) , R . GetBottom ( ) ) ) ; } } context . SetColourGroup ( ) ; const int iColSize = 10 ; for ( size_t i = 0 ; i < resources . mColours . size ( ) ; ++ i ) { context . GetNextPosition ( iColSize , iColSize ) ; wxRect R ( context . RectInner ( ) ) ; File . Write ( wxString :: Format ( wxT ( " \" \" \" \" \r \n " ) , resources . mColourNames [ i ] , R . GetLeft ( ) , R . GetTop ( ) , R . GetRight ( ) , R . GetBottom ( ) ) ) ; } File . Write ( wxT ( " \r \n " ) ) ; File . Write ( wxT ( " \r \n " ) ) ; File . Write ( wxT ( " \r \n " ) ) ; }
Writes an html file with an image map of the ImageCache
Very handy for seeing what each part is for.
Writes an html file with an image map of the ImageCache Very handy for seeing what each part is for .
// I'll put in NEW lines explicitly. // No href in html.  Uses title not alt. // Now save the colours. // No href in html.  Uses title not alt. // File will be closed automatically.