X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4fe30bceff0445f540e639d2b6d3977d56b34020..4818141bb228bbb59df63de12a5ea31801314b57:/utils/configtool/src/utils.cpp diff --git a/utils/configtool/src/utils.cpp b/utils/configtool/src/utils.cpp index f4d1920389..8c0237f458 100644 --- a/utils/configtool/src/utils.cpp +++ b/utils/configtool/src/utils.cpp @@ -13,29 +13,38 @@ // #pragma implementation #endif -#include "wx/wx.h" -#include "wx/image.h" -#include "wx/notebook.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#include + +#ifndef WX_PRECOMP + #include "wx/splitter.h" -#include "wx/wfstream.h" #include "wx/datstrm.h" #include "wx/file.h" #include "wx/listctrl.h" -#include "wx/tokenzr.h" #include "wx/process.h" -#include "wx/mimetype.h" #include "wx/variant.h" -#include "wx/cshelp.h" #include "wx/cmdline.h" -#include "wx/imaglist.h" - -#include +#include "wx/msgdlg.h" +#include "wx/log.h" +#include "wx/sizer.h" +#include "wx/icon.h" -#ifdef __WXMSW__ -#include -#include "wx/msw/winundef.h" #endif +#include "wx/wfstream.h" +#include "wx/cshelp.h" +#include "wx/image.h" +#include "wx/imaglist.h" +#include "wx/tokenzr.h" +#include "wx/notebook.h" +#include "wx/mimetype.h" #include "utils.h" // Returns the image type, or -1, determined from the extension. @@ -77,9 +86,9 @@ wxString apColourToHexString(const wxColour& col) // Convert 6-digit hex string to a colour wxColour apHexStringToColour(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); } @@ -127,7 +136,7 @@ wxFont apStringToFont(const wxString& str) pointSize = 8; if (pointSize == 9) pointSize = 10; -#endif +#endif } else if (i == 1) family = StringToInt(token); @@ -218,12 +227,14 @@ wxString wxGetTempDir() #if defined(__WXMAC__) && !defined(__DARWIN__) dir = wxMacFindFolder( (short) kOnSystemDisk, kTemporaryFolderType, kCreateFolder ) ; #else // !Mac - dir = wxGetenv(_T("TMP")); + wxString dirEnv(wxGetenv(_T("TMP"))); + dir = dirEnv; if ( dir.empty() ) { - dir = wxGetenv(_T("TEMP")); + wxString envVar(wxGetenv(_T("TEMP"))); + dir = envVar; } - + if ( dir.empty() ) { // default @@ -269,14 +280,12 @@ bool apInvokeAppForFile(const wxString& filename) wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxString& appVariableName) { - wxString str; - // Try appVariableName if (!appVariableName.IsEmpty()) { - str = wxGetenv(appVariableName); - if (!str.IsEmpty()) - return str; + wxString strVar(wxGetenv(appVariableName.c_str())); + if (!strVar.IsEmpty()) + return strVar; } if (wxIsAbsolutePath(argv0)) @@ -288,9 +297,9 @@ wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxStrin if (currentDir.Last() != wxFILE_SEP_PATH) currentDir += wxFILE_SEP_PATH; - str = currentDir + argv0; - if (wxFileExists(str)) - return wxPathOnly(str); + currentDir += argv0; + if (wxFileExists(currentDir)) + return wxPathOnly(currentDir); } // OK, it's neither an absolute path nor a relative path. @@ -298,34 +307,34 @@ wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxStrin wxPathList pathList; pathList.AddEnvList(wxT("PATH")); - str = pathList.FindAbsoluteValidPath(argv0); - if (!str.IsEmpty()) - return wxPathOnly(str); + wxString strPath = pathList.FindAbsoluteValidPath(argv0); + if (!strPath.IsEmpty()) + return wxPathOnly(strPath); // Failed return wxEmptyString; } // Adds a context-sensitive help button, for non-Windows platforms -void apAddContextHelpButton(wxWindow* +void apAddContextHelpButton(wxWindow* #if defined(__WXGTK__) || defined(__WXMAC__) parent #else WXUNUSED(parent) #endif - , wxSizer* + , wxSizer* #if defined(__WXGTK__) || defined(__WXMAC__) sizer #else WXUNUSED(sizer) #endif - , int + , int #if defined(__WXGTK__) || defined(__WXMAC__) sizerFlags #else WXUNUSED(sizerFlags) #endif - , int + , int #if defined(__WXGTK__) || defined(__WXMAC__) sizerBorder #else @@ -387,7 +396,7 @@ int wxIconInfo::GetIconId(int state, bool enabled) const { wxASSERT ( state < (wxMAX_ICON_STATES * 2) ); wxASSERT ( state < m_maxStates ); - + return m_states[state * 2 + (enabled ? 0 : 1)]; } @@ -396,7 +405,7 @@ void wxIconInfo::SetIconId(int state, bool enabled, int iconId) wxASSERT ( state < (wxMAX_ICON_STATES * 2) ); if (state+1 > m_maxStates) m_maxStates = state+1; - + m_states[state * 2 + (enabled ? 0 : 1)] = iconId; } @@ -408,7 +417,7 @@ void wxIconInfo::SetIconId(int state, bool enabled, int iconId) wxIconTable::wxIconTable(wxImageList* imageList) { m_imageList = imageList; - DeleteContents(true); + WX_CLEAR_LIST(wxIconTable,*this); } void wxIconTable::AppendInfo(wxIconInfo* info) @@ -421,7 +430,7 @@ void wxIconTable::AppendInfo(wxIconInfo* info) bool wxIconTable::AddInfo(const wxString& name, const wxIcon& icon, int state, bool enabled) { wxASSERT (m_imageList != NULL); - + wxIconInfo* info = FindInfo(name); if (!info) { @@ -434,7 +443,7 @@ bool wxIconTable::AddInfo(const wxString& name, const wxIcon& icon, int state, b wxIconInfo* wxIconTable::FindInfo(const wxString& name) const { - wxNode* node = GetFirst(); + wxObjectList::compatibility_iterator node = GetFirst(); while (node) { wxIconInfo* info = (wxIconInfo*) node->GetData();