diff --git a/include/wx/confbase.h b/include/wx/confbase.h index 910adb11aa..9066d7797c 100644 --- a/include/wx/confbase.h +++ b/include/wx/confbase.h @@ -35,13 +35,13 @@ /// separates group and entry names (probably shouldn't be changed) #ifndef wxCONFIG_PATH_SEPARATOR - #define wxCONFIG_PATH_SEPARATOR '/' + #define wxCONFIG_PATH_SEPARATOR _T('/') #endif /// introduces immutable entries // (i.e. the ones which can't be changed from the local config file) #ifndef wxCONFIG_IMMUTABLE_PREFIX - #define wxCONFIG_IMMUTABLE_PREFIX '!' + #define wxCONFIG_IMMUTABLE_PREFIX _T('!') #endif /// should we use registry instead of configuration files under Windows? diff --git a/include/wx/filefn.h b/include/wx/filefn.h index f983b7e93a..a6c2cd0f83 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -60,6 +60,65 @@ enum wxSeekMode WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; +// ---------------------------------------------------------------------------- +// declare our versions of low level file functions: some compilers prepend +// underscores to the usual names, some also have Unicode versions of them +// ---------------------------------------------------------------------------- + +// Microsoft compiler loves underscores, feed them to it +#ifdef __VISUALC__ + // functions + #define wxOpen _wopen + #define wxClose _close + #define wxRead _read + #define wxWrite _write + #define wxLseek _lseek + #define wxFsync _commit + #define wxAccess _waccess + #define wxEof _eof + + #define wxTell _tell + + #define wxMkdir _wmkdir + #define wxRmdir _wrmdir + + #define wxStat _wstat + + // types + #define wxStructStat struct _stat + + // constants + + #define O_RDONLY _O_RDONLY + #define O_WRONLY _O_WRONLY + #define O_RDWR _O_RDWR + #define O_EXCL _O_EXCL + #define O_CREAT _O_CREAT + #define O_BINARY _O_BINARY + + #define S_IFDIR _S_IFDIR + #define S_IFREG _S_IFREG +#else + // functions + #define wxOpen open + #define wxClose close + #define wxRead read + #define wxWrite write + #define wxLseek lseek + #define wxFsync commit + #define wxAccess access + #define wxEof eof + + #define wxMkdir mkdir + #define wxRmdir rmdir + + #define wxTell(fd) lseek(fd, 0, SEEK_CUR) + + // types + #define wxStructStat struct stat + +#endif // VC++ + // ---------------------------------------------------------------------------- // functions // ---------------------------------------------------------------------------- diff --git a/include/wx/msw/ole/oleutils.h b/include/wx/msw/ole/oleutils.h index 4e55127e96..98cb02176b 100644 --- a/include/wx/msw/ole/oleutils.h +++ b/include/wx/msw/ole/oleutils.h @@ -85,9 +85,9 @@ bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); #define IMPLEMENT_IUNKNOWN_METHODS(classname) \ STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv) \ { \ - wxLogQueryInterface(#classname, riid); \ + wxLogQueryInterface(_T(#classname), riid); \ \ - if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \ + if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \ *ppv = this; \ AddRef(); \ \ @@ -96,20 +96,20 @@ bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); else { \ *ppv = NULL; \ \ - return (HRESULT) E_NOINTERFACE; \ + return (HRESULT) E_NOINTERFACE; \ } \ } \ \ STDMETHODIMP_(ULONG) classname::AddRef() \ { \ - wxLogAddRef(#classname, m_cRef); \ + wxLogAddRef(_T(#classname), m_cRef); \ \ return ++m_cRef; \ } \ \ STDMETHODIMP_(ULONG) classname::Release() \ { \ - wxLogRelease(#classname, m_cRef); \ + wxLogRelease(_T(#classname), m_cRef); \ \ if ( --m_cRef == 0 ) { \ delete this; \ diff --git a/include/wx/txtstrm.h b/include/wx/txtstrm.h index 5b114305a8..9553ce1356 100644 --- a/include/wx/txtstrm.h +++ b/include/wx/txtstrm.h @@ -47,7 +47,7 @@ public: // Operators wxTextInputStream& operator>>(wxString& word); - wxTextInputStream& operator>>(wxChar& c); + wxTextInputStream& operator>>(char& c); wxTextInputStream& operator>>(wxInt16& i); wxTextInputStream& operator>>(wxInt32& i); wxTextInputStream& operator>>(wxUint16& i); @@ -90,7 +90,7 @@ public: wxTextOutputStream& operator<<(const wxChar *string); wxTextOutputStream& operator<<(const wxString& string); - wxTextOutputStream& operator<<(wxChar c); + wxTextOutputStream& operator<<(char c); wxTextOutputStream& operator<<(wxInt16 c); wxTextOutputStream& operator<<(wxInt32 c); wxTextOutputStream& operator<<(wxUint16 c); diff --git a/include/wx/wxprec.h b/include/wx/wxprec.h index e4f29ad5b4..0bfccf8d0d 100644 --- a/include/wx/wxprec.h +++ b/include/wx/wxprec.h @@ -27,6 +27,10 @@ #ifdef WX_PRECOMP +// include first to ensure that UNICODE macro is correctly set +// _before_ including +#include "wx/wxchar.h" + // include standard Windows headers #if defined(__WXMSW__) && !wxUSE_MFC #include diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 7fe202a8b5..e96aaa3e04 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -287,7 +287,7 @@ bool wxDocument::OnSaveDocument(const wxString& file) msgTitle = wxString(_("File error")); #if wxUSE_STD_IOSTREAM - ofstream store(wxString(file.fn_str())); + ofstream store(wxString(file.fn_str()).mb_str()); if (store.fail() || store.bad()) #else wxFileOutputStream store(wxString(file.fn_str())); @@ -323,7 +323,7 @@ bool wxDocument::OnOpenDocument(const wxString& file) msgTitle = wxString(_("File error")); #if wxUSE_STD_IOSTREAM - ifstream store(wxString(file.fn_str())); + ifstream store(wxString(file.fn_str()).mb_str()); if (store.fail() || store.bad()) #else wxFileInputStream store(wxString(file.fn_str())); @@ -2164,7 +2164,7 @@ bool wxTransferFileToStream(const wxString& filename, ostream& stream) FILE *fd1; int ch; - if ((fd1 = fopen (filename.fn_str(), "rb")) == NULL) + if ((fd1 = wxFopen (filename.fn_str(), _T("rb"))) == NULL) return FALSE; while ((ch = getc (fd1)) != EOF) @@ -2179,7 +2179,7 @@ bool wxTransferStreamToFile(istream& stream, const wxString& filename) FILE *fd1; int ch; - if ((fd1 = fopen (filename.fn_str(), "wb")) == NULL) + if ((fd1 = wxFopen (filename.fn_str(), _T("wb"))) == NULL) { return FALSE; } diff --git a/src/common/file.cpp b/src/common/file.cpp index 57b0ed73ca..22e0da2bb4 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -87,36 +87,6 @@ #include // stat #endif -// Microsoft compiler loves underscores, feed them to it -#ifdef __VISUALC__ - // functions - #define open _open - #define close _close - #define read _read - #define write _write - #define lseek _lseek - #define fsync _commit - #define access _access - #define eof _eof - - // types - #define stat _stat - - // constants - - #define O_RDONLY _O_RDONLY - #define O_WRONLY _O_WRONLY - #define O_RDWR _O_RDWR - #define O_EXCL _O_EXCL - #define O_CREAT _O_CREAT - #define O_BINARY _O_BINARY - - #define S_IFDIR _S_IFDIR - #define S_IFREG _S_IFREG -#else - #define tell(fd) lseek(fd, 0, SEEK_CUR) -#endif // VC++ - #if defined(__BORLANDC__) || defined(_MSC_VER) #define W_OK 2 #define R_OK 4 @@ -159,23 +129,23 @@ // ---------------------------------------------------------------------------- bool wxFile::Exists(const wxChar *name) { - struct stat st; + wxStructStat st; #if wxUSE_UNICODE && wxMBFILES wxCharBuffer fname = wxConvFile.cWC2MB(name); #ifdef __WXMAC__ return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG); #else - return !access(fname, 0) && - !stat(wxMBSTRINGCAST fname, &st) && + return !wxAccess(fname, 0) && + !wxStat(wxMBSTRINGCAST fname, &st) && (st.st_mode & S_IFREG); #endif #else #ifdef __WXMAC__ return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG); #else - return !access(name, 0) && - !stat(name, &st) && + return !wxAccess(name, 0) && + !wxStat(name, &st) && (st.st_mode & S_IFREG); #endif #endif @@ -198,7 +168,7 @@ bool wxFile::Access(const wxChar *name, OpenMode mode) wxFAIL_MSG(wxT("bad wxFile::Access mode parameter.")); } - return access(wxFNCONV(name), how) == 0; + return wxAccess(wxFNCONV(name), how) == 0; } // ---------------------------------------------------------------------------- @@ -222,10 +192,10 @@ bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode) #ifdef __WXMAC__ int fd = open(wxUnix2MacFilename( szFileName ), O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access); #else - int fd = open(wxFNCONV(szFileName), - O_BINARY | O_WRONLY | O_CREAT | - (bOverwrite ? O_TRUNC : O_EXCL) - ACCESS(accessMode)); + int fd = wxOpen(wxFNCONV(szFileName), + O_BINARY | O_WRONLY | O_CREAT | + (bOverwrite ? O_TRUNC : O_EXCL) + ACCESS(accessMode)); #endif if ( fd == -1 ) { wxLogSysError(_("can't create file '%s'"), szFileName); @@ -263,7 +233,7 @@ bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode) #ifdef __WXMAC__ int fd = open(wxUnix2MacFilename( szFileName ), flags, access); #else - int fd = open(wxFNCONV(szFileName), flags ACCESS(accessMode)); + int fd = wxOpen(wxFNCONV(szFileName), flags ACCESS(accessMode)); #endif if ( fd == -1 ) { wxLogSysError(_("can't open file '%s'"), szFileName); @@ -337,7 +307,7 @@ bool wxFile::Flush() { if ( IsOpened() ) { #if defined(__VISUALC__) || wxHAVE_FSYNC - if ( fsync(m_fd) == -1 ) + if ( wxFsync(m_fd) == -1 ) { wxLogSysError(_("can't flush file descriptor %d"), m_fd); return FALSE; @@ -522,7 +492,7 @@ bool wxTempFile::Open(const wxString& strName) mode_t umaskOld = 0; // just to suppress compiler warning bool changedUmask; - struct stat st; + wxStructStat st; if ( stat(strName.fn_str(), &st) == 0 ) { // this assumes that only lower bits of st_mode contain the access @@ -572,12 +542,12 @@ bool wxTempFile::Commit() m_file.Close(); #ifndef __WXMAC__ - if ( wxFile::Exists(m_strName) && remove(m_strName.fn_str()) != 0 ) { + if ( wxFile::Exists(m_strName) && wxRemove(m_strName.fn_str()) != 0 ) { wxLogSysError(_("can't remove file '%s'"), m_strName.c_str()); return FALSE; } - if ( rename(m_strTemp.fn_str(), m_strName.fn_str()) != 0 ) { + if ( wxRename(m_strTemp.fn_str(), m_strName.fn_str()) != 0 ) { wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str()); return FALSE; } @@ -600,7 +570,7 @@ void wxTempFile::Discard() { m_file.Close(); #ifndef __WXMAC__ - if ( remove(m_strTemp.fn_str()) != 0 ) + if ( wxRemove(m_strTemp.fn_str()) != 0 ) wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str()); #else if ( remove( wxUnix2MacFilename(m_strTemp.fn_str())) != 0 ) diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index abd042882e..0a4e98d4c0 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -881,7 +881,7 @@ bool wxFileConfig::DeleteAll() { CleanUp(); - if ( remove(m_strLocalFile.fn_str()) == -1 ) + if ( wxRemove(m_strLocalFile.fn_str()) == -1 ) wxLogSysError(_("can't delete user configuration file '%s'"), m_strLocalFile.c_str()); m_strLocalFile = m_strGlobalFile = wxT(""); diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 5ed7a5d275..59bbb35f4d 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -277,14 +277,10 @@ wxFileExists (const wxString& filename) return FALSE ; #else -#ifdef __SALFORDC__ - struct _stat stbuf; -#else - struct stat stbuf; -#endif - - if ((filename != wxT("")) && stat (wxFNSTRINGCAST filename.fn_str(), &stbuf) == 0) + wxStructStat stbuf; + if ((filename != wxT("")) && wxStat (wxFNSTRINGCAST filename.fn_str(), &stbuf) == 0) return TRUE; + return FALSE; #endif } @@ -1050,7 +1046,7 @@ wxRenameFile (const wxString& file1, const wxString& file2) return TRUE; #else // Normal system call - if (0 == rename (wxFNSTRINGCAST file1.fn_str(), wxFNSTRINGCAST file2.fn_str())) + if (0 == wxRename (wxFNSTRINGCAST file1.fn_str(), wxFNSTRINGCAST file2.fn_str())) return TRUE; #endif // Try to copy @@ -1065,7 +1061,7 @@ wxRenameFile (const wxString& file1, const wxString& file2) bool wxRemoveFile(const wxString& file) { #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) - int flag = remove(wxFNSTRINGCAST file.fn_str()); + int flag = wxRemove(wxFNSTRINGCAST file.fn_str()); #elif defined( __WXMAC__ ) int flag = unlink(wxUnix2MacFilename( file )); #else @@ -1086,7 +1082,7 @@ bool wxMkdir(const wxString& dir, int perm) #if (!(defined(__WXMSW__) || defined(__OS2__))) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WXWINE__) if ( mkdir(wxFNCONV(dirname), perm) != 0 ) #else // !MSW and !OS/2 VAC++ - if ( mkdir(wxFNSTRINGCAST wxFNCONV(dirname)) != 0 ) + if ( wxMkdir(wxFNSTRINGCAST wxFNCONV(dirname)) != 0 ) #endif // !MSW/MSW { wxLogSysError(_("Directory '%s' couldn't be created"), dirname); @@ -1109,7 +1105,7 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags)) #ifdef __SALFORDC__ return FALSE; // What to do? #else - return (rmdir(wxFNSTRINGCAST dir.fn_str()) == 0); + return (wxRmdir(wxFNSTRINGCAST dir.fn_str()) == 0); #endif #endif @@ -1170,13 +1166,9 @@ bool wxPathExists(const wxChar *pszPathName) if ( wxEndsWithPathSeparator(pszPathName) && pszPathName[1] != wxT('\0') ) strPath.Last() = wxT('\0'); -#ifdef __SALFORDC__ - struct _stat st; -#else - struct stat st; -#endif + wxStructStat st; - return stat(wxFNSTRINGCAST strPath.fn_str(), &st) == 0 && (st.st_mode & S_IFDIR); + return wxStat(wxFNSTRINGCAST strPath.fn_str(), &st) == 0 && (st.st_mode & S_IFDIR); } // Get a temporary filename, opening and closing the file. @@ -1869,9 +1861,9 @@ void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName, time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename) { - struct stat buf; + wxStructStat buf; - stat(filename.fn_str(), &buf); + wxStat(filename.fn_str(), &buf); return buf.st_mtime; } diff --git a/src/common/log.cpp b/src/common/log.cpp index b23af1e648..e0bc9a779e 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -655,7 +655,7 @@ void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg) //case wxNO: nothing to do } #else // !GUI, but MSW - switch ( ::MessageBox(NULL, szBuf, "Debug", + switch ( ::MessageBox(NULL, szBuf, _T("Debug"), MB_YESNOCANCEL | MB_ICONSTOP ) ) { case IDYES: Trap(); diff --git a/src/common/resource.cpp b/src/common/resource.cpp index 5ecc28e9d4..90043672a6 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -230,7 +230,7 @@ bool wxResourceTable::ParseResourceFile(const wxString& filename) #ifdef __WXMAC__ FILE *fd = fopen(wxUnix2MacFilename(filename.fn_str()), "r"); #else - FILE *fd = fopen(filename.fn_str(), "r"); + FILE *fd = wxFopen(filename.fn_str(), _T("r")); #endif if (!fd) return FALSE; @@ -2779,7 +2779,7 @@ bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table) if (!table) table = wxDefaultResourceTable; - FILE *fd = fopen(f.fn_str(), "r"); + FILE *fd = wxFopen(f.fn_str(), _T("r")); if (!fd) { return FALSE; diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 8131c0427a..7924cee54f 100644 --- a/src/common/sckaddr.cpp +++ b/src/common/sckaddr.cpp @@ -108,7 +108,7 @@ bool wxIPV4address::Hostname(const wxString& name) return FALSE; } - return (GAddress_INET_SetHostName(m_address, name.fn_str()) == GSOCK_NOERROR); + return (GAddress_INET_SetHostName(m_address, name.mb_str()) == GSOCK_NOERROR); } bool wxIPV4address::Hostname(unsigned long addr) @@ -118,7 +118,7 @@ bool wxIPV4address::Hostname(unsigned long addr) bool wxIPV4address::Service(const wxString& name) { - return (GAddress_INET_SetPortName(m_address, name.fn_str(), "tcp") == GSOCK_NOERROR); + return (GAddress_INET_SetPortName(m_address, name.mb_str(), "tcp") == GSOCK_NOERROR); } bool wxIPV4address::Service(unsigned short port) diff --git a/src/common/sckipc.cpp b/src/common/sckipc.cpp index 29662ab789..3fea37e1ec 100644 --- a/src/common/sckipc.cpp +++ b/src/common/sckipc.cpp @@ -305,7 +305,7 @@ bool wxTCPConnection::Execute(const wxChar *data, int size, wxIPCFormat format) m_codeco->Write8(format); if (size < 0) - size = strlen(data) + 1; // includes final NUL + size = wxStrlen(data) + 1; // includes final NUL m_codeco->Write32(size); m_sockstrm->Write(data, size); @@ -353,7 +353,7 @@ bool wxTCPConnection::Poke (const wxString& item, wxChar *data, int size, wxIPCF m_codeco->Write8(format); if (size < 0) - size = strlen(data) + 1; // includes final NUL + size = wxStrlen(data) + 1; // includes final NUL m_codeco->Write32(size); m_sockstrm->Write(data, size); @@ -409,7 +409,7 @@ bool wxTCPConnection::Advise (const wxString& item, m_codeco->Write8(format); if (size < 0) - size = strlen(data) + 1; // includes final NUL + size = wxStrlen(data) + 1; // includes final NUL m_codeco->Write32(size); m_sockstrm->Write(data, size); diff --git a/src/common/txtstrm.cpp b/src/common/txtstrm.cpp index ae71ae5d21..aaa228b9da 100644 --- a/src/common/txtstrm.cpp +++ b/src/common/txtstrm.cpp @@ -284,17 +284,19 @@ wxTextInputStream& wxTextInputStream::operator>>(wxString& word) return *this; } -wxTextInputStream& wxTextInputStream::operator>>(wxChar& c) +wxTextInputStream& wxTextInputStream::operator>>(char& c) { if (!m_input) { - c = (wxChar) 0; + c = 0; return *this; } c = m_input.GetC(); - if (EatEOL(c)) c=wxT('\n'); + if (EatEOL(c)) + c = '\n'; + return *this; } @@ -444,9 +446,14 @@ wxTextOutputStream& wxTextOutputStream::operator<<(const wxString& string) return *this; } -wxTextOutputStream& wxTextOutputStream::operator<<(wxChar c) +wxTextOutputStream& wxTextOutputStream::operator<<(char c) { - WriteString( wxString(c) ); + // these strange manipulations are needed in Unicode mode + char buf[2]; + buf[0] = c; + buf[1] = 0; + + WriteString( wxString(buf) ); return *this; } diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index c6cd6d9788..28fc29f693 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -513,8 +513,8 @@ wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) else #endif // 0 { - wxLogDebug(wxT("Unrecognized accel key '%s', accel " - "string ignored."), current.c_str()); + wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."), + current.c_str()); } } } diff --git a/src/common/wxexpr.cpp b/src/common/wxexpr.cpp index 3228a1bcc7..56f4ea458a 100644 --- a/src/common/wxexpr.cpp +++ b/src/common/wxexpr.cpp @@ -992,7 +992,7 @@ bool wxExprDatabase::Read(const wxString& filename) { noErrors = 0; - FILE *f = fopen(filename.fn_str(), "r"); + FILE *f = wxFopen(filename.fn_str(), _T("r")); if (f) { thewxExprDatabase = this; @@ -1024,7 +1024,7 @@ bool wxExprDatabase::ReadFromString(const wxString& buffer) bool wxExprDatabase::Write(const wxString& fileName) { - FILE *stream = fopen( fileName.fn_str(), "w+" ); + FILE *stream = wxFopen( fileName.fn_str(), _T("w+")); if (!stream) return FALSE; diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index d931c84ed0..196f5e6a93 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -483,8 +483,8 @@ void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event)) if ( wxFile::Exists(szFileName) ) { bool bAppend = FALSE; wxString strMsg; - strMsg.Printf(_("Append log to file '%s' " - "(choosing [No] will overwrite it)?"), szFileName); + strMsg.Printf(_("Append log to file '%s' (choosing [No] will overwrite it)?"), + szFileName); switch ( wxMessageBox(strMsg, _("Question"), wxYES_NO | wxCANCEL) ) { case wxYES: bAppend = TRUE; diff --git a/src/generic/prop.cpp b/src/generic/prop.cpp index ad6d3b521e..7175580382 100644 --- a/src/generic/prop.cpp +++ b/src/generic/prop.cpp @@ -179,7 +179,7 @@ wxPropertyValue::wxPropertyValue(wxStringList *the_list) wxNode *node = the_list->First(); while (node) { - char *s = (char *)node->Data(); + wxChar *s = (wxChar *)node->Data(); Append(new wxPropertyValue(s)); node = node->Next(); } diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index 75292ae8f2..25052abfe8 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -93,7 +93,7 @@ class wxHtmlHelpHashData : public wxObject wxHtmlHelpHashData(int index, wxTreeItemId id) : wxObject() { m_Index = index; m_Id = id;} ~wxHtmlHelpHashData() {} - + int m_Index; wxTreeItemId m_Id; }; @@ -114,7 +114,7 @@ class wxHtmlHelpHtmlWindow : public wxHtmlWindow m_Frame -> NotifyPageChanged(); } - private: + private: wxHtmlHelpFrame *m_Frame; }; @@ -178,7 +178,7 @@ void wxHtmlHelpFrame::Init(wxHtmlHelpData* data) m_NormalFonts = m_FixedFonts = NULL; m_NormalFace = m_FixedFace = wxEmptyString; m_FontSize = 1; - + #if wxUSE_PRINTING_ARCHITECTURE m_Printer = NULL; #endif @@ -217,8 +217,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti // toolbar? if (style & (wxHF_TOOLBAR | wxHF_FLATTOOLBAR)) { - wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | - wxTB_DOCKABLE | + wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | + wxTB_DOCKABLE | (style & wxHF_FLATTOOLBAR ? wxTB_FLAT : 0)); toolBar->SetMargins( 2, 2 ); AddToolbarButtons(toolBar, style); @@ -435,7 +435,7 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti m_SearchPage = notebook_page++; } m_HtmlWin -> Show(TRUE); - + RefreshLists(); // showtime @@ -516,7 +516,7 @@ void wxHtmlHelpFrame::AddToolbarButtons(wxToolBar *toolBar, int style) if ((style & wxHF_PRINT) || (style & wxHF_OPENFILES)) toolBar -> AddSeparator(); - + if (style & wxHF_OPENFILES) toolBar -> AddTool(wxID_HTML_OPENFILE, wopenBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, @@ -621,8 +621,8 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword) if (m_SearchChoice->GetSelection() != 0) book = m_SearchChoice->GetStringSelection(); - wxHtmlSearchStatus status(m_Data, keyword, - m_SearchCaseSensitive -> GetValue(), m_SearchWholeWords -> GetValue(), + wxHtmlSearchStatus status(m_Data, keyword, + m_SearchCaseSensitive -> GetValue(), m_SearchWholeWords -> GetValue(), book); wxProgressDialog progress(_("Searching..."), _("No matching page found yet"), @@ -645,7 +645,7 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword) m_SearchText -> SetFocus(); if (foundcnt) { wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(0); - if (it) + if (it) { m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); NotifyPageChanged(); @@ -662,7 +662,7 @@ void wxHtmlHelpFrame::CreateContents() return ; m_ContentsBox->Clear(); - + if (m_PagesHash) delete m_PagesHash; m_PagesHash = new wxHashTable(wxKEY_STRING, 2 * m_Data -> GetContentsCnt()); m_PagesHash -> DeleteContents(TRUE); @@ -685,7 +685,7 @@ void wxHtmlHelpFrame::CreateContents() roots[it -> m_Level + 1] = m_ContentsBox -> AppendItem( roots[it -> m_Level], it -> m_Name, IMG_Page, -1, new wxHtmlHelpTreeItemData(i)); - m_PagesHash -> Put(it -> m_Book -> GetBasePath() + it -> m_Page, + m_PagesHash -> Put(it -> m_Book -> GetBasePath() + it -> m_Page, new wxHtmlHelpHashData(i, roots[it -> m_Level + 1])); if (it -> m_Level == 0) { @@ -713,16 +713,16 @@ void wxHtmlHelpFrame::CreateIndex() m_IndexList->Clear(); int cnt = m_Data->GetIndexCnt(); - + wxString cnttext; if (cnt > INDEX_IS_SMALL) cnttext.Printf(_("%i of %i"), 0, cnt); else cnttext.Printf(_("%i of %i"), cnt, cnt); m_IndexCountInfo -> SetLabel(cnttext); if (cnt > INDEX_IS_SMALL) return; - + wxHtmlContentsItem* index = m_Data->GetIndex(); - for (int i = 0; i < cnt; i++) + for (int i = 0; i < cnt; i++) m_IndexList -> Append(index[i].m_Name, (char*)(index + i)); } @@ -773,7 +773,7 @@ void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path) int i; int cnt; wxString val, s; - + cnt = cfg -> Read(wxT("hcBookmarksCnt"), 0L); if (cnt != 0) { m_BookmarksNames.Clear(); @@ -782,7 +782,7 @@ void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path) m_Bookmarks -> Clear(); m_Bookmarks -> Append(_("(bookmarks)")); } - + for (i = 0; i < cnt; i++) { val.Printf(wxT("hcBookmark_%i"), i); s = cfg -> Read(val); @@ -821,12 +821,12 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path cfg -> Write(wxT("hcFixedFace"), m_FixedFace); cfg -> Write(wxT("hcNormalFace"), m_NormalFace); cfg -> Write(wxT("hcFontSize"), (long)m_FontSize); - + if (m_Bookmarks) { int i; int cnt = m_BookmarksNames.GetCount(); wxString val; - + cfg -> Write(wxT("hcBookmarksCnt"), (long)cnt); for (i = 0; i < cnt; i++) { val.Printf(wxT("hcBookmark_%i"), i); @@ -849,7 +849,7 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path static void SetFontsToHtmlWin(wxHtmlWindow *win, wxString scalf, wxString fixf, int size) { - static int f_sizes[5][7] = + static int f_sizes[5][7] = { { 6, 7, 9, 12, 14, 16, 19}, { 8, 9, 12, 14, 16, 19, 22}, @@ -879,30 +879,30 @@ class wxHtmlHelpFrameOptionsDialog : public wxDialog sizer = new wxBoxSizer(wxHORIZONTAL); sizer2 = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Normal font:")), wxVERTICAL); - sizer2 -> Add(NormalFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, - wxSize(200, 200), + sizer2 -> Add(NormalFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, + wxSize(200, 200), 0, NULL, wxCB_DROPDOWN | wxCB_READONLY), 1, wxEXPAND | wxLEFT | wxRIGHT, 10); sizer -> Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); sizer2 = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Fixed font:")), wxVERTICAL); - sizer2 -> Add(FixedFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, - wxSize(200, 200), - 0, NULL, wxCB_DROPDOWN | wxCB_READONLY), + sizer2 -> Add(FixedFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, + wxSize(200, 200), + 0, NULL, wxCB_DROPDOWN | wxCB_READONLY), 1, wxEXPAND | wxLEFT | wxRIGHT, 10); sizer -> Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); topsizer -> Add(sizer); - topsizer -> Add(RadioBox = new wxRadioBox(this, -1, _("Font size:"), - wxDefaultPosition, wxDefaultSize, 5, choices, 5), + topsizer -> Add(RadioBox = new wxRadioBox(this, -1, _("Font size:"), + wxDefaultPosition, wxDefaultSize, 5, choices, 5), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); - - topsizer -> Add(new wxStaticText(this, -1, _("Preview:")), + + topsizer -> Add(new wxStaticText(this, -1, _("Preview:")), 0, wxLEFT | wxTOP, 10); - topsizer -> Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150)), + topsizer -> Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150)), 1, wxEXPAND | wxLEFT|wxTOP|wxRIGHT, 10); sizer = new wxBoxSizer(wxHORIZONTAL); @@ -915,36 +915,38 @@ class wxHtmlHelpFrameOptionsDialog : public wxDialog topsizer -> Fit(this); Centre(wxBOTH); } - + void UpdateTestWin() { wxBusyCursor bcur; - SetFontsToHtmlWin(TestWin, + SetFontsToHtmlWin(TestWin, NormalFont -> GetStringSelection(), FixedFont -> GetStringSelection(), RadioBox -> GetSelection()); - TestWin -> SetPage(_("" - "Normal face
(and underlined. Italic face. " - "Bold face. Bold italic face.
" - "font size -2
" - "font size -1
" - "font size +0
" - "font size +1
" - "font size +2
" - "font size +3
" - "font size +4
" - - "

Fixed size face.
bold italic " - "bold italic underlined
" - "font size -2
" - "font size -1
" - "font size +0
" - "font size +1
" - "font size +2
" - "font size +3
" - "font size +4
" - "")); + TestWin -> SetPage(_( +"\ +Normal face
(and underlined. Italic face. \ +Bold face. Bold italic face.
\ +font size -2
\ +font size -1
\ +font size +0
\ +font size +1
\ +font size +2
\ +font size +3
\ +font size +4
\ +\ +

Fixed size face.
bold italic \ +bold italic underlined
\ +font size -2
\ +font size -1
\ +font size +0
\ +font size +1
\ +font size +2
\ +font size +3
\ +font size +4
\ +" + )); } void OnUpdate(wxCommandEvent& event) @@ -965,7 +967,7 @@ void wxHtmlHelpFrame::OptionsDialog() { wxHtmlHelpFrameOptionsDialog dlg(this); unsigned i; - + if (m_NormalFonts == NULL) { wxFontEnumerator enu; enu.EnumerateFacenames(); @@ -980,7 +982,7 @@ void wxHtmlHelpFrame::OptionsDialog() *m_FixedFonts = *enu.GetFacenames(); m_FixedFonts -> Sort(); } - + for (i = 0; i < m_NormalFonts -> GetCount(); i++) dlg.NormalFont -> Append((*m_NormalFonts)[i]); for (i = 0; i < m_FixedFonts -> GetCount(); i++) @@ -991,7 +993,7 @@ void wxHtmlHelpFrame::OptionsDialog() else dlg.FixedFont -> SetSelection(0); dlg.RadioBox -> SetSelection(m_FontSize); dlg.UpdateTestWin(); - + if (dlg.ShowModal() == wxID_OK) { m_NormalFace = dlg.NormalFont -> GetStringSelection(); m_FixedFace = dlg.FixedFont -> GetStringSelection(); @@ -1043,9 +1045,9 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) m_HtmlWin -> HistoryForward(); NotifyPageChanged(); break; - - case wxID_HTML_UP : - if (m_PagesHash) + + case wxID_HTML_UP : + if (m_PagesHash) { wxString an = m_HtmlWin -> GetOpenedAnchor(); wxHtmlHelpHashData *ha; @@ -1062,8 +1064,8 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) } break; - case wxID_HTML_UPNODE : - if (m_PagesHash) + case wxID_HTML_UPNODE : + if (m_PagesHash) { wxString an = m_HtmlWin -> GetOpenedAnchor(); wxHtmlHelpHashData *ha; @@ -1076,7 +1078,7 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) int level = m_Data -> GetContents()[ha -> m_Index].m_Level - 1; wxHtmlContentsItem *it; int ind = ha -> m_Index - 1; - + it = m_Data -> GetContents() + ind; while (ind >= 0 && it -> m_Level != level) ind--, it--; if (ind >= 0) @@ -1088,13 +1090,13 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) } break; - case wxID_HTML_DOWN : - if (m_PagesHash) + case wxID_HTML_DOWN : + if (m_PagesHash) { wxString an = m_HtmlWin -> GetOpenedAnchor(); wxString adr; wxHtmlHelpHashData *ha; - + if (an.IsEmpty()) adr = m_HtmlWin -> GetOpenedPage(); else adr = m_HtmlWin -> GetOpenedPage() + wxT("#") + an; @@ -1103,7 +1105,7 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) if (ha && ha -> m_Index < m_Data -> GetContentsCnt() - 1) { wxHtmlContentsItem *it = m_Data -> GetContents() + (ha -> m_Index + 1); - + while (it -> m_Book -> GetBasePath() + it -> m_Page == adr) it++; m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); NotifyPageChanged(); @@ -1131,12 +1133,12 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) case wxID_HTML_OPTIONS : OptionsDialog(); break; - - case wxID_HTML_BOOKMARKSADD : + + case wxID_HTML_BOOKMARKSADD : { wxString item; wxString url; - + item = m_HtmlWin -> GetOpenedPageTitle(); url = m_HtmlWin -> GetOpenedPage(); if (item == wxEmptyString) item = url.AfterLast(wxT('/')); @@ -1147,12 +1149,12 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) } } break; - - case wxID_HTML_BOOKMARKSREMOVE : + + case wxID_HTML_BOOKMARKSREMOVE : { wxString item; int pos; - + item = m_Bookmarks -> GetStringSelection(); pos = m_BookmarksNames.Index(item); if (pos != wxNOT_FOUND) { @@ -1166,7 +1168,7 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) #if wxUSE_PRINTING_ARCHITECTURE case wxID_HTML_PRINT : { - if (m_Printer == NULL) + if (m_Printer == NULL) m_Printer = new wxHtmlEasyPrinting(_("Help Printing"), this); if (!m_HtmlWin -> GetOpenedPage()) wxLogWarning(_("Cannot print empty page.")); @@ -1178,12 +1180,18 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) case wxID_HTML_OPENFILE : { - wxString s = wxFileSelector(_("Open HTML document"), wxEmptyString, wxEmptyString, wxEmptyString, - wxT("HTML files (*.htm)|*.htm|HTML files (*.html)|*.html|" - "Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|" - "HTML Help Project (*.hhp)|*.hhp|" - "All files (*.*)|*"), - wxOPEN | wxFILE_MUST_EXIST, this); + wxString s = wxFileSelector(_("Open HTML document"), + wxEmptyString, + wxEmptyString, + wxEmptyString, + _( +"HTML files (*.htm)|*.htm|HTML files (*.html)|*.html|\ +Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|\ +HTML Help Project (*.hhp)|*.hhp|\ +All files (*.*)|*" + ), + wxOPEN | wxFILE_MUST_EXIST, + this); if (!s.IsEmpty()) { wxString ext = s.Right(4).Lower(); @@ -1209,8 +1217,8 @@ void wxHtmlHelpFrame::OnContentsSel(wxTreeEvent& event) wxHtmlContentsItem *it; pg = (wxHtmlHelpTreeItemData*) m_ContentsBox -> GetItemData(event.GetItem()); - - if (pg && m_UpdateContents) + + if (pg && m_UpdateContents) { it = m_Data -> GetContents() + (pg -> m_Id); m_UpdateContents = FALSE; @@ -1233,7 +1241,7 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) { wxString sr = m_IndexText -> GetLineText(0); sr.MakeLower(); - if (sr == wxEmptyString) + if (sr == wxEmptyString) OnIndexAll(event); else { @@ -1241,7 +1249,7 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) const wxChar *cstr = sr.c_str(); wxChar mybuff[512], *ptr; bool first = TRUE; - + m_IndexList->Clear(); int cnt = m_Data->GetIndexCnt(); wxHtmlContentsItem* index = m_Data->GetIndex(); @@ -1250,9 +1258,10 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) for (int i = 0; i < cnt; i++) { wxStrncpy(mybuff, index[i].m_Name, 512); - mybuff[511] = 0; - for (ptr = mybuff; *ptr != 0; ptr++) - if (*ptr >= 'A' && *ptr <= 'Z') *ptr -= 'A' - 'a'; + mybuff[511] = _T('\0'); + for (ptr = mybuff; *ptr != 0; ptr++) + if (*ptr >= _T('A') && *ptr <= _T('Z')) + *ptr -= (wxChar)(_T('A') - _T('a')); if (wxStrstr(mybuff, cstr) != NULL) { m_IndexList -> Append(index[i].m_Name, (char*)(index + i)); displ++; @@ -1276,7 +1285,7 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event)) { wxBusyCursor bcur; - + m_IndexList->Clear(); int cnt = m_Data->GetIndexCnt(); bool first = TRUE; @@ -1300,7 +1309,7 @@ void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event)) void wxHtmlHelpFrame::OnSearchSel(wxCommandEvent& WXUNUSED(event)) { wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(m_SearchList -> GetSelection()); - if (it) + if (it) { m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); NotifyPageChanged(); @@ -1356,7 +1365,7 @@ BEGIN_EVENT_TABLE(wxHtmlHelpFrame, wxFrame) EVT_TEXT_ENTER(wxID_HTML_INDEXTEXT, wxHtmlHelpFrame::OnIndexFind) EVT_BUTTON(wxID_HTML_INDEXBUTTONALL, wxHtmlHelpFrame::OnIndexAll) EVT_COMBOBOX(wxID_HTML_BOOKMARKSLIST, wxHtmlHelpFrame::OnBookmarksSel) - EVT_CLOSE(wxHtmlHelpFrame::OnCloseWindow) + EVT_CLOSE(wxHtmlHelpFrame::OnCloseWindow) END_EVENT_TABLE() #endif diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index da669b5b18..820fdd9cc0 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -133,7 +133,7 @@ wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell() if (m_Word.Find(wxT('&')) != -1) { #define ESCSEQ(escape, subst) \ - { wxT("&"escape";"), wxT("&"escape" "), wxT(subst) } + { _T("&") _T(escape) _T(";"), _T("&") _T(escape) _T(" "), _T(subst) } static wxChar* substitutions[][3] = { ESCSEQ("quot", "\""), diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 46c504396e..94f395fdd7 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -1173,7 +1173,7 @@ int wxApp::GetComCtl32Version() // try to use DllGetVersion() if available in _headers_ #ifdef DLLVER_PLATFORM_WINDOWS // defined in shlwapi.h DLLGETVERSIONPROC pfnDllGetVersion = (DLLGETVERSIONPROC) - ::GetProcAddress(hModuleComCtl32, _T("DllGetVersion")); + ::GetProcAddress(hModuleComCtl32, "DllGetVersion"); if ( pfnDllGetVersion ) { DLLVERSIONINFO dvi; @@ -1202,11 +1202,7 @@ int wxApp::GetComCtl32Version() FARPROC theProc = ::GetProcAddress ( hModuleComCtl32, -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x520) "InitCommonControlsEx" -#else - _T("InitCommonControlsEx") -#endif ); if ( !theProc ) @@ -1221,11 +1217,7 @@ int wxApp::GetComCtl32Version() theProc = ::GetProcAddress ( hModuleComCtl32, -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x520) "InitializeFlatSB" -#else - _T("InitializeFlatSB") -#endif ); if ( !theProc ) { diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 3a091ac0fa..997951504f 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -68,8 +68,8 @@ bool wxChoice::Create(wxWindow *parent, wxASSERT_MSG( !(style & wxCB_DROPDOWN) && !(style & wxCB_READONLY) && !(style & wxCB_SIMPLE), - wxT("this style flag is ignored by wxChoice, you " - "probably want to use a wxComboBox") ); + _T("this style flag is ignored by wxChoice, you ") + _T("probably want to use a wxComboBox") ); if ( !MSWCreateControl(wxT("COMBOBOX"), msStyle) ) return FALSE; diff --git a/src/msw/curico.cpp b/src/msw/curico.cpp index 1629b21398..c8df51825e 100644 --- a/src/msw/curico.cpp +++ b/src/msw/curico.cpp @@ -99,7 +99,7 @@ HANDLE ReadIcon( wxChar *szFileName, int *W, int *H) nDirEntries = 0; // Open and read the .ICO file header and the first ICONFILERES - hFile = _lopen( wxFNCONV(szFileName), OF_READ); + hFile = _lopen( wxConvertWX2MB(szFileName), OF_READ); cbHead = _lread( hFile, (LPSTR)&iconFileHead, sizeof(ICONFILEHEADER)); cbRes = _lread( hFile, (LPSTR)&iconFileRes, sizeof(ICONFILERES)); ++nDirEntries; @@ -346,7 +346,7 @@ HANDLE ReadCur( wxChar *szFileName, LPPOINT lpptHotSpot, int *W, int *H) nDirEntries = 0; // Open and read the .ICO file header and the first ICONFILERES - hFile = _lopen( wxFNCONV(szFileName), OF_READ); + hFile = _lopen( wxConvertWX2MB(szFileName), OF_READ); cbHead = _lread( hFile, (LPSTR )&curFileHead, sizeof( CURFILEHEADER)); cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES)); ++nDirEntries; diff --git a/src/msw/data.cpp b/src/msw/data.cpp index 1b24fc3e3a..98efee9e2a 100644 --- a/src/msw/data.cpp +++ b/src/msw/data.cpp @@ -41,7 +41,7 @@ wxList WXDLLEXPORT wxPendingDelete; // Currently this can be Win95, Windows, Win32s, WinNT. // For some systems, you can't tell until run-time what services you // have. See wxGetOsVersion, which uses this string if present. -char *wxOsVersion = NULL; +extern wxChar *wxOsVersion = NULL; int wxPageNumber; diff --git a/src/msw/dialup.cpp b/src/msw/dialup.cpp index dc9ae1a6ae..2fff5a9a22 100644 --- a/src/msw/dialup.cpp +++ b/src/msw/dialup.cpp @@ -102,7 +102,7 @@ typedef DWORD (APIENTRY * RASVALIDATEENTRYNAME)( LPCSTR, LPCSTR ); typedef DWORD (APIENTRY * RASCONNECTIONNOTIFICATION)( HRASCONN, HANDLE, DWORD ); - static const char gs_funcSuffix = 'A'; + static const wxChar gs_funcSuffix = _T('A'); #else // Unicode typedef DWORD (APIENTRY * RASDIAL)( LPRASDIALEXTENSIONS, LPCWSTR, LPRASDIALPARAMSW, DWORD, LPVOID, LPHRASCONN ); typedef DWORD (APIENTRY * RASENUMCONNECTIONS)( LPRASCONNW, LPDWORD, LPDWORD ); @@ -124,7 +124,7 @@ typedef DWORD (APIENTRY * RASVALIDATEENTRYNAME)( LPCWSTR, LPCWSTR ); typedef DWORD (APIENTRY * RASCONNECTIONNOTIFICATION)( HRASCONN, HANDLE, DWORD ); - static const char gs_funcSuffix = 'W'; + static const wxChar gs_funcSuffix = _T('W'); #endif // ASCII/Unicode // structure passed to the secondary thread @@ -407,10 +407,12 @@ wxDialUpManagerMSW::wxDialUpManagerMSW() exit: if ( funcName ) { - wxLogError(_("The version of remote access service (RAS) " - "installed on this machine is too old, please " - "upgrade (the following required function is " - "missing: %s)."), funcName); + static const wxChar *msg = wxTRANSLATE( +"The version of remote access service (RAS) installed on this machine is too\ +old, please upgrade (the following required function is missing: %s)." + ); + + wxLogError(wxGetTranslation(msg), funcName); wxDllLoader::UnloadLibrary(ms_dllRas); ms_dllRas = 0; @@ -453,8 +455,8 @@ wxString wxDialUpManagerMSW::GetErrorString(DWORD error) default: { - wxLogSysError(dwRet, _("Failed to retrieve text of RAS " - "error message")); + wxLogSysError(dwRet, + _("Failed to retrieve text of RAS error message")); wxString msg; msg.Printf(_("unknown error (error code %08x)."), error); @@ -530,8 +532,7 @@ HRASCONN wxDialUpManagerMSW::FindActiveConnection() // connection) - the warning is really needed because this function // is used, for example, to select the connection to hang up and so // we may hang up the wrong connection here... - wxLogWarning(_("Several active dialup connections found, " - "choosing one randomly.")); + wxLogWarning(_("Several active dialup connections found, choosing one randomly.")); // fall through case 1: @@ -759,8 +760,7 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, entryName = wxGetSingleChoice ( _("Choose ISP to dial"), - _("Please choose which ISP do you want to " - "connect to"), + _("Please choose which ISP do you want to connect to"), count, strings ); @@ -778,7 +778,7 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, RASDIALPARAMS rasDialParams; rasDialParams.dwSize = sizeof(rasDialParams); - strncpy(rasDialParams.szEntryName, entryName, RAS_MaxEntryName); + wxStrncpy(rasDialParams.szEntryName, entryName, RAS_MaxEntryName); // do we have the username and password? if ( !username || !password ) @@ -800,8 +800,8 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, } else { - strncpy(rasDialParams.szUserName, username, UNLEN); - strncpy(rasDialParams.szPassword, password, PWLEN); + wxStrncpy(rasDialParams.szUserName, username, UNLEN); + wxStrncpy(rasDialParams.szPassword, password, PWLEN); } // default values for other fields @@ -964,9 +964,6 @@ bool wxDialUpManagerMSW::IsAlwaysOnline() const // there is some connection to the net, see of which type ms_isAlwaysOnline = (flags & INTERNET_CONNECTION_LAN != 0) || (flags & INTERNET_CONNECTION_PROXY != 0); - - wxLogMessage("InternetGetConnectedState() returned TRUE, " - "flags = %08x", flags); } else { diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 5952c60152..7340494bae 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -109,7 +109,7 @@ static BOOL WriteDIB(LPTSTR szFile, HANDLE hdib) if (!hdib) return FALSE; - fh = OpenFile(wxFNCONV(szFile), &of, OF_CREATE | OF_READWRITE); + fh = OpenFile(wxConvertWX2MB(szFile), &of, OF_CREATE | OF_READWRITE); if (fh == -1) return FALSE; @@ -429,7 +429,7 @@ BOOL wxReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) /* Open the file and get a handle to it's BITMAPINFO */ - fh = OpenFile (wxFNCONV(lpFileName), &of, OF_READ); + fh = OpenFile (wxConvertWX2MB(lpFileName), &of, OF_READ); if (fh == -1) { wxLogError(_("Can't open file '%s'"), lpFileName); return (0); diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index 5fa6df567f..950f343536 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -963,8 +963,8 @@ bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *pData) m_filenames.Add(str); if ( len2 != len - 1 ) { - wxLogDebug(wxT("In wxFileDropTarget::OnDrop DragQueryFile returned" - " %d characters, %d expected."), len2, len - 1); + wxLogDebug(wxT("In wxFileDropTarget::OnDrop DragQueryFile returned\ + %d characters, %d expected."), len2, len - 1); } } diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp index 2c61a32a6c..31a173ade6 100644 --- a/src/msw/ole/oleutils.cpp +++ b/src/msw/ole/oleutils.cpp @@ -63,16 +63,16 @@ bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount) // ---------------------------------------------------------------------------- #if defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ > 1000) -const char *GetIidName(REFIID riid) +const wxChar *GetIidName(REFIID riid) { // an association between symbolic name and numeric value of an IID struct KNOWN_IID { const IID *pIid; - const char *szName; + const wxChar *szName; }; // construct the table containing all known interfaces - #define ADD_KNOWN_IID(name) { &IID_I##name, #name } + #define ADD_KNOWN_IID(name) { &IID_I##name, _T(#name) } static const KNOWN_IID aKnownIids[] = { ADD_KNOWN_IID(AdviseSink), diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index f1ea91b760..75dfff574d 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -645,12 +645,7 @@ bool wxThread::SetConcurrency(size_t level) if ( hModKernel ) { pfnSetProcessAffinityMask = (SETPROCESSAFFINITYMASK) - ::GetProcAddress(hModKernel, -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x520) - "SetProcessAffinityMask"); -#else - _T("SetProcessAffinityMask")); -#endif + ::GetProcAddress(hModKernel, "SetProcessAffinityMask"); } // we've discovered a MT version of Win9x! diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index 0e69c00abe..c24c3fc6d1 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -207,7 +207,7 @@ WXHWND wxToolTip::GetToolTipCtrl() if ( !ms_hwndTT ) { ms_hwndTT = (WXHWND)::CreateWindow(TOOLTIPS_CLASS, - (LPSTR)NULL, + (LPCTSTR)NULL, TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 76889b37eb..1f56f745e0 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2640,10 +2640,13 @@ bool wxWindow::HandleDropFiles(WXWPARAM wParam) DragQueryPoint(hFilesInfo, (LPPOINT) &dropPoint); // Get the total number of files dropped - WORD gwFilesDropped = (WORD)DragQueryFile ((HDROP)hFilesInfo, - (UINT)-1, - (LPSTR)0, - (UINT)0); + WORD gwFilesDropped = (WORD)::DragQueryFile + ( + (HDROP)hFilesInfo, + (UINT)-1, + (LPTSTR)0, + (UINT)0 + ); wxString *files = new wxString[gwFilesDropped]; int wIndex;