X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d96cdd4a885886d1c76c6f4cb1a7eefba34b3d10..c0e69d720d8b15f788fe0998806f18c46f7d5d8b:/utils/emulator/src/emulator.cpp?ds=sidebyside diff --git a/utils/emulator/src/emulator.cpp b/utils/emulator/src/emulator.cpp index 4e44d87096..1c05b55bdc 100644 --- a/utils/emulator/src/emulator.cpp +++ b/utils/emulator/src/emulator.cpp @@ -13,10 +13,6 @@ // declarations // ============================================================================ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "emulator.h" -#endif - // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- @@ -39,6 +35,7 @@ #include "wx/cmdline.h" #include "wx/image.h" #include "wx/file.h" +#include "wx/filename.h" #ifdef __WXX11__ #include "wx/x11/reparent.h" @@ -77,14 +74,14 @@ IMPLEMENT_APP(wxEmulatorApp) static const wxCmdLineEntryDesc sg_cmdLineDesc[] = { - { wxCMD_LINE_OPTION, _T("u"), _T("use-display"), _T("display number to use (default 100)") }, + { wxCMD_LINE_OPTION, "u", "use-display", "display number to use (default 100)" }, - { wxCMD_LINE_SWITCH, _T("h"), _T("help"), _T("displays help on the command line parameters") }, - { wxCMD_LINE_SWITCH, _T("v"), _T("version"), _T("print version") }, + { wxCMD_LINE_SWITCH, "h", "help", "displays help on the command line parameters" }, + { wxCMD_LINE_SWITCH, "v", "version", "print version" }, - { wxCMD_LINE_PARAM, NULL, NULL, _T("config file 1"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_PARAM, NULL, NULL, "config file 1", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, - { wxCMD_LINE_NONE } + wxCMD_LINE_DESC_END }; @@ -108,7 +105,9 @@ wxEmulatorApp::wxEmulatorApp() // 'Main program' equivalent: the program execution "starts" here bool wxEmulatorApp::OnInit() { - wxLog::SetTimestamp(NULL); +#if wxUSE_LOG + wxLog::DisableTimestamp(); +#endif // wxUSE_LOG wxInitAllImageHandlers(); wxString currentDir = wxGetCwd(); @@ -118,10 +117,10 @@ bool wxEmulatorApp::OnInit() // If the development version, go up a directory. #ifdef __WXMSW__ - if ((m_appDir.Right(5).CmpNoCase(_T("DEBUG")) == 0) || - (m_appDir.Right(11).CmpNoCase(_T("DEBUGSTABLE")) == 0) || - (m_appDir.Right(7).CmpNoCase(_T("RELEASE")) == 0) || - (m_appDir.Right(13).CmpNoCase(_T("RELEASESTABLE")) == 0) + if ((m_appDir.Right(5).CmpNoCase(wxT("DEBUG")) == 0) || + (m_appDir.Right(11).CmpNoCase(wxT("DEBUGSTABLE")) == 0) || + (m_appDir.Right(7).CmpNoCase(wxT("RELEASE")) == 0) || + (m_appDir.Right(13).CmpNoCase(wxT("RELEASESTABLE")) == 0) ) m_appDir = wxPathOnly(m_appDir); #endif @@ -177,7 +176,7 @@ bool wxEmulatorApp::OnInit() } // create the main application window - wxEmulatorFrame *frame = new wxEmulatorFrame(_T("wxEmulator"), + wxEmulatorFrame *frame = new wxEmulatorFrame(wxT("wxEmulator"), wxPoint(50, 50), wxSize(450, 340)); #if wxUSE_STATUSBAR @@ -275,14 +274,14 @@ wxEmulatorFrame::wxEmulatorFrame(const wxString& title, // the "About" item should be in the help menu wxMenu *helpMenu = new wxMenu; - helpMenu->Append(Emulator_About, _T("&About...\tF1"), _T("Show about dialog")); + helpMenu->Append(Emulator_About, wxT("&About...\tF1"), wxT("Show about dialog")); - menuFile->Append(Emulator_Quit, _T("E&xit\tAlt-X"), _T("Quit this program")); + menuFile->Append(Emulator_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); // now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); - menuBar->Append(menuFile, _T("&File")); - menuBar->Append(helpMenu, _T("&Help")); + menuBar->Append(menuFile, wxT("&File")); + menuBar->Append(helpMenu, wxT("&Help")); // ... and attach this menu bar to the frame SetMenuBar(menuBar); @@ -306,9 +305,9 @@ void wxEmulatorFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void wxEmulatorFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxString msg; - msg.Printf( _T("wxEmulator is an environment for testing embedded X11 apps.\n")); + msg.Printf( wxT("wxEmulator is an environment for testing embedded X11 apps.\n")); - wxMessageBox(msg, _T("About wxEmulator"), wxOK | wxICON_INFORMATION, this); + wxMessageBox(msg, wxT("About wxEmulator"), wxOK | wxICON_INFORMATION, this); } void wxEmulatorFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) @@ -485,7 +484,7 @@ bool wxEmulatorInfo::Load(const wxString& appDir) m_emulatorScreenSize = wxSize(w, h); } - if (!m_emulatorBackgroundBitmapName.IsEmpty()) + if (!m_emulatorBackgroundBitmapName.empty()) { wxString absoluteBackgroundBitmapName = rootPath + wxString(wxFILE_SEP_PATH) + m_emulatorBackgroundBitmapName; if ( !wxFile::Exists(absoluteBackgroundBitmapName) ) @@ -521,20 +520,20 @@ wxBitmapType wxDetermineImageType(const wxString& filename) { wxString path, name, ext; - wxSplitPath(filename, & path, & name, & ext); + wxFileName::SplitPath(filename, & path, & name, & ext); ext.MakeLower(); - if (ext == _T("jpg") || ext == _T("jpeg")) + if (ext == wxT("jpg") || ext == wxT("jpeg")) return wxBITMAP_TYPE_JPEG; - if (ext == _T("gif")) + if (ext == wxT("gif")) return wxBITMAP_TYPE_GIF; - if (ext == _T("bmp")) + if (ext == wxT("bmp")) return wxBITMAP_TYPE_BMP; - if (ext == _T("png")) + if (ext == wxT("png")) return wxBITMAP_TYPE_PNG; - if (ext == _T("pcx")) + if (ext == wxT("pcx")) return wxBITMAP_TYPE_PCX; - if (ext == _T("tif") || ext == _T("tiff")) + if (ext == wxT("tif") || ext == wxT("tiff")) return wxBITMAP_TYPE_TIF; return wxBITMAP_TYPE_INVALID; @@ -555,9 +554,9 @@ wxString wxColourToHexString(const wxColour& col) // Convert 6-digit hex string to a colour wxColour wxHexStringToColour(const wxString& hex) { - unsigned int r = wxHexToDec(hex.Mid(0, 2)); - unsigned int g = wxHexToDec(hex.Mid(2, 2)); - unsigned int b = wxHexToDec(hex.Mid(4, 2)); + unsigned char r = (unsigned char)wxHexToDec(hex.Mid(0, 2)); + unsigned char g = (unsigned char)wxHexToDec(hex.Mid(2, 2)); + unsigned char b = (unsigned char)wxHexToDec(hex.Mid(4, 2)); return wxColour(r, g, b); } @@ -573,10 +572,10 @@ wxString wxFindAppPath(const wxString& argv0, const wxString& cwd, const wxStrin wxString str; // Try appVariableName - if (!appVariableName.IsEmpty()) + if (!appVariableName.empty()) { str = wxGetenv(appVariableName); - if (!str.IsEmpty()) + if (!str.empty()) return str; } @@ -600,7 +599,7 @@ wxString wxFindAppPath(const wxString& argv0, const wxString& cwd, const wxStrin wxPathList pathList; pathList.AddEnvList(wxT("PATH")); str = pathList.FindAbsoluteValidPath(argv0); - if (!str.IsEmpty()) + if (!str.empty()) return wxPathOnly(str); // Failed