X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/abe89c8acb7875676f2ab51b735256605fc2009e..9a0c5c012a1137c4c3fb0773df8644553dcc0551:/utils/emulator/src/emulator.cpp diff --git a/utils/emulator/src/emulator.cpp b/utils/emulator/src/emulator.cpp index ec98370575..5626b52951 100644 --- a/utils/emulator/src/emulator.cpp +++ b/utils/emulator/src/emulator.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: emulator.cpp -// Purpose: Emulator wxWindows sample +// Purpose: Emulator wxWidgets sample // Author: Julian Smart // Modified by: // Created: 04/01/98 @@ -13,10 +13,6 @@ // declarations // ============================================================================ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "emulator.h" -#endif - // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- @@ -29,7 +25,7 @@ #endif // for all others, include the necessary headers (this file is usually all you -// need because it includes almost all "standard" wxWindows headers) +// need because it includes almost all "standard" wxWidgets headers) #ifndef WX_PRECOMP #include "wx/wx.h" #endif @@ -38,6 +34,7 @@ #include "wx/fileconf.h" #include "wx/cmdline.h" #include "wx/image.h" +#include "wx/file.h" #ifdef __WXX11__ #include "wx/x11/reparent.h" @@ -55,10 +52,10 @@ #endif // ---------------------------------------------------------------------------- -// event tables and other macros for wxWindows +// event tables and other macros for wxWidgets // ---------------------------------------------------------------------------- -// the event tables connect the wxWindows events with the functions (event +// the event tables connect the wxWidgets events with the functions (event // handlers) which process them. It can be also done at run-time, but for the // simple menu events like this the static method is much simpler. BEGIN_EVENT_TABLE(wxEmulatorFrame, wxFrame) @@ -67,7 +64,7 @@ BEGIN_EVENT_TABLE(wxEmulatorFrame, wxFrame) EVT_CLOSE(wxEmulatorFrame::OnCloseWindow) END_EVENT_TABLE() -// Create a new application object: this macro will allow wxWindows to create +// Create a new application object: this macro will allow wxWidgets to create // the application object during program execution (it's better than using a // static object for many reasons) and also declares the accessor function // wxGetApp() which will return the reference of the right type (i.e. wxEmulatorApp and @@ -76,14 +73,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 }; @@ -107,7 +104,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(); @@ -146,7 +145,7 @@ bool wxEmulatorApp::OnInit() wxLog::SetActiveTarget(new wxLogStderr); #endif wxString msg; - msg.Printf(wxT("wxWindows PDA Emulator (c) Julian Smart, 2002 Version %.2f, %s"), wxEMULATOR_VERSION, __DATE__); + msg.Printf(wxT("wxWidgets PDA Emulator (c) Julian Smart, 2002 Version %.2f, %s"), wxEMULATOR_VERSION, __DATE__); wxLogMessage(msg); return false; } @@ -179,12 +178,14 @@ bool wxEmulatorApp::OnInit() wxEmulatorFrame *frame = new wxEmulatorFrame(_T("wxEmulator"), wxPoint(50, 50), wxSize(450, 340)); +#if wxUSE_STATUSBAR frame->SetStatusText(m_emulatorInfo.m_emulatorTitle, 0); wxString sizeStr; sizeStr.Printf(wxT("Screen: %dx%d"), (int) m_emulatorInfo.m_emulatorScreenSize.x, (int) m_emulatorInfo.m_emulatorScreenSize.y); frame->SetStatusText(sizeStr, 1); +#endif // wxUSE_STATUSBAR m_containerWindow = new wxEmulatorContainer(frame, wxID_ANY); @@ -453,7 +454,7 @@ bool wxEmulatorInfo::Load(const wxString& appDir) wxString rootPath = wxPathOnly(absoluteConfigPath); { - wxFileConfig config(wxT("wxEmulator"), wxT("wxWindows"), + wxFileConfig config(wxT("wxEmulator"), wxT("wxWidgets"), absoluteConfigPath, wxEmptyString, wxCONFIG_USE_LOCAL_FILE); config.Read(wxT("/General/title"), & m_emulatorTitle); @@ -482,7 +483,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) ) @@ -552,9 +553,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); } @@ -570,10 +571,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; } @@ -597,7 +598,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