X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2Ftools%2Fbitmapcode.cpp;h=4425062ac1f57b717660f6118facd0df6afe96a2;hp=5130be8c9cfda56a2ca3f938604f76bbcb300fa8;hb=3ef806261b5482a584e05dc8311c8d7633f146b4;hpb=ba675a8314831779d6415311a7ea5d7558af9464 diff --git a/source/tools/bitmapcode.cpp b/source/tools/bitmapcode.cpp index 5130be8..4425062 100644 --- a/source/tools/bitmapcode.cpp +++ b/source/tools/bitmapcode.cpp @@ -1,22 +1,30 @@ -//------------------------------------------------------------------- -// bitmapcode: Helper application which coverts PNG files into -// C++ code outputting binary code. +// bitmapcode.cpp - Bitmap code helper. // -// This application also is a simple test if the wxWidgets header -// files and library files are there. +// (c) 2012-2015 Xestia Software Development. // -// This file is licenced under the GNU General Public License -// version 3 only. (GPLv3 only). -//------------------------------------------------------------------- +// This file is part of Xestia Address Book. +// +// Xestia Address Book is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by the +// Free Software Foundation, version 3 of the license. +// +// Xestia Address Book is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with Xestia Address Book. If not, see #include #include #include #include +#include + #include #include #include -#include using namespace std; @@ -92,8 +100,8 @@ void CreateCPPFile(wxString dirfilename, wxString PNGFilename, int* counter) // Setup the inclusion guard. cppfile << "#include " << endl << endl; - cppfile << "#ifndef " << outname.c_str() << "_CPP" << endl; - cppfile << "#define " << outname.c_str() << "_CPP" << endl << endl; + cppfile << "#ifndef " << outname.ToStdString() << "_CPP" << endl; + cppfile << "#define " << outname.ToStdString() << "_CPP" << endl << endl; outname.Clear(); outname.Append(wxString::FromUTF8(DirFilenameOnly.c_str())); @@ -105,7 +113,7 @@ void CreateCPPFile(wxString dirfilename, wxString PNGFilename, int* counter) // Convert the PNG file into an unsigned char array. - cppfile << "static unsigned char " << outname.c_str() << + cppfile << "static unsigned char " << outname.ToStdString() << "[] = {" << endl; while (pngfile){ @@ -140,10 +148,9 @@ void CreateCPPFile(wxString dirfilename, wxString PNGFilename, int* counter) cppfile << "#endif" << endl << endl; cppfile.close(); - cout << "CPP\t" << CPPFilename.c_str() << endl; + cout << "CPP\t" << CPPFilename.ToStdString() << endl; ++*counter; - } void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist, @@ -163,7 +170,7 @@ void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist, bool fmatch = FALSE; wxString finaldirname; - wxString HPPFilename = dirfilename.c_str(); + wxString HPPFilename = dirfilename.ToStdString(); wxString DirFilenameOnly; wxString HPPFilenameOnly; @@ -216,8 +223,8 @@ void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist, #endif hppfile << "#include " << endl << endl; - hppfile << "#ifndef " << finaldirname.c_str() << "_H" << endl; - hppfile << "#define " << finaldirname.c_str() << "_H" << endl << endl; + hppfile << "#ifndef " << finaldirname.ToStdString() << "_H" << endl; + hppfile << "#define " << finaldirname.ToStdString() << "_H" << endl << endl; hppfile << "// List all CPP files in the directory." << endl << endl; // Write each CPP file into the header file. @@ -247,8 +254,8 @@ void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist, CPPFileOnly.RemoveLast(4); CPPFileOnly.Append(wxT(".cpp")); - hppfile << "#include \"" << DirFilenameOnly.c_str() << - "/" << CPPFileOnly.c_str() << "\"" << endl; + hppfile << "#include \"" << DirFilenameOnly.ToStdString() << + "/" << CPPFileOnly.ToStdString() << "\"" << endl; } @@ -259,7 +266,7 @@ void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist, // Increment the HPP file counter. - cout << "HPPDIR\t" << HPPFilename.c_str() << endl; + cout << "HPPDIR\t" << HPPFilename.ToStdString() << endl; ++*counter; } @@ -378,7 +385,7 @@ int main(int argc, char *argv[]) DirFilenameWxS.Empty(); - std::cout << BitmapHeaderFilename.c_str() << std::endl; + std::cout << BitmapHeaderFilename.ToStdString() << std::endl; #if defined(__WIN32__) @@ -440,7 +447,7 @@ int main(int argc, char *argv[]) for (int fi = 0; fi < filelist.GetCount(); fi++) { - CreateCPPFile(dirlist[bi].wc_str(), filelist[fi].wc_str(), &cppg); + CreateCPPFile(dirlist[bi].ToStdString(), filelist[fi].ToStdString(), &cppg); fp++; } @@ -479,12 +486,12 @@ int main(int argc, char *argv[]) #elif defined(__WIN32__) - finalhppfile << "#include \"bitmaps\\" << DirNameSplit.c_str() << + finalhppfile << "#include \"bitmaps\\" << DirNameSplit.ToStdString() << ".h\"" << endl; #else - finalhppfile << "#include \"bitmaps/" << DirNameSplit.c_str() << + finalhppfile << "#include \"bitmaps/" << DirNameSplit.ToStdString() << ".h\"" << endl; #endif @@ -503,8 +510,7 @@ int main(int argc, char *argv[]) std::cout << hppg << " .hpp files generated." << std::endl; // Write a success flag so that future runs won't take - // place thus speeding up the compilation process as - // required. + // place thus speeding up the compilation process as required. fstream bitmapflag;