From c8f29fea8f24f4f0aad3db16dd0c2e52314ec529 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 27 Oct 2022 01:23:01 +0100 Subject: [PATCH] Remove most mentions of wxUSE_UNICODE from the documentation Still document this symbol itself, but only as being defined as 1. --- docs/doxygen/mainpages/const_cpp.h | 3 ++- docs/doxygen/mainpages/const_wxusedef.h | 4 ++-- docs/doxygen/overviews/string.h | 9 +++---- docs/doxygen/overviews/unicode.h | 4 +--- interface/wx/chartype.h | 31 ++++++++++--------------- interface/wx/dataobj.h | 8 +++---- interface/wx/event.h | 3 --- interface/wx/strconv.h | 10 +------- interface/wx/xml/xml.h | 3 --- 9 files changed, 24 insertions(+), 51 deletions(-) diff --git a/docs/doxygen/mainpages/const_cpp.h b/docs/doxygen/mainpages/const_cpp.h index a5b687299c..a99b2bec38 100644 --- a/docs/doxygen/mainpages/const_cpp.h +++ b/docs/doxygen/mainpages/const_cpp.h @@ -368,7 +368,8 @@ more details. and so the usual idiom which allows to support both cases is to first include @c wx/wxprec.h} and then, inside \#ifndef WX_PRECOMP, individual headers you need.} -@itemdef{_UNICODE and UNICODE, both are defined if wxUSE_UNICODE is set to @c 1} +@itemdef{_UNICODE and UNICODE, are both always defined in current wxWidgets + versions.} @itemdef{wxUSE_GUI, this particular feature test macro is defined to 1 when compiling or using the library with the GUI features activated, diff --git a/docs/doxygen/mainpages/const_wxusedef.h b/docs/doxygen/mainpages/const_wxusedef.h index 5c4b230030..1963ec1cd2 100644 --- a/docs/doxygen/mainpages/const_wxusedef.h +++ b/docs/doxygen/mainpages/const_wxusedef.h @@ -34,8 +34,8 @@ library: particular is implicitly convertible to @c char* and not std::[w]string).} @itemdef{wxUSE_STD_IOSTREAM, Standard C++ classes are used instead of or in addition to wx stream classes.} -@itemdef{wxUSE_UNICODE, Compiled with Unicode support (default in wxWidgets - 3.0, non-Unicode build is deprecated and will be removed in the future).} +@itemdef{wxUSE_UNICODE, Always defined as 1 in wxWidgets 3.3 and later, only + exists for compatibility.} @itemdef{wxUSE_UNICODE_WCHAR, wxString uses wchar_t buffer for internal storage (default).} @itemdef{wxUSE_UNICODE_UTF8, wxString uses UTF-8 for internal storage (mostly diff --git a/docs/doxygen/overviews/string.h b/docs/doxygen/overviews/string.h index b3933e9abc..569411b16b 100644 --- a/docs/doxygen/overviews/string.h +++ b/docs/doxygen/overviews/string.h @@ -402,12 +402,9 @@ difference the change to @c EXTRA_ALLOC makes to your program. @section overview_string_settings wxString Related Compilation Settings -The main option affecting wxString is @c wxUSE_UNICODE which is now always -defined as @c 1 by default to indicate Unicode support. You may set it to 0 to -disable Unicode support in wxString and elsewhere in wxWidgets but this is @e -strongly not recommended. - -Another option affecting wxWidgets is @c wxUSE_UNICODE_WCHAR which is also 1 by +wxString always supports Unicode in wxWidgets 3.3 and later, but it may use +either UTF-8 or `wchar_t` (which, in turn, may use either UTF-16 or UTF-32) +internally. It uses the latter if @c wxUSE_UNICODE_WCHAR is set, which is the case by default. You may want to set it to 0 and set @c wxUSE_UNICODE_UTF8 to 1 instead to use UTF-8 internally. wxString still provides the same API in this case, but using UTF-8 has performance implications as explained in @ref diff --git a/docs/doxygen/overviews/unicode.h b/docs/doxygen/overviews/unicode.h index 637766f92b..2eb94c6bc7 100644 --- a/docs/doxygen/overviews/unicode.h +++ b/docs/doxygen/overviews/unicode.h @@ -215,9 +215,7 @@ size and removes the need for conversions in more cases. @subsection overview_unicode_settings Unicode Related Preprocessor Symbols -@c wxUSE_UNICODE is defined as 1 now to indicate Unicode support. It can be -explicitly set to 0 in @c setup.h under MSW or you can use @c \--disable-unicode -under Unix but doing this is strongly discouraged. By default, @c +@c wxUSE_UNICODE is always defined as 1 in wxWidgets 3.3 or later. By default, @c wxUSE_UNICODE_WCHAR is also defined as 1, however in UTF-8 build (described in the previous section), it is set to 0 and @c wxUSE_UNICODE_UTF8, which is usually 0, is set to 1 instead. In the latter case, @c wxUSE_UTF8_LOCALE_ONLY diff --git a/interface/wx/chartype.h b/interface/wx/chartype.h index cef452e9b7..84c11389e3 100644 --- a/interface/wx/chartype.h +++ b/interface/wx/chartype.h @@ -98,36 +98,29 @@ #define _T(string) /** - wxChar is defined to be - \- @c char when wxUSE_UNICODE==0 - \- @c wchar_t when wxUSE_UNICODE==1 (the default). + wxChar is a compatibility typedef always defined as @c wchar_t now. + + Note that it is not affected by @c wxUSE_UNICODE_UTF8 option. */ -typedef wxUSE_UNICODE_dependent wxChar; +typedef wchar_t wxChar; /** - wxSChar is defined to be - \- signed char when wxUSE_UNICODE==0 - \- @c wchar_t when wxUSE_UNICODE==1 (the default). + wxSChar is a compatibility typedef always defined as @c wchar_t now. */ -typedef wxUSE_UNICODE_dependent wxSChar; +typedef wchar_t wxSChar; /** - wxUChar is defined to be - \- unsigned char when wxUSE_UNICODE==0 - \- @c wchar_t when wxUSE_UNICODE==1 (the default). + wxUChar is a compatibility typedef always defined as @c wchar_t now. */ -typedef wxUSE_UNICODE_dependent wxUChar; +typedef wchar_t wxUChar; /** wxStringCharType is defined to be: - \- @c char when wxUSE_UNICODE==0 - \- @c char when wxUSE_UNICODE_WCHAR==0 and wxUSE_UNICODE==1 - \- @c wchar_t when wxUSE_UNICODE_WCHAR==1 and wxUSE_UNICODE==1 + \- @c char when wxUSE_UNICODE_WCHAR==0 + \- @c wchar_t when wxUSE_UNICODE_WCHAR==1 - The @c wxUSE_UNICODE_WCHAR symbol is defined to @c 1 when building on - Windows while it's defined to @c 0 when building on Unix, Linux or macOS. - (Note that @c wxUSE_UNICODE_UTF8 symbol is defined as the opposite of - @c wxUSE_UNICODE_WCHAR.) + The @c wxUSE_UNICODE_WCHAR symbol is defined by default, but may be turned + off in which case @c wxUSE_UNICODE_UTF8 is turned on. Note that wxStringCharType (as the name says) is the type used by wxString for internal storage of the characters. diff --git a/interface/wx/dataobj.h b/interface/wx/dataobj.h index 1abeecb7e2..57a181d057 100644 --- a/interface/wx/dataobj.h +++ b/interface/wx/dataobj.h @@ -753,18 +753,16 @@ public: /** Returns 2 under wxMac and wxGTK, where text data coming from the clipboard may be provided as ANSI (@c wxDF_TEXT) or as Unicode text - (@c wxDF_UNICODETEXT, but only when @c wxUSE_UNICODE==1). + (@c wxDF_UNICODETEXT). - Returns 1 under other platforms (e.g. wxMSW) or when building in ANSI mode - (@c wxUSE_UNICODE==0). + Returns 1 under other platforms (e.g. wxMSW). */ virtual size_t GetFormatCount(wxDataObject::Direction dir = wxDataObject::Get) const; /** Returns the preferred format supported by this object. - This is @c wxDF_TEXT or @c wxDF_UNICODETEXT depending on the platform - and from the build mode (i.e. from @c wxUSE_UNICODE). + This is @c wxDF_TEXT or @c wxDF_UNICODETEXT depending on the platform. */ const wxDataFormat& GetFormat() const; diff --git a/interface/wx/event.h b/interface/wx/event.h index 480d59913f..a4839c844c 100644 --- a/interface/wx/event.h +++ b/interface/wx/event.h @@ -1632,9 +1632,6 @@ public: If the key pressed doesn't have any character value (e.g. a cursor key) this method will return @c WXK_NONE. In this case you should use GetKeyCode() to retrieve the value of the key. - - This function is only available in Unicode build, i.e. when - @c wxUSE_UNICODE is 1. */ wxChar GetUnicodeKey() const; diff --git a/interface/wx/strconv.h b/interface/wx/strconv.h index a8e631dfc0..23adb11f44 100644 --- a/interface/wx/strconv.h +++ b/interface/wx/strconv.h @@ -231,18 +231,10 @@ public: */ wxWCharBuffer cMB2WC(const wxCharBuffer& buf) const; - ///@{ /** - Converts from multibyte encoding to the current wxChar type (which - depends on whether wxUSE_UNICODE is set to 1). - - If wxChar is char, it returns the parameter unaltered. If wxChar is - wchar_t, it returns the result in a wxWCharBuffer. The macro wxMB2WXbuf - is defined as the correct return type (without const). + Converts from multibyte encoding to `wchar_t`. */ - const char* cMB2WX(const char* psz) const; wxWCharBuffer cMB2WX(const char* psz) const; - ///@} /** Converts from Unicode to multibyte encoding by calling FromWChar() and diff --git a/interface/wx/xml/xml.h b/interface/wx/xml/xml.h index a8e82e4572..ebfda1be2b 100644 --- a/interface/wx/xml/xml.h +++ b/interface/wx/xml/xml.h @@ -55,9 +55,6 @@ enum wxXmlNodeType The @c wxXML_DOCUMENT_TYPE_NODE is not implemented at this time. Instead, you should get and set the DOCTYPE values using the wxXmlDocument class. - If @c wxUSE_UNICODE is 0, all strings are encoded in the encoding given to - wxXmlDocument::Load (default is UTF-8). - @note Once a wxXmlNode has been added to a wxXmlDocument it becomes owned by the document and this has two implications. Firstly, the wxXmlDocument takes