Writes an html file with an image map of the ImageCache Very handy for seeing what each part is for.
| 735 | /// Writes an html file with an image map of the ImageCache |
| 736 | /// Very handy for seeing what each part is for. |
| 737 | void ThemeBase::WriteOneImageMap( teThemeType id ) |
| 738 | { |
| 739 | SwitchTheme( id ); |
| 740 | auto &resources = *mpSet; |
| 741 | |
| 742 | FlowPacker context{ ImageCacheWidth }; |
| 743 | |
| 744 | auto dir = ThemeSubdir(GetFilePath(), id); |
| 745 | auto FileName = wxFileName{ dir, ImageMapFileName }.GetFullPath(); |
| 746 | wxFFile File( FileName, wxT("wb") );// I'll put in NEW lines explicitly. |
| 747 | if( !File.IsOpened() ) |
| 748 | return; |
| 749 | |
| 750 | File.Write( wxT("<html>\r\n")); |
| 751 | File.Write( wxT("<body bgcolor=\"303030\">\r\n")); |
| 752 | wxString Temp = wxString::Format( wxT("<img src=\"ImageCache.png\" width=\"%i\" usemap=\"#map1\">\r\n" ), ImageCacheWidth ); |
| 753 | File.Write( Temp ); |
| 754 | File.Write( wxT("<map name=\"map1\">\r\n") ); |
| 755 | |
| 756 | for (size_t i = 0; i < resources.mImages.size(); ++i) |
| 757 | { |
| 758 | wxImage &SrcImage = resources.mImages[i]; |
| 759 | context.mFlags = mBitmapFlags[i]; |
| 760 | if( !(mBitmapFlags[i] & resFlagInternal) ) |
| 761 | { |
| 762 | context.GetNextPosition( SrcImage.GetWidth(), SrcImage.GetHeight()); |
| 763 | // No href in html. Uses title not alt. |
| 764 | wxRect R( context.RectInner() ); |
| 765 | File.Write( wxString::Format( |
| 766 | wxT("<area title=\"Bitmap:%s\" shape=rect coords=\"%i,%i,%i,%i\">\r\n"), |
| 767 | mBitmapNames[i], |
| 768 | R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom()) ); |
| 769 | } |
| 770 | } |
| 771 | // Now save the colours. |
| 772 | context.SetColourGroup(); |
| 773 | for (size_t i = 0; i < resources.mColours.size(); ++i) |
| 774 | { |
| 775 | context.GetNextPosition( iColSize, iColSize ); |
| 776 | // No href in html. Uses title not alt. |
| 777 | wxRect R( context.RectInner() ); |
| 778 | File.Write( wxString::Format( wxT("<area title=\"Colour:%s\" shape=rect coords=\"%i,%i,%i,%i\">\r\n"), |
| 779 | mColourNames[i], |
| 780 | R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom()) ); |
| 781 | } |
| 782 | File.Write( wxT("</map>\r\n") ); |
| 783 | File.Write( wxT("</body>\r\n")); |
| 784 | File.Write( wxT("</html>\r\n")); |
| 785 | // File will be closed automatically. |
| 786 | } |
| 787 | |
| 788 | /// Writes a series of Macro definitions that can be used in the include file. |
| 789 | void ThemeBase::WriteImageDefs( ) |
nothing calls this directly
no test coverage detected