From d9ea30cf84fb0322b219f6359868b4c8a4c41096 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 22 Aug 2021 21:48:14 +0200 Subject: [PATCH] Always set wxUSE_SPELLCHECK to 1 by default for simplicity It does no real harm to set it to 1 and this avoids the need for the platform checks in setup.h files, simplifying things (although it does require checking for GTK 3 in the code compiled for both GTK 2 and 3, as gtkspell library can only be used with GTK 3). --- build/cmake/setup.h.in | 4 ---- include/wx/android/setup.h | 12 ++++-------- include/wx/gtk/setup.h | 12 ++++-------- include/wx/gtk/textctrl.h | 4 ++-- include/wx/motif/setup.h | 12 ++++-------- include/wx/msw/setup.h | 12 ++++-------- include/wx/osx/setup.h | 12 ++++-------- include/wx/setup_inc.h | 12 ++++-------- include/wx/univ/setup.h | 12 ++++-------- setup.h.in | 4 ---- src/gtk/textctrl.cpp | 8 ++++---- 11 files changed, 34 insertions(+), 70 deletions(-) diff --git a/build/cmake/setup.h.in b/build/cmake/setup.h.in index 29fae22477..496fa988ee 100644 --- a/build/cmake/setup.h.in +++ b/build/cmake/setup.h.in @@ -216,11 +216,7 @@ #cmakedefine01 wxUSE_SECRETSTORE -#if (defined(__WXGTK3__) || defined(__WXMSW__)) #cmakedefine01 wxUSE_SPELLCHECK -#else -#cmakedefine01 wxUSE_SPELLCHECK -#endif #cmakedefine01 wxUSE_STDPATHS diff --git a/include/wx/android/setup.h b/include/wx/android/setup.h index e427c6e0b0..03875c1dbf 100644 --- a/include/wx/android/setup.h +++ b/include/wx/android/setup.h @@ -447,17 +447,13 @@ // Recommended setting: 1 (but may be safely disabled if you don't use it) #define wxUSE_SECRETSTORE 1 -// Allow the use of the OS built-in spellchecker on wxTextCtrl (multiline -// only). Currently only wxGTK3 and wxMSW are implemented. +// Allow the use of the OS built-in spell checker in wxTextCtrl. // -// Default is 1 on wxGTK3 and wxMSW platforms and 0 otherwise. +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. // -// Recommended setting: 1 on supported platforms. -#if (defined(__WXGTK3__) || defined(__WXMSW__)) +// Recommended setting: 1 unless you want to save a tiny bit of code. #define wxUSE_SPELLCHECK 1 -#else -#define wxUSE_SPELLCHECK 0 -#endif // Use wxStandardPaths class which allows to retrieve some standard locations // in the file system diff --git a/include/wx/gtk/setup.h b/include/wx/gtk/setup.h index 344eec7bab..85ffff1c21 100644 --- a/include/wx/gtk/setup.h +++ b/include/wx/gtk/setup.h @@ -448,17 +448,13 @@ // Recommended setting: 1 (but may be safely disabled if you don't use it) #define wxUSE_SECRETSTORE 1 -// Allow the use of the OS built-in spellchecker on wxTextCtrl (multiline -// only). Currently only wxGTK3 and wxMSW are implemented. +// Allow the use of the OS built-in spell checker in wxTextCtrl. // -// Default is 1 on wxGTK3 and wxMSW platforms and 0 otherwise. +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. // -// Recommended setting: 1 on supported platforms. -#if (defined(__WXGTK3__) || defined(__WXMSW__)) +// Recommended setting: 1 unless you want to save a tiny bit of code. #define wxUSE_SPELLCHECK 1 -#else -#define wxUSE_SPELLCHECK 0 -#endif // Use wxStandardPaths class which allows to retrieve some standard locations // in the file system diff --git a/include/wx/gtk/textctrl.h b/include/wx/gtk/textctrl.h index 296bf73480..95d1f17811 100644 --- a/include/wx/gtk/textctrl.h +++ b/include/wx/gtk/textctrl.h @@ -96,13 +96,13 @@ public: // Overridden wxWindow methods virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; -#if wxUSE_SPELLCHECK +#if wxUSE_SPELLCHECK && defined(__WXGTK3__) // Use native spelling and grammar checking functions. virtual bool EnableProofCheck(bool WXUNUSED(enable) = true, const wxTextProofOptions& WXUNUSED(options) = wxTextProofOptions()) wxOVERRIDE; virtual bool IsProofCheckEnabled() const wxOVERRIDE; -#endif // wxUSE_SPELLCHECK +#endif // wxUSE_SPELLCHECK && __WXGTK3__ // Implementation from now on void OnDropFiles( wxDropFilesEvent &event ); diff --git a/include/wx/motif/setup.h b/include/wx/motif/setup.h index 1783056cbd..d6474006fb 100644 --- a/include/wx/motif/setup.h +++ b/include/wx/motif/setup.h @@ -448,17 +448,13 @@ // Recommended setting: 1 (but may be safely disabled if you don't use it) #define wxUSE_SECRETSTORE 1 -// Allow the use of the OS built-in spellchecker on wxTextCtrl (multiline -// only). Currently only wxGTK3 and wxMSW are implemented. +// Allow the use of the OS built-in spell checker in wxTextCtrl. // -// Default is 1 on wxGTK3 and wxMSW platforms and 0 otherwise. +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. // -// Recommended setting: 1 on supported platforms. -#if (defined(__WXGTK3__) || defined(__WXMSW__)) +// Recommended setting: 1 unless you want to save a tiny bit of code. #define wxUSE_SPELLCHECK 1 -#else -#define wxUSE_SPELLCHECK 0 -#endif // Use wxStandardPaths class which allows to retrieve some standard locations // in the file system diff --git a/include/wx/msw/setup.h b/include/wx/msw/setup.h index c45bcebd1e..3a9bceef80 100644 --- a/include/wx/msw/setup.h +++ b/include/wx/msw/setup.h @@ -448,17 +448,13 @@ // Recommended setting: 1 (but may be safely disabled if you don't use it) #define wxUSE_SECRETSTORE 1 -// Allow the use of the OS built-in spellchecker on wxTextCtrl (multiline -// only). Currently only wxGTK3 and wxMSW are implemented. +// Allow the use of the OS built-in spell checker in wxTextCtrl. // -// Default is 1 on wxGTK3 and wxMSW platforms and 0 otherwise. +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. // -// Recommended setting: 1 on supported platforms. -#if (defined(__WXGTK3__) || defined(__WXMSW__)) +// Recommended setting: 1 unless you want to save a tiny bit of code. #define wxUSE_SPELLCHECK 1 -#else -#define wxUSE_SPELLCHECK 0 -#endif // Use wxStandardPaths class which allows to retrieve some standard locations // in the file system diff --git a/include/wx/osx/setup.h b/include/wx/osx/setup.h index 1f62e4b3c2..5254f4e6b2 100644 --- a/include/wx/osx/setup.h +++ b/include/wx/osx/setup.h @@ -454,17 +454,13 @@ // Recommended setting: 1 (but may be safely disabled if you don't use it) #define wxUSE_SECRETSTORE 1 -// Allow the use of the OS built-in spellchecker on wxTextCtrl (multiline -// only). Currently only wxGTK3 and wxMSW are implemented. +// Allow the use of the OS built-in spell checker in wxTextCtrl. // -// Default is 1 on wxGTK3 and wxMSW platforms and 0 otherwise. +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. // -// Recommended setting: 1 on supported platforms. -#if (defined(__WXGTK3__) || defined(__WXMSW__)) +// Recommended setting: 1 unless you want to save a tiny bit of code. #define wxUSE_SPELLCHECK 1 -#else -#define wxUSE_SPELLCHECK 0 -#endif // Use wxStandardPaths class which allows to retrieve some standard locations // in the file system diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index 28dc701f58..52b1ca4d2c 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -444,17 +444,13 @@ // Recommended setting: 1 (but may be safely disabled if you don't use it) #define wxUSE_SECRETSTORE 1 -// Allow the use of the OS built-in spellchecker on wxTextCtrl (multiline -// only). Currently only wxGTK3 and wxMSW are implemented. +// Allow the use of the OS built-in spell checker in wxTextCtrl. // -// Default is 1 on wxGTK3 and wxMSW platforms and 0 otherwise. +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. // -// Recommended setting: 1 on supported platforms. -#if (defined(__WXGTK3__) || defined(__WXMSW__)) +// Recommended setting: 1 unless you want to save a tiny bit of code. #define wxUSE_SPELLCHECK 1 -#else -#define wxUSE_SPELLCHECK 0 -#endif // Use wxStandardPaths class which allows to retrieve some standard locations // in the file system diff --git a/include/wx/univ/setup.h b/include/wx/univ/setup.h index fcf5db2d92..0b07bfbdfe 100644 --- a/include/wx/univ/setup.h +++ b/include/wx/univ/setup.h @@ -447,17 +447,13 @@ // Recommended setting: 1 (but may be safely disabled if you don't use it) #define wxUSE_SECRETSTORE 1 -// Allow the use of the OS built-in spellchecker on wxTextCtrl (multiline -// only). Currently only wxGTK3 and wxMSW are implemented. +// Allow the use of the OS built-in spell checker in wxTextCtrl. // -// Default is 1 on wxGTK3 and wxMSW platforms and 0 otherwise. +// Default is 1, the corresponding wxTextCtrl functions simply won't do +// anything if the functionality is not supported by the current platform. // -// Recommended setting: 1 on supported platforms. -#if (defined(__WXGTK3__) || defined(__WXMSW__)) +// Recommended setting: 1 unless you want to save a tiny bit of code. #define wxUSE_SPELLCHECK 1 -#else -#define wxUSE_SPELLCHECK 0 -#endif // Use wxStandardPaths class which allows to retrieve some standard locations // in the file system diff --git a/setup.h.in b/setup.h.in index 159f6c8989..3e3f576193 100644 --- a/setup.h.in +++ b/setup.h.in @@ -216,11 +216,7 @@ #define wxUSE_SECRETSTORE 0 -#if (defined(__WXGTK3__) || defined(__WXMSW__)) #define wxUSE_SPELLCHECK 0 -#else -#define wxUSE_SPELLCHECK 0 -#endif #define wxUSE_STDPATHS 0 diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 4d43c3e824..7f7adab532 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -32,11 +32,11 @@ #include "wx/gtk/private.h" #include "wx/gtk/private/gtk3-compat.h" -#if wxUSE_SPELLCHECK +#if wxUSE_SPELLCHECK && defined(__WXGTK3__) extern "C" { #include } -#endif // wxUSE_SPELLCHECK +#endif // wxUSE_SPELLCHECK && __WXGTK3__ // ---------------------------------------------------------------------------- // helpers @@ -1023,7 +1023,7 @@ void wxTextCtrl::GTKSetJustification() } } -#if wxUSE_SPELLCHECK +#if wxUSE_SPELLCHECK && defined(__WXGTK3__) bool wxTextCtrl::EnableProofCheck(bool enable, const wxTextProofOptions& options) { @@ -1072,7 +1072,7 @@ bool wxTextCtrl::IsProofCheckEnabled() const return (spell != NULL); } -#endif // wxUSE_SPELLCHECK +#endif // wxUSE_SPELLCHECK && __WXGTK3__ void wxTextCtrl::SetWindowStyleFlag(long style) {