From e6d4038a8bf3ae178bc89cceaf60a0652749ea9b Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Fri, 7 Sep 2007 21:47:45 +0000
Subject: [PATCH] don't use _T() inside wxGetTranslation() and related macros
 (wxTRANSLATE, _, ...) to preserve compatibility with the old ASCII build
 (even at the expense with the Unicode build compatibility)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48603 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/changes.txt           | 17 +++++++++++++++++
 docs/latex/wx/function.tex | 11 +++++------
 src/common/accelcmn.cpp    |  6 +++---
 src/common/appbase.cpp     | 14 +++++++-------
 src/common/appcmn.cpp      | 10 +++++-----
 src/common/datetime.cpp    |  6 +++---
 src/common/fmapbase.cpp    |  2 +-
 src/msw/dialup.cpp         | 10 ++++------
 8 files changed, 45 insertions(+), 31 deletions(-)

diff --git a/docs/changes.txt b/docs/changes.txt
index 392d75e83e..4af8e40d94 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -5,6 +5,23 @@
 INCOMPATIBLE CHANGES SINCE 2.8.x
 ================================
 
+Unicode-related changes
+-----------------------
+
+The biggest changes in wxWidgets 3.0 are the changes due to the merge of the
+old ANSI and Unicode build modes in a single build. See the Unicode overview
+in the manual for more details but here are the most important incompatible
+changes:
+
+- Many wxWidgets functions taking "const wxChar *" have been changed to take
+  either "const wxString&" if they should accept both Unicode or ANSI strings
+  and the argument can't be NULL or "const char *" if the strings are always
+  ANSI but may be NULL.
+
+- Some structure fields have been changed from "wxChar *" to "char *" too:
+  e.g. wxCmdLineEntryDesc fields.
+
+
 Changes in behaviour not resulting in compilation errors, please read this!
 ---------------------------------------------------------------------------
 
diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex
index 5d8a4e82b6..d47a983c0e 100644
--- a/docs/latex/wx/function.tex
+++ b/docs/latex/wx/function.tex
@@ -1801,11 +1801,9 @@ build. In fact, its definition is:
 \func{const wxChar *}{wxTRANSLATE}{\param{const char *}{s}}
 
 This macro doesn't do anything in the program code -- it simply expands to the
-value of its argument (except in Unicode build where it is equivalent to
-\helpref{wxT}{wxt} which makes it unnecessary to use both wxTRANSLATE and wxT
-with the same string which would be really unreadable).
+value of its argument.
 
-However it does have a purpose and it is to mark the literal strings for the
+However it does have a purpose which is to mark the literal strings for the
 extraction into the message catalog created by {\tt xgettext} program. Usually
 this is achieved using \helpref{\_()}{underscore} but that macro not only marks
 the string for extraction but also expands into a
@@ -1820,7 +1818,7 @@ translated (note that it is a bad example, really, as
 day names already). If you write
 
 \begin{verbatim}
-static const wxChar * const weekdays[] = { _("Mon"), ..., _("Sun") };
+static const char * const weekdays[] = { _("Mon"), ..., _("Sun") };
 ...
 // use weekdays[n] as usual
 \end{verbatim}
@@ -1829,7 +1827,7 @@ the code wouldn't compile because the function calls are forbidden in the array
 initializer. So instead you should do
 
 \begin{verbatim}
-static const wxChar * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") };
+static const char * const weekdays[] = { wxTRANSLATE("Mon"), ..., wxTRANSLATE("Sun") };
 ...
 // use wxGetTranslation(weekdays[n])
 \end{verbatim}
@@ -1841,6 +1839,7 @@ wxTRANSLATE() in the above, it wouldn't work as expected because there would be
 no translations for the weekday names in the program message catalog and
 wxGetTranslation wouldn't find them.
 
+
 \membersection{::wxVsnprintf}\label{wxvsnprintf}
 
 \func{int}{wxVsnprintf}{\param{wxChar *}{buf}, \param{size\_t }{len}, \param{const wxChar *}{format}, \param{va\_list }{argPtr}}
diff --git a/src/common/accelcmn.cpp b/src/common/accelcmn.cpp
index d524d15d0c..9d5898177b 100644
--- a/src/common/accelcmn.cpp
+++ b/src/common/accelcmn.cpp
@@ -40,7 +40,7 @@
 static const struct wxKeyName
 {
     wxKeyCode code;
-    const wxChar *name;
+    const char *name;
 } wxKeyNames[] =
 {
     { WXK_DELETE, wxTRANSLATE("DEL") },
@@ -114,7 +114,7 @@ static const struct wxKeyName
 //
 // as accels can be either translated or not, check for both possibilities and
 // also compare case-insensitively as the key names case doesn't count
-static inline bool CompareAccelString(const wxString& str, const wxChar *accel)
+static inline bool CompareAccelString(const wxString& str, const char *accel)
 {
     return str.CmpNoCase(accel) == 0
 #if wxUSE_INTL
@@ -128,7 +128,7 @@ static inline bool CompareAccelString(const wxString& str, const wxChar *accel)
 //
 // first and last parameter specify the valid domain for "number" part
 static int IsNumberedAccelKey(const wxString& str,
-                              const wxChar *prefix,
+                              const char *prefix,
                               wxKeyCode prefixCode,
                               unsigned first,
                               unsigned last)
diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp
index 08b769724b..8e819f62d1 100644
--- a/src/common/appbase.cpp
+++ b/src/common/appbase.cpp
@@ -466,7 +466,7 @@ bool wxAppConsoleBase::OnExceptionInMainLoop()
 
 #if wxUSE_CMDLINE_PARSER
 
-#define OPTION_VERBOSE _T("verbose")
+#define OPTION_VERBOSE "verbose"
 
 void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser)
 {
@@ -475,8 +475,8 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser)
     {
         {
             wxCMD_LINE_SWITCH,
-            _T("h"),
-            _T("help"),
+            "h",
+            "help",
             gettext_noop("show this help message"),
             wxCMD_LINE_VAL_NONE,
             wxCMD_LINE_OPTION_HELP
@@ -485,7 +485,7 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser)
 #if wxUSE_LOG
         {
             wxCMD_LINE_SWITCH,
-            wxEmptyString,
+            "",
             OPTION_VERBOSE,
             gettext_noop("generate verbose log messages"),
             wxCMD_LINE_VAL_NONE,
@@ -496,9 +496,9 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser)
         // terminator
         {
             wxCMD_LINE_NONE,
-            wxEmptyString,
-            wxEmptyString,
-            wxEmptyString,
+            "",
+            "",
+            "",
             wxCMD_LINE_VAL_NONE,
             0x0
         }
diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp
index e25528a638..421fff4699 100644
--- a/src/common/appcmn.cpp
+++ b/src/common/appcmn.cpp
@@ -203,7 +203,7 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser)
 #ifdef __WXUNIVERSAL__
         {
             wxCMD_LINE_OPTION,
-            wxEmptyString,
+            "",
             OPTION_THEME,
             gettext_noop("specify the theme to use"),
             wxCMD_LINE_VAL_STRING,
@@ -217,7 +217,7 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser)
         //     and not mgl/app.cpp
         {
             wxCMD_LINE_OPTION,
-            wxEmptyString,
+            "",
             OPTION_MODE,
             gettext_noop("specify display mode to use (e.g. 640x480-16)"),
             wxCMD_LINE_VAL_STRING,
@@ -228,9 +228,9 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser)
         // terminator
         {
             wxCMD_LINE_NONE,
-            wxEmptyString,
-            wxEmptyString,
-            wxEmptyString,
+            "",
+            "",
+            "",
             wxCMD_LINE_VAL_NONE,
             0x0
         }
diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp
index 2697859c64..026bae109d 100644
--- a/src/common/datetime.cpp
+++ b/src/common/datetime.cpp
@@ -3835,7 +3835,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
     // some special cases
     static struct
     {
-        const wxChar *str;
+        const char *str;
         int dayDiffFromToday;
     } literalDates[] =
     {
@@ -4010,7 +4010,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
                 else // not a valid weekday name
                 {
                     // try the ordinals
-                    static const wxChar *ordinals[] =
+                    static const char *ordinals[] =
                     {
                         wxTRANSLATE("first"),
                         wxTRANSLATE("second"),
@@ -4176,7 +4176,7 @@ const wxChar *wxDateTime::ParseTime(const wxChar *time)
     // first try some extra things
     static const struct
     {
-        const wxChar *name;
+        const char *name;
         wxDateTime_t  hour;
     } stdTimes[] =
     {
diff --git a/src/common/fmapbase.cpp b/src/common/fmapbase.cpp
index 20e1f3c3be..eb6fe9843f 100644
--- a/src/common/fmapbase.cpp
+++ b/src/common/fmapbase.cpp
@@ -103,7 +103,7 @@ static wxFontEncoding gs_encodings[] =
 };
 
 // the descriptions for them
-static const wxChar* gs_encodingDescs[] =
+static const char* gs_encodingDescs[] =
 {
     wxTRANSLATE( "Western European (ISO-8859-1)" ),
     wxTRANSLATE( "Central European (ISO-8859-2)" ),
diff --git a/src/msw/dialup.cpp b/src/msw/dialup.cpp
index 9e7eeda8cf..cce425e056 100644
--- a/src/msw/dialup.cpp
+++ b/src/msw/dialup.cpp
@@ -452,12 +452,10 @@ wxDialUpManagerMSW::wxDialUpManagerMSW()
 exit:
         if ( 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);
+            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);
             m_dllRas.Unload();
             return;
         }
-- 
2.50.0

