added wxAppTraits::SetLocale() and call it during wxApp initialization in all ports, not just wxGTK
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44773 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -38,6 +38,7 @@ All:
|
|||||||
- Implemented background colour in wxRichTextCtrl.
|
- Implemented background colour in wxRichTextCtrl.
|
||||||
- Fixed crashes in helpview when opening a file.
|
- Fixed crashes in helpview when opening a file.
|
||||||
- Added wxMutex::LockTimeout() (Aleksandr Napylov)
|
- Added wxMutex::LockTimeout() (Aleksandr Napylov)
|
||||||
|
- Set locale to the default in all ports, not just wxGTK
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ public:
|
|||||||
// needed since this class declares virtual members
|
// needed since this class declares virtual members
|
||||||
virtual ~wxAppTraitsBase() { }
|
virtual ~wxAppTraitsBase() { }
|
||||||
|
|
||||||
// hooks for creating the global objects, may be overridden by the user
|
// hooks for working with the global objects, may be overridden by the user
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
@@ -69,6 +69,13 @@ public:
|
|||||||
virtual wxStandardPathsBase& GetStandardPaths();
|
virtual wxStandardPathsBase& GetStandardPaths();
|
||||||
#endif // wxUSE_STDPATHS
|
#endif // wxUSE_STDPATHS
|
||||||
|
|
||||||
|
#if wxUSE_INTL
|
||||||
|
// called during wxApp initialization to set the locale to correspond to
|
||||||
|
// the user default (i.e. system locale under Windows, LC_ALL under Unix)
|
||||||
|
virtual void SetLocale();
|
||||||
|
#endif // wxUSE_INTL
|
||||||
|
|
||||||
|
|
||||||
// functions abstracting differences between GUI and console modes
|
// functions abstracting differences between GUI and console modes
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -110,6 +117,10 @@ public:
|
|||||||
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0;
|
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// functions returning port-specific information
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
// return information about the (native) toolkit currently used and its
|
// return information about the (native) toolkit currently used and its
|
||||||
// runtime (not compile-time) version.
|
// runtime (not compile-time) version.
|
||||||
// returns wxPORT_BASE for console applications and one of the remaining
|
// returns wxPORT_BASE for console applications and one of the remaining
|
||||||
|
@@ -41,6 +41,7 @@ public:
|
|||||||
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const;
|
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const;
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
|
virtual void SetLocale();
|
||||||
virtual wxString GetDesktopEnvironment() const;
|
virtual wxString GetDesktopEnvironment() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -146,6 +146,10 @@ wxAppConsole::~wxAppConsole()
|
|||||||
|
|
||||||
bool wxAppConsole::Initialize(int& argcOrig, wxChar **argvOrig)
|
bool wxAppConsole::Initialize(int& argcOrig, wxChar **argvOrig)
|
||||||
{
|
{
|
||||||
|
#if wxUSE_INTL
|
||||||
|
GetTraits()->SetLocale();
|
||||||
|
#endif // wxUSE_INTL
|
||||||
|
|
||||||
// remember the command line arguments
|
// remember the command line arguments
|
||||||
argc = argcOrig;
|
argc = argcOrig;
|
||||||
argv = argvOrig;
|
argv = argvOrig;
|
||||||
@@ -156,7 +160,7 @@ bool wxAppConsole::Initialize(int& argcOrig, wxChar **argvOrig)
|
|||||||
// the application name is, by default, the name of its executable file
|
// the application name is, by default, the name of its executable file
|
||||||
wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL);
|
wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // !__WXPALMOS__
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -503,6 +507,11 @@ GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable()
|
|||||||
// wxAppTraits
|
// wxAppTraits
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxAppTraitsBase::SetLocale()
|
||||||
|
{
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
|
|
||||||
bool wxAppTraitsBase::ShowAssertDialog(const wxString& msgOriginal)
|
bool wxAppTraitsBase::ShowAssertDialog(const wxString& msgOriginal)
|
||||||
|
@@ -403,7 +403,8 @@ GdkVisual *wxApp::GetGdkVisual()
|
|||||||
|
|
||||||
bool wxApp::Initialize(int& argc, wxChar **argv)
|
bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||||
{
|
{
|
||||||
bool init_result;
|
if ( !wxAppBase::Initialize(argc, argv) )
|
||||||
|
return false;
|
||||||
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
if (!g_thread_supported())
|
if (!g_thread_supported())
|
||||||
@@ -413,8 +414,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
g_main_context_set_poll_func(NULL, wxapp_poll_func);
|
g_main_context_set_poll_func(NULL, wxapp_poll_func);
|
||||||
#endif // wxUSE_THREADS
|
#endif // wxUSE_THREADS
|
||||||
|
|
||||||
gtk_set_locale();
|
|
||||||
|
|
||||||
// We should have the wxUSE_WCHAR_T test on the _outside_
|
// We should have the wxUSE_WCHAR_T test on the _outside_
|
||||||
#if wxUSE_WCHAR_T
|
#if wxUSE_WCHAR_T
|
||||||
// gtk+ 2.0 supports Unicode through UTF-8 strings
|
// gtk+ 2.0 supports Unicode through UTF-8 strings
|
||||||
@@ -451,6 +450,9 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
static wxConvBrokenFileNames fileconv(encName);
|
static wxConvBrokenFileNames fileconv(encName);
|
||||||
wxConvFileName = &fileconv;
|
wxConvFileName = &fileconv;
|
||||||
|
|
||||||
|
|
||||||
|
bool init_result;
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
// gtk_init() wants UTF-8, not wchar_t, so convert
|
// gtk_init() wants UTF-8, not wchar_t, so convert
|
||||||
int i;
|
int i;
|
||||||
@@ -507,13 +509,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
// we can not enter threads before gtk_init is done
|
// we can not enter threads before gtk_init is done
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
|
|
||||||
if ( !wxAppBase::Initialize(argc, argv) )
|
|
||||||
{
|
|
||||||
gdk_threads_leave();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSetDetectableAutoRepeat( true );
|
wxSetDetectableAutoRepeat( true );
|
||||||
|
|
||||||
#if wxUSE_INTL
|
#if wxUSE_INTL
|
||||||
|
@@ -329,6 +329,11 @@ static wxString GetSM()
|
|||||||
// wxGUIAppTraits
|
// wxGUIAppTraits
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxGUIAppTraits::SetLocale()
|
||||||
|
{
|
||||||
|
gtk_set_locale();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
|
|
||||||
#if wxUSE_STACKWALKER
|
#if wxUSE_STACKWALKER
|
||||||
|
Reference in New Issue
Block a user